GoldSim Integration Overview: How It Works
First published: October 2026
Last updated: October 23, 2026
[!NOTE] The Climate Simulator provides a compiled 64-bit Windows dynamic link library (
CligenWeather.dll) designed specifically for direct coupling with GoldSim desktop modeling software.
Many civil engineers, hydrologists, and mine water managers use GoldSim to perform probabilistic water balance and contaminant transport simulations. Historically, bringing stochastic climate into GoldSim required either complex pre-generated text files or external script wrappers.
Our native C++ DLL eliminates these hurdles completely.
How the Native GoldSim Integration Works
Unlike legacy modeling setups that rely on external text files, all CLIGEN parameters are stored directly inside GoldSim Data elements. At runtime, GoldSim passes those parameters directly into CligenWeather.dll in memory.
graph TD
subgraph Inside GoldSim Model [.gsm]
A["GoldSim Simulation Engine"] -->|"Passes Run Info & Parameters"| B["External (DLL) Element"]
P1["Data Element: Precip_Params<br/>(12 x 4 Matrix)"] -.-> B
P2["Data Element: Temp_Params<br/>(12 x 5 Matrix)"] -.-> B
P3["Run Properties: Start Date, Duration, Realization"] -.-> B
end
subgraph Native C++ DLL [CligenWeather.dll]
B -->|"Calls cligen_weather_step()"| C["High-Speed C++ Engine"]
C -->|"Markov Chain & Pearson Type III"| D["Generates Daily Weather"]
end
D -->|"Returns Precip, Tmax, Tmin, WetFlag"| A
Key Advantages of Direct In-Memory Coupling
- No External Text Files to Manage: Everything needed to run the simulation is stored inside your
.gsmmodel file. You will never have broken file paths when moving your model to another computer or sharing it with a colleague. - True Native Monte Carlo: For each realization in a GoldSim Monte Carlo simulation (e.g., Realization 1, Realization 2, ... Realization 100), the DLL uses a unique pseudorandom seed based on GoldSim's realization index. Each Monte Carlo realization experiences a fresh, statistically authentic weather sequence.
- Synchronized Time Steps: The DLL receives GoldSim's simulation start date, duration, and time step, ensuring that the returned weather series aligns perfectly with your model's calendar.
- Blazing Fast Performance: Compiled in optimized 64-bit native C++, the DLL computes hundreds of simulation years in milliseconds without slowing down your GoldSim run.
What Gets Passed into the DLL?
At each time step or realization boundary, GoldSim sends 116 floating-point values into the DLL:
- Simulation Control Inputs (4 values):
- Simulation_Time: Current elapsed simulation time in days.
- Time_Step: GoldSim model time step in days (e.g. $1.0$ for daily).
- Realization: Current Monte Carlo realization number ($1, 2, 3, \dots$).
- Calendar_Start_Day: Day of the year ($1 - 365$) corresponding to the start of the simulation.
- Precipitation Parameters (48 values):
- The 12-month by 4-column matrix: $[P(W|W), P(W|D), \text{Mean}, \text{Skew}]$ for months 1 through 12.
- Temperature Parameters (60 values):
- The 12-month by 5-column matrix: $[T_{\max,\text{dry}}, T_{\max,\text{wet}}, \sigma_{T_{\max}}, T_{\min}, \sigma_{T_{\min}}]$ for months 1 through 12.
- Atmospheric / Unit Flag (4 values):
- Unit system indicator (Metric: $0$, Imperial: $1$).
What the DLL Returns to GoldSim
The DLL returns 4 values at every time step directly into GoldSim:
1. Precipitation: Precipitation depth (mm or inches) occurring during that time step.
2. Tmax: Daily maximum temperature (°C or °F).
3. Tmin: Daily minimum temperature (°C or °F).
4. Is_Wet_Day: Binary flag ($1$ for wet, $0$ for dry) useful for triggering conditional logic in downstream GoldSim elements (e.g. runoff coefficients, dust suppression, or snowmelt routines).
In the next chapter, we provide a complete step-by-step tutorial for setting up this External element inside your GoldSim model.