Generator
Use the Generator class to represent a power generator with a given active power capacity (p_nom), in order to optimize its active power over time (GeneratorDynamicResults.p).
Use the ExtendableGenerator class to represent a hypothetical generator with an active power capacity that is flexible, in order to also optimize the active power capacity (ExtendableGeneratorOptimizationStaticResults.p_nom_opt).
Use the CommittableGenerator class to represent a generator with unit commitment (start-up and shut-down) constraints, in order to also optimize when the generator is operating (CommittableGeneratorOptimizationDynamicResults.status).
API Reference
Generator, ExtendableGenerator, and CommittableGenerator all inherit from the BaseGenerator parent class.
BaseGenerator
Bases: PNomExtendableComponent[T]
Power generator for the bus carrier it attaches to.
PyPSA user guide for this component.
bus: str = Field(min_length=1)
Name of bus to which generator is attached.
control: ControlType = 'PQ'
P,Q,V control strategy for power flow, must be "PQ", "PV" or "Slack". Only relevant for "AC" and "DC" buses.
p_nom_extendable: bool
Switch to allow capacity p_nom to be extended in optimization.
p_min_pu: float | Series[T] = Field(default=0.0, ge=(-1.0), le=1.0)
The minimum output for each snapshot per unit of p_nom for the optimization (e.g. a minimal dispatch level for conventional power plants). Note that if committable=False and p_min_pu>0, this represents a must-run condition.
p_max_pu: float | Series[T] = Field(default=1.0, ge=0.0, le=1.0)
The maximum output for each snapshot per unit of p_nom for the optimization (e.g. changing availability of renewable generators due to weather conditions or a de-rating of conventional power plants).
p_set: float | Series[T] | None = None
Active power set point (for optimisation and power flow).
e_sum_min: float | None = None
The minimum total energy produced during a single optimization horizon.
e_sum_max: float | None = None
The maximum total energy produced during a single optimization horizon.
q_set: float | Series[T] = 0.0
Reactive power set point (for power flow).
sign: SignType = +1
Sign denoting the orientation of the dispatch variable (e.g. positive for generation, negative for consumption).
carrier: str | None = Field(default=None, min_length=1)
Prime mover energy carrier (e.g. coal, gas, wind, solar); required for global constraints on primary energy in optimisation.
marginal_cost: float | Series[T] = Field(default=0.0)
Marginal cost of production of 1 MWh.
marginal_cost_quadratic: float | Series[T] = Field(default=0.0)
Quadratic marginal cost of production of 1 MWh.
active: bool = True
Whether to consider the component in optimization or not.
build_year: int | None = None
Build year of the generator.
lifetime: float | None = Field(default=None, gt=0.0)
Lifetime of the generator.
efficiency: float | Series[T] = Field(default=1.0, gt=0.0, le=1.0)
Ratio output and primary energy carrier input (e.g. 0.4 MWh_elec/MWh_fuel). This is required for global constraints on primary energy in optimization.
committable: bool
Apply unit commitment constraints. This is only possible with p_nom_extendable=False.
ramp_limit_up: float | Series[T] | None = Field(default=None, gt=0.0, le=1.0)
Maximum active power increase from one snapshot to the next, per unit of the nominal power. Does not consider snapshot weightings.
ramp_limit_down: float | Series[T] | None = Field(default=None, gt=0.0, le=1.0)
Maximum active power decrease from one snapshot to the next, per unit of the nominal power. Does not consider snapshot weightings.
weight: float = 1.0
Weighting of a generator. Only used for network clustering.
Generator
Bases: BaseGenerator[T]
p_nom: float | None = Field(default=None, gt=0.0)
Nominal power for limits on p in optimization.
ExtendableGenerator
Bases: BaseGenerator[T]
p_nom_mod: float = Field(default=0.0, ge=0.0)
Nominal power of the generator module (e.g. fixed unit size of a nuclear power plant). Introduces integer variables if set.
p_nom_min: float = Field(default=0.0, ge=0.0)
Minimum value of p_nom_opt.
p_nom_max: float | None = Field(default=None, gt=0.0)
Maximum value of p_nom_opt (e.g. limited by technical potential).
p_nom_set: float | None = Field(default=None, ge=0.0)
Set value of p_nom_opt.
capital_cost: float = Field(default=0.0, ge=0.0)
Fixed period costs of extending p_nom by 1 MW, including periodized investment costs and periodic fixed O&M costs (e.g. annuitized investment costs).
CommittableGenerator
Bases: Generator[T]
start_up_cost: float = Field(default=0.0, ge=0.0)
Cost to start up the generator.
shut_down_cost: float = Field(default=0.0, ge=0.0)
Cost to shut down the generator.
stand_by_cost: float | Series[T] = Field(default=0.0, ge=0.0)
Stand-by cost for running the generator. This cost is incurred whenever the status is 1 (including when the dispatch decision is zero).
min_up_time: int = Field(default=0, ge=0)
Minimum number of snapshots for status to be 1. Does not consider snapshot weightings.
min_down_time: int = Field(default=0, ge=0)
Minimum number of snapshots for status to be 0. Does not consider snapshot weightings.
up_time_before: int = 1
Number of snapshots that the generator was online before n.snapshots start. Only used if min_up_time>0. Does not consider snapshot weightings.
down_time_before: int = 0
Number of snapshots that the generator was offline before n.snapshots start. Only used if min_down_time>0. Does not consider snapshot weightings.
ramp_limit_start_up: float | None = Field(default=None, gt=0.0, le=1.0)
Maximum active power increase at start up, per unit of the nominal power. Ignored if None.
ramp_limit_shut_down: float | None = Field(default=None, gt=0.0, le=1.0)
Maximum active power decrease at shut down, per unit of the nominal power. Ignored if None.
GeneratorBaseDynamicResults
Bases: BaseDynamicResults
p: pandas.DataFrame
Active power at bus (positive if net generation).
GeneratorOptimizationDynamicResults
Bases: GeneratorBaseDynamicResults
mu_upper: pandas.DataFrame
Shadow price of upper p_nom limit.
mu_lower: pandas.DataFrame
Shadow price of lower p_nom limit.
mu_p_set: pandas.DataFrame
Shadow price of fixed power generation p_set.
mu_ramp_limit_up: pandas.DataFrame
Shadow price of upper ramp up limit.
mu_ramp_limit_down: pandas.DataFrame
Shadow price of lower ramp down limit.
CommittableGeneratorOptimizationDynamicResults
Bases: GeneratorOptimizationDynamicResults
status: pandas.DataFrame
Status in the snapshot (1 is on, 0 is off).
start_up: pandas.DataFrame
Whether the unit was started in the snapshot (1 is yes, 0 is no).
shut_down: pandas.DataFrame
Whether the unit was shut down in the snapshot (1 is yes, 0 is no).
GeneratorPfDynamicResults
Bases: GeneratorBaseDynamicResults
GeneratorNonlinearPfDynamicResults
Bases: GeneratorPfDynamicResults
q: pandas.DataFrame
Reactive power (positive if net generation).