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 1 commit
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 measurementType = feederInfo.getComponentType();
Copy link
Contributor

Choose a reason for hiding this comment

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

why "measurement"? The value in feederInfo can be calculated, estimated, and the info can also be anything: a note, an icon. So in fact calling it something else than "componentType" would be misleading.


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, feederInfo.getUserDefinedId(), measurementType));
Copy link
Contributor

Choose a reason for hiding this comment

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

One minor thing also, measurementType is quite important in fact, at least mor than userDefinedId for instance, so you can put it more to the front in the arguments list.


// 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,12 +234,15 @@ public static class FeederInfoMetadata {

private final String userDefinedId;

private final String measurementType;

@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("userDefinedId") String userDefinedId, @JsonProperty("measurementType") String measurementType) {
this.id = Objects.requireNonNull(id);
this.equipmentId = Objects.requireNonNull(equipmentId);
this.side = side;
this.userDefinedId = userDefinedId;
this.measurementType = measurementType;
}

public String getId() {
Expand All @@ -257,6 +260,10 @@ public String getSide() {
public String getUserDefinedId() {
return userDefinedId;
}

public String getMeasurementType() {
return measurementType;
}
}

@JsonInclude(JsonInclude.Include.NON_NULL)
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", "user_id", "MEASUREMENT_TYPE"));
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("MEASUREMENT_TYPE", metadata2.getFeederInfoMetadata("id1").getMeasurementType());

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",
"measurementType" : "ARROW_ACTIVE"
}, {
"id" : "idtrf_95_TWO_ARROW_ACTIVE",
"equipmentId" : "trf",
"side" : "TWO"
"side" : "TWO",
"measurementType" : "ARROW_ACTIVE"
}, {
"id" : "idl_ARROW_ACTIVE",
"equipmentId" : "l"
"equipmentId" : "l",
"measurementType" : "ARROW_ACTIVE"
}, {
"id" : "idl_ARROW_REACTIVE",
"equipmentId" : "l"
"equipmentId" : "l",
"measurementType" : "ARROW_REACTIVE"
}, {
"id" : "idg_ARROW_REACTIVE",
"equipmentId" : "g"
"equipmentId" : "g",
"measurementType" : "ARROW_REACTIVE"
}, {
"id" : "idtrf_95_ONE_ARROW_ACTIVE",
"equipmentId" : "trf",
"side" : "ONE"
"side" : "ONE",
"measurementType" : "ARROW_ACTIVE"
}, {
"id" : "idtrf_95_ONE_ARROW_REACTIVE",
"equipmentId" : "trf",
"side" : "ONE"
"side" : "ONE",
"measurementType" : "ARROW_REACTIVE"
}, {
"id" : "idtrf_95_TWO_ARROW_REACTIVE",
"equipmentId" : "trf",
"side" : "TWO"
"side" : "TWO",
"measurementType" : "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",
"measurementType" : "ARROW_ACTIVE"
}, {
"id" : "idl_ARROW_REACTIVE",
"equipmentId" : "l"
"equipmentId" : "l",
"measurementType" : "ARROW_REACTIVE"
}, {
"id" : "idtrf_95_ONE_ARROW_ACTIVE",
"equipmentId" : "trf",
"side" : "ONE"
"side" : "ONE",
"measurementType" : "ARROW_ACTIVE"
}, {
"id" : "idtrf_95_ONE_ARROW_REACTIVE",
"equipmentId" : "trf",
"side" : "ONE"
"side" : "ONE",
"measurementType" : "ARROW_REACTIVE"
} ],
"electricalNodeInfos" : [ ],
"busInfos" : [ ],
Expand Down
Loading