#[non_exhaustive]pub struct GenCost {
pub model: u8,
pub startup: f64,
pub shutdown: f64,
pub ncost: usize,
pub coeffs: Vec<f64>,
}Expand description
A generator cost curve (mpc.gencost row).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.model: u81 = piecewise linear, 2 = polynomial.
startup: f64§shutdown: f64§ncost: usizeNumber of cost coefficients (polynomial) or breakpoints (piecewise).
coeffs: Vec<f64>Raw coefficients, highest order first for the polynomial model:
[c_{k-1}, …, c1, c0].
Implementations§
Source§impl GenCost
impl GenCost
Sourcepub fn new(model: u8, startup: f64, shutdown: f64, coeffs: Vec<f64>) -> GenCost
pub fn new(model: u8, startup: f64, shutdown: f64, coeffs: Vec<f64>) -> GenCost
Build a cost row from the values carried after ncost.
Polynomial rows (model == 2) store ncost coefficients. Piecewise
linear rows (model == 1) store flattened (x, y) breakpoint pairs, so
ncost is half the coefficient count. Use GenCost::with_ncost for
malformed source rows or callers that need to preserve an explicit
ncost.
pub fn with_ncost( model: u8, startup: f64, shutdown: f64, ncost: usize, coeffs: Vec<f64>, ) -> GenCost
Trait Implementations§
Source§impl<'de> Deserialize<'de> for GenCost
impl<'de> Deserialize<'de> for GenCost
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<GenCost, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<GenCost, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for GenCost
impl Serialize for GenCost
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for GenCost
impl RefUnwindSafe for GenCost
impl Send for GenCost
impl Sync for GenCost
impl Unpin for GenCost
impl UnsafeUnpin for GenCost
impl UnwindSafe for GenCost
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more