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

add field in feederinfo metadata #484

Merged
merged 6 commits into from
Jan 30, 2023
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 @@ -870,9 +870,10 @@ private void drawFeederInfo(String prefixId, FeederNode feederNode, List<Point>

String svgId = escapeId(feederNode.getId()) + "_" + feederInfo.getComponentType();
g.setAttribute("id", svgId);
String componentType = feederInfo.getComponentType();

String side = feederNode.getFeeder() instanceof FeederWithSides ? ((FeederWithSides) feederNode.getFeeder()).getSide().name() : null;
metadata.addFeederInfoMetadata(new FeederInfoMetadata(svgId, feederNode.getEquipmentId(), side, feederInfo.getUserDefinedId()));
metadata.addFeederInfoMetadata(new FeederInfoMetadata(svgId, feederNode.getEquipmentId(), side, componentType, feederInfo.getUserDefinedId()));

// we draw the feeder info
double rotationAngle = points.get(0).getY() > points.get(1).getY() ? 180 : 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,14 @@ public static class FeederInfoMetadata {

private final String userDefinedId;

private final String componentType;

@JsonCreator
public FeederInfoMetadata(@JsonProperty("id") String id, @JsonProperty("equipmentId") String equipmentId, @JsonProperty("side") String side, @JsonProperty("userDefinedId") String userDefinedId) {
public FeederInfoMetadata(@JsonProperty("id") String id, @JsonProperty("equipmentId") String equipmentId, @JsonProperty("side") String side, @JsonProperty("componentType") String componentType, @JsonProperty("userDefinedId") String userDefinedId) {
this.id = Objects.requireNonNull(id);
this.equipmentId = Objects.requireNonNull(equipmentId);
this.side = side;
this.componentType = componentType;
this.userDefinedId = userDefinedId;
}

Expand All @@ -254,6 +257,10 @@ public String getSide() {
return side;
}

public String getComponentType() {
return componentType;
}

public String getUserDefinedId() {
return userDefinedId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void test() throws IOException {
metadata.addNodeMetadata(new GraphMetadata.NodeMetadata("id1", "vid1", null, BREAKER, false, Direction.UNDEFINED, false, null, labels));
metadata.addNodeMetadata(new GraphMetadata.NodeMetadata("id2", "vid2", null, BUSBAR_SECTION, false, Direction.UNDEFINED, false, null, labels));
metadata.addWireMetadata(new GraphMetadata.WireMetadata("id3", "id1", "id2", false, false));
metadata.addFeederInfoMetadata(new GraphMetadata.FeederInfoMetadata("id1", "id3", "ONE", "user_id"));
metadata.addFeederInfoMetadata(new GraphMetadata.FeederInfoMetadata("id1", "id3", "ONE", "COMPONENT_TYPE", "user_id"));
metadata.addElectricalNodeInfoMetadata(new GraphMetadata.ElectricalNodeInfoMetadata("id1", "user_id"));
metadata.addBusInfoMetadata(new GraphMetadata.BusInfoMetadata("id6", "busNodeId1", "user_id"));

Expand Down Expand Up @@ -106,6 +106,7 @@ public void test() throws IOException {
assertEquals("id3", metadata2.getFeederInfoMetadata("id1").getEquipmentId());
assertEquals("ONE", metadata2.getFeederInfoMetadata("id1").getSide());
assertEquals("user_id", metadata2.getFeederInfoMetadata("id1").getUserDefinedId());
assertEquals("COMPONENT_TYPE", metadata2.getFeederInfoMetadata("id1").getComponentType());

assertNotNull(metadata2.getElectricalNodeInfoMetadata("id1"));
assertEquals("user_id", metadata2.getElectricalNodeInfoMetadata("id1").getUserDefinedId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,32 +498,40 @@
"lines" : [ ],
"feederInfos" : [ {
"id" : "idg_ARROW_ACTIVE",
"equipmentId" : "g"
"equipmentId" : "g",
"componentType" : "ARROW_ACTIVE"
}, {
"id" : "idtrf_95_TWO_ARROW_ACTIVE",
"equipmentId" : "trf",
"side" : "TWO"
"side" : "TWO",
"componentType" : "ARROW_ACTIVE"
}, {
"id" : "idl_ARROW_ACTIVE",
"equipmentId" : "l"
"equipmentId" : "l",
"componentType" : "ARROW_ACTIVE"
}, {
"id" : "idl_ARROW_REACTIVE",
"equipmentId" : "l"
"equipmentId" : "l",
"componentType" : "ARROW_REACTIVE"
}, {
"id" : "idg_ARROW_REACTIVE",
"equipmentId" : "g"
"equipmentId" : "g",
"componentType" : "ARROW_REACTIVE"
}, {
"id" : "idtrf_95_ONE_ARROW_ACTIVE",
"equipmentId" : "trf",
"side" : "ONE"
"side" : "ONE",
"componentType" : "ARROW_ACTIVE"
}, {
"id" : "idtrf_95_ONE_ARROW_REACTIVE",
"equipmentId" : "trf",
"side" : "ONE"
"side" : "ONE",
"componentType" : "ARROW_REACTIVE"
}, {
"id" : "idtrf_95_TWO_ARROW_REACTIVE",
"equipmentId" : "trf",
"side" : "TWO"
"side" : "TWO",
"componentType" : "ARROW_REACTIVE"
} ],
"electricalNodeInfos" : [ ],
"busInfos" : [ ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,18 +275,22 @@
"lines" : [ ],
"feederInfos" : [ {
"id" : "idl_ARROW_ACTIVE",
"equipmentId" : "l"
"equipmentId" : "l",
"componentType" : "ARROW_ACTIVE"
}, {
"id" : "idl_ARROW_REACTIVE",
"equipmentId" : "l"
"equipmentId" : "l",
"componentType" : "ARROW_REACTIVE"
}, {
"id" : "idtrf_95_ONE_ARROW_ACTIVE",
"equipmentId" : "trf",
"side" : "ONE"
"side" : "ONE",
"componentType" : "ARROW_ACTIVE"
}, {
"id" : "idtrf_95_ONE_ARROW_REACTIVE",
"equipmentId" : "trf",
"side" : "ONE"
"side" : "ONE",
"componentType" : "ARROW_REACTIVE"
} ],
"electricalNodeInfos" : [ ],
"busInfos" : [ ],
Expand Down
Loading