GoldSim Modeling & Native DLL

Step-by-Step GoldSim Setup Guide

First published: October 2026
Last updated: October 23, 2026

[!TIP] Setting up GoldSim to use the CLIGEN DLL takes less than 10 minutes. You can also download our pre-configured template GoldSim model (.gsm) with all elements already created!

This tutorial guides you through the setup process from downloading the DLL to running your first simulation inside GoldSim.


Step 1: Download the DLL and Example Model

  1. On the Climate Simulator dashboard, scroll to the GoldSim Integration section at the bottom of the page.
  2. Click Download CligenWeather.dll (64-bit Windows).
  3. Save the CligenWeather.dll file in the same folder where your GoldSim model (.gsm) is located.
  4. (Optional) Click Download Example GoldSim Model (.gsm) to get an immediate, fully functional template model.

Step 2: Copy Calibrated Parameters into GoldSim

Inside your GoldSim model, create two Data Elements:

1. Precip_Params (2D Table Data Element)

  • Rows: 12 (labeled Month 1 through Month 12, or Jan to Dec).
  • Columns: 4 (labeled P_W_W, P_W_D, Mean_Depth, Skewness).
  • Units: Dimensionless for probabilities and skewness; mm (or inches) for mean depth.
  • In the Climate Simulator web app, click Copy for GoldSim next to the Precipitation Parameters table, then paste the values directly into your GoldSim table editor.

2. Temp_Params (2D Table Data Element)

  • Rows: 12 (Month 1 through Month 12).
  • Columns: 5 (labeled Tmax_Dry, Tmax_Wet, Std_Tmax, Tmin, Std_Tmin).
  • Units: °C (or °F).
  • In the Climate Simulator web app, click Copy for GoldSim next to the Temperature Parameters table, then paste the values directly into your GoldSim table editor.

Step 3: Insert the External (DLL) Element

In GoldSim: 1. Right-click on the graphics canvas and select Insert Element → Functions → External (DLL). 2. Name the element Cligen_Weather_Engine. 3. In the element properties dialog: - File Name: Enter CligenWeather.dll (if placed in the same folder as the model) or browse to its location. - Function Name: Enter cligen_weather_step. - Calling Convention: Select __cdecl (or standard C).

Configuring External Element Inputs

Configure the input arguments to match the DLL's expected vector of 116 parameters: 1. Time: Link to GoldSim's built-in ETIME (Elapsed Time in days). 2. Time_Step: Link to GoldSim's built-in DT (Time Step in days). 3. Realization: Link to GoldSim's built-in Realization run property. 4. Calendar_Day: Link to the calendar day of the year for simulation start (e.g. Day 1 for Jan 1). 5. Precip_Matrix: Link to Precip_Params (48 values). 6. Temp_Matrix: Link to Temp_Params (60 values). 7. Units_Flag: Set to 0 for Metric (mm, °C) or 1 for Imperial (in, °F).

Configuring External Element Outputs

The External element outputs 4 signals: 1. Precipitation: Daily precipitation depth (e.g. in mm/day or mm). 2. Tmax: Daily maximum temperature (°C). 3. Tmin: Daily minimum temperature (°C). 4. Is_Wet_Day: Condition flag (0 or 1).


Step 4: Connecting Weather Signals to Downstream Elements

Now you can route the weather signals throughout your GoldSim model:

  • Runoff Inflow: Multiply Precipitation by your catchment area and runoff coefficient to drive pond inflow.
  • Evaporation / ET: Feed Tmax and Tmin into Hargreaves or Penman-Monteith potential evapotranspiration (PET) expressions.
  • Snowpack Accumulation & Melt: Use a conditional expression: goldsim If (Tmax < 0 degC, Precipitation, 0 mm) // Snowfall
  • Dust Suppression Trigger: Use Is_Wet_Day to turn haul road dust watering on or off automatically.

Step 5: Test Run in GoldSim

  1. Set your GoldSim simulation settings to:
  2. Duration: 10 years.
  3. Time Step: 1 day.
  4. Realizations: 1.
  5. Click Run in GoldSim.
  6. Open a Time History Result element connected to Precipitation and Tmax.
  7. You should see a continuous, dynamic synthetic weather sequence generated dynamically in memory!