Skip to main content

LoadCostModel

Enum LoadCostModel 

Source
pub enum LoadCostModel {
    LinearCurtailment {
        cost_per_mw: f64,
    },
    QuadraticUtility {
        a: f64,
        b: f64,
    },
    PiecewiseLinear {
        points: Vec<(f64, f64)>,
    },
    InterruptPenalty {
        cost_per_mw: f64,
    },
}
Expand description

Cost / benefit model governing the OPF objective contribution.

Variants§

§

LinearCurtailment

Linear curtailment cost: c * (P_sched - P_served) [$/MWh].

Represents the Value of Lost Load (VOLL) or interruptible contract price. OPF will curtail when LMP > c (curtailment is cheaper than serving the load). Objective contribution to minimise: c * (p_sched - P_served). Gradient d_obj/d_P_served = -c (serving more load reduces curtailment cost).

Fields

§cost_per_mw: f64

Curtailment cost in $/MWh (Value of Lost Load or contract price).

§

QuadraticUtility

Quadratic utility / welfare: U(P) = a*P - b*P²/2.

The marginal utility is MU(P) = a - b*P (linear demand curve). OPF minimises -U(P) (equivalently, maximises utility minus cost). At equilibrium: MU(P_served) = LMP (price equals marginal value).

OPF objective contribution (to minimise): -(a*P - b*P²/2). Gradient d_obj/d_P = -(a - b*P) = b*P - a. Second derivative (for Hessian): b (positive = convex minimisation).

Fields

§a: f64

Choke price in $/MWh (marginal utility at P = 0).

§b: f64

Slope of marginal utility curve in $/MW²h (demand curve steepness).

§

PiecewiseLinear

Piecewise-linear utility: list of (P_breakpoint_MW, marginal_utility_$/MWh) pairs.

Breakpoints must be sorted by P in ascending order. The utility between adjacent breakpoints is the integral of the linear interpolated MU. Compatible with LP formulation (no quadratic terms).

Fields

§points: Vec<(f64, f64)>

Breakpoints: (P_MW, marginal_utility_$/MWh). Must be sorted by P.

§

InterruptPenalty

Fixed penalty for any curtailment (interruptible contract).

Similar to LinearCurtailment but semantically represents a per-event interrupt payment rather than a value-of-lost-load. Objective: c * (P_sched - P_served).

Fields

§cost_per_mw: f64

Payment to load owner per MW curtailed per hour [$/MWh].

Implementations§

Source§

impl LoadCostModel

Source

pub fn objective_contribution( &self, p_served_pu: f64, p_sched_pu: f64, base_mva: f64, ) -> f64

Evaluate cost contribution to OPF objective (to minimise).

For utility models, returns the negative utility (minimising negative utility maximises social welfare). For cost models, returns the positive curtailment cost.

p_served and p_sched are both in per-unit (positive = consuming). Returns $/hr (consistent with generator cost units in the OPF).

Source

pub fn d_obj_d_p(&self, p_served_pu: f64, base_mva: f64) -> f64

Gradient of objective contribution w.r.t. p_served_pu.

Used in gradient evaluation (AC-OPF objective gradient). Units: $/hr / (pu) = $/hr * base_mva / MW.

Source

pub fn d2_obj_d_p2(&self, base_mva: f64) -> f64

Second derivative of objective w.r.t. p_served_pu (for Hessian).

Non-zero only for LoadCostModel::QuadraticUtility: b * base_mva². All other models have zero second derivative (linear in P_served).

Source

pub fn has_quadratic_term(&self) -> bool

Whether this cost model contributes a nonzero quadratic (Hessian) term.

Source

pub fn dc_linear_obj_coeff(&self, base_mva: f64) -> f64

Linear objective coefficient for DC-OPF (LP/QP).

For LP-compatible models (LinearCurtailment, InterruptPenalty): returns -cost_per_mw * base_mva (coefficient on P_served_pu in objective).

For QP models (QuadraticUtility): returns the linear coefficient -a * base_mva. The quadratic term must be added to the Hessian separately.

For PiecewiseLinear: returns 0.0 (pwl epiograph constraints handle it).

Source

pub fn dc_quadratic_obj_coeff(&self, base_mva: f64) -> f64

Quadratic diagonal coefficient for DC-OPF (QP Hessian).

For LoadCostModel::QuadraticUtility: b * base_mva² (full quadratic coefficient, HiGHS applies 0.5× internally for the symmetric ½ x’Hx convention).

Trait Implementations§

Source§

impl Clone for LoadCostModel

Source§

fn clone(&self) -> LoadCostModel

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 LoadCostModel

Source§

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

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

impl<'de> Deserialize<'de> for LoadCostModel

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 LoadCostModel

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>,