Commit d39c75e2 authored by Carlos A. Iglesias's avatar Carlos A. Iglesias
Browse files

Renombrado mosaik como simulator

parent a0bca966
This module allows users to generate synthetic data from a smart grid that suffers False Data Injection Attacks. For this purpose, a smart grid is simulated using Mosaik, which can be installed following the instructions of this link https://mosaik.readthedocs.io/en/latest/installation.html.
Basically, it requres two steps:
1) Installing mosaik:
$ pip install mosaik
2) Installing packages and requirements for the demo
$ sudo apt-get install git python3-numpy python3-scipy python3-h5py
$ cd securegrid-demo
pip install -r requirements.txt
The directory securegrid-demo contains the demo. It has been done extending mosaik-demo (git clone https://git@bitbucket.org/mosaik/mosaik-demo.git ~/Code/mosaik-demo) with the files `securegrid-demo.py`, `householdsim.py`, `attack.py` and `model_house.py`.
Mosaik only allows users to simulate a scenario that contains normal smart grid behavior, so this module has been implemented in order to simulate attacks. The attack that can be simulated modifies the power consumption values of the houses to a specific percentage of the original value.
In order to define how many houses of the simulation suffer an attack, the variable `nAttacks` of the `demo.py` file can be modified.
In addition, to define the percentage of the original value at which the power consumption values of the houses will be modified, the variable `attackPercentageValue` of the `attack.py` file can be modified.
Furthermore, to define the moment in which the attack starts, the variable `attackTime` of the `attack.py` file can be modified. This variable represents the percentage of the course of the simulation in which the attack will begin.
Finally, the following command starts the simulation.
$ python securegrid-demo.py
Once the simulation ends, the results are stored in the `demo.hdf5` file.
During the simulation, the grid can be inspected by accessing to `http://localhost:8000`.
For inspecting hdf5 file, an hdf5 viewer should be used. In linux, ViTables can be used, which is available at http://vitables.org/Download/.
It can be installed as follows.
$ apt install libhdf5-dev
$ python -m pip install pyqt5
$ python -m pip install vitables
The files that will be used for attack detection are Series/HouseholdSim-0.House_{N}/P_out which contain the power of House N. It has 44.640 values, since the
simulator generates data every minute for a month (60 minutes * 24 hours * 31 days).
securegrid-simulator @ e322b7a3
Subproject commit e322b7a3575964d33522a747500cc9a2d957046b
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment