Water treatment process simulator with:
- Multi-zone reactor physics (mixing, advection, pH/chlorine chemistry, temperature)
- Actuator dynamics (valves and dosing pump behavior)
- Sensor dynamics (delay, noise, drift, warm-up, faults)
- Remote maintenance (Modbus-driven recalibration and hardware-replacement actions)
- Modbus TCP server for plant-style command/feedback integration
HydraSim is designed to emulate realistic water treatment process behavior for integration and control testing against real-world PLC/SCADA systems. It allows engineers and researchers to prototype control logic, validate operational behaviors, and exercise control loops without access to physical hardware.
The goal is practical plant-behavior emulation for integration and control testing. It is not a full CFD model and should not be treated as design authority for safety-critical decisions.
Runtime loop:
- Read Modbus holding registers/coils.
- Apply commands to actuator models.
- Map actuator outputs to reactor boundary flows.
- Step reactor physics.
- Read sensors from reactor state.
- Publish sensor values/status to Modbus input registers/discrete inputs.
- Poll maintenance trigger coil; dispatch any pending maintenance action.
This keeps command sources external while the simulator acts like a field-facing process unit.
python -m venv .venv
source .venv/bin/activate
pip install -e .For Modbus support:
pip install -e ".[modbus]"With Modbus:
python -m src.wt_simulator --host 127.0.0.1 --port 5020Without Modbus:
python -m src.wt_simulator --no-modbus --duration 120 --dt 1./venv/bin/python -m unittest discover -s tests -vsrc/wt_simulator/core: reactor physics and transport/chemistry modelssrc/wt_simulator/actuators: valves and dosing pump dynamicssrc/wt_simulator/sensors: sensor models and suite factorysrc/wt_simulator/maintenance: remote recalibration and hardware-replacement managersrc/wt_simulator/modbus: register map, encoding, and Modbus serversrc/wt_simulator/__main__.py: runtime orchestration looptests: unit and end-to-end Modbus tests
docs/MODEL_SCOPE.md: what the model includes and what it does notdocs/MODBUS_INTERFACE.md: command/feedback register behavior, control loop mapping, and maintenance register protocol
MIT