GoldSim Modeling & Native DLL

GoldSim Integration Overview: How It Works

Native C++ Engine (CligenWeather.dll)

The Climate Simulator includes a standalone, zero-dependency 64-bit native C++17 Windows DLL (CligenWeather.dll) designed to plug directly into GoldSim's External (DLL) element and output full Time Series Definitions (Precip_Rate, Tmax, Tmin).

Instead of exporting gigabytes of pre-computed stochastic weather CSV files or running an external Python process during a simulation, CligenWeather.dll executes the complete CLIGEN stochastic daily weather generator inside GoldSim's memory space at realization initialization (ETime = 0).

Key Capabilities

  • Single 64-bit Native DLL (CligenWeather.dll): Statically compiled with x86_64-w64-mingw32-g++ (-O3 -std=c++17 -static). Requires no Python installation, runtime libraries, or external configuration files.
  • Direct Time Series Definition Output: Generates the complete daily weather time series at ETime = 0 (XF_CALCULATE_TS) and passes three Time Series Definitions (Precip_Rate, Tmax, Tmin) directly to GoldSim Time Series elements.
  • Seasonal Periodic Cubic Spline Interpolation: Accepts your 12 monthly climate vectors (Jan..Dec) directly from GoldSim Data elements (Vector[Months]) and fits a periodic cubic spline across all 365/366 calendar days so daily parameters transition smoothly without month-boundary step jumps.
  • CLIGEN Skewed-Normal Precipitation & Matalas AR(1) Temperatures: Preserves extreme daily storm tails via the Nicks (1974) / Wilson-Hilferty skewed normal formulation and maintains wet/dry state conditioning and lag-1 serial/cross-correlation for Tmax and Tmin.
  • Deterministic Monte Carlo Seeding: Automatically seeds an independent 64-bit Mersenne Twister (std::mt19937_64) stream from GoldSim's Realization number so every Monte Carlo realization is distinct and 100% reproducible.

Interface Summary (CligenWeather)

Property Value
DLL File Name CligenWeather.dll (64-bit Windows)
Function Name CligenWeather
Inputs (inargs) 14 arguments (113 doubles total): 5 scalars (Start_Time, Sim_Dur, Time_Step, Realization, Units_Flag) + 9 monthly vectors (PWW, PWD, Mean_P, SD_P, Skew_P, Mean_Tmax, SD_Tmax, Mean_Tmin, SD_Tmin)
Outputs (outargs) 3 Time Series Definitions: Precip_Rate (mm/d or in/d), Tmax (C or F), Tmin (C or F)
Default Logging ERROR only (silent during normal runs; drop cligen_info.txt or cligen_debug.txt in the model folder to enable cligen_debug.log)