model¶
This module defines the PREP-SHOT model. The model is created using the pyoptinterface library.
- prepshot.model.check_line_symmetry(existing)[source]¶
Check that each existing line has the same capacity in both directions.
A line has one entry for each direction, and the cost rules charge half of the line cost on each entry. An entry with no equal entry in the opposite direction would thus be charged incorrectly.
- Parameters
existing (dict) --
transmission_existing, keyed(zone1, zone2)or(zone1, zone2, commission_year).- Raises
ValueError -- If the capacity of a line differs between the two directions.
- Return type
None
- prepshot.model.create_model(params)[source]¶
Create the PREP-SHOT model.
- Parameters
params (dict) -- Dictionary of parameters for the model.
- Returns
Model object.
- Return type
object
- prepshot.model.define_active_zone_tech(model)[source]¶
Pull the sparse
(zone, tech)set frommodel.params(built once at file-read time byload_data.compute_active_zone_tech) and derive the time-indexed key lists used by the constraint builders.The (zone, tech) set itself is data-property (depends only on
existing_fleet+expansion_candidates), so we compute it inload_dataand reuse it unchanged across every PCM window. The (h, m, y, z, te) lists DO depend on the per-window time index sets, so they're materialised here.- Parameters
model (object) --
- Return type
None
- prepshot.model.define_basic_sets(model)[source]¶
Define sets for the model.
- Parameters
model (object) -- Model object to be solved.
- Return type
None
- prepshot.model.define_complex_sets(model)[source]¶
Validate that every line param needed by the constraints is actually present in the loaded CSVs.
Refuses to silently default a missing entry. Each (active line, year) combination MUST have a row in the CSV.
- Parameters
model (object) --
- Return type
None
- prepshot.model.define_constraints(model)[source]¶
Define constraints for the model.
- Parameters
model (object) -- Model to be solved.
- Return type
None
- prepshot.model.define_model(params)[source]¶
This function creates the model class depending on predefined solver.
- Parameters
params (dict) -- parameters for the model
- Returns
A pyoptinterface Model object depending on the solver
- Return type
object
- Raises
ValueError -- Unsupported or undefined solver