Skip to main content

Generator

Struct Generator 

Source
pub struct Generator {
Show 32 fields pub id: String, pub bus: u32, pub machine_id: Option<String>, pub p: f64, pub q: f64, pub qmax: f64, pub qmin: f64, pub voltage_setpoint_pu: f64, pub voltage_regulated: bool, pub reg_bus: Option<u32>, pub machine_base_mva: f64, pub pmax: f64, pub pmin: f64, pub in_service: bool, pub cost: Option<CostCurve>, pub gen_type: GenType, pub technology: Option<GeneratorTechnology>, pub source_technology_code: Option<String>, pub agc_participation_factor: Option<f64>, pub h_inertia_s: Option<f64>, pub pfr_eligible: bool, pub quick_start: bool, pub forced_outage_rate: Option<f64>, pub storage: Option<StorageParams>, pub owners: Vec<OwnershipEntry>, pub commitment: Option<CommitmentParams>, pub ramping: Option<RampingParams>, pub inverter: Option<InverterParams>, pub fault_data: Option<GenFaultData>, pub reactive_capability: Option<ReactiveCapability>, pub fuel: Option<FuelParams>, pub market: Option<MarketParams>,
}
Expand description

A generation unit connected to a bus in the transmission network.

Represents thermal, hydro, renewable, and storage resources. For storage units (BESS, pumped hydro), set storage = Some(StorageParams) with pmin = -charge_mw_max (negative) and pmax = discharge_mw_max.

All power quantities are in MW/MVAr (system base = 100 MVA for per-unit conversion). Voltage setpoint is in per-unit.

Fields§

§id: String

Canonical generator identifier.

This is the stable, crate-native identity for the generator and is used for replaying detached solutions, scenario application, and any other workflow that must survive generator reordering.

Auto-assigned by crate::network::Network::canonicalize_generator_ids for generators that lack an explicit ID (format: gen_{bus}_{ordinal}).

§bus: u32

Bus number where the generator is connected.

§machine_id: Option<String>

PSS/E machine ID string (e.g. "1", "G1").

§p: f64

Real power output in MW.

§q: f64

Reactive power output in MVAr.

§qmax: f64

Maximum reactive power in MVAr.

§qmin: f64

Minimum reactive power in MVAr.

§voltage_setpoint_pu: f64

Voltage setpoint in per-unit.

§voltage_regulated: bool

Whether this generator participates in voltage regulation (PV bus). When false, the generator injects P/Q but does not control bus voltage. Default true — most generators regulate voltage.

§reg_bus: Option<u32>

Remote voltage regulated bus number (PSS/E IREG field).

§machine_base_mva: f64

Machine base MVA.

§pmax: f64

Maximum real power in MW.

§pmin: f64

Minimum real power in MW.

§in_service: bool

Generator status (true = in service).

§cost: Option<CostCurve>

Cost curve for OPF (physical cost for planning).

§gen_type: GenType

Generator electrical class.

§technology: Option<GeneratorTechnology>

Generator technology / prime mover classification.

§source_technology_code: Option<String>

Source-native technology code when available (e.g. MATPOWER gentype).

§agc_participation_factor: Option<f64>

AGC participation factor (dimensionless).

§h_inertia_s: Option<f64>

Inertia constant H in seconds (MVA·s / MVA).

§pfr_eligible: bool

Eligible to provide primary frequency response.

§quick_start: bool

Quick-start flag: can reach full output in <=10 minutes.

§forced_outage_rate: Option<f64>

Forced outage rate [0, 1].

§storage: Option<StorageParams>

Storage parameters. Present iff this generator has energy storage capability (BESS, pumped hydro in storage mode, etc.). When Some: pmin = -charge_mw_max (negative), pmax = discharge_mw_max.

§owners: Vec<OwnershipEntry>

Ownership entries (PSS/E O1,F1..O4,F4). Up to 4 co-owners.

§commitment: Option<CommitmentParams>

Unit commitment parameters.

§ramping: Option<RampingParams>

Piecewise ramp curve parameters.

§inverter: Option<InverterParams>

Inverter-specific parameters.

§fault_data: Option<GenFaultData>

Generator fault/sequence data.

§reactive_capability: Option<ReactiveCapability>

Reactive capability curve data.

§fuel: Option<FuelParams>

Fuel-related parameters.

§market: Option<MarketParams>

Market offer/qualification parameters.

Implementations§

Source§

impl Generator

Source

pub fn new(bus: u32, p: f64, voltage_setpoint_pu: f64) -> Self

Create a generator with the given bus, real power output, and voltage setpoint.

Source

