Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void setEdgeWeightQuantity(
* ComparableQuantity)} instead, as it provides means for proper unit handling
*/
@Override
@Deprecated
@Deprecated(since = ("Deprecated since 2.1.0. See Javadocs for more information."))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UnnecessaryParentheses: These grouping parentheses are unnecessary; it is unlikely the code will be misinterpreted without them (details)
(at-me in a reply with help or ignore)

public void setEdgeWeight(ImpedanceWeightedEdge edge, double impedanceInOhm) {
super.setEdgeWeight(edge, impedanceInOhm);
}
Expand Down
17 changes: 6 additions & 11 deletions src/main/java/edu/ie3/datamodel/utils/ContainerUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,29 +222,24 @@ private static void addImpedanceGraphEdge(
NodeInput nodeA = connectorInput.getNodeA();
NodeInput nodeB = connectorInput.getNodeB();
/* Add an edge if it is not a switch or the switch is closed */
if (!(connectorInput instanceof SwitchInput) || ((SwitchInput) connectorInput).isClosed())
if (!(connectorInput instanceof SwitchInput sw) || ((SwitchInput) connectorInput).isClosed())
graph.addEdge(nodeA, nodeB);

if (connectorInput instanceof LineInput) {
LineInput line = (LineInput) connectorInput;
if (connectorInput instanceof LineInput line) {
graph.setEdgeWeightQuantity(
graph.getEdge(nodeA, nodeB),
calcImpedance(line.getType().getR(), line.getType().getX(), line.getLength()));
}
if (connectorInput instanceof SwitchInput) {
SwitchInput sw = (SwitchInput) connectorInput;
if (connectorInput instanceof SwitchInput sw && sw.isClosed()) {
// assumption: closed switch has a resistance of 1 OHM
if (sw.isClosed())
graph.setEdgeWeightQuantity(graph.getEdge(nodeA, nodeB), Quantities.getQuantity(1d, OHM));
graph.setEdgeWeightQuantity(graph.getEdge(nodeA, nodeB), Quantities.getQuantity(1d, OHM));
}
if (connectorInput instanceof Transformer2WInput) {
Transformer2WInput trafo2w = (Transformer2WInput) connectorInput;
if (connectorInput instanceof Transformer2WInput trafo2w) {
graph.setEdgeWeightQuantity(
graph.getEdge(nodeA, nodeB),
calcImpedance(trafo2w.getType().getrSc(), trafo2w.getType().getxSc()));
}
if (connectorInput instanceof Transformer3WInput) {
Transformer3WInput trafo3w = (Transformer3WInput) connectorInput;
if (connectorInput instanceof Transformer3WInput trafo3w) {
graph.addEdge(nodeA, trafo3w.getNodeC());

graph.setEdgeWeightQuantity(
Expand Down