Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 64 additions & 33 deletions docs/developer-guide/andes-compatibility.md

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions src/fileInput/gridDynReadDYR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "griddyn/Stabilizer.h"
#include "griddyn/generators/DynamicGenerator.h"
#include "griddyn/governors/GovernorIeeeG1.h"
#include "griddyn/stabilizers/StabilizerIEEEST.h"
#include "griddyn/stabilizers/StabilizerST2CUT.h"
#include <cmath>
#include <fstream>
Expand All @@ -35,6 +36,7 @@ namespace {
void loadEXST1(CoreObject* parentObject, stringVec& tokens);
void loadTGOV1(CoreObject* parentObject, stringVec& tokens);
void loadIEEEG1(CoreObject* parentObject, stringVec& tokens);
void loadIEEEST(CoreObject* parentObject, stringVec& tokens);
void loadST2CUT(CoreObject* parentObject, stringVec& tokens);
void loadEXDC2(CoreObject* parentObject, stringVec& tokens);
void loadSEXS(CoreObject* parentObject, stringVec& tokens);
Expand Down Expand Up @@ -90,6 +92,8 @@ void loadDyr(CoreObject* parentObject,
loadTGOV1(parentObject, lineTokens);
} else if (type == "'IEEEG1'") {
loadIEEEG1(parentObject, lineTokens);
} else if (type == "'IEEEST'") {
loadIEEEST(parentObject, lineTokens);
} else if (type == "'ST2CUT'") {
loadST2CUT(parentObject, lineTokens);
} else if (type == "'SEXS'") {
Expand Down Expand Up @@ -392,6 +396,9 @@ namespace {
const int busId = std::stoi(tokens[0]);
const auto* bus = static_cast<GridBus*>(parentObject->findByUserID("bus", busId));
const int genId = std::stoi(tokens[2]);
if ((bus == nullptr) || (genId <= 0)) {
throw InvalidParameterValue("ST2CUT generator identity");
}
auto* generator = dynamic_cast<DynamicGenerator*>(bus->getGen(genId - 1));
if (generator == nullptr) {
throw InvalidParameterValue("ST2CUT requires a dynamic generator");
Expand Down Expand Up @@ -424,6 +431,49 @@ namespace {
stabilizer->set("vcl", params[22]);
generator->add(stabilizer);
}

void loadIEEEST(CoreObject* parentObject, stringVec& tokens)
{
if (tokens.size() != 22U) {
throw InvalidParameterValue("IEEEST DYR record must contain 22 fields");
}
const int busId = std::stoi(tokens[0]);
const auto* bus = static_cast<GridBus*>(parentObject->findByUserID("bus", busId));
const int genId = std::stoi(tokens[2]);
if ((bus == nullptr) || (genId <= 0)) {
throw InvalidParameterValue("IEEEST generator identity");
}
auto* generator = dynamic_cast<DynamicGenerator*>(bus->getGen(genId - 1));
if (generator == nullptr) {
throw InvalidParameterValue("IEEEST requires a dynamic generator");
}

const auto params = gmlc::utilities::str2vector(tokens, kNullVal);
auto* stabilizer = new stabilizers::StabilizerIEEEST();
// Exact frozen ANDES psse-dyr.yaml order after BUS and ID:
// MODE, BUSR, A1, A2, A3, A4, A5, A6, T1, T2, T3, T4,
// T5, T6, KS, LSMAX, LSMIN, VCU, VCL.
stabilizer->set("mode", params[3]);
stabilizer->set("busr", params[4]);
stabilizer->set("a1", params[5]);
stabilizer->set("a2", params[6]);
stabilizer->set("a3", params[7]);
stabilizer->set("a4", params[8]);
stabilizer->set("a5", params[9]);
stabilizer->set("a6", params[10]);
stabilizer->set("t1", params[11]);
stabilizer->set("t2", params[12]);
stabilizer->set("t3", params[13]);
stabilizer->set("t4", params[14]);
stabilizer->set("t5", params[15]);
stabilizer->set("t6", params[16]);
stabilizer->set("ks", params[17]);
stabilizer->set("lsmax", params[18]);
stabilizer->set("lsmin", params[19]);
stabilizer->set("vcu", params[20]);
stabilizer->set("vcl", params[21]);
generator->add(stabilizer);
}
} // namespace

} // namespace griddyn
2 changes: 2 additions & 0 deletions src/griddyn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ set(gridSource_sources
set(exciter_headers
Exciter.h
Stabilizer.h
stabilizers/StabilizerIEEEST.h
stabilizers/StabilizerST2CUT.h
exciters/ExciterDC1A.h
exciters/ExciterDC2A.h
Expand All @@ -102,6 +103,7 @@ set(exciter_sources
exciters/ExciterIEEEtype2.cpp
exciters/ExciterSEXS.cpp
stabilizers/Stabilizer.cpp
stabilizers/StabilizerIEEEST.cpp
stabilizers/StabilizerST2CUT.cpp
)

Expand Down
3 changes: 3 additions & 0 deletions src/griddyn/stabilizers/Stabilizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "../Generator.h"
#include "../GridBus.h"
#include "StabilizerIEEEST.h"
#include "StabilizerST2CUT.h"
#include "core/CoreObjectTemplates.hpp"
#include "core/ObjectFactoryTemplates.hpp"
Expand All @@ -20,6 +21,8 @@ static const TypeFactory<Stabilizer> STABILIZER_FACTORY("pss",
std::to_array<std::string_view>({"basic"}));
static ChildTypeFactory<stabilizers::StabilizerST2CUT, Stabilizer>
gSt2cutFactory("pss", std::to_array<std::string_view>({"st2cut"}));
static ChildTypeFactory<stabilizers::StabilizerIEEEST, Stabilizer>
gIeeestFactory("pss", std::to_array<std::string_view>({"ieeest"}));

Stabilizer::Stabilizer(const std::string& objName):
GridSubModel(objName), mp_Tw(0.0), mp_Teps(0.0), mp_Kw(0.0), mp_Kp(0.0), mp_Kv(0.0),
Expand Down
Loading