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

Añadido explicación de los ficheros de la demo

parent 2ddffe29
This directory contains the model of Securegrid. It includes several files:
- ``. This is the main file of Mosaik, in which the simulators that will participate in the simulation are defined, as well as the different connections between them.
For this reason, it has had to be modified to include the definition and initialization of the attack simulator and its connection with the house simulator.
The attack simulator has to be initialized in this file as follows:
attacks = attacksim.Attack.create(38, target_attr=’P_out’)
When initializing the simulator, two attributes must be set. The first attribute is
the number of houses that are going to suffer an attack, which in the case of the
example shown above is 38. If the number of attacks is higher than the number of
houses, the simulation does not start and an error is thrown. The other attribute
is the target attribute, that is to say, the value that is going to be modified by the
attack. This target attribute is P out, which is the value that indicates the house
power consumption.
In addition, the assignment of attacks to houses is done randomly, in this way, in
different simulations not always the same house is attacked. This assignment is made
in the following way:
world.connect(house, attacked_houses[house], (’P_out’,’P_out_val’),
First, the house and the instance of the corresponding attack have to be indicated.
The next two attributes are the parameters of the two simulators that are going to
be linked. P out is the value of power consumption of the house and P out val is the
new power consumption value generated by the attack simulator.
- ``. This is the new implemented simulator that is initialized in the executable
file. The duration of the attack is configurable, allowing users to execute the attack
during the whole simulation or during an specific time frame. In addition, the data
flow between the house simulator and the attack simulator is bi-directional. First,
the house power consumption value is received so it can be modified according to the
attack chosen to simulate. Once it is modified, that new value is returned to the house
simulator to replace the original value.
The set data function provided by the Mosaik API has been used to send a value from
one simulator to another. Therefore, it has been used to send data from HouseHoldSim
to AttackSim and vice-versa. The data that is sent is an object mapping source entity
IDs to objects which in turn map destination entity IDs to objects of attributes and
values. In addition, it has to follow the following structure:
Listing 4.3: Data format
{"src_full_id": {"dest_full_id": {"attr1": "val1", "attr2": "val2"}}}
Where src full id is the identifier of the source simulator, dest full id is the identifier
of the destination simulator and then the attribute with its value that is wanted to
be sent. This data will be received as input of the destination simulator.
In this way, the power consumption value of the houses can be set to a specific power
value, or to a specific percentage of the original value.
-``. HouseholdSim simulator.
The simulator simulates de behaviour of Houses (using the HouseModel defined in ``) and their Resitential loads. In every step of simulation, the house power is updated
according to loaded power profile.
Initially, data was sent from the attack simulator to the original HouseHoldSim but was never received, which was a problem. After investigating
why this data was not received, it was concluded that the simulator was prepared to send data to other simulators but not to receive it, as this was not necessary. For this
reason, this simulator had to be configured in order to be able to receive data from other simulators.
Therefore, the configurations that have been made to this simulator include sending data to the attack simulator and the possibility of receiving data in the event that an
attack takes place. The data that is received, in the format explained above, replaces the original power consumption values generated by the simulator itself.
In case of an attack occurs, this simulator will send the data to the attack simulator which will modify these data depending on the attack chosen for its
simulation. Once the values have been modified, they are sent back to HouseholdSim, which is in charge of sending them to the rest of the simulators of Mosaik.
It uses the HouseModel for
- ``. The HouseModel processes and prepares the load profiles and their associated meta data to allow and easier access to it.
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