The following tutorial is based on the standard SDK rundir. The information should be easily employable also for other projects, though.

Simulation GUI

Open the OGEMA Simulation GUI from the Home Screen to see available simulation providers:

SimulationGUIIcon.jpg

The list should look like this:

SimulationGUIClosedV2.png

Note: If you are using the Smartrplace version of the SDK you might see additional "basic" simulations here. These basic simulation providers just provide OGEMA resources with some random changing values in the sensor resources. This is quite helpful for early testing and very simple to set up, but not sufficient for more realistic testing. This does not take into account any actor values, of course.

Note: The Simulation GUI does not always update itself correctly. If you have created a new simulation instance and it is not shown, reload the Simulation GUI page.

Generally the simulation GUI allows to create new resources of the simulated type and configure them for simulation, but the GUI also allows to select existing resources to be configured for simulation. The latter case is most often used when a complete resource setup is created by any OGEMA system and just the hardware connection to the real devices is not available in the development system. In this case usually existing resources have to be set "alive" by a simulation provider. When just starting the SDK you will most likely want to create the resources also.

Open the Battery simulation tab and click on "Create new simulated object". You can just accept the standard name and click "Create". The GUI should now show the simulated device. Click on "Open configuration" to choose a configuration value you want to set or just to see the default value that was set when the resource was created. You can set the values as you like now:

SimulationGUIConfig.png

As information also other relevant values of the simulation can be seen via "Show vlaues". "Show plots" requires previous configuration of logging and is in an experimental state. The configurations and values offered here depend on the simulation provider implementation. There may be configuration or result values that are only accessible via the respective resources (but they should not be relevant, normally; it is in the responsibility of the simulation provider to provide convenient access to all relevant settings and results). All simulation configurations are stored in the resource OGEMASimulationConfiguration and look like this in the Resource View:

SimulationResourceView.png

You can also set the values in the Resource View programmatically or via the Resource Tree Manipulator.

The simulation does not do anything at the moment as the battery power is zero and this value needs to be changed by a controlling application. You can change the power via the Resource Tree Manipulator to see how the SOC is changed by the simulation. If you also create a meter you can see that the meter automatically collects the total power of the electrical devices in the OGEMA system.

Room Simulation Connector

Each instance of the simulation provider "Room Simulation Connector" starts a "virtual room" inside which further components can be simulated. These components are indicated with "(Room Simulation" at the end of their names. Each of these simulation instances required to be connected to a Room Simulation Connector instance before it is activated. To see the activation status after setting the room reload the Simulation GUI page. So for the tutorial app explaining event-based database interaction you should first create a Room Simulation Connector, then a Thermostat simulation and a Window sensor simulation. Do not forget to create a backup of the resources OGEMASimulation as explained in Managing the development environment and the simulated resources before restarting the rundir, otherwise you will need to go through the steps to set up the simulations on every clean start.

SimulationGUIRoomConnectorg.png

If you need to use some other simulation which does not connect to the Room Simulation Connector natively, you may create the simulated device as described above, and move it to the target room via the Room Link app. The latter also allows you to create new rooms and edit the existing ones.

Next steps


Tags:
Created by Jan Lapp on 2016/11/22 15:38