Extended Period Simulation (EPS)
Extended Period Simulation (EPS) is the environment where R-THYM models the operational cycle of your water infrastructure over 24- to 48-hour windows. While the EPANET solver provides the core hydraulic math, R-THYM injects a layer of operational and environmental logic (often called orchestration) that transforms static snapshots into a dynamic, living system.
The Simulation Loop
At the start of every time step, R-THYM performs a structured series of calculations. This loop ensures that the hydraulic solver receives the most accurate boundary conditions based on your system state.
graph TD
A[Start Simulation Tick] --> B[Input Synchronization]
B --> C[EPANET Hydraulic Solve]
C --> D[Stochastic Demand & Physics Injection]
D --> E[Result Extraction & Mass Balance Integration]
E --> F{Simulation Continue?}
F -- Yes --> B
F -- No --> G[End]
-
Power Topology Analysis (Optional): If your model includes electrical components, the engine traces the electrical graph of your system. If you choose to model power, a pump or battery will only function if it maintains an unbroken path to an active power source. If you do not include power links or sources in your model, the system simply proceeds directly to the hydraulic solver without these constraints.
-
Environmental and Weather Input: R-THYM continuously processes weather data, such as solar irradiance and wind speeds, to drive interface displays and environmental monitoring. If your model utilizes renewable energy generators, the engine integrates this data to dynamically calculate power output values for your solar, wind, and hydropower resources.
-
Control Logic Execution: The engine evaluates your Control Links, including PID controllers and control rules. It determines if a pump should toggle, a valve should modulate, or a power switch should flip based on your monitored variables.
-
Hydraulic Solve: R-THYM syncs these inputs to the EPANET solver, which computes the resulting flows and pressures for that time step.
-
Mass Balance and State Update: Finally, the system updates tank levels, fuel tank volumes, and cumulative energy consumption based on the hydraulic results.
Electrical and Power Injection (Optional)
You can choose to build your model with or without energy dependencies. If you opt to include an electrical topology, R-THYM injects the constraints of a power microgrid into your hydraulic simulation:
- Power Tracing: The system evaluates electrical topology dynamically. If an upstream power switch is tripped or a fuel tank is empty, the software injects an OFF status into the hydraulic solver for all dependent components.
- Renewable Generation: Power generation from solar and wind is determined by site-specific weather inputs. Hydropower can be modeled either as a standalone generator with static inputs or as an integrated Turbine Node that physically interacts with the hydraulic network’s flows and pressures.
- Load-Following and Storage: The engine simulates battery charging and discharging, as well as fuel generator load-following. If a battery is charging, the power draw is treated as a load on your active upstream power sources (such as the utility grid or local generators); if it is discharging, it acts as a power source to offset demand.
Advanced Control Injection
Beyond simple ON/OFF rules, R-THYM injects complex operational logic that mimics a human operator or a PLC controller, which functions regardless of whether energy modeling is enabled:
- PID Control: You can implement proportional-integral-derivative controllers that modulate pump speeds or valve openings. The simulation calculates the error between your target value and the measured system pressure or level, injecting an instantaneous target setting into the hydraulic solver.
- Surge Protection (PCV Logic): When a pump is signaled to shut down, the system injects a surge-override command. This prevents the pump from instantly tripping, instead keeping it running while the associated discharge valve performs a controlled, ramped closure to mitigate water hammer transients.
- Component Ramping: To avoid unrealistic instantaneous shifts, the system injects transition logic. Whether you are changing a pump speed or a valve position, the engine calculates the mechanical ramp-up or ramp-down time, ensuring that the hydraulic solver sees a gradual change.
Mass Balance Safety Net
Because R-THYM runs a series of steady-state snapshots, it manually tracks the cumulative accumulation or depletion of water in your tanks to ensure the model never creates or destroys water.
R-THYM enforces strict mass balance bounds during the solve. If a tank reaches 0% (empty) and total demand exceeds supply, the engine throttles the outgoing flows to match the actual available supply. If a tank reaches 100% (full), it throttles incoming flows. This iterative correction ensures the entire network remains physically consistent throughout the daily cycle.