Skip to content
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

fix: OverloadManagementSystem did not serialize to binary when a trip… #3176

Merged
merged 2 commits into from
Nov 7, 2024
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 @@ -76,6 +76,7 @@ private String readString() {
}
byte[] stringBytes = dis.readNBytes(stringNbBytes);
if (stringBytes.length != stringNbBytes) {
// this may happen when the attribute wasn't written in the first place, causing string length to be an aberrant number
throw new PowsyblException("Cannot read the full string, bytes missing: " + (stringNbBytes - stringBytes.length));
}
return new String(stringBytes, StandardCharsets.UTF_8);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ private void writeTrippingCommonAttributes(OverloadManagementSystem.Tripping tri
String nameOrKey = tripping.getNameOrKey();
if (nameOrKey != null && !nameOrKey.equals(tripping.getKey())) {
context.getWriter().writeStringAttribute("name", nameOrKey);
} else {
context.getWriter().writeStringAttribute("name", null);
}
context.getWriter().writeDoubleAttribute("currentLimit", tripping.getCurrentLimit());
context.getWriter().writeBooleanAttribute("openAction", tripping.isOpenAction());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,12 @@ private static Network createNetwork() {
.setOpenAction(true)
.setSwitchToOperateId("S1_400_LINE_2_BREAKER")
.add()
.newSwitchTripping()
.setKey("trippingWithNoName")
.setCurrentLimit(800)
.setOpenAction(true)
.setSwitchToOperateId("S1_400_LINE_2_BREAKER")
.add()
.add();

// Create an overload management system monitoring "LINE_1" with a tripping on "LINE_2".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<iidm:branchTripping key="tripping1" name="1st tripping name" currentLimit="1200.0" openAction="true" branchId="2WT" side="ONE"/>
<iidm:threeWindingsTransformerTripping key="tripping2" name="2nd tripping name" currentLimit="1000.0" openAction="false" threeWindingsTransformerId="3WT" side="ONE"/>
<iidm:switchTripping key="tripping3" name="3rd tripping name" currentLimit="1000.0" openAction="true" switchId="S1_400_LINE_2_BREAKER"/>
<iidm:switchTripping key="trippingWithNoName" currentLimit="800.0" openAction="true" switchId="S1_400_LINE_2_BREAKER"/>
</iidm:overloadManagementSystem>
<iidm:overloadManagementSystem id="OMS2" name="2nd OMS" enabled="true" monitoredElementId="LINE_1" side="ONE">
<iidm:branchTripping key="tripping" name="tripping name" currentLimit="1300.0" openAction="true" branchId="LINE_2" side="ONE"/>
Expand Down