Hi,
Does anyone know how to create virtual sensors to simulate an real IoT device before any construction begins?
Would be greatly beneficial to map design information to these sensors during the design phase and compare against the real measurements once construction handover is completed. Ideally being able to schedule information sent to Tandem to make full use of heat maps and graphs to present to the client would be great.
Once the virtual sensors are created, hoping that we can do a simple swap between the physical and virtual sensors.
Thanks,
You can utilize the attached python program for simulating the following variables every 15 mins (this assumes your streams are already setup in Tandem, just waiting for data):
Name | Min | Max | Units |
temperatureF | 65.00 | 72.00 | F° |
temperatureC | 18.33 | 22.22 | C° |
Co2 | 530.00 | 550.00 | ppm |
Humidity | 30 | 50 | % |
Pressure | 67.00 | 75.00 | ppm |
Room_occupancy | 10 | 20 | Persons |
Building_occupancy | 200 | 400 | Persons |
Motor_speed | 1000 | 2000 | Rpms |
Motor_vibrations | .1 | 2 | m/s² |
Motor_frequency | 55 | 60 | Hz |
Energy_usage | 1000 | Incremental | kWh |
1. Download the attached 'Sim Tandem Variables.txt' and open in a text-editor (such as notepad), perform a 'Save-As', and rename the file/extension to 'Sim Tandem Variables.py'
2. Download Python onto your corresponding OS by going to python.org/downloads and follow the installation instructions.
3. After the Python installation completes, we will also install the HTTP ‘Requests’ library by opening your cmd/terminal and entering:
Windows:
python -m pip install requests
MacOS:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
pip install requests
4. Open ‘Sim Tandem Variables.py’ in Notepad, Text-Editor, or your preferred code-editing tool such as Visual Studio Code. Add your links from your Tandem Environment in the 'tandem_streams_endpoints' array, being sure to separate each one with a comma:
5. After updating all your Tandem Stream Links, save the updated changes and run the python program:
Data will start publishing to your Tandem Streams every 15 minutes. Leave this python program running as long as you want data publishing:
***Note, if you upgrade python from previous version and the window flashes and disappears run:
pip install --upgrade requests
6. Feel free to link some or all values that apply to your simulation:
There are also multiple options available within the IoT industry to create virtual devices and simulate telemetry data including running code on a local machine, creating an Azure IoT hub and using a mobile device or virtual device as a simulated IoT device (https://www.youtube.com/watch?v=zPEonu_NDnI), or using a specific vendor's device simulation such as Disruptive Technologies Studio (https://www.youtube.com/watch?v=F9pTnHa08W0).
Hi all.
I tested the script yesterday and it worked smoothly for me except for some minor issues that I wanted to share here:
Can't find what you're looking for? Ask the community or share your knowledge.