pub fn with_id( id: impl Into<String>, bus: u32, p: f64, voltage_setpoint_pu: f64, ) -> Self

Create a generator with an explicit canonical ID.

Source

pub fn has_reactive_power_range(&self, tolerance_mvar: f64) -> bool

Returns true when the generator can move reactive output enough to support a voltage target.

Source

pub fn is_excluded_from_voltage_regulation(&self) -> bool

Returns true when this generator is explicitly excluded from acting as a voltage-regulating reference resource.

Source

pub fn can_voltage_regulate(&self) -> bool

Returns true when the generator should participate in AC voltage control.

Q range is intentionally NOT required here: a generator with qmin == qmax (e.g. Q pinned to a reference value for diagnostic roundtrips or fixed-Q dispatch replays) is still a legitimate voltage reference — V is the free variable at its bus, Q just happens to be fixed rather than free. Requiring has_reactive_power_range here breaks validate_for_solve whenever the per-period dispatch profile collapses Q bounds to a point (the bus then has no regulator count, slack-placement check fails, AC-OPF preflight rejects the network).

Source

pub fn ramp_up_at_mw(&self, p_mw: f64) -> Option<f64>

Interpolate ramp-up rate at a given MW operating point. Below first breakpoint -> first segment’s rate. Above last breakpoint -> last segment’s rate. Returns None if curve is empty (unlimited ramp).

Source

pub fn ramp_down_at_mw(&self, p_mw: f64) -> Option<f64>

Interpolate ramp-down rate at a given MW operating point. Falls back to ramp_up_curve if ramp_down_curve is empty.

Source

pub fn reg_ramp_up_at_mw(&self, p_mw: f64) -> Option<f64>

Interpolate regulation ramp-up rate at a given MW operating point. Falls back to ramp_up_curve if reg curve is empty.

Source

pub fn reg_ramp_down_at_mw(&self, p_mw: f64) -> Option<f64>

Interpolate regulation ramp-down rate at a given MW operating point. Falls back to ramp_down_curve, then ramp_up_curve.

Source

pub fn ramp_up_avg_mw_per_min(&self) -> Option<f64>

Weighted-average ramp-up rate over [Pmin, Pmax]. Returns None if curve is empty (unlimited ramp).

Source

pub fn ramp_down_avg_mw_per_min(&self) -> Option<f64>

Weighted-average ramp-down rate over [Pmin, Pmax]. Falls back to ramp_up_curve if ramp_down_curve is empty.

Source

pub fn ramp_up_mw_per_min(&self) -> Option<f64>

Scalar ramp-up rate (MW/min) — first segment of ramp_up_curve. Equivalent to ramp_up_at_mw(pmin). Returns None if curve is empty.

Source

pub fn ramp_down_mw_per_min(&self) -> Option<f64>

Scalar ramp-down rate (MW/min) — first segment, falls back to ramp_up.

Source

pub fn ramp_agc_mw_per_min(&self) -> Option<f64>

AGC/regulation ramp rate (MW/min) — first segment, falls back to ramp_up.

Source

pub fn is_storage(&self) -> bool

Returns true if this generator has energy storage capability.

Source

pub fn charge_mw_max(&self) -> f64

Maximum charge power (MW). Returns 0 for non-storage generators.

Source

pub fn discharge_mw_max(&self) -> f64

Maximum discharge power (MW). Alias for pmax for storage generators.

Source

pub fn is_must_run(&self) -> bool

True if this generator is must-run.

Source

pub fn reserve_offer(&self, product_id: &str) -> Option<&ReserveOffer>

Get the reserve offer for a specific product, if any.

Source

pub fn ramp_limited_mw(&self, product: &ReserveProduct) -> f64

Maximum MW deliverable within a product’s deployment window, limited by ramp rate.

Selects the appropriate ramp curve (reg/normal/emergency) based on product context.

Source

pub fn shutdown_ramp_mw_per_period(&self, dt_hours: f64) -> f64

Effective shutdown ramp capacity (MW) for one dispatch period of dt_hours.

Uses shutdown_ramp_mw_per_min when present; otherwise falls back to the economic ramp-down rate. Returns f64::MAX when no ramp curve is defined.

Source

pub fn startup_ramp_mw_per_period(&self, dt_hours: f64) -> f64

Effective startup ramp capacity (MW) for one dispatch period of dt_hours.

Uses startup_ramp_mw_per_min when present; otherwise falls back to the economic ramp-up rate. Returns f64::MAX when no ramp curve is defined.

Trait Implementations§

Source§

impl Clone for Generator

Source§

fn clone(&self) -> Generator

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Generator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Generator

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Generator

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Generator

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,