-
Notifications
You must be signed in to change notification settings - Fork 0
add detail attachment point for line attached to vl modification #128
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
Conversation
Signed-off-by: Etienne LESOT <[email protected]>
Signed-off-by: Etienne LESOT <[email protected]>
Signed-off-by: Etienne LESOT <[email protected]>
Mathieu-Deharbe
left a comment
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.
Code OK, test OK.
Only optional small remarks.
| // override voltage level | ||
| VoltageLevel voltageLevel = network.getVoltageLevel(modificationInfos.getAttachmentPointId()); | ||
| if (modificationInfos.getAttachmentPointDetailInformation().getHighVoltageLimit() != null) { | ||
| voltageLevel.setHighVoltageLimit(modificationInfos.getAttachmentPointDetailInformation().getHighVoltageLimit()); | ||
| } | ||
| if (modificationInfos.getAttachmentPointDetailInformation().getLowVoltageLimit() != null) { | ||
| voltageLevel.setLowVoltageLimit(modificationInfos.getAttachmentPointDetailInformation().getLowVoltageLimit()); | ||
| } | ||
| if (modificationInfos.getAttachmentPointDetailInformation().getIpMax() != null || modificationInfos.getAttachmentPointDetailInformation().getIpMin() != null) { | ||
| IdentifiableShortCircuitAdder<VoltageLevel> adder = voltageLevel.newExtension(IdentifiableShortCircuitAdder.class); | ||
| if (modificationInfos.getAttachmentPointDetailInformation().getIpMax() != null) { | ||
| adder.withIpMax(modificationInfos.getAttachmentPointDetailInformation().getIpMax()); | ||
| } | ||
| if (modificationInfos.getAttachmentPointDetailInformation().getIpMin() != null) { | ||
| adder.withIpMin(modificationInfos.getAttachmentPointDetailInformation().getIpMin()); | ||
| } | ||
| adder.add(); | ||
| } | ||
| PropertiesUtils.applyProperties(voltageLevel, modificationInfos.getAttachmentPointDetailInformation().getProperties()); | ||
| // override substation | ||
| SubstationCreationInfos substationCreationInfos = modificationInfos.getAttachmentPointDetailInformation().getSubstationCreation(); | ||
| final Substation substation = network.getSubstation(substationCreationInfos.getEquipmentId()); | ||
| if (substationCreationInfos.getEquipmentName() != null) { | ||
| substation.setName(substationCreationInfos.getEquipmentName()); | ||
| } | ||
| if (substationCreationInfos.getCountry() != null) { | ||
| substation.setCountry(substationCreationInfos.getCountry()); | ||
| } | ||
| PropertiesUtils.applyProperties(substation, substationCreationInfos.getProperties()); |
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.
All that part could be extracted to a function taking modificationInfos.getAttachmentPointDetailInformation() as a VoltageLevelCreationInfos parameter.
(I say this to please please sonar but technically this is a separate modification so it kind of make sense)
A bit like this :
private void updateAttachmentVoltageLevel(Network network, @NotNull VoltageLevelCreationInfos attachmentPointDetailInformation) {
VoltageLevel voltageLevel = network.getVoltageLevel(modificationInfos.getAttachmentPointId());
if (attachmentPointDetailInformation.getHighVoltageLimit() != null) {
voltageLevel.setHighVoltageLimit(attachmentPointDetailInformation.getHighVoltageLimit());
}
if (attachmentPointDetailInformation.getLowVoltageLimit() != null) {
voltageLevel.setLowVoltageLimit(attachmentPointDetailInformation.getLowVoltageLimit());
}
if (attachmentPointDetailInformation.getIpMax() != null || attachmentPointDetailInformation.getIpMin() != null) {
IdentifiableShortCircuitAdder<VoltageLevel> adder = voltageLevel.newExtension(IdentifiableShortCircuitAdder.class);
if (attachmentPointDetailInformation.getIpMax() != null) {
adder.withIpMax(attachmentPointDetailInformation.getIpMax());
}
if (attachmentPointDetailInformation.getIpMin() != null) {
adder.withIpMin(attachmentPointDetailInformation.getIpMin());
}
adder.add();
}
PropertiesUtils.applyProperties(voltageLevel, attachmentPointDetailInformation.getProperties());
// override substation
SubstationCreationInfos substationCreationInfos = attachmentPointDetailInformation.getSubstationCreation();
final Substation substation = network.getSubstation(substationCreationInfos.getEquipmentId());
if (substationCreationInfos.getEquipmentName() != null) {
substation.setName(substationCreationInfos.getEquipmentName());
}
if (substationCreationInfos.getCountry() != null) {
substation.setCountry(substationCreationInfos.getCountry());
}
PropertiesUtils.applyProperties(substation, substationCreationInfos.getProperties());
}
You can even separate voltage level and substation creation in two functions.
| .substationCreation(SubstationCreationInfos.builder().stashed(false) | ||
| .equipmentId("attachmentPointSubstation") | ||
| .country(Country.FR) |
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.
This is the only data that you don't test :
| .substationCreation(SubstationCreationInfos.builder().stashed(false) | |
| .equipmentId("attachmentPointSubstation") | |
| .country(Country.FR) | |
| .substationCreation(SubstationCreationInfos.builder().stashed(false) | |
| .equipmentId("attachmentPointSubstation") | |
| .equipmentName("attachmentPointSubstationName") | |
| .country(Country.FR) |
Signed-off-by: Etienne LESOT <[email protected]>
Signed-off-by: Etienne LESOT <[email protected]>
|



PR Summary
add voltage level info in line attached to voltage level to override fictious information of the voltage level created