pub enum BuildError {
TwoCurrentExcitations {
first_edge: EdgeIndex,
second_edge: EdgeIndex,
graph: UnGraph<usize, Type>,
},
DeadEnd {
node: NodeIndex,
graph: UnGraph<usize, Type>,
},
ShortCircuit {
edge: EdgeIndex,
graph: UnGraph<usize, Type>,
},
NotAllEdgesConnected,
OverdefinedByCurrentSources {
edge: EdgeIndex,
graph: UnGraph<usize, Type>,
},
OverdefinedByVoltageSources {
edge: EdgeIndex,
graph: UnGraph<usize, Type>,
},
}Expand description
An error returned from a failed attempt of creating a Network from a graph.
The diagram below shows a graph which fails to represent a valid electrical circuit:
┌──┬─[1]─┬─[5]─
│ │ [2]
│ [0] │
│ │ [3]
└──┴─[4]─┘- Edge 0 is short-circuited. To fix this issue, it needs to be removed from the network.
- If both edge 2 and 4 would have a current excitation, the current flowing through the edges 2, 3 and 4 cannot be defined. To fix this issue, one of the excitations needs to be removed.
- Edge 5 is a dead end. It can simply be deleted.
Variants§
TwoCurrentExcitations
Two (or more) current excitations are defined without a “junction node” (more than two edges) in between. For example, if a node is used by only two edges and both edges have a current excitation, the current going through the edges is not unambiguous (except for the trivial case of both current excitations being equal, however in this case one of them can be omitted anyway).
Variant contains the indices of the two offending current sources and the input graph.
DeadEnd
A node is a “dead end” (has only one edge using it). Since the circuit is not closed, no current can go through this edge and it can be omitted.
Variant contains the index of the “dead end” node and the input graph.
ShortCircuit
An edge is short-circuited (source and target node are identical). In this case, the edge can be omitted.
Variant contains the index of the short-circuited edge and the input graph.
NotAllEdgesConnected
Some edges are not connected to other edges, or in other words, the graph represents two or more circuits instead of one.
OverdefinedByCurrentSources
For each edge, at least one of the possible loops containing it must not have more than one current source. Otherwise, the network cannot be solved for the general case, since some current sources are contradicting.
Example: If 0, 6 and 3 are current sources, the network is overdefined, since there is no possible loop without two current sources.
┌─[1]─┬─[2]─┐
[0] [6] [3]
└─[5]─┴─[4]─┘Variant contains the index of one current source edge which must be changed to make the graph valid as well as the input graph.
OverdefinedByVoltageSources
For each edge, all possible loops containing it must not have only voltage sources. Otherwise, the network cannot be solved for the general case, since some voltage sources are contradicting.
Example: If 0 and 1 are voltage sources, the network is overdefined, since the loop 0 -> 1 contains only voltage sources.
┌───┬───┐
[0] [1] [2]
└───┴───┘Variant contains the index of one voltage source edge which must be changed to make the graph valid as well as the input graph.
Trait Implementations§
Source§impl Clone for BuildError
impl Clone for BuildError
Source§fn clone(&self) -> BuildError
fn clone(&self) -> BuildError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BuildError
impl Debug for BuildError
Source§impl Display for BuildError
impl Display for BuildError
Source§impl Error for BuildError
impl Error for BuildError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Auto Trait Implementations§
impl Freeze for BuildError
impl RefUnwindSafe for BuildError
impl Send for BuildError
impl Sync for BuildError
impl Unpin for BuildError
impl UnwindSafe for BuildError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.