This is a Python script that acts as a BACnet IP server describing the states of a Fire Protection system, containing 19 Boolean tags.
This script can be run on both Windows and Linux OS. It supports Python versions 3.8 to 3.14+ (the required pyasyncore package is included to support Python 3.12+ since native asyncore was removed).
-
Create and activate a Virtual Environment:
python -m venv venv venv\Scripts\activate
-
Install the dependencies using the supplied
requirements.txt:pip install -r requirements.txt
-
Update package list and ensure you have
pipinstalled:sudo apt-get update sudo apt-get install python3-pip
-
Install the required BACnet library dependencies using the supplied
requirements.txt:pip3 install -r requirements.txt
Execute the script using Python:
python fire_protection_simulator.pyUpon launching, the script will prompt you to enter the IP address for the BACnet server to bind to (or press Enter to safely use the auto-detected IP). Alternatively, you can explicitly launch it and bypass the prompt with a target IP:
python fire_protection_simulator.py <target_ip_address>An interactive menu will then appear in the terminal, allowing you to select different system scenarios (1 through 6). Selecting a scenario will instantly update the 19 BACnet tags being broadcasted, making them available to any SCADA, Dashboard, or BMS software querying the simulator's IP address on port 47808.
The simulator features 6 built-in scenarios. By default, it operates on an active background timer loop:
- STANDBY: Only
Valve_Poste_Closed(TAG 18) active.- Cycle: Runs for 60 minutes. If uninterrupted, it automatically triggers a 5-minute DIESEL PUMP TEST (Scenario 3) and then loops back to Standby.
- MINOR LOSS OF PRESSURE: Only
Sprinkler_Flow_Event(TAG 3) &Valve_Poste_Closed(TAG 18) active.- Cycle: Runs for 45 seconds, then auto-reverts to STANDBY.
- DIESEL PUMP TEST: Only
Pump_Run_Event(TAG 4),Valve_Discharge_Closed(TAG 6) &Valve_Poste_Closed(TAG 18) active.- Cycle: Runs for 5 minutes, then auto-reverts to STANDBY.
- SPRINKLER SYSTEM DEMAND: Only
Sprinkler_Flow_Event(TAG 3),Pump_Run_Event(TAG 4) &Valve_Poste_Closed(TAG 18) active.- Cycle: Runs for 15 minutes, then auto-transitions to TANK DEPLETED (Scenario 6).
- RIA HOSE DEMAND: Only
RIA_Flow_Event(TAG 1),Pump_Run_Event(TAG 4) &Valve_Poste_Closed(TAG 18) active.- Cycle: Runs for 15 minutes, then auto-transitions to TANK DEPLETED (Scenario 6).
- TANK DEPLETED: Only
RIA_Flow_Event(TAG 1),Post_Flow_Event(TAG 2),Sprinkler_Flow_Event(TAG 3) &Tank_Low_Active(TAG 8) active.- Cycle: Runs for 10 minutes, then auto-reverts to STANDBY.