Skip to content

Commit

Permalink
Merge branch 'main' into reactive_limits_refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Seddik Yengui committed Sep 18, 2023
2 parents 18e70ff + 68f6a21 commit 0090e33
Show file tree
Hide file tree
Showing 9 changed files with 418 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,16 @@ public void apply(Network network, Reporter subReporter) {
.allMatch(filterEquipments -> filterEquipments.getIdentifiableAttributes().isEmpty());

if (noValidEquipmentId) {
String errorMsg = "There is no valid equipment ID among the provided filter(s)";
String errorMsg = scalingInfos.getErrorType() + ": There is no valid equipment ID among the provided filter(s)";
createReport(subReporter, "invalidFilters", errorMsg, TypedValue.ERROR_SEVERITY);
throw new NetworkModificationException(scalingInfos.getErrorType(), errorMsg);
return;
}

// create report for each wrong filter
filterWithWrongEquipmentsIds.values().forEach(f -> {
var equipmentIds = String.join(", ", f.getNotFoundEquipments());

createReport(subReporter,
"filterEquipmentsNotFound",
"filterEquipmentsNotFound_" + f.getFilterName(),
String.format("Cannot find the following equipments %s in filter %s", equipmentIds, filters.get(f.getFilterId())),
TypedValue.WARN_SEVERITY);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ private static double computeTotalAmountFixedSupply(Network network, Component c
return totalAmountFixedSupply;
}

private static Component getSynchronousComponentFrom(HvdcConverterStation<?> station) {
return station.getTerminal().getBusView().getBus().getSynchronousComponent();
private static boolean inDifferentSynchronousComponent(HvdcConverterStation<?> station, int componentNum) {
Bus bus = station.getTerminal().getBusView().getBus();
return bus != null && bus.getSynchronousComponent().getNum() != componentNum;
}

private static double computeHvdcBalance(Component component) {
Expand All @@ -115,8 +116,8 @@ private static double computeHvdcBalance(Component component) {
HvdcConverterStation<?> station1 = hvdcLine.getConverterStation1();
HvdcConverterStation<?> station2 = hvdcLine.getConverterStation2();

boolean station2NotInComponent = station1.getId().equals(station.getId()) && getSynchronousComponentFrom(station2).getNum() != component.getNum();
boolean station1NotInComponent = station2.getId().equals(station.getId()) && getSynchronousComponentFrom(station1).getNum() != component.getNum();
boolean station2NotInComponent = station1.getId().equals(station.getId()) && inDifferentSynchronousComponent(station2, component.getNum());
boolean station1NotInComponent = station2.getId().equals(station.getId()) && inDifferentSynchronousComponent(station1, component.getNum());
return station1NotInComponent || station2NotInComponent;
})
.mapToDouble(station -> {
Expand Down Expand Up @@ -375,7 +376,7 @@ private double reduceGeneratorMaxPValue(Generator generator,
}
}
double genFrequencyReserve = computeGenFrequencyReserve(generator, generatorsFrequencyReserve);
return res * (1. - genFrequencyReserve / 100.);
return Math.max(generator.getMinP(), res * (1. - genFrequencyReserve / 100.));
}

@Override
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/resources/db/changelog/db.changelog-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ databaseChangeLog:
file: changesets/changelog_20230702T105416Z.xml
relativeToChangelogFile: true
- include:
file: changesets/changelog_20230629T150259Z.xml
file: changesets/changelog_20230728T141452Z.xml
relativeToChangelogFile: true
- include:
file: changesets/changelog_20230629T150259Z.xml
Expand Down
Loading

0 comments on commit 0090e33

Please sign in to comment.