Sofia2 IoT Workshop (Part 2/4): Simulate input data. Simulator Configuration and Execution.

The goal of this workshop is the realization of a real example on wich we can evaluate the capabilities of Sofia2 platform.

To do this, we are going to simulate a building that has several floors, and three devices for the reading of energy consumption, temperature and humidity in each one of them.  Finally, we will create a dashboard to display this information and we will publish data in an API to be consumed in a simple way by any application.

 

In order to get a better understanding of the workshop, we will structure the steps to follow in 4 posts. In previous posts we were working about:

 

(Part 1/4) – Data Model. Ontology. ThinKP.

 

We will see today (Part 2/4) in which we’ll simulate the input data and the configuration and execution of the simulator.

 

 

Simulate input data

 

Simulator configuration

 

Since we do not have a real device that inserts information into our ontology, we will make use of Sofia2 tools to insert simulated data, to do this, we will access to the ‘Instance Real Time Simulator’ from the ‘Ontologies’ menu.

 

image217

 

Click the ‘Create Simulator’ button. The first thing we are going to create are the Instance Generators we are going to use. An Instance Generator is a data test definition.

 

We are going to create the next generators:

 

  • First of all, the ID field generator for our supposed Wattmeter. As a name we’ll write ‘WorkshopIoTWATPTG’ (WorkshopIoTWAT+our initials), as Generator Type, ‘Fixed String’ and as value, the same as the name we have given. Click ‘Add Instance Generator’ button.

 

image218

 

  • Now the ID field generator for our supposed Thermostat, as the name we’ll write ‘WorkshopIOTThermostatPTG’ (WorkshopIoTThermostat+our initials), as Generator Type, ‘Fixed String’ and as value the same as the name we have given. Click ‘Add Instance Generator’ button.

 

  • To end with the ID, the ID field generator for our supposed humidity meter, as the name we’ll write ‘WorkshopIoTHPTG’ (WorkshopIoTH+our initials), as Generator Type ‘Fixed String’ and as value the same as the name we have given. Click ‘Add Instance Generator’ button.

 

  • As a values generator we are going to create a single generator that we’ll use it to simulate temperature, humidity and consumed watts, we’ll call it ‘WorkshopIoTVALUEPTG’ (WorkshopIoTVALUE+our initials), as Generator Type ‘Random Number’, values from 1 to 100 and decimal precision 2. Click ‘Add Instance Generator’ button.

 

  • For the location we’ll create a ‘Random String’ generator, with the word list HALL, GF, F1, F2, F3, B1 and B2, simulating the floors of a building. And we are going to call it WorkshopIoTLOCATIONPTG (WorkshopIoTLOCATION+our initials). Click ‘Add Instance Generator’ button.

 

  • Finally, we are going to create the generator types for the ‘TYPE’ field, which will be of ‘Fixed String’ type and will be called ‘WorkshopIoTTYPEHPTG’ and ‘HUMIDITY’ value, ‘WorkshopIoTTYPETPTG’ and ‘TEMPERATURE’ value and ‘WorkshopIoTTYPEWPTG’ and ‘WATTS’ value. Click ‘Add Instance Generator’ button.

 

Once we have defined the generators we’ll create three simulators, the temperature meter, humidity meter and wattmeter, to do this, in the ‘identification field’ we’ll write the name ‘WorkshopIoTSIMULATORTPTG’, ‘WorkshopIoTSIMULATORHPTG’ and ‘WorkshopIoTSIMULATORWPTG’.

 

For the first one:

 

 

image222

 

In the ‘Ontology’ tab, we select our ontology WorkshopIoTPTG (WorkshopIoT+our initials).

 

image220

 

We create the ‘Temperature Simulator’ configuration.

 

image221

 

Click ‘Create Simulator’ button.

 

To create the ‘WorkshopIoTSIMULATORHPTG’, we have this ‘Humidity Simulator’ configuration.

 

image223

 

Click ‘Create Simulator’ button.

 

 

To create the ‘WorkshopIoTSIMULATORWPTG’, we have this ‘Wattmeter Simulator’ ’ configuration.

 

image224

 

Click ‘Create Simulator’ button.

 

 Simulator Execution

 

We open three new tabs in the browser, we access each of them to one of the three simulators and we press the button Start! in each one of them.

 

We open a fourth tab and we access the option menu ‘TOOLS’ -> ‘RTDB & BDH CONSOLE’.

 

image225

 

We select our ontology

image226

We’ll see a default query for querying RTDB using the SQL-Like language.

 

image227

 

If we click the ‘Perform Query’ button, it will return the data contained in the Database. We must be aware that the platform by configuration will return us at most 100 Registries.

 

image228

 

Stop our three simulators by clicking on the ‘Stop!’ button.

 

In next posts we’ll continue with the workshop and we’ll see how to create Gadgets, Dashboards and publish Ontologies like Apis.

 

We’ll wait for you!

 

 

 

 

 

 

 

 

 

 

Sofia2 IoT Workshop (Part 2/4): Simulate input data. Simulator Configuration and Execution.

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s