BCNexus logoBCNexus
Source
Esc to exit · ← → to navigate
BCNexus logo

The BCNexus CLEWs Model

A least-cost optimisation model of British Columbia's coupled Climate, Land, Energy and Water systems — built on OSeMOSYS, extended with land-use accounting, documented here block by block.

Framework OSeMOSYS Extension CLEWs Solver GLPK · CBC · Gurobi · CPLEX Region British Columbia Language GNU MathProg
What it is

A model that connects energy decisions to land and water

BCNexus identifies technological pathways to meet BC's decarbonization targets — through electrification and alternative carriers such as hydrogen — while accounting for the water, food and land-use implications of expanding electricity supply. It couples three subsystems (Water, Food/land, Energy) to climate.

WFE → Climate
Water · Food/land · Energy subsystems coupled through CO₂ emissions
Flexible time
User-defined temporal resolution via clustering (hour_grouping × n_clusters, e.g. 30 timeslices) to capture both diurnal and seasonal VRE patterns Base model horizon: 2020–2050, British Columbia (single region, grid B).
Bottom-up
Explicit technologies, fuels and flows form a reference energy system
LP
Linear cost optimisation over the horizon The base case is a pure LPCapacityOfOneTechnologyUnit is left unused. Activating it turns the model into a MILP (integer unit-builds).
What's inside

Explore the documentation

Everything is built directly from the GNU MathProg source of the two model files in the DeltaE/BC_Nexus repository. Each card opens in a new tab.

Key concept · click a domain

The CLEWs nexus

CLEWs — Climate, Land, Energy, Water Systems — is an integrated framework and an extension of OSeMOSYS. Rather than optimising energy in isolation, it captures feedbacks between the four domains. Open any node for a detailed explainer (new tab).

The coupling is elegant: land parcels are technologies, the way land is used is a mode of operation, and water and crop products flow as fuels. So land allocation, water demand and agricultural emissions are all expressed through the same energy primitives — no separate sub-models needed.

How a scenario runs

From raw data to policy insight

Each scenario flows through interfacing tools, a model run, and result processing. The documented GNU MathProg file is the Model Script — marked below.

Input
📥 Raw Data
Unprocessed BC inputs
Scenario 1…n · Data prep
otoole recommended
Python CLI · data ↔ datafile
clicSAND option
Spreadsheet GUI
MoManI option
Browser interface
Model Run · Cloud / PC
📄 Input Datafile
Sets & parameters (.txt)
⚙️ Model Script
GNU MathProg — documented here
🧮 Solver
GLPKCBCGurobiCPLEX
Result Processing
📊 Result Datafile
CSV outputs
📈 Visualization
Charts & dashboards
🏛️ 📊 ✅
Insights for
Policy Support

Click another box to explore · hover any box for a quick label
The Model Script is the GNU MathProg file documented on this site. Run workflow ↗ Tip: click any box for details.
The core idea

Critical constraints — and how everything becomes "energy"

CLEWs models climate, land and water without bespoke sub-models. The trick is representational: every domain is re-expressed in the OSeMOSYS vocabulary of technologies, modes, fuels and activity. A handful of constraints then govern the whole coupled system.

A parcel of land
→ TECHNOLOGY
+
How land is used (crop / practice)
→ MODE_OF_OPERATION
+
Water, crops, heat, electricity
→ FUEL (commodity)
=
One unified flow problem
→ RateOfActivity

⚖️ Energy balance EBa11 / EBb4

For every fuel — energy or water or crop — production ≥ demand + use + net trade in each timeslice. This single template enforces electricity balance, water availability and crop supply alike.

🏭 Capacity adequacy CAa4 / CAb1

Activity ≤ installed capacity × capacity factor. Bounds how hard a power plant — or an irrigation scheme, or a field — can operate, tying operation to investment.

🗺️ Land use LU1–LU4

Per-mode annual activity is bounded in level (max/min area) and in rate of change (how fast a land use may expand or contract). This is the CLEWs-defining constraint set.

🌡️ Emissions E8 / E9

Activity × emission factor is summed and capped annually and over the horizon, and priced into the objective — the climate thread that couples all domains.

