Skip to main content

ContingencySet

Struct ContingencySet 

Source
pub struct ContingencySet {
    pub header: Vec<String>,
    pub cases: Vec<ContingencyCase>,
    pub automatic: Vec<AutomaticSpec>,
    pub skips: Vec<SkipRule>,
    pub retained: Vec<RetainedStatement>,
}
Expand description

One contingency description file.

Fields§

§header: Vec<String>

Comment lines ahead of the first statement, as written. PSS/E leads a generated file with its /PSS(R)E stamp and a COM banner.

§cases: Vec<ContingencyCase>

Named cases, in file order.

§automatic: Vec<AutomaticSpec>

Specifications that expand into cases against a named subsystem.

§skips: Vec<SkipRule>

Branches excluded from automatic expansion.

§retained: Vec<RetainedStatement>

File level statements outside the grammar, kept as their trimmed line.

Implementations§

Source§

impl ContingencySet

Source

pub fn expand( &self, net: &BalancedNetwork, subsystems: &SubsystemSet, ) -> Expanded

Expand every automatic specification against net and subsystems.

The expanded set keeps the header and the statements kept as text, puts the explicit cases first and the generated cases after them, and holds no automatic specification that expanded. A specification naming a subsystem subsystems does not state stays in ContingencySet::automatic and earns a BUILD.CON.SUBSYSTEM_UNKNOWN note; the SKIP rules stay with it, because it still needs them. A specification whose subsystem holds fewer elements it names than its order needs expands into no case and earns a BUILD.CON.SPECIFICATION_EMPTY note whose message states both counts. A DOUBLE specification therefore needs two eligible elements, because its cases are the unordered pairs of them.

Only elements the network states in service expand into cases, because outaging an element already out of service changes nothing.

Source

pub fn expand_with( &self, index: &PsseEquipmentIndex<'_>, subsystems: &SubsystemSet, ) -> Expanded

ContingencySet::expand against an index built once, for a caller expanding several sets over one network.

The network is the one the index borrows, so the rows it reads always index that network’s tables.

Source§

impl ContingencySet

Source

pub fn resolve(&self, net: &BalancedNetwork) -> ContingencyResolution

Bind every case to the elements of net, building the equipment index once.

Resolution reports rather than refuses: an action that names no element is kept with its reason and the case is counted unresolved, while the actions of that case that did bind stay listed.

An element the network already states out of service binds like any other, with in_service false, because outaging it changes nothing. A case with no actions resolves to no components.

Source

pub fn resolve_with( &self, index: &PsseEquipmentIndex<'_>, ) -> ContingencyResolution

ContingencySet::resolve against an index built once, for a caller resolving several sets against one network.

The network is the one the index borrows, so the rows it states always index that network’s tables.

Source§

impl ContingencySet

Source

pub fn parse(text: &str) -> Result<ContingencyParsed, Error>

Read a .con file from UTF-8 text. Keywords are case insensitive.

A statement the grammar does not cover keeps its line, with surrounding whitespace dropped, in ContingencyAction::Unrecognized inside a case or in ContingencySet::retained at file level, and is reported. A statement naming a value that no written line states, one holding both ' and ", is kept the same way. Lines after a file level END are also kept as text, marked RetainedStatement::after_end, and reported once.

§Errors

Error::FormatRead when a CONTINGENCY starts before the previous case reached END, or when a case, a SKIP block, or a dispatch block is still open at end of input. The message names the 1-based line.

Source

pub fn to_con(&self) -> String

Write the set as .con text: the header lines as written, the automatic specifications, one SKIP block, the cases in order, the file level statements kept as text, a final END, and then the statements read after the file END. Every line ends with a newline.

Reading the result back gives the same set, except that a statement kept from the middle of a file is written after the cases and so reads back from a different line. Writing that second set gives the same text.

Trait Implementations§

Source§

impl Clone for ContingencySet

Source§

fn clone(&self) -> ContingencySet

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ContingencySet

Source§

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

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

impl Default for ContingencySet

Source§

fn default() -> ContingencySet

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

impl<'de> Deserialize<'de> for ContingencySet

Source§

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

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

impl From<ContingencySet> for PioValue

Source§

fn from(value: ContingencySet) -> Self

Converts to this type from the input type.
Source§

impl JsonSchema for ContingencySet

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for ContingencySet

Source§

fn eq(&self, other: &ContingencySet) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ContingencySet

Source§

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
Source§

impl StructuralPartialEq for ContingencySet

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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
§

impl<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

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

§

fn vzip(self) -> V