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
impl ContingencySet
Sourcepub fn expand(
&self,
net: &BalancedNetwork,
subsystems: &SubsystemSet,
) -> Expanded
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.
Sourcepub fn expand_with(
&self,
index: &PsseEquipmentIndex<'_>,
subsystems: &SubsystemSet,
) -> Expanded
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
impl ContingencySet
Sourcepub fn resolve(&self, net: &BalancedNetwork) -> ContingencyResolution
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.
Sourcepub fn resolve_with(
&self,
index: &PsseEquipmentIndex<'_>,
) -> ContingencyResolution
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
impl ContingencySet
Sourcepub fn parse(text: &str) -> Result<ContingencyParsed>
pub fn parse(text: &str) -> Result<ContingencyParsed>
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.
Sourcepub fn to_con(&self) -> String
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
impl Clone for ContingencySet
Source§fn clone(&self) -> ContingencySet
fn clone(&self) -> ContingencySet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ContingencySet
impl Debug for ContingencySet
Source§impl Default for ContingencySet
impl Default for ContingencySet
Source§fn default() -> ContingencySet
fn default() -> ContingencySet
Source§impl<'de> Deserialize<'de> for ContingencySet
impl<'de> Deserialize<'de> for ContingencySet
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for ContingencySet
impl JsonSchema for ContingencySet
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for ContingencySet
impl PartialEq for ContingencySet
Source§fn eq(&self, other: &ContingencySet) -> bool
fn eq(&self, other: &ContingencySet) -> bool
self and other values to be equal, and is used by ==.