From 0e197600fdba8d29b5109ac4df87f1cac7a83e7c Mon Sep 17 00:00:00 2001 From: Florentine Rosiere Date: Thu, 19 Dec 2024 17:30:57 +0100 Subject: [PATCH] #817 disable emulation AC if active power control is activated in a hvdc but droop is zero closes #817 Signed-off-by: Florentine Rosiere --- etc/Dictionaries/DFLLog_en_GB.dic | 1 + sources/Algo/src/HVDCDefinitionAlgorithm.cpp | 2 +- sources/Inputs/src/AssemblingDataBase.cpp | 6 ++---- sources/Inputs/src/NetworkManager.cpp | 3 ++- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/etc/Dictionaries/DFLLog_en_GB.dic b/etc/Dictionaries/DFLLog_en_GB.dic index f1779ffb..3c4876b0 100644 --- a/etc/Dictionaries/DFLLog_en_GB.dic +++ b/etc/Dictionaries/DFLLog_en_GB.dic @@ -40,6 +40,7 @@ CannotLoadLibrary = cannot load library %1% : %2% DynModelLibraryNotFound = library %1% not found : model %2% will be skipped ContingencyInvalidForSimulation = element %1% from contingency %2% is not valid: not in main connected component or has an invalid type. It will be ignored. ContingencyInvalidForSimulationNoValidElements = contingency %1% is invalid for simulation. All elements are invalid (not in main connected component or invalid type) +HvdcActivePowerControlActivatedNoDroop = active power control is activated in hvdc %1% but droop is zero. Active power control will be considered as disabled. //------------------ Outputs ----------------------- TFOComponentNotFound = reference %1% references a TFO element but model %2% does not use a TFO association : reference is ignored diff --git a/sources/Algo/src/HVDCDefinitionAlgorithm.cpp b/sources/Algo/src/HVDCDefinitionAlgorithm.cpp index 4b1c7ea9..966b7efc 100644 --- a/sources/Algo/src/HVDCDefinitionAlgorithm.cpp +++ b/sources/Algo/src/HVDCDefinitionAlgorithm.cpp @@ -87,7 +87,7 @@ auto HVDCDefinitionAlgorithm::computeModel(const inputs::HvdcLine &hvdcline, HVD if (type == inputs::HvdcLine::ConverterType::LCC) { return HVDCModelDefinition{infiniteReactiveLimits_ ? HVDCDefinition::HVDCModel::HvdcPTanPhi : HVDCDefinition::HVDCModel::HvdcPTanPhiDiagramPQ}; } else { - const bool hvdcAngleDroopActivePowerControlIsEnabled = hvdcline.activePowerControl.has_value(); + const bool hvdcAngleDroopActivePowerControlIsEnabled = hvdcline.activePowerControl.has_value() && !DYN::doubleIsZero(hvdcline.activePowerControl->droop); if (!hvdcAngleDroopActivePowerControlIsEnabled) { if (isInSVC) { if (converterSide1) diff --git a/sources/Inputs/src/AssemblingDataBase.cpp b/sources/Inputs/src/AssemblingDataBase.cpp index d3af808c..154676be 100644 --- a/sources/Inputs/src/AssemblingDataBase.cpp +++ b/sources/Inputs/src/AssemblingDataBase.cpp @@ -235,10 +235,8 @@ AssemblingDataBase::AssemblingXmlDocument::HvdcLineHandler::HvdcLineHandler(cons onStartElement(root, [this](const parser::ElementName &, const attributes_type &attributes) { currentHvdcLine->name = attributes["name"].as_string(); currentHvdcLine->converterStation1 = AssemblingDataBase::HvdcLineConverterSide::SIDE1; - if (attributes.has("converterStation1")) { - if (attributes["converterStation1"].as_string() == "SIDE2") { - currentHvdcLine->converterStation1 = AssemblingDataBase::HvdcLineConverterSide::SIDE2; - } + if (attributes.has("converterStation1") && attributes["converterStation1"].as_string() == "SIDE2") { + currentHvdcLine->converterStation1 = AssemblingDataBase::HvdcLineConverterSide::SIDE2; } }); } diff --git a/sources/Inputs/src/NetworkManager.cpp b/sources/Inputs/src/NetworkManager.cpp index eb5c74ac..d3866829 100644 --- a/sources/Inputs/src/NetworkManager.cpp +++ b/sources/Inputs/src/NetworkManager.cpp @@ -38,7 +38,6 @@ #include #include - namespace dfl { namespace inputs { @@ -326,6 +325,8 @@ void NetworkManager::buildTree() { // active power control external IIDM extension const bool activePowerEnabled = hvdcLine->isActivePowerControlEnabled().get_value_or(false); + if (activePowerEnabled && DYN::doubleIsZero(hvdcLine->getDroop().value())) + LOG(warn, HvdcActivePowerControlActivatedNoDroop, hvdcLine->getID()); auto activePowerControl = activePowerEnabled ? boost::optional(HvdcLine::ActivePowerControl(hvdcLine->getDroop().value(), hvdcLine->getP0().value()))