From 837b824bc0c7a3309b78189085928dd245f43ccd Mon Sep 17 00:00:00 2001 From: Le Courtois Florent Date: Wed, 8 Dec 2021 10:10:52 +0100 Subject: [PATCH] #216 Update dyd --- sources/Outputs/include/Dyd.h | 2 ++ sources/Outputs/src/Dyd.cpp | 14 ++++++++++++-- .../reference/TestDydShunts/TestDydShunts.dyd | 16 ++++++++++++---- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/sources/Outputs/include/Dyd.h b/sources/Outputs/include/Dyd.h index 54c6271f8..69f0819ce 100644 --- a/sources/Outputs/include/Dyd.h +++ b/sources/Outputs/include/Dyd.h @@ -198,6 +198,8 @@ class Dyd { */ static boost::shared_ptr writeShuntRegulation(const inputs::Shunt::BusId& busId, const std::string& basename); + static boost::shared_ptr writeShuntBSections(const inputs::Shunt& shunt, const std::string& basename); + /** * @brief Create constant models * diff --git a/sources/Outputs/src/Dyd.cpp b/sources/Outputs/src/Dyd.cpp index 09a54b6aa..323942fa8 100644 --- a/sources/Outputs/src/Dyd.cpp +++ b/sources/Outputs/src/Dyd.cpp @@ -154,9 +154,10 @@ Dyd::write() const { auto modelId = constants::computeShuntRegulationId(shuntPair.first); dynamicModelsToConnect->addConnect(modelId, "UMonitoredPu_value", constants::networkModelName, shuntPair.first + "_U_value"); for (auto it = shuntPair.second.begin(); it != shuntPair.second.end(); ++it) { + dynamicModelsToConnect->addModel(writeShuntBSections(*it, def_.basename)); unsigned int i = static_cast(it - shuntPair.second.begin()); - dynamicModelsToConnect->addConnect(modelId, "section_" + std::to_string(i) + "_value", constants::networkModelName, - it->get().id + "_currentSection_value"); + dynamicModelsToConnect->addConnect(it->get().id, "shunt_section_value", constants::networkModelName, it->get().id + "_currentSection_value"); + dynamicModelsToConnect->addConnect(modelId, "section_" + std::to_string(i) + "_value", it->get().id, "shunt_section_value"); } } @@ -288,6 +289,15 @@ Dyd::writeShuntRegulation(const inputs::Shunt::BusId& busId, const std::string& return model; } +boost::shared_ptr +Dyd::writeShuntBSections(const inputs::Shunt& shunt, const std::string& basename) { + auto model = dynamicdata::BlackBoxModelFactory::newModel(shunt.id); + model->setLib("ShuntBWithSections"); + model->setParFile(basename + ".par"); + model->setParId(shunt.id); + return model; +} + boost::shared_ptr Dyd::writeLoad(const algo::LoadDefinition& load, const std::string& basename) { auto model = dynamicdata::BlackBoxModelFactory::newModel(load.id); diff --git a/tests/outputs/reference/TestDydShunts/TestDydShunts.dyd b/tests/outputs/reference/TestDydShunts/TestDydShunts.dyd index 48eedce55..95be8bdba 100644 --- a/tests/outputs/reference/TestDydShunts/TestDydShunts.dyd +++ b/tests/outputs/reference/TestDydShunts/TestDydShunts.dyd @@ -33,14 +33,22 @@ + + + + - - + + + + - - + + + +