Skip to content

Commit

Permalink
#216 Update dyd
Browse files Browse the repository at this point in the history
  • Loading branch information
Le Courtois Florent committed Dec 8, 2021
1 parent 8828b12 commit 837b824
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
2 changes: 2 additions & 0 deletions sources/Outputs/include/Dyd.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ class Dyd {
*/
static boost::shared_ptr<dynamicdata::BlackBoxModel> writeShuntRegulation(const inputs::Shunt::BusId& busId, const std::string& basename);

static boost::shared_ptr<dynamicdata::BlackBoxModel> writeShuntBSections(const inputs::Shunt& shunt, const std::string& basename);

/**
* @brief Create constant models
*
Expand Down
14 changes: 12 additions & 2 deletions sources/Outputs/src/Dyd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsigned int>(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");
}
}

Expand Down Expand Up @@ -288,6 +289,15 @@ Dyd::writeShuntRegulation(const inputs::Shunt::BusId& busId, const std::string&
return model;
}

boost::shared_ptr<dynamicdata::BlackBoxModel>
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<dynamicdata::BlackBoxModel>
Dyd::writeLoad(const algo::LoadDefinition& load, const std::string& basename) {
auto model = dynamicdata::BlackBoxModelFactory::newModel(load.id);
Expand Down
16 changes: 12 additions & 4 deletions tests/outputs/reference/TestDydShunts/TestDydShunts.dyd
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,22 @@
<dyn:staticRef var="SVarC_modeHandling_mode_value" staticVar="regulatingMode"/>
<dyn:staticRef var="SVarC_state" staticVar="state"/>
</dyn:macroStaticReference>
<dyn:blackBoxModel id="1.1" lib="ShuntBWithSections" parFile="TestDydShunts.par" parId="1.1"/>
<dyn:blackBoxModel id="1.2" lib="ShuntBWithSections" parFile="TestDydShunts.par" parId="1.2"/>
<dyn:blackBoxModel id="3.1" lib="ShuntBWithSections" parFile="TestDydShunts.par" parId="3.1"/>
<dyn:blackBoxModel id="3.2" lib="ShuntBWithSections" parFile="TestDydShunts.par" parId="3.2"/>
<dyn:blackBoxModel id="Model_Signal_N" lib="SignalN"/>
<dyn:blackBoxModel id="ShuntRegulation_1" lib="DYNModelCentralizedShuntsSectionControl" parFile="TestDydShunts.par" parId="ShuntRegulation_1"/>
<dyn:blackBoxModel id="ShuntRegulation_3" lib="DYNModelCentralizedShuntsSectionControl" parFile="TestDydShunts.par" parId="ShuntRegulation_3"/>
<dyn:connect id1="ShuntRegulation_1" var1="UMonitoredPu_value" id2="NETWORK" var2="1_U_value"/>
<dyn:connect id1="ShuntRegulation_1" var1="section_0_value" id2="NETWORK" var2="1.2_currentSection_value"/>
<dyn:connect id1="ShuntRegulation_1" var1="section_1_value" id2="NETWORK" var2="1.1_currentSection_value"/>
<dyn:connect id1="1.2" var1="shunt_section_value" id2="NETWORK" var2="1.2_currentSection_value"/>
<dyn:connect id1="ShuntRegulation_1" var1="section_0_value" id2="1.2" var2="shunt_section_value"/>
<dyn:connect id1="1.1" var1="shunt_section_value" id2="NETWORK" var2="1.1_currentSection_value"/>
<dyn:connect id1="ShuntRegulation_1" var1="section_1_value" id2="1.1" var2="shunt_section_value"/>
<dyn:connect id1="ShuntRegulation_3" var1="UMonitoredPu_value" id2="NETWORK" var2="3_U_value"/>
<dyn:connect id1="ShuntRegulation_3" var1="section_0_value" id2="NETWORK" var2="3.2_currentSection_value"/>
<dyn:connect id1="ShuntRegulation_3" var1="section_1_value" id2="NETWORK" var2="3.1_currentSection_value"/>
<dyn:connect id1="3.2" var1="shunt_section_value" id2="NETWORK" var2="3.2_currentSection_value"/>
<dyn:connect id1="ShuntRegulation_3" var1="section_0_value" id2="3.2" var2="shunt_section_value"/>
<dyn:connect id1="3.1" var1="shunt_section_value" id2="NETWORK" var2="3.1_currentSection_value"/>
<dyn:connect id1="ShuntRegulation_3" var1="section_1_value" id2="3.1" var2="shunt_section_value"/>
<dyn:connect id1="Model_Signal_N" var1="signalN_thetaRef" id2="NETWORK" var2="Slack_phi"/>
</dyn:dynamicModelsArchitecture>

0 comments on commit 837b824

Please sign in to comment.