Running models in different modes¶
Models can be built and solved in different modes:
planmode. Inplanmode, the user defines upper and lower boundaries for technology capacities and the model decides on an optimal system configuration. In this configuration, the total cost of investing in technologies and then using them to meet demand in every timestep (e.g., every hour) is as low as possible.operatemode. Inoperatemode, all capacity constraints are fixed and the system is operated with a receding horizon control algorithm. This is sometimes known as adispatchmodel - we're only concerned with the dispatch of technologies whose capacities are already fixed. Optimisation is limited to a time horizon whichsporesmode.SPORESrefers to Spatially-explicit Practically Optimal REsultS. This run mode allows a user to generate any number of alternative results which are within a certain range of the optimal cost.
In this notebook we will run the Calliope national scale example model in these three modes.
More detail on these modes is given in the advanced section of the Calliope documentation.
import plotly.express as px
import plotly.graph_objects as go
import xarray as xr
import calliope
# We update logging to show a bit more information but to hide the solver output, which can be long.
calliope.set_log_verbosity("INFO", include_solver_output=False)
Running in plan mode.¶
# We subset to the same time range as operate mode
model_plan = calliope.examples.national_scale(time_subset=["2005-01-01", "2005-01-10"])
model_plan.build()
model_plan.solve()
[2025-06-27 09:31:23] INFO Model: initialising
[2025-06-27 09:31:23] INFO Model: preprocessing stage 1 (model_run)
[2025-06-27 09:31:24] INFO Model: preprocessing stage 2 (model_data)
[2025-06-27 09:31:24] INFO Model: preprocessing complete
[2025-06-27 09:31:24] INFO Model: backend build starting
[2025-06-27 09:31:24] INFO Math preprocessing | added file 'plan'.
[2025-06-27 09:31:25] INFO Math preprocessing | validated math against schema.
[2025-06-27 09:31:25] INFO Optimisation Model | parameters | Generated.
[2025-06-27 09:31:27] INFO Optimisation Model | Validated math strings.
[2025-06-27 09:31:27] INFO Optimisation Model | variables | Generated.
[2025-06-27 09:31:28] INFO Optimisation Model | global_expressions | Generated.
[2025-06-27 09:31:29] INFO Optimisation Model | constraints | Generated.
[2025-06-27 09:31:29] INFO Optimisation Model | piecewise_constraints | Generated.
[2025-06-27 09:31:30] INFO Optimisation Model | objectives | Generated.
[2025-06-27 09:31:30] INFO Model: backend build complete
[2025-06-27 09:31:30] INFO Optimisation model | starting model in plan mode.
[2025-06-27 09:31:30] INFO Backend: solver finished running. Time since start of solving optimisation problem: 0:00:00.560940
[2025-06-27 09:31:30] WARNING Postprocessing: All values < 1e-10 set to 0 in flow_cap, flow_out, flow_in, storage, flow_out_inc_eff, flow_in_inc_eff, cost_operation_variable, cost, capacity_factor
[2025-06-27 09:31:30] INFO Postprocessing: ended. Time since start of solving optimisation problem: 0:00:00.631473
[2025-06-27 09:31:30] INFO Backend: model solve completed. Time since start of solving optimisation problem: 0:00:00.632828
Running in operate mode.¶
model_operate = calliope.examples.national_scale(scenario="operate")
model_operate.build()
model_operate.solve()
[2025-06-27 09:31:30] INFO Model: initialising
[2025-06-27 09:31:30] INFO (scenarios, operate ) | Applying the following overrides: ['operate'].
[2025-06-27 09:31:30] INFO Model: preprocessing stage 1 (model_run)
[2025-06-27 09:31:31] INFO Model: preprocessing stage 2 (model_data)
[2025-06-27 09:31:31] INFO Model: preprocessing complete
[2025-06-27 09:31:31] INFO Model: backend build starting
[2025-06-27 09:31:32] INFO Math preprocessing | added file 'operate'.
[2025-06-27 09:31:32] INFO Math preprocessing | validated math against schema.
[2025-06-27 09:31:32] INFO Optimisation Model | parameters | Generated.
[2025-06-27 09:31:34] INFO Optimisation Model | Validated math strings.
[2025-06-27 09:31:34] INFO Optimisation Model | variables | Generated.
[2025-06-27 09:31:34] INFO Optimisation Model | global_expressions | Generated.
[2025-06-27 09:31:36] INFO Optimisation Model | constraints | Generated.
[2025-06-27 09:31:36] INFO Optimisation Model | piecewise_constraints | Generated.
[2025-06-27 09:31:36] INFO Optimisation Model | objectives | Generated.
[2025-06-27 09:31:36] INFO Model: backend build complete
[2025-06-27 09:31:36] INFO Optimisation model | starting model in operate mode.
[2025-06-27 09:31:36] INFO Optimisation model | Running first time window.
[2025-06-27 09:31:36] INFO Optimisation model | Running time window starting at 2005-01-01 12:00:00.
[2025-06-27 09:31:36] INFO Optimisation model | parameters:storage_initial | Defining values for a previously fully/partially undefined parameter. The optimisation problem components ['balance_storage', 'balance_supply_with_storage'] will be re-built.
[2025-06-27 09:31:36] INFO Optimisation model | Running time window starting at 2005-01-02 00:00:00.
[2025-06-27 09:31:36] INFO Optimisation model | Running time window starting at 2005-01-02 12:00:00.
[2025-06-27 09:31:36] INFO Optimisation model | Running time window starting at 2005-01-03 00:00:00.
[2025-06-27 09:31:36] INFO Optimisation model | Running time window starting at 2005-01-03 12:00:00.
[2025-06-27 09:31:37] INFO Optimisation model | Running time window starting at 2005-01-04 00:00:00.
[2025-06-27 09:31:37] INFO Optimisation model | Running time window starting at 2005-01-04 12:00:00.
[2025-06-27 09:31:37] INFO Optimisation model | Running time window starting at 2005-01-05 00:00:00.
[2025-06-27 09:31:37] INFO Optimisation model | Running time window starting at 2005-01-05 12:00:00.
[2025-06-27 09:31:37] INFO Optimisation model | Running time window starting at 2005-01-06 00:00:00.
[2025-06-27 09:31:37] INFO Optimisation model | Running time window starting at 2005-01-06 12:00:00.
[2025-06-27 09:31:37] INFO Optimisation model | Running time window starting at 2005-01-07 00:00:00.
[2025-06-27 09:31:37] INFO Optimisation model | Running time window starting at 2005-01-07 12:00:00.
[2025-06-27 09:31:37] INFO Optimisation model | Running time window starting at 2005-01-08 00:00:00.
[2025-06-27 09:31:38] INFO Optimisation model | Running time window starting at 2005-01-08 12:00:00.
[2025-06-27 09:31:38] INFO Optimisation model | Running time window starting at 2005-01-09 00:00:00.
[2025-06-27 09:31:38] INFO Optimisation model | Running time window starting at 2005-01-09 12:00:00.
[2025-06-27 09:31:38] INFO Optimisation model | Running time window starting at 2005-01-10 00:00:00.
[2025-06-27 09:31:38] INFO Optimisation model | Running time window starting at 2005-01-10 12:00:00.
[2025-06-27 09:31:38] INFO Optimisation model | Reaching the end of the timeseries. Re-building model with shorter time horizon.
[2025-06-27 09:31:38] INFO Model: backend build starting
[2025-06-27 09:31:38] INFO Math preprocessing | added file 'operate'.
[2025-06-27 09:31:38] INFO Math preprocessing | validated math against schema.
[2025-06-27 09:31:38] INFO Optimisation Model | parameters | Generated.
[2025-06-27 09:31:40] INFO Optimisation Model | Validated math strings.
[2025-06-27 09:31:40] INFO Optimisation Model | variables | Generated.
[2025-06-27 09:31:41] INFO Optimisation Model | global_expressions | Generated.
[2025-06-27 09:31:42] INFO Optimisation Model | constraints | Generated.
[2025-06-27 09:31:42] INFO Optimisation Model | piecewise_constraints | Generated.
[2025-06-27 09:31:42] INFO Optimisation Model | objectives | Generated.
[2025-06-27 09:31:42] INFO Model: backend build complete
[2025-06-27 09:31:42] INFO Optimisation model | parameters:storage_initial | Defining values for a previously fully/partially undefined parameter. The optimisation problem components ['balance_storage', 'balance_supply_with_storage'] will be re-built.
[2025-06-27 09:31:42] INFO Backend: solver finished running. Time since start of solving optimisation problem: 0:00:06.696983
[2025-06-27 09:31:42] WARNING Postprocessing: All values < 1e-10 set to 0 in flow_out, flow_in, storage, flow_out_inc_eff, flow_in_inc_eff, cost_operation_variable, capacity_factor
[2025-06-27 09:31:42] INFO Postprocessing: ended. Time since start of solving optimisation problem: 0:00:06.750412
[2025-06-27 09:31:42] INFO Backend: model solve completed. Time since start of solving optimisation problem: 0:00:06.752797
Note how we have capacity variables as parameters in the inputs and only dispatch variables in the results
model_operate.inputs[["flow_cap", "storage_cap", "area_use"]]
<xarray.Dataset> Size: 872B
Dimensions: (nodes: 4, techs: 7)
Coordinates:
* techs (techs) object 56B 'battery' 'ccgt' ... 'region1_to_region2'
* nodes (nodes) <U9 144B 'region1' 'region1_1' 'region1_3' 'region2'
Data variables:
flow_cap (nodes, techs) float64 224B nan 3e+04 nan nan ... nan nan nan
storage_cap (nodes, techs) float64 224B nan nan nan nan ... nan nan nan nan
area_use (nodes, techs) float64 224B nan nan nan nan ... nan nan nan nan
Attributes: (12/13)
termination_condition: optimal
calliope_version_defined: 0.7.0
calliope_version_initialised: 0.7.0.dev6
applied_overrides: operate
scenario: operate
defaults: {'bigM': 1000000000.0, 'objective_cost_wei...
... ...
name: National-scale example model
timestamp_model_creation: 1751016690.693611
timestamp_build_start: 1751016698.419695
timestamp_build_complete: 1751016702.415181
timestamp_solve_start: 1751016696.127526
timestamp_solve_complete: 1751016702.880323model_operate.results
<xarray.Dataset> Size: 523kB
Dimensions: (timesteps: 240, techs: 7, nodes: 4,
carriers: 1, costs: 1)
Coordinates:
* techs (techs) object 56B 'battery' ... 'region1_to_...
* carriers (carriers) <U5 20B 'power'
* nodes (nodes) <U9 144B 'region1' ... 'region2'
* timesteps (timesteps) datetime64[ns] 2kB 2005-01-01 ......
* costs (costs) object 8B 'monetary'
Data variables: (12/14)
link_flow_cap (timesteps, techs) float64 13kB nan nan ... nan
flow_out (nodes, techs, carriers, timesteps) float64 54kB ...
flow_in (nodes, techs, carriers, timesteps) float64 54kB ...
source_use (nodes, techs, timesteps) float64 54kB nan .....
storage (nodes, techs, timesteps) float64 54kB nan .....
unmet_demand (nodes, carriers, timesteps) float64 8kB 0.0 ...
... ...
cost_operation_variable (nodes, techs, costs, timesteps) float64 54kB ...
cost (timesteps, nodes, techs, costs) float64 54kB ...
capacity_factor (nodes, techs, carriers, timesteps) float64 54kB ...
systemwide_capacity_factor (techs, carriers) float64 56B 0.03872 ... 0.0
systemwide_levelised_cost (carriers, timesteps, techs, costs) float64 13kB ...
total_levelised_cost (carriers, timesteps, costs) float64 2kB 0.00...
Attributes: (12/13)
termination_condition: optimal
calliope_version_defined: 0.7.0
calliope_version_initialised: 0.7.0.dev6
applied_overrides: operate
scenario: operate
defaults: {'bigM': 1000000000.0, 'objective_cost_wei...
... ...
name: National-scale example model
timestamp_model_creation: 1751016690.693611
timestamp_build_start: 1751016698.419695
timestamp_build_complete: 1751016702.415181
timestamp_solve_start: 1751016696.127526
timestamp_solve_complete: 1751016702.880323Running in spores mode.¶
# We subset to the same time range as operate/plan mode
model_spores = calliope.examples.national_scale(
scenario="spores", time_subset=["2005-01-01", "2005-01-10"]
)
model_spores.build()
model_spores.solve()
[2025-06-27 09:31:42] INFO Model: initialising
[2025-06-27 09:31:42] INFO (scenarios, spores ) | Applying the following overrides: ['spores'].
[2025-06-27 09:31:42] INFO Model: preprocessing stage 1 (model_run)
[2025-06-27 09:31:44] INFO Model: preprocessing stage 2 (model_data)
[2025-06-27 09:31:44] INFO Model: preprocessing complete
[2025-06-27 09:31:44] INFO Model: backend build starting
[2025-06-27 09:31:44] INFO Math preprocessing | added file 'spores'.
[2025-06-27 09:31:44] INFO Math preprocessing | validated math against schema.
[2025-06-27 09:31:44] INFO Optimisation Model | parameters | Generated.
[2025-06-27 09:31:46] INFO Optimisation Model | Validated math strings.
[2025-06-27 09:31:47] INFO Optimisation Model | variables | Generated.
[2025-06-27 09:31:47] INFO Optimisation Model | global_expressions | Generated.
[2025-06-27 09:31:49] INFO Optimisation Model | constraints | Generated.
[2025-06-27 09:31:49] INFO Optimisation Model | piecewise_constraints | Generated.
[2025-06-27 09:31:49] INFO Optimisation Model | objectives | Generated.
[2025-06-27 09:31:49] INFO Model: backend build complete
[2025-06-27 09:31:49] INFO Optimisation model | starting model in spores mode.
[2025-06-27 09:31:49] INFO Optimisation model | Resetting SPORES parameters.
[2025-06-27 09:31:49] INFO Optimisation model | parameters:spores_score | Defining values for a previously fully/partially undefined parameter. The optimisation problem components ['min_spores', 'spores_score_cumulative'] will be re-built.
[2025-06-27 09:31:49] INFO Optimisation model | parameters:spores_baseline_cost | Defining values for a previously fully/partially undefined parameter. The optimisation problem components ['total_system_cost_max'] will be re-built.
[2025-06-27 09:31:50] INFO Optimisation model | objectives:min_cost_optimisation | Objective deactivated.
[2025-06-27 09:31:50] INFO Optimisation model | objectives:min_cost_optimisation | Objective activated.
[2025-06-27 09:31:50] INFO Optimisation model | Running baseline model.
[2025-06-27 09:31:50] INFO Optimisation model | Running SPORES with `integer` scoring algorithm.
[2025-06-27 09:31:50] INFO Optimisation model | Running SPORE 1.
[2025-06-27 09:31:50] INFO Optimisation model | parameters:spores_baseline_cost | Defining values for a previously fully/partially undefined parameter. The optimisation problem components ['total_system_cost_max'] will be re-built.
[2025-06-27 09:31:50] INFO Optimisation model | parameters:spores_score | Defining values for a previously fully/partially undefined parameter. The optimisation problem components ['min_spores', 'spores_score_cumulative'] will be re-built.
[2025-06-27 09:31:50] INFO Optimisation model | objectives:min_cost_optimisation | Objective deactivated.
[2025-06-27 09:31:50] INFO Optimisation model | objectives:min_spores | Objective activated.
[2025-06-27 09:31:51] INFO Optimisation model | Running SPORE 2.
[2025-06-27 09:31:51] INFO Optimisation model | objectives:min_spores | Objective deactivated.
[2025-06-27 09:31:51] INFO Optimisation model | objectives:min_spores | Objective activated.
[2025-06-27 09:31:52] INFO Optimisation model | Running SPORE 3.
[2025-06-27 09:31:52] INFO Optimisation model | objectives:min_spores | Objective deactivated.
[2025-06-27 09:31:52] INFO Optimisation model | objectives:min_spores | Objective activated.
[2025-06-27 09:31:53] INFO Backend: solver finished running. Time since start of solving optimisation problem: 0:00:03.363072
[2025-06-27 09:31:53] WARNING Postprocessing: All values < 1e-10 set to 0 in flow_cap, link_flow_cap, flow_out, flow_in, source_use, source_cap, storage_cap, storage, flow_out_inc_eff, flow_in_inc_eff, cost_operation_variable, cost, capacity_factor
[2025-06-27 09:31:53] INFO Postprocessing: ended. Time since start of solving optimisation problem: 0:00:03.453731
[2025-06-27 09:31:53] INFO Backend: model solve completed. Time since start of solving optimisation problem: 0:00:03.455251
Note how we have a new spores dimension in our results.
model_spores.results
<xarray.Dataset> Size: 3MB
Dimensions: (spores: 4, nodes: 5, techs: 8, carriers: 1,
timesteps: 240, costs: 1)
Coordinates:
* techs (techs) object 64B 'battery' ... 'region1_to...
* carriers (carriers) <U5 20B 'power'
* nodes (nodes) <U9 180B 'region1' ... 'region2'
* timesteps (timesteps) datetime64[ns] 2kB 2005-01-01 .....
* costs (costs) object 8B 'monetary'
* spores (spores) object 32B 'baseline' 1 2 3
Data variables: (12/25)
flow_cap (spores, nodes, techs, carriers) float64 1kB ...
link_flow_cap (spores, techs) float64 256B nan ... 3.877e+03
flow_out (spores, nodes, techs, carriers, timesteps) float64 307kB ...
flow_in (spores, nodes, techs, carriers, timesteps) float64 307kB ...
area_use (spores, nodes, techs) float64 1kB nan ... nan
source_use (spores, nodes, techs, timesteps) float64 307kB ...
... ...
cost (spores, nodes, techs, costs) float64 1kB na...
spores_score_cumulative (spores, nodes, techs, carriers) float64 1kB ...
capacity_factor (spores, nodes, techs, carriers, timesteps) float64 307kB ...
systemwide_capacity_factor (spores, techs, carriers) float64 256B 0.134...
systemwide_levelised_cost (carriers, spores, techs, costs) float64 256B ...
total_levelised_cost (carriers, spores, costs) float64 32B 0.0671...
Attributes: (12/13)
termination_condition: optimal
calliope_version_defined: 0.7.0
calliope_version_initialised: 0.7.0.dev6
applied_overrides: spores
scenario: spores
defaults: {'bigM': 1000000000.0, 'objective_cost_wei...
... ...
name: National-scale example model
timestamp_model_creation: 1751016702.927925
timestamp_build_start: 1751016704.254343
timestamp_build_complete: 1751016709.910877
timestamp_solve_start: 1751016709.91173
timestamp_solve_complete: 1751016713.366981We can track the SPORES scores used between iterations using the spores_score_cumulative result.
This scoring mechanism is based on increasing the score of any technology-node combination where the
# We do some prettification of the outputs
model_spores.results.spores_score_cumulative.to_series().where(
lambda x: x > 0
).dropna().unstack("spores")
| spores | 1 | 2 | 3 | ||
|---|---|---|---|---|---|
| nodes | techs | carriers | |||
| region1 | ccgt | power | 1.0 | 2.0 | 3.0 |
| region1_1 | csp | power | 1.0 | 2.0 | 2.0 |
| region1_3 | csp | power | 1.0 | 1.0 | 2.0 |
| region1_2 | csp | power | NaN | 1.0 | 2.0 |
# We set the color mapping to use in all our plots by extracting the colors defined in the technology definitions of our model.
# We also create some reusable plotting functions.
colors = model_plan.inputs.color.to_series().to_dict()
def plot_flows(results: xr.Dataset) -> go.Figure:
df_electricity = (
(results.flow_out.fillna(0) - results.flow_in.fillna(0))
.sel(carriers="power")
.sum("nodes")
.to_series()
.where(lambda x: x != 0)
.dropna()
.to_frame("Flow in/out (kWh)")
.reset_index()
)
df_electricity_demand = df_electricity[df_electricity.techs == "demand_power"]
df_electricity_other = df_electricity[df_electricity.techs != "demand_power"]
fig = px.bar(
df_electricity_other,
x="timesteps",
y="Flow in/out (kWh)",
color="techs",
color_discrete_map=colors,
)
fig.add_scatter(
x=df_electricity_demand.timesteps,
y=-1 * df_electricity_demand["Flow in/out (kWh)"],
marker_color="black",
name="demand",
)
return fig
def plot_capacity(results: xr.Dataset, **plotly_kwargs) -> go.Figure:
df_capacity = (
results.flow_cap.where(results.techs != "demand_power")
.sel(carriers="power")
.to_series()
.where(lambda x: x != 0)
.dropna()
.to_frame("Flow capacity (kW)")
.reset_index()
)
fig = px.bar(
df_capacity,
x="nodes",
y="Flow capacity (kW)",
color="techs",
color_discrete_map=colors,
**plotly_kwargs,
)
return fig
Using different spores scoring algorithms.¶
We make a number of scoring algorithms accessible out-of-the-box, based on those we present in Lombardi et al. (2023).
You can call them on solving the model.
Here, we'll compare the result on flow_cap from running each.
# We subset to the same time range as operate/plan mode
model_spores = calliope.examples.national_scale(
scenario="spores", time_subset=["2005-01-01", "2005-01-10"]
)
model_spores.build()
spores_results = []
for algorithm in ["integer", "evolving_average", "random", "relative_deployment"]:
model_spores.solve(**{"spores.scoring_algorithm": algorithm}, force=True)
spores_results.append(model_spores.results.expand_dims(algorithm=[algorithm]))
spores_results_da = xr.concat(spores_results, dim="algorithm")
spores_results_da.flow_cap.to_series().dropna().unstack("spores")
[2025-06-27 09:31:53] INFO Model: initialising
[2025-06-27 09:31:53] INFO (scenarios, spores ) | Applying the following overrides: ['spores'].
[2025-06-27 09:31:53] INFO Model: preprocessing stage 1 (model_run)
[2025-06-27 09:31:54] INFO Model: preprocessing stage 2 (model_data)
[2025-06-27 09:31:54] INFO Model: preprocessing complete
[2025-06-27 09:31:54] INFO Model: backend build starting
[2025-06-27 09:31:54] INFO Math preprocessing | added file 'spores'.
[2025-06-27 09:31:54] INFO Math preprocessing | validated math against schema.
[2025-06-27 09:31:55] INFO Optimisation Model | parameters | Generated.
[2025-06-27 09:31:57] INFO Optimisation Model | Validated math strings.
[2025-06-27 09:31:57] INFO Optimisation Model | variables | Generated.
[2025-06-27 09:31:58] INFO Optimisation Model | global_expressions | Generated.
[2025-06-27 09:31:59] INFO Optimisation Model | constraints | Generated.
[2025-06-27 09:31:59] INFO Optimisation Model | piecewise_constraints | Generated.
[2025-06-27 09:32:00] INFO Optimisation Model | objectives | Generated.
[2025-06-27 09:32:00] INFO Model: backend build complete
[2025-06-27 09:32:00] INFO Updating Model solve SPORES mode configuration `scoring_algorithm`: integer -> integer
[2025-06-27 09:32:00] INFO Optimisation model | starting model in spores mode.
[2025-06-27 09:32:00] INFO Optimisation model | Resetting SPORES parameters.
[2025-06-27 09:32:00] INFO Optimisation model | parameters:spores_score | Defining values for a previously fully/partially undefined parameter. The optimisation problem components ['min_spores', 'spores_score_cumulative'] will be re-built.
[2025-06-27 09:32:00] INFO Optimisation model | parameters:spores_baseline_cost | Defining values for a previously fully/partially undefined parameter. The optimisation problem components ['total_system_cost_max'] will be re-built.
[2025-06-27 09:32:00] INFO Optimisation model | objectives:min_cost_optimisation | Objective deactivated.
[2025-06-27 09:32:00] INFO Optimisation model | objectives:min_cost_optimisation | Objective activated.
[2025-06-27 09:32:00] INFO Optimisation model | Running baseline model.
[2025-06-27 09:32:01] INFO Optimisation model | Running SPORES with `integer` scoring algorithm.
[2025-06-27 09:32:01] INFO Optimisation model | Running SPORE 1.
[2025-06-27 09:32:01] INFO Optimisation model | parameters:spores_baseline_cost | Defining values for a previously fully/partially undefined parameter. The optimisation problem components ['total_system_cost_max'] will be re-built.
[2025-06-27 09:32:01] INFO Optimisation model | parameters:spores_score | Defining values for a previously fully/partially undefined parameter. The optimisation problem components ['min_spores', 'spores_score_cumulative'] will be re-built.
[2025-06-27 09:32:01] INFO Optimisation model | objectives:min_cost_optimisation | Objective deactivated.
[2025-06-27 09:32:01] INFO Optimisation model | objectives:min_spores | Objective activated.
[2025-06-27 09:32:01] INFO Optimisation model | Running SPORE 2.
[2025-06-27 09:32:01] INFO Optimisation model | objectives:min_spores | Objective deactivated.
[2025-06-27 09:32:01] INFO Optimisation model | objectives:min_spores | Objective activated.
[2025-06-27 09:32:02] INFO Optimisation model | Running SPORE 3.
[2025-06-27 09:32:02] INFO Optimisation model | objectives:min_spores | Objective deactivated.
[2025-06-27 09:32:02] INFO Optimisation model | objectives:min_spores | Objective activated.
[2025-06-27 09:32:03] INFO Backend: solver finished running. Time since start of solving optimisation problem: 0:00:03.573892
[2025-06-27 09:32:03] WARNING Postprocessing: All values < 1e-10 set to 0 in flow_cap, link_flow_cap, flow_out, flow_in, source_use, source_cap, storage_cap, storage, flow_out_inc_eff, flow_in_inc_eff, cost_operation_variable, cost, capacity_factor
[2025-06-27 09:32:03] INFO Postprocessing: ended. Time since start of solving optimisation problem: 0:00:03.660819
[2025-06-27 09:32:03] INFO Backend: model solve completed. Time since start of solving optimisation problem: 0:00:03.663222
[2025-06-27 09:32:03] INFO Updating Model solve SPORES mode configuration `scoring_algorithm`: integer -> evolving_average
[2025-06-27 09:32:03] INFO Optimisation model | starting model in spores mode.
[2025-06-27 09:32:03] INFO Optimisation model | Resetting SPORES parameters.
[2025-06-27 09:32:03] INFO Optimisation model | objectives:min_spores | Objective deactivated.
[2025-06-27 09:32:03] INFO Optimisation model | objectives:min_cost_optimisation | Objective activated.
[2025-06-27 09:32:03] INFO Optimisation model | Running baseline model.
[2025-06-27 09:32:04] INFO Optimisation model | Running SPORES with `evolving_average` scoring algorithm.
[2025-06-27 09:32:04] INFO Optimisation model | Running SPORE 1.
[2025-06-27 09:32:04] INFO Optimisation model | objectives:min_cost_optimisation | Objective deactivated.
[2025-06-27 09:32:04] INFO Optimisation model | objectives:min_spores | Objective activated.
[2025-06-27 09:32:05] INFO Optimisation model | Running SPORE 2.
[2025-06-27 09:32:05] INFO Optimisation model | objectives:min_spores | Objective deactivated.
[2025-06-27 09:32:05] INFO Optimisation model | objectives:min_spores | Objective activated.
[2025-06-27 09:32:06] INFO Optimisation model | Running SPORE 3.
[2025-06-27 09:32:06] INFO Optimisation model | objectives:min_spores | Objective deactivated.
[2025-06-27 09:32:06] INFO Optimisation model | objectives:min_spores | Objective activated.
[2025-06-27 09:32:07] INFO Backend: solver finished running. Time since start of solving optimisation problem: 0:00:03.553529
[2025-06-27 09:32:07] WARNING Postprocessing: All values < 1e-10 set to 0 in flow_cap, link_flow_cap, flow_out, flow_in, source_use, source_cap, storage_cap, storage, flow_out_inc_eff, flow_in_inc_eff, cost_operation_variable, cost_investment_annualised, cost, capacity_factor
[2025-06-27 09:32:07] INFO Postprocessing: ended. Time since start of solving optimisation problem: 0:00:03.645329
[2025-06-27 09:32:07] INFO Backend: model solve completed. Time since start of solving optimisation problem: 0:00:03.647059
[2025-06-27 09:32:07] INFO Updating Model solve SPORES mode configuration `scoring_algorithm`: evolving_average -> random
[2025-06-27 09:32:07] INFO Optimisation model | starting model in spores mode.
[2025-06-27 09:32:07] INFO Optimisation model | Resetting SPORES parameters.
[2025-06-27 09:32:07] INFO Optimisation model | objectives:min_spores | Objective deactivated.
[2025-06-27 09:32:07] INFO Optimisation model | objectives:min_cost_optimisation | Objective activated.
[2025-06-27 09:32:07] INFO Optimisation model | Running baseline model.
[2025-06-27 09:32:08] INFO Optimisation model | Running SPORES with `random` scoring algorithm.
[2025-06-27 09:32:08] INFO Optimisation model | Running SPORE 1.
[2025-06-27 09:32:08] INFO Optimisation model | objectives:min_cost_optimisation | Objective deactivated.
[2025-06-27 09:32:08] INFO Optimisation model | objectives:min_spores | Objective activated.
[2025-06-27 09:32:08] INFO Optimisation model | Running SPORE 2.
[2025-06-27 09:32:08] INFO Optimisation model | objectives:min_spores | Objective deactivated.
[2025-06-27 09:32:08] INFO Optimisation model | objectives:min_spores | Objective activated.
[2025-06-27 09:32:09] INFO Optimisation model | Running SPORE 3.
[2025-06-27 09:32:09] INFO Optimisation model | objectives:min_spores | Objective deactivated.
[2025-06-27 09:32:09] INFO Optimisation model | objectives:min_spores | Objective activated.
[2025-06-27 09:32:10] INFO Backend: solver finished running. Time since start of solving optimisation problem: 0:00:02.711408
[2025-06-27 09:32:10] WARNING Postprocessing: All values < 1e-10 set to 0 in flow_cap, flow_out, flow_in, source_use, source_cap, storage, flow_out_inc_eff, flow_in_inc_eff, cost_operation_variable, cost, capacity_factor
[2025-06-27 09:32:10] INFO Postprocessing: ended. Time since start of solving optimisation problem: 0:00:02.800871
[2025-06-27 09:32:10] INFO Backend: model solve completed. Time since start of solving optimisation problem: 0:00:02.803420
[2025-06-27 09:32:10] INFO Updating Model solve SPORES mode configuration `scoring_algorithm`: random -> relative_deployment
[2025-06-27 09:32:10] INFO Optimisation model | starting model in spores mode.
[2025-06-27 09:32:10] INFO Optimisation model | Resetting SPORES parameters.
[2025-06-27 09:32:10] INFO Optimisation model | objectives:min_spores | Objective deactivated.
[2025-06-27 09:32:10] INFO Optimisation model | objectives:min_cost_optimisation | Objective activated.
[2025-06-27 09:32:10] INFO Optimisation model | Running baseline model.
[2025-06-27 09:32:10] INFO Optimisation model | Running SPORES with `relative_deployment` scoring algorithm.
[2025-06-27 09:32:10] INFO Optimisation model | Running SPORE 1.
[2025-06-27 09:32:10] INFO Optimisation model | objectives:min_cost_optimisation | Objective deactivated.
[2025-06-27 09:32:10] INFO Optimisation model | objectives:min_spores | Objective activated.
[2025-06-27 09:32:11] INFO Optimisation model | Running SPORE 2.
[2025-06-27 09:32:11] INFO Optimisation model | objectives:min_spores | Objective deactivated.
[2025-06-27 09:32:11] INFO Optimisation model | objectives:min_spores | Objective activated.
[2025-06-27 09:32:12] INFO Optimisation model | Running SPORE 3.
[2025-06-27 09:32:12] INFO Optimisation model | objectives:min_spores | Objective deactivated.
[2025-06-27 09:32:12] INFO Optimisation model | objectives:min_spores | Objective activated.
[2025-06-27 09:32:13] INFO Backend: solver finished running. Time since start of solving optimisation problem: 0:00:03.380353
[2025-06-27 09:32:13] WARNING Postprocessing: All values < 1e-10 set to 0 in flow_cap, flow_out, flow_in, storage, flow_out_inc_eff, flow_in_inc_eff, cost_operation_variable, cost, capacity_factor
[2025-06-27 09:32:13] INFO Postprocessing: ended. Time since start of solving optimisation problem: 0:00:03.468646
[2025-06-27 09:32:13] INFO Backend: model solve completed. Time since start of solving optimisation problem: 0:00:03.470122
| spores | baseline | 1 | 2 | 3 | |||
|---|---|---|---|---|---|---|---|
| algorithm | nodes | techs | carriers | ||||
| integer | region1 | ccgt | power | 30000.0000 | 30000.0000 | 2.835861e+04 | 22649.52900 |
| demand_power | power | 39614.8160 | 39614.8160 | 3.961482e+04 | 39614.81600 | ||
| region1_to_region1_1 | power | 9000.0000 | 2861.6819 | 0.000000e+00 | 9000.00000 | ||
| region1_to_region1_2 | power | 0.0000 | 9000.0000 | 4.503073e+03 | 2863.26850 | ||
| region1_to_region1_3 | power | 2861.6819 | 0.0000 | 9.000000e+03 | 7348.88410 | ||
| region1_to_region2 | power | 3230.4729 | 4069.4306 | 3.423336e+03 | 3876.56710 | ||
| region1_1 | csp | power | 10000.0000 | 3179.6465 | 0.000000e+00 | 10000.00000 | |
| region1_to_region1_1 | power | 9000.0000 | 2861.6819 | 0.000000e+00 | 9000.00000 | ||
| region1_2 | csp | power | 0.0000 | 10000.0000 | 5.003414e+03 | 3181.40940 | |
| region1_to_region1_2 | power | 0.0000 | 9000.0000 | 4.503073e+03 | 2863.26850 | ||
| region1_3 | csp | power | 3179.6465 | 0.0000 | 1.000000e+04 | 8165.42680 | |
| region1_to_region1_3 | power | 2861.6819 | 0.0000 | 9.000000e+03 | 7348.88410 | ||
| region2 | battery | power | 1000.0000 | 1000.0000 | 1.000000e+03 | 1000.00000 | |
| demand_power | power | 2909.8360 | 2909.8360 | 2.909836e+03 | 2909.83600 | ||
| region1_to_region2 | power | 3230.4729 | 4069.4306 | 3.423336e+03 | 3876.56710 | ||
| evolving_average | region1 | ccgt | power | 30000.0000 | 30000.0000 | 2.289690e+04 | 22897.95400 |
| demand_power | power | 39614.8160 | 39614.8160 | 3.961482e+04 | 39614.81600 | ||
| region1_to_region1_1 | power | 9000.0000 | 2861.6819 | 9.000000e+03 | 9000.00000 | ||
| region1_to_region1_2 | power | 0.0000 | 9000.0000 | 3.110695e+03 | 2140.19890 | ||
| region1_to_region1_3 | power | 2861.6819 | 0.0000 | 8.030559e+03 | 9000.00000 | ||
| region1_to_region2 | power | 3230.4729 | 4069.4306 | 3.423336e+03 | 3423.33650 | ||
| region1_1 | csp | power | 10000.0000 | 3179.6465 | 1.000000e+04 | 10000.00000 | |
| region1_to_region1_1 | power | 9000.0000 | 2861.6819 | 9.000000e+03 | 9000.00000 | ||
| region1_2 | csp | power | 0.0000 | 10000.0000 | 3.456327e+03 | 2377.99880 | |
| region1_to_region1_2 | power | 0.0000 | 9000.0000 | 3.110695e+03 | 2140.19890 | ||
| region1_3 | csp | power | 3179.6465 | 0.0000 | 8.922843e+03 | 10000.00000 | |
| region1_to_region1_3 | power | 2861.6819 | 0.0000 | 8.030559e+03 | 9000.00000 | ||
| region2 | battery | power | 1000.0000 | 1000.0000 | 0.000000e+00 | 0.00000 | |
| demand_power | power | 2909.8360 | 2909.8360 | 2.909836e+03 | 2909.83600 | ||
| region1_to_region2 | power | 3230.4729 | 4069.4306 | 3.423336e+03 | 3423.33650 | ||
| random | region1 | ccgt | power | 30000.0000 | 30000.0000 | 3.000000e+04 | 30000.00000 |
| demand_power | power | 39614.8160 | 39614.8160 | 3.961482e+04 | 39614.81600 | ||
| region1_to_region1_1 | power | 9000.0000 | 9000.0000 | 2.861682e+03 | 2861.68190 | ||
| region1_to_region1_2 | power | 0.0000 | 2861.6819 | 9.000000e+03 | 0.00000 | ||
| region1_to_region1_3 | power | 2861.6819 | 0.0000 | 2.894711e-09 | 9000.00000 | ||
| region1_to_region2 | power | 3230.4729 | 10000.0000 | 1.000000e+04 | 10000.00000 | ||
| region1_1 | csp | power | 10000.0000 | 10000.0000 | 3.179646e+03 | 3179.64650 | |
| region1_to_region1_1 | power | 9000.0000 | 9000.0000 | 2.861682e+03 | 2861.68190 | ||
| region1_2 | csp | power | 0.0000 | 3179.6465 | 1.000000e+04 | 0.00000 | |
| region1_to_region1_2 | power | 0.0000 | 2861.6819 | 9.000000e+03 | 0.00000 | ||
| region1_3 | csp | power | 3179.6465 | 0.0000 | -1.420347e-10 | 10000.00000 | |
| region1_to_region1_3 | power | 2861.6819 | 0.0000 | 2.894711e-09 | 9000.00000 | ||
| region2 | battery | power | 1000.0000 | 1000.0000 | 1.000000e+03 | 1000.00000 | |
| demand_power | power | 2909.8360 | 2909.8360 | 2.909836e+03 | 2909.83600 | ||
| region1_to_region2 | power | 3230.4729 | 10000.0000 | 1.000000e+04 | 10000.00000 | ||
| relative_deployment | region1 | ccgt | power | 30000.0000 | 28824.5160 | 2.265217e+04 | 23389.69100 |
| demand_power | power | 39614.8160 | 39614.8160 | 3.961482e+04 | 39614.81600 | ||
| region1_to_region1_1 | power | 9000.0000 | 0.0000 | 9.000000e+03 | 9000.00000 | ||
| region1_to_region1_2 | power | 0.0000 | 9000.0000 | 1.209515e+03 | 9000.00000 | ||
| region1_to_region1_3 | power | 2861.6819 | 5213.6366 | 9.000000e+03 | 471.99107 | ||
| region1_to_region2 | power | 3230.4729 | 3423.3365 | 3.876567e+03 | 4021.21410 | ||
| region1_1 | csp | power | 10000.0000 | 0.0000 | 1.000000e+04 | 10000.00000 | |
| region1_to_region1_1 | power | 9000.0000 | 0.0000 | 9.000000e+03 | 9000.00000 | ||
| region1_2 | csp | power | 0.0000 | 10000.0000 | 1.343906e+03 | 10000.00000 | |
| region1_to_region1_2 | power | 0.0000 | 9000.0000 | 1.209515e+03 | 9000.00000 | ||
| region1_3 | csp | power | 3179.6465 | 5792.9296 | 1.000000e+04 | 524.43452 | |
| region1_to_region1_3 | power | 2861.6819 | 5213.6366 | 9.000000e+03 | 471.99107 | ||
| region2 | battery | power | 1000.0000 | 0.0000 | 1.000000e+03 | 1000.00000 | |
| demand_power | power | 2909.8360 | 2909.8360 | 2.909836e+03 | 2909.83600 | ||
| region1_to_region2 | power | 3230.4729 | 3423.3365 | 3.876567e+03 | 4021.21410 |
plan vs operate¶
Here, we compare flows over the 10 days. Note how flows do not match as the rolling horizon makes it difficult to make the correct storage charge/discharge decisions.
fig_flows_plan = plot_flows(
model_plan.results.sel(timesteps=model_operate.results.timesteps)
)
fig_flows_plan.update_layout(title="Plan mode flows")
fig_flows_operate = plot_flows(model_operate.results)
fig_flows_operate.update_layout(title="Operate mode flows")
plan vs spores¶
Here, we compare installed capacities between the baseline run (== plan mode) and the SPORES.
Note how the baseline SPORE is the same as plan mode and then results deviate considerably.
fig_flows_plan = plot_capacity(model_plan.results)
fig_flows_plan.update_layout(title="Plan mode capacities")
fig_flows_spores = plot_capacity(model_spores.results, facet_col="spores")
fig_flows_spores.update_layout(title="SPORES mode capacities")
Comparing spores scoring algorithms¶
Here, we compare installed capacities between the different SPORES runs.
fig_flows_spores = plot_capacity(
spores_results_da, facet_col="spores", facet_row="algorithm"
)
fig_flows_spores.update_layout(
title="SPORES mode capacities using different scoring algorithms",
autosize=False,
height=800,
)