Examples
These examples build systems with Posy2's make... methods. Nosy still provides the simulation, snapshot, carriers, and nodes, but the pages do not assemble Nosy Component objects by hand.
Each page is a small working study built around one feature: an interconnection pattern, a storage technology, a hydrogen pathway. The remaining assets are kept simple.
| Example | Content |
|---|---|
| One Country | Building and solving a complete single-node study |
| Dispatchable Generation | Choosing PV and gas capacities, then meeting the residual demand |
| Dispatch Optimization | Comparing merit-order dispatch with ramp-limited operation of a fixed CCGT fleet |
| CO2 Pricing | How a carbon price reorders emitting and non-emitting technologies |
| Nuclear | How refuelling schedule flexibility reduces backup capacity |
| Battery Storage | Shifting daytime PV generation to later hours |
| Pumped Storage | Using grid electricity to store energy and generate later |
| Hydro Reservoir | Timing generation by storing variable natural intake |
| Demand Response | Demand-side flexibility that shaves a demand peak |
| Electric Vehicles | Comparing smart charging with vehicle-to-grid operation |
| Hydrogen Production | Producing hydrogen from PV and shifting supply with storage |
| Two Countries | Comparing trade and local generation with and without a transmission limit |
| Price Interconnection | Choosing between domestic generation and priced imports |
| DC OPF | How KVL changes flows across meshed AC lines, and how controllable HVDC differs |
| Stochastic Programming | Sharing investment capacities across two snapshots while operation adapts to each future |
| Coarse Time Mesh | Trading resolution for model size by solving a two-country system on two-hour steps |
| Infeasibility | Using conflicts to locate incompatible constraints in an infeasible model |
Data sources
The examples cover all four combinations of tech_mode and timeseries_mode. In :excel mode, missing values are read from the technology or time-series workbook, and any keyword you pass on a make... builder overrides that workbook value. In :arguments mode there is no workbook fallback: builders use documented neutral defaults where available and require the remaining active values explicitly. The table shows which combination each example uses.
| Example | tech_mode | timeseries_mode |
|---|---|---|
| One Country | :excel | :excel |
| Dispatchable Generation | :arguments | :excel |
| Dispatch Optimization | :arguments | :arguments |
| CO2 Pricing | :arguments | :excel |
| Nuclear | :excel | :excel |
| Battery Storage | :arguments | :excel |
| Pumped Storage | :arguments | :excel |
| Hydro Reservoir | :excel | :excel |
| Demand Response | :arguments | :arguments |
| Electric Vehicles | :arguments | :excel |
| Hydrogen Production | :excel | :excel |
| Two Countries | :arguments | :excel |
| Price Interconnection | :arguments | :excel |
| DC OPF | :excel | :arguments |
| Stochastic Programming | :arguments | :arguments |
| Coarse Time Mesh | :arguments | :excel |
| Infeasibility | :arguments | :arguments |
Exporting Example Results
Every solved example returns a numeric result from extract(snapshot). write_results turns that result into Posy2's standard workbook report:
write_results(result, "results/scenario.xlsx")The file is written at the given path and contains annual values for the complete system and the modelled system boundary, detailed time series, and price-duration curves. An existing file is kept and an error raised unless overwrite=true is passed. Call write_results with the extracted result, not the unsolved symbolic snapshot.
Posy2 follows Nosy's unit-agnostic convention: values only need to be self-consistent. Here, power and capacity are MW, energy is MWh, overnight investment is currency/kW, fixed operation and maintenance is currency/kW/year, and variable costs are currency/MWh. The numerical assumptions are deliberately simple teaching values, not reference projections.