pub struct ComponentGraph<N, E>{ /* private fields */ }Expand description
A graph representation of the electrical components of a microgrid and the connections between them.
Implementations§
Source§impl<N, E> ComponentGraph<N, E>
ComponentGraph instantiation.
impl<N, E> ComponentGraph<N, E>
ComponentGraph instantiation.
Sourcepub fn try_new<NodeIterator: IntoIterator<Item = N>, EdgeIterator: IntoIterator<Item = E>>(
components: NodeIterator,
connections: EdgeIterator,
config: ComponentGraphConfig,
) -> Result<Self, Error>
pub fn try_new<NodeIterator: IntoIterator<Item = N>, EdgeIterator: IntoIterator<Item = E>>( components: NodeIterator, connections: EdgeIterator, config: ComponentGraphConfig, ) -> Result<Self, Error>
Creates a new ComponentGraph from the given components and connections.
Returns an error if the graph is invalid.
Source§impl<N, E> ComponentGraph<N, E>
Meter role identification.
impl<N, E> ComponentGraph<N, E>
Meter role identification.
Sourcepub fn is_pv_meter(&self, component_id: u64) -> Result<bool, Error>
pub fn is_pv_meter(&self, component_id: u64) -> Result<bool, Error>
Returns true if the node is a PV meter.
A meter is identified as a PV meter if:
- it has atleast one successor,
- all its successors are PV inverters.
Sourcepub fn is_battery_meter(&self, component_id: u64) -> Result<bool, Error>
pub fn is_battery_meter(&self, component_id: u64) -> Result<bool, Error>
Returns true if the node is a battery meter.
A meter is identified as a battery meter if
- it has atleast one successor,
- all its successors are battery inverters.
Sourcepub fn is_ev_charger_meter(&self, component_id: u64) -> Result<bool, Error>
pub fn is_ev_charger_meter(&self, component_id: u64) -> Result<bool, Error>
Returns true if the node is an EV charger meter.
A meter is identified as an EV charger meter if
- it has atleast one successor,
- all its successors are EV chargers.
Source§impl<N, E> ComponentGraph<N, E>
Component and Connection retrieval.
impl<N, E> ComponentGraph<N, E>
Component and Connection retrieval.
Sourcepub fn component(&self, component_id: u64) -> Result<&N, Error>
pub fn component(&self, component_id: u64) -> Result<&N, Error>
Returns the component with the given component_id, if it exists.
Sourcepub fn components(&self) -> Components<'_, N> ⓘ
pub fn components(&self) -> Components<'_, N> ⓘ
Returns an iterator over the components in the graph.
Sourcepub fn connections(&self) -> Connections<'_, N, E> ⓘ
pub fn connections(&self) -> Connections<'_, N, E> ⓘ
Returns an iterator over the connections in the graph.
Source§impl<N, E> ComponentGraph<N, E>
Formulas for various microgrid metrics.
impl<N, E> ComponentGraph<N, E>
Formulas for various microgrid metrics.
Sourcepub fn consumer_formula(&self) -> Result<AggregationFormula, Error>
pub fn consumer_formula(&self) -> Result<AggregationFormula, Error>
Returns the consumer formula for the graph.
Sourcepub fn grid_formula(&self) -> Result<AggregationFormula, Error>
pub fn grid_formula(&self) -> Result<AggregationFormula, Error>
Returns the grid formula for the graph.
Sourcepub fn producer_formula(&self) -> Result<AggregationFormula, Error>
pub fn producer_formula(&self) -> Result<AggregationFormula, Error>
Returns the producer formula for the graph.
Sourcepub fn battery_formula(
&self,
battery_ids: Option<BTreeSet<u64>>,
) -> Result<AggregationFormula, Error>
pub fn battery_formula( &self, battery_ids: Option<BTreeSet<u64>>, ) -> Result<AggregationFormula, Error>
Returns the battery formula with the given battery IDs.
If battery_ids is None, the formula will contain all batteries in
the graph.
Sourcepub fn chp_formula(
&self,
chp_ids: Option<BTreeSet<u64>>,
) -> Result<AggregationFormula, Error>
pub fn chp_formula( &self, chp_ids: Option<BTreeSet<u64>>, ) -> Result<AggregationFormula, Error>
Returns the CHP formula for the graph.
Sourcepub fn pv_formula(
&self,
pv_inverter_ids: Option<BTreeSet<u64>>,
) -> Result<AggregationFormula, Error>
pub fn pv_formula( &self, pv_inverter_ids: Option<BTreeSet<u64>>, ) -> Result<AggregationFormula, Error>
Returns the PV formula for the graph.
Sourcepub fn ev_charger_formula(
&self,
ev_charger_ids: Option<BTreeSet<u64>>,
) -> Result<AggregationFormula, Error>
pub fn ev_charger_formula( &self, ev_charger_ids: Option<BTreeSet<u64>>, ) -> Result<AggregationFormula, Error>
Returns the EV charger formula for the graph.
Sourcepub fn component_formula(
&self,
component_id: u64,
) -> Result<AggregationFormula, Error>
pub fn component_formula( &self, component_id: u64, ) -> Result<AggregationFormula, Error>
Returns the formula for a specific component by its ID.
Sourcepub fn grid_coalesce_formula(&self) -> Result<CoalesceFormula, Error>
pub fn grid_coalesce_formula(&self) -> Result<CoalesceFormula, Error>
Returns the grid coalesce formula for the graph.
This formula is used for non-aggregating metrics like AC voltage or frequency.
The formula is a COALESCE expression that includes all meters,
PV inverters, and battery inverters that are directly connected to the
grid.
Sourcepub fn battery_ac_coalesce_formula(
&self,
battery_ids: Option<BTreeSet<u64>>,
) -> Result<CoalesceFormula, Error>
pub fn battery_ac_coalesce_formula( &self, battery_ids: Option<BTreeSet<u64>>, ) -> Result<CoalesceFormula, Error>
Returns the battery AC coalesce formula for the given components.
This formula is used for non-aggregating metrics like AC voltage or frequency.
The formula is a COALESCE expression that includes all the specified
battery meters and corresponding inverters.
When the battery_ids parameter is None, it will include all the
battery meters and inverters in the graph.
Sourcepub fn pv_ac_coalesce_formula(
&self,
pv_inverter_ids: Option<BTreeSet<u64>>,
) -> Result<CoalesceFormula, Error>
pub fn pv_ac_coalesce_formula( &self, pv_inverter_ids: Option<BTreeSet<u64>>, ) -> Result<CoalesceFormula, Error>
Returns the PV AC coalesce formula for the given components.
This formula is used for non-aggregating metrics like AC voltage or frequency.
The formula is a COALESCE expression that includes all the specified
PV meters and corresponding inverters.
When the pv_inverter_ids parameter is None, it will include all the
PV meters and inverters in the graph.
Sourcepub fn component_ac_coalesce_formula(
&self,
component_id: u64,
) -> Result<CoalesceFormula, Error>
pub fn component_ac_coalesce_formula( &self, component_id: u64, ) -> Result<CoalesceFormula, Error>
Returns the AC coalesce formula for a specific component by its ID.
Trait Implementations§
Source§impl<N, E> Clone for ComponentGraph<N, E>
Implement Clone for ComponentGraph when the Nodes and Edges
implement Clone.
impl<N, E> Clone for ComponentGraph<N, E>
Implement Clone for ComponentGraph when the Nodes and Edges
implement Clone.