February 18, 2026

Beyond Deterministic Hydraulics: Introducing the EPANET-GoldSim Bridge

The EPANET-GoldSim Bridge is now available, offering a simple way to leverage GoldSim’s simulation capabilities for water distribution system analysis. This Windows DLL enables users to embed an EPANET hydraulic engine directly within a GoldSim model, bridging the gap between standard hydraulic modeling and probabilistic systems simulation. By integrating these two platforms, organizations can move beyond single-scenario analysis to truly quantify risk and reliability across their networks.

Why Connect Them?

While EPANET is the industry standard for hydraulics, it's typically used for deterministic analysis. Integrating it with GoldSim allows you to:

  • Quantify Uncertainty: Run thousands of realizations to see how demand fluctuations or equipment failures impact system pressures.
  • Test Complex Logic: Use GoldSim's control elements to drive pump speeds, valve settings, and demands at every timestep.
  • Track Performance: Monitor hydraulic head, flow, and even real-time pump power/efficiency to calculate operating costs.
Screenshot of the GoldSim model interface with the EPANET element


From Deterministic to Probabilistic

The real power of this integration becomes clear when you look at the results. In a standard hydraulic model, you get a single possible future. By running the EPANET engine through GoldSim’s Monte Carlo solver, we transform that single line into a distribution of possibilities.

Probabilistic Time History plot of Tank Level

In the chart above, we aren't just looking at whether a tank fills or empties; we are looking at the probability of it doing so under varying demands and operational uncertainties. This allows engineers to identify the likelihood of system failures before they happen.

How it Works:

Users can build and verify their systems using the familiar EPANET GUI by defining pipe diameters, pump curves, and tank elevations as usual.

Screen capture of the EPANET model that is being embedded in the GoldSim model using the bridge dll

Once the network is validated, the bridge acts as the "translator," allowing GoldSim to reach into this model and manipulate its properties in real-time at each timestep.

Mapping the Models

The bridge uses a simple JSON configuration file to act as the "map" between the two systems. This file tells the bridge which GoldSim inputs should control specific EPANET links or nodes, and which hydraulic results should be sent back as outputs.

For example, a typical JSON configuration might look like this:

{
  "version": "1.1",
  "logging_level": "DEBUG",
  "inp_file": "Pump_to_Tank.inp",
  "hydraulic_timestep": 300,
  "input_count": 2,
  "output_count": 2,
  "inputs": [
    {"index": 0, "name": "ElapsedTime", "object_type": "SYSTEM", "property": "ELAPSEDTIME"},
    {"index": 1, "name": "Pump1_Control", "object_type": "LINK", "property": "SETTING"}
  ],
  "outputs": [
    {"index": 0, "name": "Tank1_Level", "object_type": "NODE", "property": "HEAD"},
    {"index": 1, "name": "Pump1_Flow", "object_type": "LINK", "property": "FLOW"}
  ]
}

In GoldSim, you simply point an External element to the bridge DLL and align your inputs/outputs to match this map. This setup allows you to scale from a single pump to an entire pressure zone without touching the underlying C++ code.

Screen capture of GoldSim External element interface mapping to a JSON configuration file.

Through development, I found a few settings are vital for getting accurate results:

  • Timestep Sync: GoldSim's basic timestep must match the EPANET hydraulic timestep (e.g., 300s).
  • Monitor 'HEAD': It is more robust to monitor the HEAD property (Elevation + Level) to keep dynamics consistent across realizations.
  • DLL Loading: Ensure "Unload DLL after each use" is unchecked in GoldSim to maintain the hydraulic state between steps.

Get Started

The project is available on GitHub. I’ve included a "Pump to Tank" example system that demonstrates a deadband controller and energy analysis to help you get started.

Resources:

I’m curious to see what kind of complex control strategies the community might build with this. If you have questions or ideas for new features, feel free to reach out via the repo!

#WaterEngineering #Hydraulics #GoldSim #EPANET #MonteCarlo #OpenSource #RiskAnalysis

No comments:

Post a Comment