-
Notifications
You must be signed in to change notification settings - Fork 8
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
Check target voltage plausibility on Transformers and Shunt Compensators #1030
Changes from all commits
6eae7a6
3abf4d2
b4623d5
1e38117
b2d796e
30e9d29
4bb002f
6ee938c
b8d75b6
b43b026
d2df78b
4026142
cf6d113
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -400,7 +400,7 @@ public void visitHvdcConverterStation(HvdcConverterStation<?> converterStation) | |
}); | ||
|
||
if (!shuntCompensators.isEmpty()) { | ||
lfBus.setShuntCompensators(shuntCompensators, parameters, topoConfig); | ||
lfBus.setShuntCompensators(shuntCompensators, parameters, topoConfig, report); | ||
} | ||
|
||
return lfBus; | ||
|
@@ -627,6 +627,14 @@ private static void createTransformerVoltageControl(LfNetwork lfNetwork, RatioTa | |
double targetValue = rtc.getTargetV() / regulatingTerminalNominalV; | ||
Double targetDeadband = rtc.getTargetDeadband() > 0 ? rtc.getTargetDeadband() / regulatingTerminalNominalV : null; | ||
|
||
if (!VoltageControl.checkTargetV(targetValue, controlledBus.getNominalV(), parameters)) { | ||
LOGGER.trace("RatioTapChanger on transformer '{}' has an inconsistent target voltage: {} pu: transformer voltage control discarded", controllerBranchId, targetValue); | ||
if (report != null) { | ||
report.transformersWithInconsistentTargetVoltage++; | ||
} | ||
return; | ||
} | ||
|
||
controlledBus.getTransformerVoltageControl().ifPresentOrElse(vc -> { | ||
LOGGER.trace("Controlled bus '{}' already has a transformer voltage control: a shared control is created", controlledBus.getId()); | ||
if (FastMath.abs(vc.getTargetValue() - targetValue) > TARGET_V_EPSILON) { | ||
|
@@ -705,54 +713,55 @@ private static void createShuntVoltageControl(LfNetwork lfNetwork, ShuntCompensa | |
LOGGER.warn("Voltage controller shunt {} is out of voltage: no voltage control created", shuntCompensator.getId()); | ||
return; | ||
} | ||
LfShunt controllerShunt = controllerBus.getControllerShunt().orElseThrow(); | ||
LfBus controlledBus = getLfBus(shuntCompensator.getRegulatingTerminal(), lfNetwork, parameters.isBreakers()); | ||
if (controlledBus == null) { | ||
LOGGER.warn("Regulating terminal of voltage controller shunt {} is out of voltage: no voltage control created", shuntCompensator.getId()); | ||
controllerShunt.setVoltageControlCapability(false); | ||
return; | ||
} | ||
if (controllerShunt.getVoltageControl().isPresent()) { | ||
// if a controller shunt is already in a shunt voltage control, the number of equations will not equal the | ||
// number of variables. We have only one B variable for more than one bus target V equations. | ||
if (!controllerShunt.getVoltageControl().orElseThrow().getControlledBus().getId().equals(controlledBus.getId())) { | ||
LOGGER.error("Controller shunt {} is already in a shunt voltage control. The second controlled bus {} is ignored", controllerShunt.getId(), controlledBus.getId()); | ||
Reports.reportControllerShuntAlreadyInVoltageControl(controllerBus.getNetwork().getReportNode(), controllerShunt.getId(), controlledBus.getId()); | ||
controllerBus.getControllerShunt().ifPresent(controllerShunt -> { | ||
LfBus controlledBus = getLfBus(shuntCompensator.getRegulatingTerminal(), lfNetwork, parameters.isBreakers()); | ||
if (controlledBus == null) { | ||
LOGGER.warn("Regulating terminal of voltage controller shunt {} is out of voltage: no voltage control created", shuntCompensator.getId()); | ||
controllerShunt.setVoltageControlCapability(false); | ||
return; | ||
} | ||
if (controllerShunt.getVoltageControl().isPresent()) { | ||
// if a controller shunt is already in a shunt voltage control, the number of equations will not equal the | ||
// number of variables. We have only one B variable for more than one bus target V equations. | ||
if (!controllerShunt.getVoltageControl().orElseThrow().getControlledBus().getId().equals(controlledBus.getId())) { | ||
LOGGER.error("Controller shunt {} is already in a shunt voltage control. The second controlled bus {} is ignored", controllerShunt.getId(), controlledBus.getId()); | ||
Reports.reportControllerShuntAlreadyInVoltageControl(controllerBus.getNetwork().getReportNode(), controllerShunt.getId(), controlledBus.getId()); | ||
} | ||
return; | ||
} | ||
return; | ||
} | ||
|
||
double regulatingTerminalNominalV = shuntCompensator.getRegulatingTerminal().getVoltageLevel().getNominalV(); | ||
double targetValue = shuntCompensator.getTargetV() / regulatingTerminalNominalV; | ||
Double targetDeadband = shuntCompensator.getTargetDeadband() > 0 ? shuntCompensator.getTargetDeadband() / regulatingTerminalNominalV : null; | ||
double regulatingTerminalNominalV = shuntCompensator.getRegulatingTerminal().getVoltageLevel().getNominalV(); | ||
double targetValue = shuntCompensator.getTargetV() / regulatingTerminalNominalV; | ||
Double targetDeadband = shuntCompensator.getTargetDeadband() > 0 ? shuntCompensator.getTargetDeadband() / regulatingTerminalNominalV : null; | ||
|
||
controlledBus.getShuntVoltageControl().ifPresentOrElse(voltageControl -> { | ||
LOGGER.trace("Controlled bus {} has already a shunt voltage control: a shared control is created", controlledBus.getId()); | ||
if (FastMath.abs(voltageControl.getTargetValue() - targetValue) > TARGET_V_EPSILON) { | ||
LOGGER.warn("Controlled bus {} already has a shunt voltage control with a different target voltage: {} and {}", | ||
controlledBus.getId(), voltageControl.getTargetValue(), targetValue); | ||
} | ||
if (!voltageControl.getControllerElements().contains(controllerShunt)) { | ||
voltageControl.addControllerElement(controllerShunt); | ||
controllerShunt.setVoltageControl(voltageControl); | ||
controlledBus.setShuntVoltageControl(voltageControl); | ||
if (targetDeadband != null) { | ||
Double oldTargetDeadband = voltageControl.getTargetDeadband().orElse(null); | ||
if (oldTargetDeadband == null) { | ||
voltageControl.setTargetDeadband(targetDeadband); | ||
} else { | ||
// merge target deadbands by taking minimum | ||
voltageControl.setTargetDeadband(Math.min(oldTargetDeadband, targetDeadband)); | ||
controlledBus.getShuntVoltageControl().ifPresentOrElse(voltageControl -> { | ||
LOGGER.trace("Controlled bus {} has already a shunt voltage control: a shared control is created", controlledBus.getId()); | ||
if (FastMath.abs(voltageControl.getTargetValue() - targetValue) > TARGET_V_EPSILON) { | ||
LOGGER.warn("Controlled bus {} already has a shunt voltage control with a different target voltage: {} and {}", | ||
controlledBus.getId(), voltageControl.getTargetValue(), targetValue); | ||
} | ||
if (!voltageControl.getControllerElements().contains(controllerShunt)) { | ||
voltageControl.addControllerElement(controllerShunt); | ||
controllerShunt.setVoltageControl(voltageControl); | ||
controlledBus.setShuntVoltageControl(voltageControl); | ||
if (targetDeadband != null) { | ||
Double oldTargetDeadband = voltageControl.getTargetDeadband().orElse(null); | ||
if (oldTargetDeadband == null) { | ||
voltageControl.setTargetDeadband(targetDeadband); | ||
} else { | ||
// merge target deadbands by taking minimum | ||
voltageControl.setTargetDeadband(Math.min(oldTargetDeadband, targetDeadband)); | ||
} | ||
} | ||
} | ||
} | ||
}, () -> { | ||
}, () -> { | ||
// we create a new shunt voltage control. | ||
ShuntVoltageControl voltageControl = new ShuntVoltageControl(controlledBus, parameters.getVoltageTargetPriority(VoltageControl.Type.SHUNT), targetValue, targetDeadband); | ||
voltageControl.addControllerElement(controllerShunt); | ||
controllerShunt.setVoltageControl(voltageControl); | ||
controlledBus.setShuntVoltageControl(voltageControl); | ||
}); | ||
}); | ||
} | ||
|
||
private static LfBus getLfBus(Terminal terminal, LfNetwork lfNetwork, boolean breakers) { | ||
|
@@ -843,15 +852,12 @@ private LfNetwork create(int numCC, int numSC, Network network, List<Bus> buses, | |
LOGGER.warn("Network {}: {} branches have been discarded because connected to same bus at both ends", | ||
lfNetwork, report.branchesDiscardedBecauseConnectedToSameBusAtBothEnds); | ||
} | ||
if (report.linesWithDifferentNominalVoltageAtBothEnds > 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why it is removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is dead code ... See #1030 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is a mistake @geofjamg what's happen here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
LOGGER.warn("Network {}: {} lines have a different nominal voltage at both ends: a ratio has been added", | ||
lfNetwork, report.linesWithDifferentNominalVoltageAtBothEnds); | ||
} | ||
if (report.nonImpedantBranches > 0) { | ||
LOGGER.warn("Network {}: {} branches are non impedant", lfNetwork, report.nonImpedantBranches); | ||
} | ||
|
||
if (report.generatorsWithInconsistentTargetVoltage > 0) { | ||
Reports.reportGeneratorsDiscardedFromVoltageControlBecauseTargetVIsInconsistent(reportNode, report.generatorsWithInconsistentTargetVoltage); | ||
LOGGER.warn("Network {}: {} generators have an inconsistent target voltage and have been discarded from voltage control", | ||
lfNetwork, report.generatorsWithInconsistentTargetVoltage); | ||
} | ||
|
@@ -867,10 +873,22 @@ private LfNetwork create(int numCC, int numSC, Network network, List<Bus> buses, | |
} | ||
|
||
if (report.transformerReactivePowerControlDiscardedBecauseControllerBranchIsOpen > 0) { | ||
LOGGER.warn("Network {}: {} ratio tap changer reactive power controls have been discarded because controller branch is open", | ||
LOGGER.warn("Network {}: {} transformer reactive power controls have been discarded because controller branch is open", | ||
lfNetwork, report.transformerReactivePowerControlDiscardedBecauseControllerBranchIsOpen); | ||
} | ||
|
||
if (report.transformersWithInconsistentTargetVoltage > 0) { | ||
Reports.reportTransformersDiscardedFromVoltageControlBecauseTargetVIsInconsistent(reportNode, report.transformersWithInconsistentTargetVoltage); | ||
LOGGER.warn("Network {}: {} transformer voltage controls have an inconsistent target voltage and have been discarded from voltage control", | ||
lfNetwork, report.transformersWithInconsistentTargetVoltage); | ||
} | ||
|
||
if (report.shuntsWithInconsistentTargetVoltage > 0) { | ||
Reports.reportShuntsDiscardedFromVoltageControlBecauseTargetVIsInconsistent(reportNode, report.shuntsWithInconsistentTargetVoltage); | ||
LOGGER.warn("Network {}: {} shunt voltage controls have an inconsistent target voltage and have been discarded from voltage control", | ||
lfNetwork, report.shuntsWithInconsistentTargetVoltage); | ||
} | ||
|
||
if (parameters.getDebugDir() != null) { | ||
Path debugDir = DebugUtil.getDebugDir(parameters.getDebugDir()); | ||
String dateStr = ZonedDateTime.now().format(DATE_TIME_FORMAT); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,8 +30,6 @@ public class LfNetworkLoadingReport { | |
|
||
int branchesDiscardedBecauseConnectedToSameBusAtBothEnds = 0; | ||
|
||
int linesWithDifferentNominalVoltageAtBothEnds = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question. |
||
|
||
int nonImpedantBranches = 0; | ||
|
||
int generatorsWithInconsistentTargetVoltage = 0; | ||
|
@@ -41,4 +39,8 @@ public class LfNetworkLoadingReport { | |
int transformerVoltageControlDiscardedBecauseControllerBranchIsOpen = 0; | ||
|
||
int transformerReactivePowerControlDiscardedBecauseControllerBranchIsOpen = 0; | ||
|
||
int transformersWithInconsistentTargetVoltage = 0; | ||
|
||
int shuntsWithInconsistentTargetVoltage = 0; | ||
} |
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.
@annetill just a note, no check on
minNominalVoltageTargetVoltageCheck
here, I have no idea if this is deliberate (I lack knowledge about this outerloop).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.
I think we are going to wait for the issue @geofjamg . At RTE, we are using this outer loop on network without any generator connected to low nominal voltages, but it could arrived soon.