Because water and land flows ride on the same balance and capacity equations as energy, the optimiser trades off a tonne of CO₂ saved by wind against one saved by a bioenergy crop — including that crop's land and irrigation-water cost — inside one linear program.

Two model files

Niet & Kotzur variants

Both files are identical except for how the storage state of charge is tracked in time; both carry the same CLEWs land-use extension. Niet and Kotzur are two of four temporal-representation methods (Cluster, Kotzur, Welsch, Niet) benchmarked in the storage-in-OSeMOSYS study on storage with temporal aggregation — best practices and algorithms.

model_BCNexus_Niet standard

Classic OSeMOSYS storage.

  • State of charge tracked timeslice-by-timeslice within a representative year
  • Variable StorageLevelTSStart[r,s,l,y]
  • Refilling balanced over all timeslices (SC8)

model_BCNexus_Kotzur seasonal

Typical-day (Kotzur) storage.

  • Adds the DAYSCRO chronological-day set
  • Tracks charge across ordered typical days for inter-seasonal storage
  • Fewer variables — efficient for long-duration storage

🔋 Why storage representation matters

When a full year (8760 h) is compressed into a few representative days to keep the optimisation tractable, the storage state of charge must still be chained correctly across those days — otherwise long-duration and seasonal storage is mis-valued. The two variants here are different answers to that problem: Niet keeps an explicit intra-year timeslice chronology, while Kotzur reconstructs inter-day cycling from clustered typical days. The trade-off between accuracy and variable count is exactly what the storage-in-OSeMOSYS framework (Cluster · Kotzur · Welsch · Niet) was built to quantify, using k-means clustering of capacity-factor and demand profiles to pick representative days.

How the file reads

Five phases, top to bottom

A MathProg OSeMOSYS file is processed in order. Declarations come first (sets and their data), then the objective, the constraints, and finally the solve and result export.

Sets & Parameters

Index domains (years, technologies, fuels, timeslices, regions, modes, storage) and the exogenous data defined over them — costs, demands, efficiencies, emission factors, land limits.

Variables

Decision & accounting unknowns the solver chooses; RateOfActivity is the master from which most constraints are built.

Objective

A single minimize cost over total discounted system cost — capital, O&M, emission penalties, salvage and storage.

Constraints

14 blocks: capacity adequacy, energy balance, accounting, storage, costs, capacity/activity limits, reserve margin, RE target, emissions, and land use.

Solve & output

solve; invokes GLPK, then ~30 table tout … OUT "CSV" statements export results for post-processing.

📖 Open the full code documentation ↗
Part of a larger toolchain

The Combined Modelling BC suite

BCNexus does not stand alone. It is one component of an end-to-end, soft-linked modelling workflow for British Columbia that couples capacity expansion, renewable-resource assessment and operational power-system simulation.

Get involved

Run it, contribute, connect

A quick path from clone to results, how to contribute changes, and how to reach the developer.

Quick start

On Linux / WSL with Anaconda:

git clone https://github.com/DeltaE/BC_Nexus
cd BC_Nexus
conda env create --file env/environment.yaml
conda activate bcnexus
bash install_bcnexus.sh        # or: pip install .
bash dashboard.sh              # sample results + dashboard

Then configure & run via BCNexus.py or BCNexus.ipynb — pick scenario, storage algorithm (Kotzur/Niet), clustering and solver (gurobi / cbc) and threads.

🌿

How to contribute

The standard GitHub flow:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/idea)
  3. Commit your changes
  4. Push and open a Pull Request

Hitting solver/Gurobi-license or DOT/graphviz setup issues? The wiki's Troubleshooting & Known-issues notes cover the common fixes (incl. the free CBC fallback).

Open pull requests ↗
🤝

Connect with the developer

Muhammad Eliasinul Islam (EL) — Delta E+ Research Lab, Simon Fraser University. Co-developer of BCNexus and the storage-in-OSeMOSYS framework.

⌥ github.com/eliasinul ↗ in · linkedin.com/in/eliasinul ↗ ◇ Report an issue on GitHub ↗
1 / 9