-
Notifications
You must be signed in to change notification settings - Fork 292
Configuration of BACnet data source using BACnet device simulator
We can use simple Python scirpt that will simulate BACnet device and our Scada's data source will be able to communicate with it and read some values:
https://github.com/Kretiss/BACnet-simulator/blob/main/rooms_simulator.py
Put freshly downloaded python script in any folder and launch it using bash/command prompt or powershell with these lines:
First you will have to install some BACnet libraries for python:
pip install BAC0
pip install pytz
After installing all neccessery libraries launch BACnet device simulator:
python .\rooms_simulator.py -a <address>
Launch parameters
"-a", "--address", default=None, help="IPV4 address of device interface with network mask, "e.g. 10.0.0.34/24"
"-p", "--port", default=47809, type=int, help="Port of BACnet device that will be created"
"-di", "--deviceId", default=101, type=int, help="ID of BACnet device that will be created"
"-st", "--sleepTime", default=0.4, type=float, help="Main loop sleep time (simulation speed)"
"-log", "--logging", default=False, type=bool, help="Enable logging to console"
Where address can be checked using command prompt with command:
ipconfig -all
After using that command look for your main network adapter and check Local Ipv4 address:
Address in red square is the one you should use.
For configuration you will need a broadcast address of your local network, take Ipv4 address and Subnet mask from your ipconfig and use them on this website to check your broadcast address:
https://www.calculator.net/ip-subnet-calculator.html
When you got everything you need we can start creating BACnet I/P data source in Scada-LTS.
As for properties:
You will have to change broadcast address for one you got. You can change both timeouts for something smaller. For ports you will have to choose something that is not taken already.
As for data points:
You need to fill out the data point form with values from python script, which are remote device IP, remote device port, remote device instance number (device instance(id): ).
Object type and object instance number are configured inside python script. Data type is telling us what type of data we will be getting back (int, string etc.)
Two example data instances in python script:
analog_input(
instance=20,
name="RoomTwoTemperature",
properties={"units": "degreesCelsius"},
description="Room 2 Temperature",
presentValue=19.0,
)
analog_output(
instance=10,
name="RoomOneSetPoint",
properties={"units": "degreesCelsius"},
description="Room one set point",
presentValue=21,
relinquish_default=21
)
To use chosen point you will need to type correct Object type and Object instance number in data point edit form
You should see that BACnet data point turned on and there is communication between Scada and BACnet device simulator, you can check what values are being recieved by using watchlists.
- Basic configuration with ona BACnet data point
bacnet-simple-configuration.txt
- Advanced configuration with 3 data points and 2 data sources (bacnet-dp-1 is following bacnet-dp-3 value, they are in the same instance but one of them is analog input(dp-1) and other is analog output (dp-3))
bacnet-advanced-configuration.txt
You can copy text from that file and import it in Import/Export menu.