-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add notification when move connectable #461
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* Copyright (c) 2024, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package com.powsybl.network.store.iidm.impl; | ||
|
||
import com.powsybl.iidm.network.BusTopologyPoint; | ||
import com.powsybl.iidm.network.TopologyKind; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* @author Slimane Amar <slimane.amar at rte-france.com> | ||
*/ | ||
public class BusTopologyPointImpl implements BusTopologyPoint { | ||
|
||
private final String voltageLevelId; | ||
|
||
private final String connectableBusId; | ||
|
||
private final boolean connected; | ||
|
||
public BusTopologyPointImpl(String voltageLevelId, String connectableBusId, boolean connected) { | ||
this.voltageLevelId = Objects.requireNonNull(voltageLevelId); | ||
this.connectableBusId = Objects.requireNonNull(connectableBusId); | ||
this.connected = connected; | ||
} | ||
|
||
@Override | ||
public TopologyKind getTopologyKind() { | ||
return TopologyKind.BUS_BREAKER; | ||
} | ||
|
||
@Override | ||
public String getVoltageLevelId() { | ||
return voltageLevelId; | ||
} | ||
|
||
@Override | ||
public String getConnectableBusId() { | ||
return connectableBusId; | ||
} | ||
|
||
@Override | ||
public boolean isConnected() { | ||
return connected; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "NodeTopologyPoint(" + | ||
"voltageLevelId='" + voltageLevelId + '\'' + | ||
", connectableBusId='" + connectableBusId + '\'' + | ||
", connected=" + connected + | ||
')'; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* Copyright (c) 2024, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package com.powsybl.network.store.iidm.impl; | ||
|
||
import com.powsybl.iidm.network.NodeTopologyPoint; | ||
import com.powsybl.iidm.network.TopologyKind; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* @author Slimane Amar <slimane.amar at rte-france.com> | ||
*/ | ||
public class NodeTopologyPointImpl implements NodeTopologyPoint { | ||
|
||
private final String voltageLevelId; | ||
|
||
private final int node; | ||
|
||
public NodeTopologyPointImpl(String voltageLevelId, int node) { | ||
this.voltageLevelId = Objects.requireNonNull(voltageLevelId); | ||
this.node = node; | ||
} | ||
|
||
@Override | ||
public TopologyKind getTopologyKind() { | ||
return TopologyKind.NODE_BREAKER; | ||
} | ||
|
||
@Override | ||
public String getVoltageLevelId() { | ||
return voltageLevelId; | ||
} | ||
|
||
@Override | ||
public int getNode() { | ||
return node; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "NodeTopologyPoint(" + | ||
"voltageLevelId='" + voltageLevelId + '\'' + | ||
", node=" + node + | ||
')'; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,8 +42,22 @@ public TerminalImpl(NetworkObjectIndex index, Connectable<?> connectable, Functi | |
this.index = index; | ||
this.connectable = connectable; | ||
this.attributesGetter = attributesGetter; | ||
nodeBreakerView = new TerminalNodeBreakerViewImpl<>(index, connectable, attributesGetter); | ||
busBreakerView = new TerminalBusBreakerViewImpl<>(index, connectable, attributesGetter); | ||
nodeBreakerView = new TerminalNodeBreakerViewImpl<>(index, connectable, attributesGetter) { | ||
@Override | ||
public void moveConnectable(int node, String voltageLevelId) { | ||
TopologyPoint oldTopologyPoint = TerminalImpl.this.getTopologyPoint(); | ||
super.moveConnectable(node, voltageLevelId); | ||
index.notifyUpdate(connectable, "moveConnectable", oldTopologyPoint, TerminalImpl.this.getTopologyPoint()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. attribute name "moveConnectable" is not the same as the one in powsybl-core ... (where it is : "terminal" + side) notifyUpdate("terminal" + (iSide + 1), oldTopologyPoint, terminalExt.getTopologyPoint()); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
} | ||
}; | ||
busBreakerView = new TerminalBusBreakerViewImpl<>(index, connectable, attributesGetter) { | ||
@Override | ||
public void moveConnectable(String busId, boolean connected) { | ||
TopologyPoint oldTopologyPoint = TerminalImpl.this.getTopologyPoint(); | ||
super.moveConnectable(busId, connected); | ||
index.notifyUpdate(connectable, "moveConnectable", oldTopologyPoint, TerminalImpl.this.getTopologyPoint()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
} | ||
}; | ||
busView = new TerminalBusViewImpl<>(index, connectable, attributesGetter); | ||
} | ||
|
||
|
@@ -55,8 +69,8 @@ protected boolean isNodeBeakerTopologyKind() { | |
return getTopologyKind() == TopologyKind.NODE_BREAKER; | ||
} | ||
|
||
private boolean isBusBeakerTopologyKind() { | ||
return getTopologyKind() == TopologyKind.BUS_BREAKER; | ||
private TopologyPoint getTopologyPoint() { | ||
return isNodeBeakerTopologyKind() ? new NodeTopologyPointImpl(getAttributes().getVoltageLevelId(), getNodeBreakerView().getNode()) : new BusTopologyPointImpl(getAttributes().getVoltageLevelId(), getBusBreakerView().getConnectableBus().getId(), isConnected()); | ||
} | ||
|
||
@Override | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BusTopologyPoint (same error in powsybl-core ...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done