diff --git a/dpsim-models/include/dpsim-models/SP/SP_Ph1_Shunt.h b/dpsim-models/include/dpsim-models/SP/SP_Ph1_Shunt.h index bd46e325b8..9526b0649c 100644 --- a/dpsim-models/include/dpsim-models/SP/SP_Ph1_Shunt.h +++ b/dpsim-models/include/dpsim-models/SP/SP_Ph1_Shunt.h @@ -20,15 +20,14 @@ namespace SP {namespace Ph1 { const Attribute::Ptr mConductance; /// Susceptance [S] const Attribute::Ptr mSusceptance; + /// Conductance [pu] + const Attribute::Ptr mConductancePerUnit; + /// Susceptance [pu] + const Attribute::Ptr mSusceptancePerUnit; private: /// Base voltage [V] Real mBaseVoltage; - /// Conductance [pu] - Real mConductancePerUnit; - /// Susceptance [pu] - Real mSusceptancePerUnit; - public: /// Defines UID, name, component parameters and logging level Shunt(String uid, String name, Logger::Level logLevel = Logger::Level::off); diff --git a/dpsim-models/include/dpsim-models/SimNode.h b/dpsim-models/include/dpsim-models/SimNode.h index bfcbae2072..05a3edccc1 100644 --- a/dpsim-models/include/dpsim-models/SimNode.h +++ b/dpsim-models/include/dpsim-models/SimNode.h @@ -127,4 +127,7 @@ namespace CPS { template<> void SimNode::setVoltage(Complex newVoltage); + + template<> + void SimNode::setPower(Complex newPower); } diff --git a/dpsim-models/include/dpsim-models/SystemTopology.h b/dpsim-models/include/dpsim-models/SystemTopology.h index d3c97bb723..217e799aed 100644 --- a/dpsim-models/include/dpsim-models/SystemTopology.h +++ b/dpsim-models/include/dpsim-models/SystemTopology.h @@ -14,7 +14,6 @@ #include #include #include -#include #ifdef WITH_GRAPHVIZ #include @@ -107,8 +106,8 @@ namespace CPS { /// Add multiple components void addComponents(const IdentifiedObject::List& components); - /// Initialize nodes from PowerFlow - void initWithPowerflow(const SystemTopology& systemPF); + /// Initialize nodes and SG power from PowerFlow + void initWithPowerflow(const SystemTopology& systemPF, CPS::Domain domain); /// Adds component and initializes frequencies void addTearComponent(IdentifiedObject::Ptr component); diff --git a/dpsim-models/src/SP/SP_Ph1_Shunt.cpp b/dpsim-models/src/SP/SP_Ph1_Shunt.cpp index 8ceb42a147..d388f4c672 100644 --- a/dpsim-models/src/SP/SP_Ph1_Shunt.cpp +++ b/dpsim-models/src/SP/SP_Ph1_Shunt.cpp @@ -13,7 +13,9 @@ using namespace CPS; SP::Ph1::Shunt::Shunt(String uid, String name, Logger::Level logLevel) : SimPowerComp(uid, name, logLevel), mConductance(mAttributes->create("G")), - mSusceptance(mAttributes->create("B")) { + mSusceptance(mAttributes->create("B")), + mConductancePerUnit(mAttributes->create("Gpu")), + mSusceptancePerUnit(mAttributes->create("Bpu")) { SPDLOG_LOGGER_INFO(mSLog, "Create {} of type {}", this->type(), name); setTerminalNumber(1); @@ -42,15 +44,15 @@ void SP::Ph1::Shunt::calculatePerUnitParameters(Real baseApparentPower, Real bas auto baseAdmittance = 1.0 / baseImpedance; SPDLOG_LOGGER_INFO(mSLog, "Base Voltage={} [V] Base Admittance={} [S]", mBaseVoltage, baseAdmittance); - mConductancePerUnit = **mConductance / baseAdmittance; - mSusceptancePerUnit = **mSusceptance / baseAdmittance; - SPDLOG_LOGGER_INFO(mSLog, "Susceptance={} [pu] Conductance={} [pu]", mSusceptancePerUnit, mConductancePerUnit); + **mConductancePerUnit = **mConductance / baseAdmittance; + **mSusceptancePerUnit = **mSusceptance / baseAdmittance; + SPDLOG_LOGGER_INFO(mSLog, "Susceptance={} [pu] Conductance={} [pu]", **mSusceptancePerUnit, **mConductancePerUnit); }; void SP::Ph1::Shunt::pfApplyAdmittanceMatrixStamp(SparseMatrixCompRow & Y) { int bus1 = this->matrixNodeIndex(0); - Complex Y_element = Complex(mConductancePerUnit, mSusceptancePerUnit); + Complex Y_element = Complex(**mConductancePerUnit, **mSusceptancePerUnit); if (std::isinf(Y_element.real()) || std::isinf(Y_element.imag())) { std::cout << "Y:" << Y_element << std::endl; diff --git a/dpsim-models/src/SystemTopology.cpp b/dpsim-models/src/SystemTopology.cpp index b8b5c3bbd4..e952b9c56d 100644 --- a/dpsim-models/src/SystemTopology.cpp +++ b/dpsim-models/src/SystemTopology.cpp @@ -12,6 +12,7 @@ #include #include +#include using namespace CPS; @@ -72,7 +73,8 @@ void SystemTopology::addComponents(const IdentifiedObject::List& components) { addComponent(comp); } -void SystemTopology::initWithPowerflow(const SystemTopology& systemPF) { +void SystemTopology::initWithPowerflow(const SystemTopology& systemPF, CPS::Domain domain) { + for (auto nodePF : systemPF.mNodes) { if (auto node = this->node(nodePF->name())) { //SPDLOG_LOGGER_INFO(mSLog, "Updating initial voltage of {} according to powerflow", node->name()); @@ -81,6 +83,22 @@ void SystemTopology::initWithPowerflow(const SystemTopology& systemPF) { //SPDLOG_LOGGER_INFO(mSLog, "Updated initial voltage: {}", node->initialSingleVoltage()); } } + + // set initial power of SG + for (auto compPF : systemPF.mComponents) { + if (auto genPF = std::dynamic_pointer_cast(compPF)) { + if (domain==CPS::Domain::DP || domain==CPS::Domain::SP) { + auto comp = this->component>(compPF->name()); + auto terminal = comp->terminals()[0]; + terminal->setPower(-genPF->getApparentPower()); + } else if (domain==CPS::Domain::EMT) { + auto comp = this->component>(compPF->name()); + auto terminal = comp->terminals()[0]; + terminal->setPower(-genPF->getApparentPower()); + } + //SPDLOG_LOGGER_INFO(mSLog, "Updated initial power of gen {}: {}", compPF->name(), genPF->getApparentPower()); + } + } } void SystemTopology::addTearComponent(IdentifiedObject::Ptr component) { diff --git a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG.cpp b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG.cpp index e14036d037..93a6c4dc67 100644 --- a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG.cpp +++ b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG.cpp @@ -79,7 +79,7 @@ int main(int argc, char** argv){ CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::debug); SystemTopology systemDP = reader2.loadCIM(scenario.systemFrequency, filenames, CPS::Domain::DP); Examples::Grids::CIGREMV::addInvertersToCIGREMV(systemDP, scenario, Domain::DP); - systemDP.initWithPowerflow(systemPF); + systemDP.initWithPowerflow(systemPF, CPS::Domain::DP); auto logger = DPsim::DataLogger::make(simName); diff --git a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG_withLoadStep.cpp b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG_withLoadStep.cpp index a692cb6516..f5ce6ef329 100644 --- a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG_withLoadStep.cpp +++ b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withDG_withLoadStep.cpp @@ -75,15 +75,13 @@ int main(int argc, char** argv){ CIM::Reader reader2(simName, Logger::Level::info, Logger::Level::debug); SystemTopology systemDP = reader2.loadCIM(scenario.systemFrequency, filenames, CPS::Domain::DP); Examples::Grids::CIGREMV::addInvertersToCIGREMV(systemDP, scenario, Domain::DP); - systemDP.initWithPowerflow(systemPF); + systemDP.initWithPowerflow(systemPF, CPS::Domain::DP); auto logger = DPsim::DataLogger::make(simName); // log node voltages for (auto node : systemDP.mNodes) - { logger->logAttribute(node->name() + ".V", node->attribute("v")); - } // log line currents for (auto comp : systemDP.mComponents) { diff --git a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withoutDG.cpp b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withoutDG.cpp index e234a579b9..47529d6200 100644 --- a/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withoutDG.cpp +++ b/dpsim/examples/cxx/CIM/DP_CIGRE_MV_withoutDG.cpp @@ -71,7 +71,7 @@ int main(int argc, char** argv){ Logger::setLogDir("logs/" + simName); CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::debug); SystemTopology systemDP = reader2.loadCIM(systemFrequency, filenames, CPS::Domain::DP); - systemDP.initWithPowerflow(systemPF); + systemDP.initWithPowerflow(systemPF, CPS::Domain::DP); auto logger = DPsim::DataLogger::make(simName); diff --git a/dpsim/examples/cxx/CIM/DP_WSCC-9bus_IdealVS.cpp b/dpsim/examples/cxx/CIM/DP_WSCC-9bus_IdealVS.cpp index 2c09f11ab1..dc2cab4fe5 100644 --- a/dpsim/examples/cxx/CIM/DP_WSCC-9bus_IdealVS.cpp +++ b/dpsim/examples/cxx/CIM/DP_WSCC-9bus_IdealVS.cpp @@ -47,7 +47,7 @@ int main(int argc, char *argv[]) { CPS::CIM::Reader reader(simNamePF, Logger::Level::debug, Logger::Level::debug); SystemTopology systemPF = reader.loadCIM(60, filenames, Domain::SP, PhaseType::Single, CPS::GeneratorType::PVNode); systemPF.component("GEN1")->modifyPowerFlowBusType(CPS::PowerflowBusType::VD); - + // define logging auto loggerPF = DPsim::DataLogger::make(simNamePF); for (auto node : systemPF.mNodes) @@ -72,7 +72,7 @@ int main(int argc, char *argv[]) { CPS::CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::debug); SystemTopology sys = reader2.loadCIM(60, filenames, Domain::DP, PhaseType::Single, CPS::GeneratorType::IdealVoltageSource); - sys.initWithPowerflow(systemPF); + sys.initWithPowerflow(systemPF, CPS::Domain::DP); // Logging auto logger = DataLogger::make(simName); diff --git a/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderIter.cpp b/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderIter.cpp index 448cf9afe4..679bd43465 100644 --- a/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderIter.cpp +++ b/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderIter.cpp @@ -139,13 +139,10 @@ int main(int argc, char *argv[]) { sys.addComponent(faultDP); } - sys.initWithPowerflow(systemPF); + sys.initWithPowerflow(systemPF, Domain::DP); for (auto comp : sys.mComponents) { - if (auto genReducedOrder = std::dynamic_pointer_cast>(comp)) { - auto genPF = systemPF.component(comp->name()); - genReducedOrder->terminal(0)->setPower(-genPF->getApparentPower()); + if (auto genReducedOrder = std::dynamic_pointer_cast>(comp)) genReducedOrder->scaleInertiaConstant(inertiaScalingFactor); - } } // Logging diff --git a/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderVBR.cpp b/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderVBR.cpp index cf949c93ab..23d147eae8 100644 --- a/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderVBR.cpp +++ b/dpsim/examples/cxx/CIM/DP_WSCC9bus_SGReducedOrderVBR.cpp @@ -135,11 +135,9 @@ int main(int argc, char *argv[]) { sys.addComponent(faultDP); } - sys.initWithPowerflow(systemPF); + sys.initWithPowerflow(systemPF, Domain::DP); for (auto comp : sys.mComponents) { if (auto genReducedOrder = std::dynamic_pointer_cast>(comp)) { - auto genPF = systemPF.component(comp->name()); - genReducedOrder->terminal(0)->setPower(-genPF->getApparentPower()); genReducedOrder->scaleInertiaConstant(inertiaScalingFactor); genReducedOrder->setModelAsNortonSource(false); } diff --git a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG.cpp b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG.cpp index c5827d1278..9dff250b66 100644 --- a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG.cpp +++ b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG.cpp @@ -76,7 +76,7 @@ int main(int argc, char** argv){ CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::debug); SystemTopology systemEMT = reader2.loadCIM(scenario.systemFrequency, filenames, CPS::Domain::EMT, PhaseType::ABC); Examples::Grids::CIGREMV::addInvertersToCIGREMV(systemEMT, scenario, Domain::EMT); - systemEMT.initWithPowerflow(systemPF); + systemEMT.initWithPowerflow(systemPF, CPS::Domain::EMT); auto logger = DPsim::DataLogger::make(simName); diff --git a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG_withLoadStep.cpp b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG_withLoadStep.cpp index d9555a00bf..5f05249abd 100644 --- a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG_withLoadStep.cpp +++ b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withDG_withLoadStep.cpp @@ -76,7 +76,7 @@ int main(int argc, char** argv){ CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::debug); SystemTopology systemEMT = reader2.loadCIM(scenario.systemFrequency, filenames, CPS::Domain::EMT, PhaseType::ABC); Examples::Grids::CIGREMV::addInvertersToCIGREMV(systemEMT, scenario, Domain::EMT); - systemEMT.initWithPowerflow(systemPF); + systemEMT.initWithPowerflow(systemPF, CPS::Domain::EMT); auto logger = DPsim::DataLogger::make(simName); diff --git a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withoutDG.cpp b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withoutDG.cpp index 09ae1173bd..3ab6877ce5 100644 --- a/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withoutDG.cpp +++ b/dpsim/examples/cxx/CIM/EMT_CIGRE_MV_withoutDG.cpp @@ -69,7 +69,7 @@ int main(int argc, char** argv){ Logger::setLogDir("logs/" + simName); CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::debug); SystemTopology systemEMT = reader2.loadCIM(systemFrequency, filenames, CPS::Domain::EMT, PhaseType::ABC); - systemEMT.initWithPowerflow(systemPF); + systemEMT.initWithPowerflow(systemPF, CPS::Domain::EMT); auto logger = DPsim::DataLogger::make(simName); diff --git a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_FullOrderSG.cpp b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_FullOrderSG.cpp index 77114a438b..3a4ee78c95 100644 --- a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_FullOrderSG.cpp +++ b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_FullOrderSG.cpp @@ -73,13 +73,7 @@ int main(int argc, char *argv[]) { CPS::CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::debug); SystemTopology sys = reader2.loadCIM(60, filenames, Domain::EMT, PhaseType::ABC, CPS::GeneratorType::FullOrder); - sys.initWithPowerflow(systemPF); - for (auto comp : sys.mComponents) { - if (auto genEMT = std::dynamic_pointer_cast(comp)) { - auto genPF = systemPF.component(comp->name()); - genEMT->terminal(0)->setPower(-genPF->getApparentPower()); - } - } + sys.initWithPowerflow(systemPF, CPS::Domain::EMT); // Logging auto logger = DataLogger::make(simName); diff --git a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealCS.cpp b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealCS.cpp index 4784ee3b42..5e9c4bbb9c 100644 --- a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealCS.cpp +++ b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealCS.cpp @@ -73,13 +73,7 @@ int main(int argc, char *argv[]) { CPS::CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::debug); SystemTopology sys = reader2.loadCIM(60, filenames, Domain::EMT, PhaseType::ABC, CPS::GeneratorType::IdealCurrentSource); - sys.initWithPowerflow(systemPF); - for (auto comp : sys.mComponents) { - if (auto genEMT = std::dynamic_pointer_cast(comp)) { - auto genPF = systemPF.component(comp->name()); - genEMT->terminal(0)->setPower(-genPF->getApparentPower()); - } - } + sys.initWithPowerflow(systemPF, CPS::Domain::EMT); // Logging auto logger = DataLogger::make(simName); diff --git a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealVS.cpp b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealVS.cpp index 91d036b73f..2f0c6f0c90 100644 --- a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealVS.cpp +++ b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_IdealVS.cpp @@ -72,7 +72,7 @@ int main(int argc, char *argv[]) { CPS::CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::debug); SystemTopology sys = reader2.loadCIM(60, filenames, Domain::EMT, PhaseType::ABC, CPS::GeneratorType::IdealVoltageSource); - sys.initWithPowerflow(systemPF); + sys.initWithPowerflow(systemPF, CPS::Domain::EMT); // Logging auto logger = DataLogger::make(simName); diff --git a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_VBR.cpp b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_VBR.cpp index df32723042..5cb072c5bd 100644 --- a/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_VBR.cpp +++ b/dpsim/examples/cxx/CIM/EMT_WSCC-9bus_VBR.cpp @@ -76,13 +76,7 @@ int main(int argc, char *argv[]) { CPS::CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::debug); SystemTopology sys = reader2.loadCIM(60, filenames, Domain::EMT, PhaseType::ABC, CPS::GeneratorType::FullOrderVBR); - sys.initWithPowerflow(systemPF); - for (auto comp : sys.mComponents) { - if (auto genEMT = std::dynamic_pointer_cast(comp)) { - auto genPF = systemPF.component(comp->name()); - genEMT->terminal(0)->setPower(-genPF->getApparentPower()); - } - } + sys.initWithPowerflow(systemPF, CPS::Domain::EMT); // Logging auto logger = DataLogger::make(simName); diff --git a/dpsim/examples/cxx/CIM/EMT_WSCC9bus_SGReducedOrderVBR.cpp b/dpsim/examples/cxx/CIM/EMT_WSCC9bus_SGReducedOrderVBR.cpp index 701645f658..7d5f1ebe78 100644 --- a/dpsim/examples/cxx/CIM/EMT_WSCC9bus_SGReducedOrderVBR.cpp +++ b/dpsim/examples/cxx/CIM/EMT_WSCC9bus_SGReducedOrderVBR.cpp @@ -132,11 +132,9 @@ int main(int argc, char *argv[]) { sys.addComponent(sw); } - sys.initWithPowerflow(systemPF); + sys.initWithPowerflow(systemPF, CPS::Domain::EMT); for (auto comp : sys.mComponents) { if (auto genReducedOrder = std::dynamic_pointer_cast>(comp)) { - auto genPF = systemPF.component(comp->name()); - genReducedOrder->terminal(0)->setPower(-genPF->getApparentPower()); genReducedOrder->scaleInertiaConstant(inertiaScalingFactor); genReducedOrder->setModelAsNortonSource(false); } diff --git a/dpsim/examples/cxx/CIM/SP_WSCC9bus_SGReducedOrderVBR.cpp b/dpsim/examples/cxx/CIM/SP_WSCC9bus_SGReducedOrderVBR.cpp index d995c8bd80..baf7966630 100644 --- a/dpsim/examples/cxx/CIM/SP_WSCC9bus_SGReducedOrderVBR.cpp +++ b/dpsim/examples/cxx/CIM/SP_WSCC9bus_SGReducedOrderVBR.cpp @@ -129,13 +129,10 @@ int main(int argc, char *argv[]) { sys.addComponent(faultSP); } - sys.initWithPowerflow(systemPF); + sys.initWithPowerflow(systemPF, Domain::SP); for (auto comp : sys.mComponents) { - if (auto genReducedOrder = std::dynamic_pointer_cast>(comp)) { - auto genPF = systemPF.component(comp->name()); - genReducedOrder->terminal(0)->setPower(-genPF->getApparentPower()); + if (auto genReducedOrder = std::dynamic_pointer_cast>(comp)) genReducedOrder->scaleInertiaConstant(inertiaScalingFactor); - } } // Logging diff --git a/dpsim/examples/cxx/CIM/WSCC-9bus_CIM.cpp b/dpsim/examples/cxx/CIM/WSCC-9bus_CIM.cpp index 386e159442..4af2b7bb09 100644 --- a/dpsim/examples/cxx/CIM/WSCC-9bus_CIM.cpp +++ b/dpsim/examples/cxx/CIM/WSCC-9bus_CIM.cpp @@ -72,7 +72,7 @@ int main(int argc, char *argv[]) { CPS::CIM::Reader reader2(simName, Logger::Level::debug, Logger::Level::off); SystemTopology sys = reader2.loadCIM(60, filenames, Domain::DP, PhaseType::Single, CPS::GeneratorType::IdealVoltageSource); - sys.initWithPowerflow(systemPF); + sys.initWithPowerflow(systemPF, CPS::Domain::EMT); // Logging auto logger = DataLogger::make(simName); diff --git a/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_PQLoad_with_PF_Init.cpp b/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_PQLoad_with_PF_Init.cpp index 9a13838376..a0738aaca6 100644 --- a/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_PQLoad_with_PF_Init.cpp +++ b/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_PQLoad_with_PF_Init.cpp @@ -111,7 +111,7 @@ int main(int argc, char* argv[]) { SystemComponentList{extnetDP, lineDP, loadDP}); // Initialization of dynamic topology - systemDP.initWithPowerflow(systemPF); + systemDP.initWithPowerflow(systemPF, Domain::DP); // Logging auto loggerDP = DataLogger::make(simNameDP); diff --git a/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp b/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp index ba4a886269..eb32618902 100644 --- a/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp +++ b/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp @@ -132,7 +132,7 @@ int main(int argc, char* argv[]) { SystemComponentList{extnetDP, lineDP, pv}); // Initialization of dynamic topology with values from powerflow - systemDP.initWithPowerflow(systemPF); + systemDP.initWithPowerflow(systemPF, Domain::DP); // Logging auto loggerDP = DataLogger::make(simName); diff --git a/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_VSI_with_PF_Init.cpp b/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_VSI_with_PF_Init.cpp index dd3ff4d82e..5f0f1ba6bd 100644 --- a/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_VSI_with_PF_Init.cpp +++ b/dpsim/examples/cxx/Circuits/DP_Slack_PiLine_VSI_with_PF_Init.cpp @@ -120,7 +120,7 @@ int main(int argc, char* argv[]) { SystemComponentList{extnetDP, lineDP, pv}); // Initialization of dynamic topology with values from powerflow - systemDP.initWithPowerflow(systemPF); + systemDP.initWithPowerflow(systemPF, Domain::DP); // Logging auto loggerDP = DataLogger::make(simNameDP); diff --git a/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_3Bus_Fault.cpp b/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_3Bus_Fault.cpp index 7862d54ff8..e6899d476d 100644 --- a/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_3Bus_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_3Bus_Fault.cpp @@ -32,13 +32,13 @@ void DP_SynGenTrStab_3Bus_Fault(String simName, Real timeStep, Real finalTime, b auto n3PF = SimNode::make("n3", PhaseType::Single); //Synchronous generator 1 - auto gen1PF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto gen1PF = SP::Ph1::SynchronGenerator::make("SynGen1", Logger::Level::debug); // setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side gen1PF->setParameters(ThreeBus.nomPower_G1, ThreeBus.nomPhPhVoltRMS_G1, ThreeBus.initActivePower_G1, ThreeBus.setPointVoltage_G1*ThreeBus.t1_ratio, PowerflowBusType::VD); gen1PF->setBaseVoltage(ThreeBus.Vnom); //Synchronous generator 2 - auto gen2PF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto gen2PF = SP::Ph1::SynchronGenerator::make("SynGen2", Logger::Level::debug); // setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side gen2PF->setParameters(ThreeBus.nomPower_G2, ThreeBus.nomPhPhVoltRMS_G2, ThreeBus.initActivePower_G2, ThreeBus.setPointVoltage_G2*ThreeBus.t2_ratio, PowerflowBusType::PV); gen2PF->setBaseVoltage(ThreeBus.Vnom); @@ -166,7 +166,7 @@ void DP_SynGenTrStab_3Bus_Fault(String simName, Real timeStep, Real finalTime, b SystemComponentList{gen1DP, gen2DP, loadDP, line12DP, line13DP, line23DP, faultDP}); // Initialization of dynamic topology - systemDP.initWithPowerflow(systemPF); + systemDP.initWithPowerflow(systemPF, Domain::DP); // Logging auto loggerDP = DataLogger::make(simNameDP); diff --git a/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_3Bus_SteadyState.cpp b/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_3Bus_SteadyState.cpp index eb68eb086c..09b7e6a39d 100644 --- a/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_3Bus_SteadyState.cpp +++ b/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_3Bus_SteadyState.cpp @@ -28,13 +28,13 @@ void DP_SynGenTrStab_3Bus_SteadyState(String simName, Real timeStep, Real finalT auto n3PF = SimNode::make("n3", PhaseType::Single); //Synchronous generator 1 - auto gen1PF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto gen1PF = SP::Ph1::SynchronGenerator::make("SynGen1", Logger::Level::debug); // setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side gen1PF->setParameters(ThreeBus.nomPower_G1, ThreeBus.nomPhPhVoltRMS_G1, ThreeBus.initActivePower_G1, ThreeBus.setPointVoltage_G1*ThreeBus.t1_ratio, PowerflowBusType::VD); gen1PF->setBaseVoltage(ThreeBus.Vnom); //Synchronous generator 2 - auto gen2PF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto gen2PF = SP::Ph1::SynchronGenerator::make("SynGen2", Logger::Level::debug); // setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side gen2PF->setParameters(ThreeBus.nomPower_G2, ThreeBus.nomPhPhVoltRMS_G2, ThreeBus.initActivePower_G2, ThreeBus.setPointVoltage_G2*ThreeBus.t2_ratio, PowerflowBusType::PV); gen2PF->setBaseVoltage(ThreeBus.Vnom); @@ -97,20 +97,14 @@ void DP_SynGenTrStab_3Bus_SteadyState(String simName, Real timeStep, Real finalT // Components //Synchronous generator 1 - auto gen1DP = DP::Ph1::SynchronGeneratorTrStab::make("SynGen", Logger::Level::debug); + auto gen1DP = DP::Ph1::SynchronGeneratorTrStab::make("SynGen1", Logger::Level::debug); // Xpd is given in p.u of generator base at transfomer primary side and should be transformed to network side gen1DP->setStandardParametersPU(ThreeBus.nomPower_G1, ThreeBus.nomPhPhVoltRMS_G1, ThreeBus.nomFreq_G1, ThreeBus.Xpd_G1*std::pow(ThreeBus.t1_ratio,2), cmdInertia_G1*ThreeBus.H_G1, ThreeBus.Rs_G1, cmdDamping_G1*ThreeBus.D_G1); - // Get actual active and reactive power of generator's Terminal from Powerflow solution - Complex initApparentPower_G1= gen1PF->getApparentPower(); - gen1DP->setInitialValues(initApparentPower_G1, ThreeBus.initMechPower_G1); //Synchronous generator 2 - auto gen2DP = DP::Ph1::SynchronGeneratorTrStab::make("SynGen", Logger::Level::debug); + auto gen2DP = DP::Ph1::SynchronGeneratorTrStab::make("SynGen2", Logger::Level::debug); // Xpd is given in p.u of generator base at transfomer primary side and should be transformed to network side gen2DP->setStandardParametersPU(ThreeBus.nomPower_G2, ThreeBus.nomPhPhVoltRMS_G2, ThreeBus.nomFreq_G2, ThreeBus.Xpd_G2*std::pow(ThreeBus.t2_ratio,2), cmdInertia_G2*ThreeBus.H_G2, ThreeBus.Rs_G2, cmdDamping_G2*ThreeBus.D_G2); - // Get actual active and reactive power of generator's Terminal from Powerflow solution - Complex initApparentPower_G2= gen2PF->getApparentPower(); - gen2DP->setInitialValues(initApparentPower_G2, ThreeBus.initMechPower_G2); ///Load auto loadDP = DP::Ph1::RXLoad::make("Load", Logger::Level::debug); @@ -138,7 +132,7 @@ void DP_SynGenTrStab_3Bus_SteadyState(String simName, Real timeStep, Real finalT SystemComponentList{gen1DP, gen2DP, loadDP, line12DP, line13DP, line23DP}); // Initialization of dynamic topology - systemDP.initWithPowerflow(systemPF); + systemDP.initWithPowerflow(systemPF, Domain::DP); // Logging auto loggerDP = DataLogger::make(simNameDP); diff --git a/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_SMIB_Fault.cpp b/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_SMIB_Fault.cpp index c12ca1f2ff..7c0fe26a9f 100644 --- a/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_SMIB_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_SMIB_Fault.cpp @@ -123,7 +123,7 @@ void DP_1ph_SynGenTrStab_Fault(String simName, Real timeStep, Real finalTime, bo SystemComponentList{genDP, lineDP, extnetDP, faultDP}); // Initialization of dynamic topology - systemDP.initWithPowerflow(systemPF); + systemDP.initWithPowerflow(systemPF, Domain::DP); // Logging diff --git a/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_SMIB_SteadyState.cpp b/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_SMIB_SteadyState.cpp index d432c908fc..35e1afa389 100644 --- a/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_SMIB_SteadyState.cpp +++ b/dpsim/examples/cxx/Circuits/DP_SynGenTrStab_SMIB_SteadyState.cpp @@ -27,7 +27,7 @@ void DP_1ph_SynGenTrStab_SteadyState(String simName, Real timeStep, Real finalTi auto n2PF = SimNode::make("n2", PhaseType::Single); //Synchronous generator ideal model - auto genPF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto genPF = SP::Ph1::SynchronGenerator::make("SynGen", Logger::Level::debug); // setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side genPF->setParameters(smib.nomPower, smib.nomPhPhVoltRMS, smib.initActivePower, smib.setPointVoltage*smib.t_ratio, PowerflowBusType::PV); genPF->setBaseVoltage(smib.Vnom); @@ -81,9 +81,6 @@ void DP_1ph_SynGenTrStab_SteadyState(String simName, Real timeStep, Real finalTi auto genDP = DP::Ph1::SynchronGeneratorTrStab::make("SynGen", Logger::Level::debug); // Xpd is given in p.u of generator base at transfomer primary side and should be transformed to network side genDP->setStandardParametersPU(smib.nomPower, smib.nomPhPhVoltRMS, smib.nomFreq, smib.Xpd*std::pow(smib.t_ratio,2), cmdInertia*smib.H, smib.Rs, cmdDamping*smib.D ); - // Get actual active and reactive power of generator's Terminal from Powerflow solution - Complex initApparentPower= genPF->getApparentPower(); - genDP->setInitialValues(initApparentPower, smib.initMechPower); //Grid bus as Slack auto extnetDP = DP::Ph1::NetworkInjection::make("Slack", Logger::Level::debug); @@ -101,7 +98,7 @@ void DP_1ph_SynGenTrStab_SteadyState(String simName, Real timeStep, Real finalTi SystemComponentList{genDP, lineDP, extnetDP}); // Initialization of dynamic topology - systemDP.initWithPowerflow(systemPF); + systemDP.initWithPowerflow(systemPF, Domain::DP); // Logging diff --git a/dpsim/examples/cxx/Circuits/EMT_DP_SP_Slack_PiLine_PQLoad_FM.cpp b/dpsim/examples/cxx/Circuits/EMT_DP_SP_Slack_PiLine_PQLoad_FM.cpp index d8280e0fe1..346e06338e 100644 --- a/dpsim/examples/cxx/Circuits/EMT_DP_SP_Slack_PiLine_PQLoad_FM.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_DP_SP_Slack_PiLine_PQLoad_FM.cpp @@ -108,7 +108,7 @@ void simulateDP(SystemTopology& systemPF, String waveform) { SystemComponentList{extnetDP, lineDP, loadDP}); // Initialization of dynamic topology - systemDP.initWithPowerflow(systemPF); + systemDP.initWithPowerflow(systemPF, Domain::DP); // Logging auto loggerDP = DataLogger::make(simNameDP); @@ -163,7 +163,7 @@ void simulateSP(SystemTopology& systemPF, String waveform) { SystemComponentList{extnetSP, lineSP, loadSP}); // Initialization of dynamic topology with values from powerflow - systemSP.initWithPowerflow(systemPF); + systemSP.initWithPowerflow(systemPF, Domain::SP); // Logging auto loggerSP = DataLogger::make(simNameSP); @@ -217,7 +217,7 @@ void simulateEMT(SystemTopology& systemPF, String waveform) { SystemComponentList{extnetEMT, lineEMT, loadEMT}); // Initialization of dynamic topology - systemEMT.initWithPowerflow(systemPF); + systemEMT.initWithPowerflow(systemPF, CPS::Domain::EMT); // Logging auto loggerEMT = DataLogger::make(simNameEMT); diff --git a/dpsim/examples/cxx/Circuits/EMT_DP_SP_Slack_PiLine_PQLoad_FrequencyRamp_CosineFM.cpp b/dpsim/examples/cxx/Circuits/EMT_DP_SP_Slack_PiLine_PQLoad_FrequencyRamp_CosineFM.cpp index 6fa561ad6a..116d9f58ef 100644 --- a/dpsim/examples/cxx/Circuits/EMT_DP_SP_Slack_PiLine_PQLoad_FrequencyRamp_CosineFM.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_DP_SP_Slack_PiLine_PQLoad_FrequencyRamp_CosineFM.cpp @@ -108,7 +108,7 @@ void simulateDP(SystemTopology& systemPF, String waveform) { SystemComponentList{extnetDP, lineDP, loadDP}); // Initialization of dynamic topology - systemDP.initWithPowerflow(systemPF); + systemDP.initWithPowerflow(systemPF, Domain::DP); // Logging auto loggerDP = DataLogger::make(simNameDP); @@ -163,7 +163,7 @@ void simulateSP(SystemTopology& systemPF, String waveform) { SystemComponentList{extnetSP, lineSP, loadSP}); // Initialization of dynamic topology with values from powerflow - systemSP.initWithPowerflow(systemPF); + systemSP.initWithPowerflow(systemPF, Domain::SP); // Logging auto loggerSP = DataLogger::make(simNameSP); @@ -216,7 +216,7 @@ void simulateEMT(SystemTopology& systemPF, String waveform) { SystemComponentList{extnetEMT, lineEMT, loadEMT}); // Initialization of dynamic topology - systemEMT.initWithPowerflow(systemPF); + systemEMT.initWithPowerflow(systemPF, CPS::Domain::EMT); // Logging auto loggerEMT = DataLogger::make(simNameEMT); diff --git a/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_PQLoad_with_PF_Init.cpp b/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_PQLoad_with_PF_Init.cpp index 649cdfb0a4..1f9ec96852 100644 --- a/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_PQLoad_with_PF_Init.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_PQLoad_with_PF_Init.cpp @@ -112,7 +112,7 @@ int main(int argc, char* argv[]) { SystemComponentList{extnetEMT, lineEMT, loadEMT}); // Initialization of dynamic topology - systemEMT.initWithPowerflow(systemPF); + systemEMT.initWithPowerflow(systemPF, CPS::Domain::EMT); // Logging auto loggerEMT = DataLogger::make(simNameEMT); diff --git a/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp b/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp index f3d674a35f..c56697a758 100644 --- a/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp @@ -131,7 +131,7 @@ int main(int argc, char* argv[]) { SystemComponentList{extnetEMT, lineEMT, pv}); // Initialization of dynamic topology - systemEMT.initWithPowerflow(systemPF); + systemEMT.initWithPowerflow(systemPF, CPS::Domain::EMT); // Logging auto loggerEMT = DataLogger::make(simName); diff --git a/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init.cpp b/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init.cpp index b70927eb5b..db9a2586de 100644 --- a/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init.cpp @@ -118,7 +118,7 @@ int main(int argc, char* argv[]) { SystemComponentList{extnetEMT, lineEMT, pv}); // Initialization of dynamic topology - systemEMT.initWithPowerflow(systemPF); + systemEMT.initWithPowerflow(systemPF, CPS::Domain::EMT); // Logging auto loggerEMT = DataLogger::make(simNameEMT); diff --git a/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_DP_SynGenTrStab_SMIB_Fault.cpp b/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_DP_SynGenTrStab_SMIB_Fault.cpp index 19e8151dea..b91064e389 100644 --- a/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_DP_SynGenTrStab_SMIB_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_DP_SynGenTrStab_SMIB_Fault.cpp @@ -61,7 +61,7 @@ void EMT_3ph_SynGenDQ7odTrapez_ThreePhFault(Real timeStep, Real finalTime, bool auto n2PF = SimNode::make("n2", PhaseType::Single); //Synchronous generator ideal model - auto genPF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto genPF = SP::Ph1::SynchronGenerator::make("SynGen", Logger::Level::debug); genPF->setParameters(syngenKundur.nomPower, syngenKundur.nomVoltage, setPointActivePower, setPointVoltage, PowerflowBusType::PV); genPF->setBaseVoltage(VnomMV); genPF->modifyPowerFlowBusType(PowerflowBusType::PV); @@ -156,7 +156,7 @@ void EMT_3ph_SynGenDQ7odTrapez_ThreePhFault(Real timeStep, Real finalTime, bool SystemComponentList{gen, line, fault, extnet}); // Initialization of dynamic topology - system.initWithPowerflow(systemPF); + system.initWithPowerflow(systemPF, CPS::Domain::EMT); // Logging auto logger = DataLogger::make(simName); @@ -253,19 +253,13 @@ void DP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve String simName = "DP_1ph_SynGenTrStab_Fault"; Logger::setLogDir("logs/"+simName); - // Extract relevant powerflow results - Real initActivePower = genPF->getApparentPower().real(); - Real initMechPower = initActivePower; - // Nodes auto n1 = SimNode::make("n1", PhaseType::Single); auto n2 = SimNode::make("n2", PhaseType::Single); // Components auto gen = CPS::DP::Ph1::SynchronGeneratorTrStab::make("SynGen", Logger::Level::debug); - gen->setFundamentalParametersPU(syngenKundur.nomPower, syngenKundur.nomVoltage, syngenKundur.nomFreq, syngenKundur.Ll, syngenKundur.Lmd, syngenKundur.Llfd, syngenKundur.H, 1.5); - gen->setInitialValues(initActivePower, initMechPower); //Grid bus as Slack auto extnet = DP::Ph1::NetworkInjection::make("Slack", Logger::Level::debug); @@ -295,7 +289,7 @@ void DP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve SystemComponentList{gen, line, fault, extnet}); // Initialization of dynamic topology - system.initWithPowerflow(systemPF); + system.initWithPowerflow(systemPF, CPS::Domain::DP); // Logging @@ -347,7 +341,7 @@ void SP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve auto n2PF = SimNode::make("n2", PhaseType::Single); //Synchronous generator ideal model - auto genPF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto genPF = SP::Ph1::SynchronGenerator::make("SynGen", Logger::Level::debug); genPF->setParameters(syngenKundur.nomPower, syngenKundur.nomVoltage, setPointActivePower, setPointVoltage, PowerflowBusType::PV); genPF->setBaseVoltage(VnomMV); genPF->modifyPowerFlowBusType(PowerflowBusType::PV); @@ -394,19 +388,13 @@ void SP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve String simName = "SP_1ph_SynGenTrStab_Fault"; Logger::setLogDir("logs/"+simName); - // Extract relevant powerflow results - Real initActivePower = genPF->getApparentPower().real(); - Real initMechPower = initActivePower; - // Nodes auto n1 = SimNode::make("n1", PhaseType::Single); auto n2 = SimNode::make("n2", PhaseType::Single); // Components auto gen = CPS::SP::Ph1::SynchronGeneratorTrStab::make("SynGen", Logger::Level::debug); - gen->setFundamentalParametersPU(syngenKundur.nomPower, syngenKundur.nomVoltage, syngenKundur.nomFreq, syngenKundur.Ll, syngenKundur.Lmd, syngenKundur.Llfd, syngenKundur.H, 1.5); - gen->setInitialValues(initActivePower, initMechPower); //Grid bus as Slack auto extnet = SP::Ph1::NetworkInjection::make("Slack", Logger::Level::debug); @@ -436,8 +424,7 @@ void SP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve SystemComponentList{gen, line, fault, extnet}); // Initialization of dynamic topology - system.initWithPowerflow(systemPF); - + system.initWithPowerflow(systemPF, CPS::Domain::SP); // Logging auto logger = DataLogger::make(simName); diff --git a/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault.cpp b/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault.cpp index 066ee67328..00db116fc5 100644 --- a/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault.cpp @@ -110,7 +110,7 @@ int main(int argc, char* argv[]) { auto n2PF = SimNode::make("n2", PhaseType::Single); //Synchronous generator ideal model - auto genPF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto genPF = SP::Ph1::SynchronGenerator::make("SynGen", Logger::Level::debug); genPF->setParameters(syngenKundur.nomPower, syngenKundur.nomVoltage, setPointActivePower, setPointVoltage, PowerflowBusType::PV); genPF->setBaseVoltage(VnomMV); genPF->modifyPowerFlowBusType(PowerflowBusType::PV); @@ -196,8 +196,7 @@ int main(int argc, char* argv[]) { SystemComponentList{gen, line, fault, extnet}); // Initialization of dynamic topology - system.initWithPowerflow(systemPF); - gen->terminal(0)->setPower(-genPF->getApparentPower()); + system.initWithPowerflow(systemPF, CPS::Domain::EMT); // Logging auto logger = DataLogger::make(simName); diff --git a/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_JsonSyngenParams.cpp b/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_JsonSyngenParams.cpp index 368b2e0ce9..bbbe2c1bb3 100644 --- a/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_JsonSyngenParams.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_JsonSyngenParams.cpp @@ -74,7 +74,7 @@ int main(int argc, char* argv[]) { auto n2PF = SimNode::make("n2", PhaseType::Single); //Synchronous generator ideal model - auto genPF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto genPF = SP::Ph1::SynchronGenerator::make("SynGen", Logger::Level::debug); genPF->setParameters(syngenKundur.nomPower, syngenKundur.nomVoltage, setPointActivePower, setPointVoltage, PowerflowBusType::PV); genPF->setBaseVoltage(VnomMV); genPF->modifyPowerFlowBusType(PowerflowBusType::PV); @@ -122,13 +122,6 @@ int main(int argc, char* argv[]) { // ----- DYNAMIC SIMULATION ------ Logger::setLogDir("logs/"+simName); - // Extract relevant powerflow results - Real initTerminalVolt=std::abs(n1PF->singleVoltage())*RMS3PH_TO_PEAK1PH; - Real initVoltAngle= Math::phase(n1PF->singleVoltage()); // angle in rad - Real initActivePower = genPF->getApparentPower().real(); - Real initReactivePower = genPF->getApparentPower().imag(); - Real initMechPower = initActivePower; - // Nodes auto n1 = SimNode::make("n1", PhaseType::ABC); auto n2 = SimNode::make("n2", PhaseType::ABC); @@ -140,7 +133,6 @@ int main(int argc, char* argv[]) { syngenKundur.nomPower, syngenKundur.nomVoltage, syngenKundur.nomFreq, syngenKundur.poleNum, syngenKundur.nomFieldCurr, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, syngenKundur.H); - gen->setInitialValues(initActivePower, initReactivePower, initTerminalVolt, initVoltAngle, initMechPower); DPsim::Utils::applySynchronousGeneratorParametersFromJson(simConfig, gen); //Grid bus as Slack @@ -169,7 +161,7 @@ int main(int argc, char* argv[]) { SystemComponentList{gen, line, fault, extnet}); // Initialization of dynamic topology - system.initWithPowerflow(systemPF); + system.initWithPowerflow(systemPF, CPS::Domain::EMT); // Logging auto logger = DataLogger::make(simName); diff --git a/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_SMIB_Fault.cpp b/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_SMIB_Fault.cpp index 8cc125fdd1..7e691a301c 100644 --- a/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_SMIB_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_SynGenDQ7odTrapez_SMIB_Fault.cpp @@ -64,7 +64,7 @@ int main(int argc, char* argv[]) { auto n2PF = SimNode::make("n2", PhaseType::Single); //Synchronous generator ideal model - auto genPF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto genPF = SP::Ph1::SynchronGenerator::make("SynGen", Logger::Level::debug); genPF->setParameters(syngenKundur.nomPower, syngenKundur.nomVoltage, setPointActivePower, setPointVoltage, PowerflowBusType::PV); genPF->setBaseVoltage(VnomMV); genPF->modifyPowerFlowBusType(PowerflowBusType::PV); @@ -158,7 +158,7 @@ int main(int argc, char* argv[]) { SystemComponentList{gen, line, fault, extnet}); // Initialization of dynamic topology - system.initWithPowerflow(systemPF); + system.initWithPowerflow(systemPF, CPS::Domain::EMT); // Logging auto logger = DataLogger::make(simName); diff --git a/dpsim/examples/cxx/Circuits/EMT_SynGenTrStab_SMIB_Fault.cpp b/dpsim/examples/cxx/Circuits/EMT_SynGenTrStab_SMIB_Fault.cpp index 228bdee887..7d64f28f2e 100644 --- a/dpsim/examples/cxx/Circuits/EMT_SynGenTrStab_SMIB_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_SynGenTrStab_SMIB_Fault.cpp @@ -25,7 +25,6 @@ Real Xpd=0.31; Real Rs = 0.003*0; Real D = 1*50; // Initialization parameters -Real initMechPower= 300e6; Real initActivePower = 300e6; Real setPointVoltage=nomPhPhVoltRMS + 0.05*nomPhPhVoltRMS; @@ -59,7 +58,7 @@ void EMT_1ph_SynGenTrStab_Fault(String simName, Real timeStep, Real finalTime, b auto n2PF = SimNode::make("n2", PhaseType::Single); //Synchronous generator ideal model - auto genPF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto genPF = SP::Ph1::SynchronGenerator::make("SynGen", Logger::Level::debug); // setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side genPF->setParameters(nomPower, nomPhPhVoltRMS, initActivePower, setPointVoltage*t_ratio, PowerflowBusType::PV); genPF->setBaseVoltage(Vnom); @@ -114,10 +113,6 @@ void EMT_1ph_SynGenTrStab_Fault(String simName, Real timeStep, Real finalTime, b // Xpd is given in p.u of generator base at transfomer primary side and should be transformed to network side genEMT->setStandardParametersPU(nomPower, nomPhPhVoltRMS, nomFreq, Xpd*std::pow(t_ratio,2), cmdInertia*H, Rs, D ); - // Get actual active and reactive power of generator's Terminal from Powerflow solution - Complex initApparentPower= genPF->getApparentPower(); - genEMT->setInitialValues(initApparentPower, initMechPower); - //Grid bus as Slack auto extnetEMT = EMT::Ph3::NetworkInjection::make("Slack", Logger::Level::debug); @@ -144,8 +139,7 @@ void EMT_1ph_SynGenTrStab_Fault(String simName, Real timeStep, Real finalTime, b SystemComponentList{genEMT, lineEMT, extnetEMT, faultEMT}); // Initialization of dynamic topology - systemEMT.initWithPowerflow(systemPF); - + systemEMT.initWithPowerflow(systemPF, CPS::Domain::EMT); // Logging auto loggerEMT = DataLogger::make(simNameEMT); diff --git a/dpsim/examples/cxx/Circuits/EMT_SynGenTrStab_SMIB_SteadyState.cpp b/dpsim/examples/cxx/Circuits/EMT_SynGenTrStab_SMIB_SteadyState.cpp index 2f5714e8b7..677c6715cb 100644 --- a/dpsim/examples/cxx/Circuits/EMT_SynGenTrStab_SMIB_SteadyState.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_SynGenTrStab_SMIB_SteadyState.cpp @@ -25,7 +25,6 @@ Real Xpd=0.31; Real Rs = 0.003*0; Real D = 1*50; // Initialization parameters -Real initMechPower= 300e6; Real initActivePower = 300e6; Real setPointVoltage=nomPhPhVoltRMS + 0.05*nomPhPhVoltRMS; @@ -55,7 +54,7 @@ void EMT_1ph_SynGenTrStab_SteadyState(String simName, Real timeStep, Real finalT auto n2PF = SimNode::make("n2", PhaseType::Single); //Synchronous generator ideal model - auto genPF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto genPF = SP::Ph1::SynchronGenerator::make("SynGen", Logger::Level::debug); // setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side genPF->setParameters(nomPower, nomPhPhVoltRMS, initActivePower, setPointVoltage*t_ratio, PowerflowBusType::PV); genPF->setBaseVoltage(Vnom); @@ -110,10 +109,6 @@ void EMT_1ph_SynGenTrStab_SteadyState(String simName, Real timeStep, Real finalT // Xpd is given in p.u of generator base at transfomer primary side and should be transformed to network side genEMT->setStandardParametersPU(nomPower, nomPhPhVoltRMS, nomFreq, Xpd*std::pow(t_ratio,2), cmdInertia*H, Rs, D ); - // Get actual active and reactive power of generator's Terminal from Powerflow solution - Complex initApparentPower= genPF->getApparentPower(); - genEMT->setInitialValues(initApparentPower, initMechPower); - //Grid bus as Slack auto extnetEMT = EMT::Ph3::NetworkInjection::make("Slack", Logger::Level::debug); @@ -133,8 +128,7 @@ void EMT_1ph_SynGenTrStab_SteadyState(String simName, Real timeStep, Real finalT SystemComponentList{genEMT, lineEMT, extnetEMT}); // Initialization of dynamic topology - systemEMT.initWithPowerflow(systemPF); - + systemEMT.initWithPowerflow(systemPF, CPS::Domain::EMT); // Logging auto loggerEMT = DataLogger::make(simNameEMT); diff --git a/dpsim/examples/cxx/Circuits/EMT_SynGenVBR_OperationalParams_SMIB_Fault.cpp b/dpsim/examples/cxx/Circuits/EMT_SynGenVBR_OperationalParams_SMIB_Fault.cpp index 0a50918490..7897e18f9f 100644 --- a/dpsim/examples/cxx/Circuits/EMT_SynGenVBR_OperationalParams_SMIB_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_SynGenVBR_OperationalParams_SMIB_Fault.cpp @@ -58,7 +58,7 @@ int main(int argc, char* argv[]) { auto n2PF = SimNode::make("n2", PhaseType::Single); //Synchronous generator ideal model - auto genPF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto genPF = SP::Ph1::SynchronGenerator::make("SynGen", Logger::Level::debug); genPF->setParameters(syngenKundur.nomPower, syngenKundur.nomVoltage, setPointActivePower, setPointVoltage, PowerflowBusType::PV); genPF->setBaseVoltage(VnomMV); genPF->modifyPowerFlowBusType(PowerflowBusType::PV); @@ -144,8 +144,7 @@ int main(int argc, char* argv[]) { SystemComponentList{gen, line, fault, extnet}); // Initialization of dynamic topology - system.initWithPowerflow(systemPF); - gen->terminal(0)->setPower(-genPF->getApparentPower()); + system.initWithPowerflow(systemPF, CPS::Domain::EMT); // Logging auto logger = DataLogger::make(simName); diff --git a/dpsim/examples/cxx/Circuits/EMT_SynGenVBR_SMIB_Fault.cpp b/dpsim/examples/cxx/Circuits/EMT_SynGenVBR_SMIB_Fault.cpp index 5d24224bbd..b61b549c23 100644 --- a/dpsim/examples/cxx/Circuits/EMT_SynGenVBR_SMIB_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/EMT_SynGenVBR_SMIB_Fault.cpp @@ -58,7 +58,7 @@ int main(int argc, char* argv[]) { auto n2PF = SimNode::make("n2", PhaseType::Single); //Synchronous generator ideal model - auto genPF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto genPF = SP::Ph1::SynchronGenerator::make("SynGen", Logger::Level::debug); genPF->setParameters(syngenKundur.nomPower, syngenKundur.nomVoltage, setPointActivePower, setPointVoltage, PowerflowBusType::PV); genPF->setBaseVoltage(VnomMV); genPF->modifyPowerFlowBusType(PowerflowBusType::PV); @@ -112,7 +112,7 @@ int main(int argc, char* argv[]) { Real initActivePower = genPF->getApparentPower().real(); Real initReactivePower = genPF->getApparentPower().imag(); Real initMechPower = initActivePower; - + // Nodes auto n1 = SimNode::make("n1", PhaseType::ABC); auto n2 = SimNode::make("n2", PhaseType::ABC); @@ -152,7 +152,7 @@ int main(int argc, char* argv[]) { SystemComponentList{gen, line, fault, extnet}); // Initialization of dynamic topology - system.initWithPowerflow(systemPF); + system.initWithPowerflow(systemPF, CPS::Domain::EMT); // Logging auto logger = DataLogger::make(simName); diff --git a/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_PQLoad_with_PF_Init.cpp b/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_PQLoad_with_PF_Init.cpp index d49a10b5f2..2005bcd8f1 100644 --- a/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_PQLoad_with_PF_Init.cpp +++ b/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_PQLoad_with_PF_Init.cpp @@ -110,7 +110,7 @@ int main(int argc, char* argv[]) { SystemComponentList{extnetSP, lineSP, loadSP}); // Initialization of dynamic topology with values from powerflow - systemSP.initWithPowerflow(systemPF); + systemSP.initWithPowerflow(systemPF, Domain::SP); // Logging auto loggerSP = DataLogger::make(simNameSP); diff --git a/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp b/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp index b78827c072..8ba2a83952 100644 --- a/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp +++ b/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_VSI_Ramp_with_PF_Init.cpp @@ -131,7 +131,7 @@ int main(int argc, char* argv[]) { SystemComponentList{extnetSP, lineSP, pv}); // Initialization of dynamic topology with values from powerflow - systemSP.initWithPowerflow(systemPF); + systemSP.initWithPowerflow(systemPF, Domain::SP); // Logging auto loggerSP = DataLogger::make(simName); diff --git a/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_VSI_with_PF_Init.cpp b/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_VSI_with_PF_Init.cpp index e3b47c855e..05e001d096 100644 --- a/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_VSI_with_PF_Init.cpp +++ b/dpsim/examples/cxx/Circuits/SP_Slack_PiLine_VSI_with_PF_Init.cpp @@ -120,7 +120,7 @@ int main(int argc, char* argv[]) { SystemComponentList{extnetSP, lineSP, pv}); // Initialization of dynamic topology with values from powerflow - systemSP.initWithPowerflow(systemPF); + systemSP.initWithPowerflow(systemPF, Domain::SP); // Logging auto loggerSP = DataLogger::make(simNameSP); diff --git a/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_3Bus_Fault.cpp b/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_3Bus_Fault.cpp index 4d3320f5dd..0b6e406f6f 100644 --- a/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_3Bus_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_3Bus_Fault.cpp @@ -32,13 +32,13 @@ void SP_SynGenTrStab_3Bus_Fault(String simName, Real timeStep, Real finalTime, b auto n3PF = SimNode::make("n3", PhaseType::Single); //Synchronous generator 1 - auto gen1PF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto gen1PF = SP::Ph1::SynchronGenerator::make("SynGen1", Logger::Level::debug); // setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side gen1PF->setParameters(ThreeBus.nomPower_G1, ThreeBus.nomPhPhVoltRMS_G1, ThreeBus.initActivePower_G1, ThreeBus.setPointVoltage_G1*ThreeBus.t1_ratio, PowerflowBusType::VD); gen1PF->setBaseVoltage(ThreeBus.Vnom); //Synchronous generator 2 - auto gen2PF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto gen2PF = SP::Ph1::SynchronGenerator::make("SynGen2", Logger::Level::debug); // setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side gen2PF->setParameters(ThreeBus.nomPower_G2, ThreeBus.nomPhPhVoltRMS_G2, ThreeBus.initActivePower_G2, ThreeBus.setPointVoltage_G2*ThreeBus.t2_ratio, PowerflowBusType::PV); gen2PF->setBaseVoltage(ThreeBus.Vnom); @@ -108,20 +108,14 @@ void SP_SynGenTrStab_3Bus_Fault(String simName, Real timeStep, Real finalTime, b // Components //Synchronous generator 1 - auto gen1SP = SP::Ph1::SynchronGeneratorTrStab::make("SynGen", Logger::Level::debug); + auto gen1SP = SP::Ph1::SynchronGeneratorTrStab::make("SynGen1", Logger::Level::debug); // Xpd is given in p.u of generator base at transfomer primary side and should be transformed to network side gen1SP->setStandardParametersPU(ThreeBus.nomPower_G1, ThreeBus.nomPhPhVoltRMS_G1, ThreeBus.nomFreq_G1, ThreeBus.Xpd_G1*std::pow(ThreeBus.t1_ratio,2), cmdInertia_G1*ThreeBus.H_G1, ThreeBus.Rs_G1, cmdDamping_G1*ThreeBus.D_G1); - // Get actual active and reactive power of generator's Terminal from Powerflow solution - Complex initApparentPower_G1= gen1PF->getApparentPower(); - gen1SP->setInitialValues(initApparentPower_G1, ThreeBus.initMechPower_G1); //Synchronous generator 2 - auto gen2SP = SP::Ph1::SynchronGeneratorTrStab::make("SynGen", Logger::Level::debug); + auto gen2SP = SP::Ph1::SynchronGeneratorTrStab::make("SynGen2", Logger::Level::debug); // Xpd is given in p.u of generator base at transfomer primary side and should be transformed to network side gen2SP->setStandardParametersPU(ThreeBus.nomPower_G2, ThreeBus.nomPhPhVoltRMS_G2, ThreeBus.nomFreq_G2, ThreeBus.Xpd_G2*std::pow(ThreeBus.t2_ratio,2), cmdInertia_G2*ThreeBus.H_G2, ThreeBus.Rs_G2, cmdDamping_G2*ThreeBus.D_G2); - // Get actual active and reactive power of generator's Terminal from Powerflow solution - Complex initApparentPower_G2= gen2PF->getApparentPower(); - gen2SP->setInitialValues(initApparentPower_G2, ThreeBus.initMechPower_G2); gen2SP->setModelFlags(true); gen2SP->setReferenceOmega(gen1SP->attributeTyped("w_r"), gen1SP->attributeTyped("delta_r")); @@ -166,7 +160,7 @@ void SP_SynGenTrStab_3Bus_Fault(String simName, Real timeStep, Real finalTime, b SystemComponentList{gen1SP, gen2SP, loadSP, line12SP, line13SP, line23SP, faultSP}); // Initialization of dynamic topology - systemSP.initWithPowerflow(systemPF); + systemSP.initWithPowerflow(systemPF, Domain::SP); // Logging auto loggerSP = DataLogger::make(simNameSP); diff --git a/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_3Bus_SteadyState.cpp b/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_3Bus_SteadyState.cpp index 941f7337ac..719ba47183 100644 --- a/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_3Bus_SteadyState.cpp +++ b/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_3Bus_SteadyState.cpp @@ -28,13 +28,13 @@ void SP_SynGenTrStab_3Bus_SteadyState(String simName, Real timeStep, Real finalT auto n3PF = SimNode::make("n3", PhaseType::Single); //Synchronous generator 1 - auto gen1PF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto gen1PF = SP::Ph1::SynchronGenerator::make("SynGen1", Logger::Level::debug); // setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side gen1PF->setParameters(ThreeBus.nomPower_G1, ThreeBus.nomPhPhVoltRMS_G1, ThreeBus.initActivePower_G1, ThreeBus.setPointVoltage_G1*ThreeBus.t1_ratio, PowerflowBusType::VD); gen1PF->setBaseVoltage(ThreeBus.Vnom); //Synchronous generator 2 - auto gen2PF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto gen2PF = SP::Ph1::SynchronGenerator::make("SynGen2", Logger::Level::debug); // setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side gen2PF->setParameters(ThreeBus.nomPower_G2, ThreeBus.nomPhPhVoltRMS_G2, ThreeBus.initActivePower_G2, ThreeBus.setPointVoltage_G2*ThreeBus.t2_ratio, PowerflowBusType::PV); gen2PF->setBaseVoltage(ThreeBus.Vnom); @@ -97,20 +97,14 @@ void SP_SynGenTrStab_3Bus_SteadyState(String simName, Real timeStep, Real finalT // Components //Synchronous generator 1 - auto gen1SP = SP::Ph1::SynchronGeneratorTrStab::make("SynGen", Logger::Level::debug); + auto gen1SP = SP::Ph1::SynchronGeneratorTrStab::make("SynGen1", Logger::Level::debug); // Xpd is given in p.u of generator base at transfomer primary side and should be transformed to network side gen1SP->setStandardParametersPU(ThreeBus.nomPower_G1, ThreeBus.nomPhPhVoltRMS_G1, ThreeBus.nomFreq_G1, ThreeBus.Xpd_G1*std::pow(ThreeBus.t1_ratio,2), cmdInertia_G1*ThreeBus.H_G1, ThreeBus.Rs_G1, cmdDamping_G1*ThreeBus.D_G1); - // Get actual active and reactive power of generator's Terminal from Powerflow solution - Complex initApparentPower_G1= gen1PF->getApparentPower(); - gen1SP->setInitialValues(initApparentPower_G1, ThreeBus.initMechPower_G1); //Synchronous generator 2 - auto gen2SP = SP::Ph1::SynchronGeneratorTrStab::make("SynGen", Logger::Level::debug); + auto gen2SP = SP::Ph1::SynchronGeneratorTrStab::make("SynGen2", Logger::Level::debug); // Xpd is given in p.u of generator base at transfomer primary side and should be transformed to network side gen2SP->setStandardParametersPU(ThreeBus.nomPower_G2, ThreeBus.nomPhPhVoltRMS_G2, ThreeBus.nomFreq_G2, ThreeBus.Xpd_G2*std::pow(ThreeBus.t2_ratio,2), cmdInertia_G2*ThreeBus.H_G2, ThreeBus.Rs_G2, cmdDamping_G2*ThreeBus.D_G2); - // Get actual active and reactive power of generator's Terminal from Powerflow solution - Complex initApparentPower_G2= gen2PF->getApparentPower(); - gen2SP->setInitialValues(initApparentPower_G2, ThreeBus.initMechPower_G2); //Load auto loadSP = SP::Ph1::Load::make("Load", Logger::Level::debug); @@ -138,7 +132,7 @@ void SP_SynGenTrStab_3Bus_SteadyState(String simName, Real timeStep, Real finalT SystemComponentList{gen1SP, gen2SP, loadSP, line12SP, line13SP, line23SP}); // Initialization of dynamic topology - systemSP.initWithPowerflow(systemPF); + systemSP.initWithPowerflow(systemPF, Domain::SP); // Logging auto loggerSP = DataLogger::make(simNameSP); diff --git a/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_Fault.cpp b/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_Fault.cpp index e94f4abf03..7e926e51dc 100644 --- a/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_Fault.cpp +++ b/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_Fault.cpp @@ -31,7 +31,7 @@ void SP_1ph_SynGenTrStab_Fault(String simName, Real timeStep, Real finalTime, bo auto n2PF = SimNode::make("n2", PhaseType::Single); //Synchronous generator ideal model - auto genPF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto genPF = SP::Ph1::SynchronGenerator::make("SynGen", Logger::Level::debug); // setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side genPF->setParameters(smib.nomPower, smib.nomPhPhVoltRMS, smib.initActivePower, smib.setPointVoltage*smib.t_ratio, PowerflowBusType::PV); genPF->setBaseVoltage(smib.Vnom); @@ -91,9 +91,6 @@ void SP_1ph_SynGenTrStab_Fault(String simName, Real timeStep, Real finalTime, bo auto genSP = CPS::SP::Ph1::SynchronGeneratorTrStab::make("SynGen", Logger::Level::debug); // Xpd is given in p.u of generator base at transfomer primary side and should be transformed to network side genSP->setStandardParametersPU(smib.nomPower, smib.nomPhPhVoltRMS, smib.nomFreq, smib.Xpd*std::pow(smib.t_ratio,2), cmdInertia*smib.H, smib.Rs, cmdDamping*smib.D ); - // Get actual active and reactive power of generator's Terminal from Powerflow solution - Complex initApparentPower= genPF->getApparentPower(); - genSP->setInitialValues(initApparentPower, smib.initMechPower); //Grid bus as Slack auto extnetSP = SP::Ph1::NetworkInjection::make("Slack", Logger::Level::debug); @@ -123,8 +120,7 @@ void SP_1ph_SynGenTrStab_Fault(String simName, Real timeStep, Real finalTime, bo SystemComponentList{genSP, lineSP, extnetSP, faultSP}); // Initialization of dynamic topology - systemSP.initWithPowerflow(systemPF); - + systemSP.initWithPowerflow(systemPF, Domain::SP); // Logging auto loggerSP = DataLogger::make(simNameSP); diff --git a/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_Fault_KundurExample1.cpp b/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_Fault_KundurExample1.cpp index a0a8d28c78..0e596fc2e8 100644 --- a/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_Fault_KundurExample1.cpp +++ b/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_Fault_KundurExample1.cpp @@ -33,7 +33,6 @@ Real syngenRsPU = gen.RsPU; Real syngenD = gen.D; // SG - init -Real initMechPower = 0.9*syngenNomPower; Real initActivePower = 0.9*syngenNomPower; Real setPointVoltage = syngenNomVoltage; @@ -72,7 +71,7 @@ void SP_1ph_SynGenTrStab_Fault(String simName, Real timeStep, Real finalTime, Re auto n3PF = SimNode::make("n3", PhaseType::Single); // Synchronous generator ideal model - auto genPF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto genPF = SP::Ph1::SynchronGenerator::make("SynGen", Logger::Level::debug); // setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side genPF->setParameters(syngenNomPower, syngenNomVoltage, initActivePower, setPointVoltage, PowerflowBusType::PV); genPF->setBaseVoltage(nomVoltNetwork); @@ -144,10 +143,6 @@ void SP_1ph_SynGenTrStab_Fault(String simName, Real timeStep, Real finalTime, Re genSP->setStandardParametersPU(syngenNomPower, syngenNomVoltage, nomFreq, syngenXpdPU, cmdInertiaFactor*syngenH, syngenRsPU, syngenD); genSP->setModelFlags(false); - // Get actual active and reactive power of generator's Terminal from Powerflow solution - Complex initApparentPower= genPF->getApparentPower(); - genSP->setInitialValues(initApparentPower, initMechPower); - // Transformer auto trafoSP = CPS::SP::Ph1::Transformer::make("trafo", "trafo", Logger::Level::debug, false); trafoSP->setParameters(transformerNomVoltageHV, transformerNomVoltageMV, transformerRatio, 0, transformerResistance, transformerInductance); @@ -176,8 +171,7 @@ void SP_1ph_SynGenTrStab_Fault(String simName, Real timeStep, Real finalTime, Re SystemComponentList{genSP, trafoSP, lineSP, extnetSP, faultSP}); // Initialization of dynamic topology - systemSP.initWithPowerflow(systemPF); - + systemSP.initWithPowerflow(systemPF, Domain::SP); // Logging auto loggerSP = DataLogger::make(simNameSP); diff --git a/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_SteadyState.cpp b/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_SteadyState.cpp index 738af2d60c..c7bc92b6f7 100644 --- a/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_SteadyState.cpp +++ b/dpsim/examples/cxx/Circuits/SP_SynGenTrStab_SMIB_SteadyState.cpp @@ -27,7 +27,7 @@ void SP_1ph_SynGenTrStab_SteadyState(String simName, Real timeStep, Real finalTi auto n2PF = SimNode::make("n2", PhaseType::Single); //Synchronous generator ideal model - auto genPF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto genPF = SP::Ph1::SynchronGenerator::make("SynGen", Logger::Level::debug); // setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side genPF->setParameters(smib.nomPower, smib.nomPhPhVoltRMS, smib.initActivePower, smib.setPointVoltage*smib.t_ratio, PowerflowBusType::PV); genPF->setBaseVoltage(smib.Vnom); @@ -81,9 +81,6 @@ void SP_1ph_SynGenTrStab_SteadyState(String simName, Real timeStep, Real finalTi auto genSP = SP::Ph1::SynchronGeneratorTrStab::make("SynGen", Logger::Level::debug); // Xpd is given in p.u of generator base at transfomer primary side and should be transformed to network side genSP->setStandardParametersPU(smib.nomPower, smib.nomPhPhVoltRMS, smib.nomFreq, smib.Xpd*std::pow(smib.t_ratio,2), cmdInertia*smib.H, smib.Rs, cmdDamping*smib.D ); - // Get actual active and reactive power of generator's Terminal from Powerflow solution - Complex initApparentPower= genPF->getApparentPower(); - genSP->setInitialValues(initApparentPower, smib.initMechPower); //Grid bus as Slack auto extnetSP = SP::Ph1::NetworkInjection::make("Slack", Logger::Level::debug); @@ -101,8 +98,7 @@ void SP_1ph_SynGenTrStab_SteadyState(String simName, Real timeStep, Real finalTi SystemComponentList{genSP, lineSP, extnetSP}); // Initialization of dynamic topology - systemSP.initWithPowerflow(systemPF); - + systemSP.initWithPowerflow(systemPF, Domain::SP); // Logging auto loggerSP = DataLogger::make(simNameSP); diff --git a/dpsim/examples/cxx/Components/DP_SP_SynGenTrStab_testModels.cpp b/dpsim/examples/cxx/Components/DP_SP_SynGenTrStab_testModels.cpp index 7efbdec358..2756b436fe 100644 --- a/dpsim/examples/cxx/Components/DP_SP_SynGenTrStab_testModels.cpp +++ b/dpsim/examples/cxx/Components/DP_SP_SynGenTrStab_testModels.cpp @@ -30,12 +30,6 @@ Real Rkq1 = 0.0062; Real Llkq1 = 0.7252; Real Rkq2 = 0.0237; Real Llkq2 = 0.125; -// Initialization parameters -Real initActivePower = 300e6; -Real initReactivePower = 0; -Real initMechPower = 300e6; -// Real initTerminalVolt = 24000 / sqrt(3) * sqrt(2); -// Real initVoltAngle = -PI / 2; //PiLine parameters calculated from CIGRE Benchmark system (works with 1us) //1oo km length 230kV @@ -86,7 +80,7 @@ void SP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve auto n2PF = SimNode::make("n2", PhaseType::Single); //Synchronous generator ideal model - auto genPF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto genPF = SP::Ph1::SynchronGenerator::make("SynGen", Logger::Level::debug); genPF->setParameters(ratedApparentPower, ratedVoltage, setPointActivePower, setPointVoltage, PowerflowBusType::PV); genPF->setBaseVoltage(Vnom); genPF->modifyPowerFlowBusType(PowerflowBusType::PV); @@ -140,7 +134,6 @@ void SP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve // Components auto gen = CPS::SP::Ph1::SynchronGeneratorTrStab::make("SynGen", Logger::Level::debug); gen->setFundamentalParametersPU(nomPower, nomPhPhVoltRMS, nomFreq, Ll, Lmd, Llfd, H); - gen->setInitialValues(initActivePower, initMechPower); //Grid bus as Slack auto extnet = SP::Ph1::NetworkInjection::make("Slack", Logger::Level::debug); @@ -164,7 +157,7 @@ void SP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve SystemComponentList{gen, line, fault, extnet}); // Initialization of dynamic topology - system.initWithPowerflow(systemPF); + system.initWithPowerflow(systemPF, CPS::Domain::SP); // Logging @@ -215,7 +208,7 @@ void DP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve auto n2PF = SimNode::make("n2", PhaseType::Single); //Synchronous generator ideal model - auto genPF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto genPF = SP::Ph1::SynchronGenerator::make("SynGen", Logger::Level::debug); genPF->setParameters(ratedApparentPower, ratedVoltage, setPointActivePower, setPointVoltage, PowerflowBusType::PV); genPF->setBaseVoltage(Vnom); genPF->modifyPowerFlowBusType(PowerflowBusType::PV); @@ -269,7 +262,6 @@ void DP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve // Components auto gen = CPS::DP::Ph1::SynchronGeneratorTrStab::make("SynGen", Logger::Level::debug); gen->setFundamentalParametersPU(nomPower, nomPhPhVoltRMS, nomFreq, Ll, Lmd, Llfd, H); - gen->setInitialValues(initActivePower, initMechPower); //Grid bus as Slack auto extnet = DP::Ph1::NetworkInjection::make("Slack", Logger::Level::debug); @@ -293,7 +285,7 @@ void DP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve SystemComponentList{gen, line, fault, extnet}); // Initialization of dynamic topology - system.initWithPowerflow(systemPF); + system.initWithPowerflow(systemPF, CPS::Domain::DP); // Logging diff --git a/dpsim/examples/cxx/Components/DP_SP_SynGenTrStab_testModels_doubleLine.cpp b/dpsim/examples/cxx/Components/DP_SP_SynGenTrStab_testModels_doubleLine.cpp index bad77ce355..5867eb97e2 100644 --- a/dpsim/examples/cxx/Components/DP_SP_SynGenTrStab_testModels_doubleLine.cpp +++ b/dpsim/examples/cxx/Components/DP_SP_SynGenTrStab_testModels_doubleLine.cpp @@ -30,13 +30,6 @@ Real Rkq1 = 0.0062; Real Llkq1 = 0.7252; Real Rkq2 = 0.0237; Real Llkq2 = 0.125; -// Initialization parameters -Real initActivePower = 300e6; -Real initReactivePower = 0; -Real initMechPower = 300e6; -// Real initTerminalVolt = 24000 / sqrt(3) * sqrt(2); -// Real initVoltAngle = -PI / 2; - //PiLine parameters calculated from CIGRE Benchmark system Real lineResistance = 0.073; @@ -84,7 +77,7 @@ void SP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve auto n3PF = SimNode::make("n3", PhaseType::Single); //Synchronous generator ideal model - auto genPF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto genPF = SP::Ph1::SynchronGenerator::make("SynGen", Logger::Level::debug); genPF->setParameters(ratedApparentPower, ratedVoltage, setPointActivePower, setPointVoltage, PowerflowBusType::PV); genPF->setBaseVoltage(Vnom); genPF->modifyPowerFlowBusType(PowerflowBusType::PV); @@ -153,8 +146,6 @@ void SP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve // Components auto gen = CPS::SP::Ph1::SynchronGeneratorTrStab::make("SynGen", Logger::Level::debug); gen->setFundamentalParametersPU(nomPower, nomPhPhVoltRMS, nomFreq, Ll, Lmd, Llfd, H); - gen->setInitialValues(initActivePower, initMechPower); - //Grid bus as Slack auto extnet = SP::Ph1::NetworkInjection::make("Slack", Logger::Level::debug); @@ -191,7 +182,7 @@ void SP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve // Initialization of dynamic topology - system.initWithPowerflow(systemPF); + system.initWithPowerflow(systemPF, CPS::Domain::SP); // Logging @@ -247,7 +238,7 @@ void DP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve auto n3PF = SimNode::make("n3", PhaseType::Single); //Synchronous generator ideal model - auto genPF = SP::Ph1::SynchronGenerator::make("Generator", Logger::Level::debug); + auto genPF = SP::Ph1::SynchronGenerator::make("SynGen", Logger::Level::debug); genPF->setParameters(ratedApparentPower, ratedVoltage, setPointActivePower, setPointVoltage, PowerflowBusType::PV); genPF->setBaseVoltage(Vnom); genPF->modifyPowerFlowBusType(PowerflowBusType::PV); @@ -316,7 +307,6 @@ void DP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve // Components auto gen = CPS::DP::Ph1::SynchronGeneratorTrStab::make("SynGen", Logger::Level::debug); gen->setFundamentalParametersPU(nomPower, nomPhPhVoltRMS, nomFreq, Ll, Lmd, Llfd, H); - gen->setInitialValues(initActivePower, initMechPower); //Grid bus as Slack auto extnet = DP::Ph1::NetworkInjection::make("Slack", Logger::Level::debug); @@ -348,7 +338,7 @@ void DP_1ph_SynGenTrStab_Fault(Real timeStep, Real finalTime, bool startFaultEve SystemComponentList{gen, line1, line21, fault, line22, extnet}); // Initialization of dynamic topology - system.initWithPowerflow(systemPF); + system.initWithPowerflow(systemPF, CPS::Domain::DP); // Logging diff --git a/dpsim/include/dpsim/MNASolver.h b/dpsim/include/dpsim/MNASolver.h index 8c748732fc..9fca8294db 100644 --- a/dpsim/include/dpsim/MNASolver.h +++ b/dpsim/include/dpsim/MNASolver.h @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/dpsim/include/dpsim/PFSolverPowerPolar.h b/dpsim/include/dpsim/PFSolverPowerPolar.h index 2b56c9b3d6..6181f4e86b 100644 --- a/dpsim/include/dpsim/PFSolverPowerPolar.h +++ b/dpsim/include/dpsim/PFSolverPowerPolar.h @@ -61,6 +61,8 @@ namespace DPsim { void calculatePAndQAtSlackBus(); /// Calculate the reactive power at all PV buses from current solution void calculateQAtPVBuses(); + /// Calculate complex power flowing from this node to the other nodes + void calculatePAndQInjectionPQBuses(); /// Calculate branch flows from current solution and store them in line and transformer components void calculateBranchFlow(); /// Calculate nodal power injections and store them in first line or transformer (in case no line is connected), so that lower level classes (Node, TopologicalTerminal) can stay untouched diff --git a/dpsim/src/PFSolverPowerPolar.cpp b/dpsim/src/PFSolverPowerPolar.cpp index 0fd371e1b2..233f1edc85 100644 --- a/dpsim/src/PFSolverPowerPolar.cpp +++ b/dpsim/src/PFSolverPowerPolar.cpp @@ -92,6 +92,20 @@ void PFSolverPowerPolar::generateInitialSolution(Real time, bool keep_last_solut for (auto comp : mSystem.mComponentsAtNode[vd]) { if (std::shared_ptr extnet = std::dynamic_pointer_cast(comp)) { sol_V(vd->matrixNodeIndex()) = extnet->attributeTyped("V_set_pu")->get(); + sol_P(vd->matrixNodeIndex()) += extnet->attributeTyped("p_inj")->get() / mBaseApparentPower; // Todo add p_set q_set to extnet + sol_Q(vd->matrixNodeIndex()) += extnet->attributeTyped("q_inj")->get() / mBaseApparentPower; + } + + // if load at VD bus, substract P and Q + else if (std::shared_ptr load = std::dynamic_pointer_cast(comp)) { + sol_P(vd->matrixNodeIndex()) -= load->attributeTyped("P_pu")->get(); + sol_Q(vd->matrixNodeIndex()) -= load->attributeTyped("Q_pu")->get(); + } + + // if generator at VD, add P_set Q_Set + else if (std::shared_ptr gen = std::dynamic_pointer_cast(comp)) { + sol_P(vd->matrixNodeIndex()) += gen->attributeTyped("P_set_pu")->get(); + sol_Q(vd->matrixNodeIndex()) += gen->attributeTyped("Q_set_pu")->get(); } } @@ -267,6 +281,7 @@ void PFSolverPowerPolar::setSolution() { else { calculatePAndQAtSlackBus(); calculateQAtPVBuses(); + calculatePAndQInjectionPQBuses(); SPDLOG_LOGGER_INFO(mSLog, "converged in {} iterations",mIterations); SPDLOG_LOGGER_INFO(mSLog, "Solution: "); SPDLOG_LOGGER_INFO(mSLog, "P\t\tQ\t\tV\t\tD"); @@ -279,7 +294,7 @@ void PFSolverPowerPolar::setSolution() { sol_V_complex(i) = CPS::Complex(sol_V.coeff(i)*cos(sol_D.coeff(i)), sol_V.coeff(i)*sin(sol_D.coeff(i))); } -// update voltage and power at each node + // update voltage and power at each node for (auto node : mSystem.mNodes) { std::dynamic_pointer_cast>(node)->setVoltage(sol_V_complex(node->matrixNodeIndex())*mBaseVoltageAtNode[node]); std::dynamic_pointer_cast>(node)->setPower(sol_S_complex(node->matrixNodeIndex())*mBaseApparentPower); @@ -353,47 +368,102 @@ Real PFSolverPowerPolar::Q(UInt k) { } void PFSolverPowerPolar::calculatePAndQAtSlackBus() { - for (auto k: mVDBusIndices) { + // calculates apparent power injection at slack buses flowing to other nodes (i.e. S_inj_to_other = S_inj - S_shunt, with S_inj = S_gen - S_load) + for (auto topoNode: mVDBuses) { + auto node_idx = topoNode->matrixNodeIndex(); + + // calculate power flowing out of the node into the admittance matrix (i.e. S_inj) CPS::Complex I(0.0, 0.0); - for (UInt j = 0; j < mSystem.mNodes.size(); ++j) { - I += mY.coeff(k, j) * sol_Vcx(j); - } - CPS::Complex S(0.0, 0.0); - S = sol_Vcx(k) * conj(I); - sol_P(k) = S.real(); - sol_Q(k) = S.imag(); - for(auto extnet : mExternalGrids){ - if(extnet->mPowerflowBusType==CPS::PowerflowBusType::VD){ - extnet->updatePowerInjection(S*mBaseApparentPower); + for (UInt j = 0; j < mSystem.mNodes.size(); ++j) + I += mY.coeff(node_idx, j) * sol_Vcx(j); + CPS::Complex S = sol_Vcx(node_idx) * conj(I); + + // add load power to obtain generator power (S_gen = S_inj + S_load) + for(auto comp : mSystem.mComponentsAtNode[topoNode]) + if (auto loadPtr = std::dynamic_pointer_cast(comp)) + S += Complex(**(loadPtr->mActivePowerPerUnit), **(loadPtr->mReactivePowerPerUnit)); + + // Set power of either VD-type external network injection or VD-type synchronous generator depending on what is connected + for(auto comp : mSystem.mComponentsAtNode[topoNode]) { + if(auto extnetPtr = std::dynamic_pointer_cast(comp)) { + extnetPtr->updatePowerInjection(S*mBaseApparentPower); break; } - } - for(auto gen : mSynchronGenerators){ - if(gen->mPowerflowBusType==CPS::PowerflowBusType::VD){ - gen->updatePowerInjection(S*mBaseApparentPower); + if(auto sgPtr = std::dynamic_pointer_cast(comp)) { + sgPtr->updatePowerInjection(S*mBaseApparentPower); break; } } + + // Subtracting shunt power to obtain power injection flowing from this node to the other nodes + // FIXME: this calculates here S_gen-S_shunt, which is equal to S_inj_to_other+S_load, but generally not equal to S_inj_to_other + CPS::Real V = sol_V.coeff(node_idx); + for(auto comp : mSystem.mComponentsAtNode[topoNode]) + if (auto shuntPtr = std::dynamic_pointer_cast(comp)) + // capacitive susceptance is positive --> q is injected into the node + S += std::pow(V,2) * Complex(-**(shuntPtr->mConductancePerUnit), **(shuntPtr->mSusceptancePerUnit)); + + // TODO: check whether S_inj_to_other+S_load should be stored here in sol_P and sol_Q or rather S_inj + sol_P(node_idx) = S.real(); + sol_Q(node_idx) = S.imag(); } } void PFSolverPowerPolar::calculateQAtPVBuses() { - for (auto k: mPVBusIndices) { + // calculates apparent power injection at PV buses flowing to other nodes (i.e. S_inj_to_other = S_inj - S_shunt, with S_inj = S_gen - S_load) + for (auto topoNode: mPVBuses) { + auto node_idx = topoNode->matrixNodeIndex(); + + // calculate power flowing out of the node into the admittance matrix (i.e. S_inj) CPS::Complex I(0.0, 0.0); - for (UInt j = 0; j < mSystem.mNodes.size(); ++j) { - I += mY.coeff(k, j) * sol_Vcx(j); - } - CPS::Complex S(0.0, 0.0); - S = sol_Vcx(k) * conj(I); - sol_Q(k) = S.imag(); + for (UInt j = 0; j < mSystem.mNodes.size(); ++j) + I += mY.coeff(node_idx, j) * sol_Vcx(j); + Complex S = sol_Vcx(node_idx) * conj(I); + + // add load power to obtain generator power (S_gen = S_inj + S_load) + auto Sgen = S; + for(auto comp : mSystem.mComponentsAtNode[topoNode]) + if (auto loadPtr = std::dynamic_pointer_cast(comp)) + Sgen += Complex(**(loadPtr->mActivePowerPerUnit), **(loadPtr->mReactivePowerPerUnit)); + + // Set power of generator + for(auto comp : mSystem.mComponentsAtNode[topoNode]) + if(auto sgPtr = std::dynamic_pointer_cast(comp)) + sgPtr->updatePowerInjection(Sgen*mBaseApparentPower); + + // Subtracting shunt power to obtain power injection flowing from this node to the other nodes (i.e. S_inj_to_other = S_inj - S_shunt) + CPS::Real V = sol_V.coeff(node_idx); + for(auto comp : mSystem.mComponentsAtNode[topoNode]) + if (auto shuntPtr = std::dynamic_pointer_cast(comp)) + // capacitive susceptance is positive --> q is injected into the node + S += std::pow(V,2) * Complex(-**(shuntPtr->mConductancePerUnit), **(shuntPtr->mSusceptancePerUnit)); + + // TODO: check whether Q_inj_to_other should be stored in sol_Q or rather Q_inj + sol_Q(node_idx) = S.imag(); + } +} - for (auto topoNode : mSystem.mNodes) - if (topoNode->matrixNodeIndex() == k) - for(auto comp : mSystem.mComponentsAtNode[topoNode]) - if(auto genPtr = std::dynamic_pointer_cast(comp)) - if (genPtr->mPowerflowBusType==CPS::PowerflowBusType::PV) - genPtr->updateReactivePowerInjection(S*mBaseApparentPower); +void PFSolverPowerPolar::calculatePAndQInjectionPQBuses() { + // calculates apparent power injection at PQ buses flowing to other nodes (i.e. S_inj_to_other = S_inj - S_shunt, with S_inj = S_gen - S_load) + for (auto topoNode: mPQBuses) { + auto node_idx = topoNode->matrixNodeIndex(); + // calculate power flowing out of the node into the admittance matrix (i.e. S_inj) + CPS::Complex I(0.0, 0.0); + for (UInt j = 0; j < mSystem.mNodes.size(); ++j) + I += mY.coeff(node_idx, j) * sol_Vcx(j); + CPS::Complex S = sol_Vcx(node_idx) * conj(I); + + // Subtracting shunt power to obtain power injection flowing from this node to the other nodes (i.e. S_inj_to_other) + CPS::Real V = sol_V.coeff(node_idx); + for(auto comp : mSystem.mComponentsAtNode[topoNode]) + if (auto shuntPtr = std::dynamic_pointer_cast(comp)) + // capacitive susceptance is positive --> q is injected into the node + S += std::pow(V,2) * Complex(-**(shuntPtr->mConductancePerUnit), **(shuntPtr->mSusceptancePerUnit)); + + // TODO: check whether S_inj_to_other should be stored in sol_P and sol_Q or rather S_inj + sol_P(node_idx) = S.real(); + sol_Q(node_idx) = S.imag(); } } diff --git a/dpsim/src/pybind/main.cpp b/dpsim/src/pybind/main.cpp index ddd64bb5eb..4041e724b8 100644 --- a/dpsim/src/pybind/main.cpp +++ b/dpsim/src/pybind/main.cpp @@ -44,6 +44,7 @@ PYBIND11_MODULE(dpsimpy, m) { and to parameterize all components of the network from Python. )pbdoc"; + //Enums py::enum_(m, "LogLevel") .value("trace", CPS::Logger::Level::trace) .value("debug", CPS::Logger::Level::debug) @@ -58,6 +59,85 @@ PYBIND11_MODULE(dpsimpy, m) { .def_static("single_phase_parameter_to_three_phase", &CPS::Math::singlePhaseParameterToThreePhase) .def_static("single_phase_power_to_three_phase", &CPS::Math::singlePhasePowerToThreePhase); + py::enum_(m, "SolverBehaviour") + .value("Initialization", DPsim::Solver::Behaviour::Initialization) + .value("Simulation", DPsim::Solver::Behaviour::Simulation); + + py::enum_(m, "Domain") + .value("SP", CPS::Domain::SP) + .value("DP", CPS::Domain::DP) + .value("EMT", CPS::Domain::EMT); + + py::enum_(m, "PhaseType") + .value("A", CPS::PhaseType::A) + .value("B", CPS::PhaseType::B) + .value("C", CPS::PhaseType::C) + .value("ABC", CPS::PhaseType::ABC) + .value("Single", CPS::PhaseType::Single); + + py::enum_(m, "PowerflowBusType") + .value("PV", CPS::PowerflowBusType::PV) + .value("PQ", CPS::PowerflowBusType::PQ) + .value("VD", CPS::PowerflowBusType::VD) + .value("None", CPS::PowerflowBusType::None); + + py::enum_(m, "GeneratorType") + .value("PVNode", CPS::GeneratorType::PVNode) + .value("TransientStability", CPS::GeneratorType::TransientStability) + .value("IdealVoltageSource", CPS::GeneratorType::IdealVoltageSource) + .value("SG3OrderVBR", CPS::GeneratorType::SG3OrderVBR) + .value("SG4OrderVBR", CPS::GeneratorType::SG4OrderVBR) + .value("SG5OrderVBR", CPS::GeneratorType::SG5OrderVBR) + .value("SG6aOrderVBR", CPS::GeneratorType::SG6aOrderVBR) + .value("SG6bOrderVBR", CPS::GeneratorType::SG6bOrderVBR) + .value("FullOrderVBR", CPS::GeneratorType::FullOrderVBR) + .value("FullOrder", CPS::GeneratorType::FullOrder) + .value("NONE", CPS::GeneratorType::None); + + py::enum_(m, "Solver") + .value("MNA", DPsim::Solver::Type::MNA) + .value("DAE", DPsim::Solver::Type::DAE) + .value("NRP", DPsim::Solver::Type::NRP); + + py::enum_(m, "DirectLinearSolverImpl") + .value("Undef", DPsim::DirectLinearSolverImpl::Undef) + .value("DenseLU", DPsim::DirectLinearSolverImpl::DenseLU) + .value("SparseLU", DPsim::DirectLinearSolverImpl::SparseLU) + .value("KLU", DPsim::DirectLinearSolverImpl::KLU) + .value("CUDADense", DPsim::DirectLinearSolverImpl::CUDADense) + .value("CUDASparse", DPsim::DirectLinearSolverImpl::CUDASparse) + .value("CUDAMagma", DPsim::DirectLinearSolverImpl::CUDAMagma); + + py::enum_(m, "scaling_method") + .value("no_scaling", DPsim::SCALING_METHOD::NO_SCALING) + .value("sum_scaling", DPsim::SCALING_METHOD::SUM_SCALING) + .value("max_scaling", DPsim::SCALING_METHOD::MAX_SCALING); + + py::enum_(m, "fill_in_reduction_method") + .value("amd", DPsim::FILL_IN_REDUCTION_METHOD::AMD) + .value("amd_nv", DPsim::FILL_IN_REDUCTION_METHOD::AMD_NV) + .value("amd_ra", DPsim::FILL_IN_REDUCTION_METHOD::AMD_RA) + .value("colamd", DPsim::FILL_IN_REDUCTION_METHOD::COLAMD); + + py::enum_(m, "partial_refactorization_method") + .value("no_partial_refactorization", DPsim::PARTIAL_REFACTORIZATION_METHOD::NO_PARTIAL_REFACTORIZATION) + .value("factorization_path", DPsim::PARTIAL_REFACTORIZATION_METHOD::FACTORIZATION_PATH) + .value("refactorization_restart", DPsim::PARTIAL_REFACTORIZATION_METHOD::REFACTORIZATION_RESTART); + + py::enum_(m, "use_btf") + .value("no_btf", DPsim::USE_BTF::NO_BTF) + .value("do_btf", DPsim::USE_BTF::DO_BTF); + + py::enum_(m, "CSVReaderMode") + .value("AUTO", CPS::CSVReader::Mode::AUTO) + .value("MANUAL", CPS::CSVReader::Mode::MANUAL); + + py::enum_(m, "CSVReaderFormat") + .value("HHMMSS", CPS::CSVReader::DataFormat::HHMMSS) + .value("SECONDS", CPS::CSVReader::DataFormat::SECONDS) + .value("HOURS", CPS::CSVReader::DataFormat::HOURS) + .value("MINUTES", CPS::CSVReader::DataFormat::MINUTES); + m.attr("RMS3PH_TO_PEAK1PH") = RMS3PH_TO_PEAK1PH; m.attr("PEAK1PH_TO_RMS3PH") = PEAK1PH_TO_RMS3PH; m.attr("P_SNUB_TRANSFORMER") = P_SNUB_TRANSFORMER; @@ -133,9 +213,10 @@ PYBIND11_MODULE(dpsimpy, m) { #endif .def_readwrite("nodes", &DPsim::SystemTopology::mNodes) .def_readwrite("components", &DPsim::SystemTopology::mComponents) + .def_readwrite("components_at_node", &DPsim::SystemTopology::mComponentsAtNode) .def_readonly("tear_components", &DPsim::SystemTopology::mTearComponents) .def("list_idobjects", &DPsim::SystemTopology::listIdObjects) - .def("init_with_powerflow", &DPsim::SystemTopology::initWithPowerflow); + .def("init_with_powerflow", &DPsim::SystemTopology::initWithPowerflow, "systemPF"_a, "domain"_a); py::class_>(m, "Interface"); @@ -165,87 +246,6 @@ PYBIND11_MODULE(dpsimpy, m) { .def("print_attribute", &printAttribute, "attribute_name"_a) .def("__str__", &getAttributeList); - //Enums - - py::enum_(m, "SolverBehaviour") - .value("Initialization", DPsim::Solver::Behaviour::Initialization) - .value("Simulation", DPsim::Solver::Behaviour::Simulation); - - py::enum_(m, "Domain") - .value("SP", CPS::Domain::SP) - .value("DP", CPS::Domain::DP) - .value("EMT", CPS::Domain::EMT); - - py::enum_(m, "PhaseType") - .value("A", CPS::PhaseType::A) - .value("B", CPS::PhaseType::B) - .value("C", CPS::PhaseType::C) - .value("ABC", CPS::PhaseType::ABC) - .value("Single", CPS::PhaseType::Single); - - py::enum_(m, "PowerflowBusType") - .value("PV", CPS::PowerflowBusType::PV) - .value("PQ", CPS::PowerflowBusType::PQ) - .value("VD", CPS::PowerflowBusType::VD) - .value("None", CPS::PowerflowBusType::None); - - py::enum_(m, "GeneratorType") - .value("PVNode", CPS::GeneratorType::PVNode) - .value("TransientStability", CPS::GeneratorType::TransientStability) - .value("IdealVoltageSource", CPS::GeneratorType::IdealVoltageSource) - .value("SG3OrderVBR", CPS::GeneratorType::SG3OrderVBR) - .value("SG4OrderVBR", CPS::GeneratorType::SG4OrderVBR) - .value("SG5OrderVBR", CPS::GeneratorType::SG5OrderVBR) - .value("SG6aOrderVBR", CPS::GeneratorType::SG6aOrderVBR) - .value("SG6bOrderVBR", CPS::GeneratorType::SG6bOrderVBR) - .value("FullOrderVBR", CPS::GeneratorType::FullOrderVBR) - .value("FullOrder", CPS::GeneratorType::FullOrder) - .value("NONE", CPS::GeneratorType::None); - - py::enum_(m, "Solver") - .value("MNA", DPsim::Solver::Type::MNA) - .value("DAE", DPsim::Solver::Type::DAE) - .value("NRP", DPsim::Solver::Type::NRP); - - py::enum_(m, "DirectLinearSolverImpl") - .value("Undef", DPsim::DirectLinearSolverImpl::Undef) - .value("DenseLU", DPsim::DirectLinearSolverImpl::DenseLU) - .value("SparseLU", DPsim::DirectLinearSolverImpl::SparseLU) - .value("KLU", DPsim::DirectLinearSolverImpl::KLU) - .value("CUDADense", DPsim::DirectLinearSolverImpl::CUDADense) - .value("CUDASparse", DPsim::DirectLinearSolverImpl::CUDASparse) - .value("CUDAMagma", DPsim::DirectLinearSolverImpl::CUDAMagma); - - py::enum_(m, "scaling_method") - .value("no_scaling", DPsim::SCALING_METHOD::NO_SCALING) - .value("sum_scaling", DPsim::SCALING_METHOD::SUM_SCALING) - .value("max_scaling", DPsim::SCALING_METHOD::MAX_SCALING); - - py::enum_(m, "fill_in_reduction_method") - .value("amd", DPsim::FILL_IN_REDUCTION_METHOD::AMD) - .value("amd_nv", DPsim::FILL_IN_REDUCTION_METHOD::AMD_NV) - .value("amd_ra", DPsim::FILL_IN_REDUCTION_METHOD::AMD_RA) - .value("colamd", DPsim::FILL_IN_REDUCTION_METHOD::COLAMD); - - py::enum_(m, "partial_refactorization_method") - .value("no_partial_refactorization", DPsim::PARTIAL_REFACTORIZATION_METHOD::NO_PARTIAL_REFACTORIZATION) - .value("factorization_path", DPsim::PARTIAL_REFACTORIZATION_METHOD::FACTORIZATION_PATH) - .value("refactorization_restart", DPsim::PARTIAL_REFACTORIZATION_METHOD::REFACTORIZATION_RESTART); - - py::enum_(m, "use_btf") - .value("no_btf", DPsim::USE_BTF::NO_BTF) - .value("do_btf", DPsim::USE_BTF::DO_BTF); - - py::enum_(m, "CSVReaderMode") - .value("AUTO", CPS::CSVReader::Mode::AUTO) - .value("MANUAL", CPS::CSVReader::Mode::MANUAL); - - py::enum_(m, "CSVReaderFormat") - .value("HHMMSS", CPS::CSVReader::DataFormat::HHMMSS) - .value("SECONDS", CPS::CSVReader::DataFormat::SECONDS) - .value("HOURS", CPS::CSVReader::DataFormat::HOURS) - .value("MINUTES", CPS::CSVReader::DataFormat::MINUTES); - #ifdef WITH_CIM py::class_(m, "CIMReader") .def(py::init(), "name"_a, "loglevel"_a = CPS::Logger::Level::info, "comploglevel"_a = CPS::Logger::Level::off) diff --git a/examples/Notebooks/Circuits/Compare_DP_SMIB_ReducedOrderSG_VBR_PCM_LoadStep.ipynb b/examples/Notebooks/Circuits/Compare_DP_SMIB_ReducedOrderSG_VBR_PCM_LoadStep.ipynb index 3ba502fa32..878c3c61f1 100644 --- a/examples/Notebooks/Circuits/Compare_DP_SMIB_ReducedOrderSG_VBR_PCM_LoadStep.ipynb +++ b/examples/Notebooks/Circuits/Compare_DP_SMIB_ReducedOrderSG_VBR_PCM_LoadStep.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -8,6 +9,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -35,6 +37,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -81,6 +84,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -134,6 +138,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -151,13 +156,13 @@ "\n", "### Nodes\n", "gnd_pf = dpsimpy.sp.SimNode.gnd\n", - "n1_pf = dpsimpy.sp.SimNode('n1_pf', dpsimpy.PhaseType.Single)\n", - "n2_pf = dpsimpy.sp.SimNode('n2_pf', dpsimpy.PhaseType.Single)\n", + "n1_pf = dpsimpy.sp.SimNode('n1', dpsimpy.PhaseType.Single)\n", + "n2_pf = dpsimpy.sp.SimNode('n2', dpsimpy.PhaseType.Single)\n", "\n", "### Components\n", "\n", "# syncrhon generator\n", - "gen_pf = dpsimpy.sp.ph1.SynchronGenerator('gen_pf', dpsimpy.LogLevel.debug)\n", + "gen_pf = dpsimpy.sp.ph1.SynchronGenerator('gen', dpsimpy.LogLevel.debug)\n", "gen_pf.set_parameters(rated_apparent_power=nom_power, rated_voltage=nominal_voltage_mv, \n", " set_point_active_power=set_point_active_power, set_point_voltage=set_point_voltage, \n", " powerflow_bus_type=dpsimpy.PowerflowBusType.PV)\n", @@ -202,6 +207,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -216,10 +222,6 @@ "source": [ "def dp_reducedOrderSG_loadStep(sim_pf, gen_pf, gen_model=\"4TPM\", event_time=0.1, final_time=0.5, time_step=10e-6, max_iter=10, tolerance=1e-6):\n", " \n", - " # ## Extract relevant powerflow results\n", - " init_electrical_power = gen_pf.get_apparent_power()\n", - " init_mechanical_power = gen_pf.get_apparent_power().real\n", - "\n", " ### DPsim DP simulation\n", " name = \"DP_SMIB_ReducedOrderSGIterative_LoadStep_\" + gen_model\n", " dpsimpy.Logger.set_log_dir(\"logs/\" + name)\n", @@ -227,11 +229,7 @@ " ### Nodes\n", " gnd = dpsimpy.dp.SimNode.gnd\n", " n1 = dpsimpy.dp.SimNode('n1', dpsimpy.PhaseType.Single) \n", - " n1.set_initial_voltage(sim_pf.get_idobj_attr(n1_pf.name(), 'v').get()[0])\n", - "\n", " n2 = dpsimpy.dp.SimNode('n2', dpsimpy.PhaseType.Single)\n", - " n2.set_initial_voltage(sim_pf.get_idobj_attr(n2_pf.name(), 'v').get()[0])\n", - "\n", "\n", " ### Components\n", "\n", @@ -265,8 +263,6 @@ " Ld_s=Ld_s, Lq_s=Lq_s, Td0_s=Td0_s, Tq0_s=Tq0_s)\n", " gen.set_max_iterations(max_iter=max_iter)\n", " gen.set_tolerance(tolerance=tolerance)\n", - " gen.set_initial_values(init_complex_electrical_power=init_electrical_power, init_mechanical_power=init_mechanical_power, \n", - " init_complex_terminal_voltage=sim_pf.get_idobj_attr(n1_pf.name(), 'v').get()[0][0])\n", "\n", " # Switch\n", " switch = dpsimpy.dp.ph1.Switch('Load_Add_Switch_', dpsimpy.LogLevel.debug)\n", @@ -298,6 +294,8 @@ " logger = dpsimpy.Logger(name)\n", " logger.log_attribute('Te', 'Te', gen)\n", "\n", + " # init node voltages and SG power with power flow\n", + " system.init_with_powerflow(system_pf, dpsimpy.Domain.DP)\n", " \n", " ### Simulation\n", " sim = dpsimpy.Simulation(name, dpsimpy.LogLevel.debug)\n", @@ -319,6 +317,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -326,6 +325,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -357,6 +357,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -388,6 +389,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -418,6 +420,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -447,6 +450,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -454,6 +458,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -485,6 +490,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Circuits/Compare_EMT_DP_Slack_PiLine_PQLoad.ipynb b/examples/Notebooks/Circuits/Compare_EMT_DP_Slack_PiLine_PQLoad.ipynb index 746aed8618..61ecca2b9b 100644 --- a/examples/Notebooks/Circuits/Compare_EMT_DP_Slack_PiLine_PQLoad.ipynb +++ b/examples/Notebooks/Circuits/Compare_EMT_DP_Slack_PiLine_PQLoad.ipynb @@ -3,25 +3,27 @@ { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "from villas.dataprocessing.readtools import *\n", "from villas.dataprocessing.timeseries import *\n", "import dpsimpy\n", "import re" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## EMT Simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Parameters\n", "V_nom = 20e3\n", @@ -114,7 +116,7 @@ "system_emt = dpsimpy.SystemTopology(50, [n1_emt, n2_emt], [extnet_emt, line_emt, load_emt])\n", "\n", "# Initialization of dynamic topology\n", - "system_emt.init_with_powerflow(system_pf)\n", + "system_emt.init_with_powerflow(system_pf, dpsimpy.Domain.EMT)\n", "\n", "# Logging\n", "logger_emt = dpsimpy.Logger(sim_name_emt)\n", @@ -143,20 +145,20 @@ "sim_emt.add_logger(logger_emt)\n", "sim_emt.add_event(load_step_event)\n", "sim_emt.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## DP Simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Parameters\n", "V_nom = 20e3\n", @@ -244,7 +246,7 @@ "system_dp = dpsimpy.SystemTopology(50, [n1_dp, n2_dp], [extnet_dp, line_dp, load_dp])\n", "\n", "# Initialization of dynamic topology\n", - "system_dp.init_with_powerflow(system_pf)\n", + "system_dp.init_with_powerflow(system_pf, dpsimpy.Domain.DP)\n", "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", @@ -273,20 +275,20 @@ "sim_dp.add_logger(logger_dp)\n", "sim_dp.add_event(load_step_event)\n", "sim_dp.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Results" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "model_name = 'Slack_PiLine_PQLoad_with_PF_Init'\n", "\n", @@ -297,20 +299,20 @@ "path_EMT = 'logs/' + 'EMT_' + model_name + '_EMT/'\n", "dpsim_result_file_EMT = path_EMT + 'EMT_' + model_name + '_EMT.csv'\n", "ts_dpsim_EMT = read_timeseries_csv(dpsim_result_file_EMT)" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Plot voltages" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "\n", @@ -325,20 +327,20 @@ " \n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Plot current" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "var_name = 'i12'\n", "\n", @@ -350,25 +352,23 @@ "plt.plot(ts_dp_compare.time, ts_dp_compare.values, label='DP backshift', linestyle='--')\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Calculate difference" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "ts_emt_compare.rmse(ts_emt_compare, ts_dp_compare)" - ], - "outputs": [], - "metadata": {} + ] } ], "metadata": { diff --git a/examples/Notebooks/Circuits/Compare_EMT_SynGenDQ7odTrapez_DP_SynGenTrStab_SMIB_Fault.ipynb b/examples/Notebooks/Circuits/Compare_EMT_SynGenDQ7odTrapez_DP_SynGenTrStab_SMIB_Fault.ipynb index 71d1f14969..7547add118 100644 --- a/examples/Notebooks/Circuits/Compare_EMT_SynGenDQ7odTrapez_DP_SynGenTrStab_SMIB_Fault.ipynb +++ b/examples/Notebooks/Circuits/Compare_EMT_SynGenDQ7odTrapez_DP_SynGenTrStab_SMIB_Fault.ipynb @@ -1,15 +1,18 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "# Synchronous Generator dq 7th order model vs transient stability classical model" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "import villas.dataprocessing.readtools as rt\n", "from villas.dataprocessing.timeseries import TimeSeries as ts\n", @@ -20,27 +23,29 @@ "import dpsimpy\n", "\n", "#matplotlib widget" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## EMT Simulation" - ], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Parametrization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# General grid parameters\n", "V_nom_MV = 24e3\n", @@ -84,20 +89,21 @@ "final_time = 1.0\n", "time_step = 10e-6\n", "start_time_fault = 0.2" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Powerflow for Initialization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_pf = sim_name + \"_PF\"\n", "dpsimpy.Logger.set_log_dir(\"logs/\" + sim_name_pf)\n", @@ -109,7 +115,7 @@ "n2_pf = dpsimpy.sp.SimNode(\"n2\", dpsimpy.PhaseType.Single)\n", "\n", "# Synchronous generator ideal model\n", - "gen_pf = dpsimpy.sp.ph1.SynchronGenerator(\"Generator\", dpsimpy.LogLevel.debug)\n", + "gen_pf = dpsimpy.sp.ph1.SynchronGenerator(\"SynGen\", dpsimpy.LogLevel.debug)\n", "gen_pf.set_parameters(rated_apparent_power=555e6, rated_voltage=24e3,\n", " set_point_active_power=set_point_active_power,\n", " set_point_voltage=set_point_voltage,\n", @@ -153,20 +159,21 @@ "sim_pf.do_init_from_nodes_and_terminals(False)\n", "sim_pf.add_logger(logger_pf)\n", "sim_pf.run()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Dynamic Simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "dpsimpy.Logger.set_log_dir(\"logs/\"+sim_name)\n", "\n", @@ -218,7 +225,7 @@ "\n", "\n", "# Initialization of dynamic topology\n", - "system.init_with_powerflow(system_pf)\n", + "system.init_with_powerflow(systemPF=system_pf, domain=dpsimpy.Domain.EMT)\n", "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", @@ -243,27 +250,29 @@ "sim.add_logger(logger)\n", "sim.add_event(sw1)\n", "sim.run()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## DP Simulation" - ], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Parametrization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Power System\n", "V_nom = 230e3\n", @@ -310,20 +319,21 @@ "end_time_fault = 10.2\n", "cmd_Inertia = 1.0\n", "cmd_Damping = 1.0" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Powerflow for Initialization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_pf = sim_name + \"_PF\"\n", "dpsimpy.Logger.set_log_dir(\"logs/\" + sim_name_pf)\n", @@ -381,20 +391,21 @@ "sim_pf.do_init_from_nodes_and_terminals(False)\n", "sim_pf.add_logger(logger_pf)\n", "sim_pf.run()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Dynamic simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_dp = sim_name + \"_DP\" \n", "dpsimpy.Logger.set_log_dir(\"logs/\"+sim_name_dp)\n", @@ -435,7 +446,7 @@ "\n", "\n", "# Initialization of dynamic topology\n", - "system_dp.init_with_powerflow(system_pf)\n", + "system_dp.init_with_powerflow(system_pf, dpsimpy.Domain.DP)\n", "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", @@ -479,58 +490,61 @@ " sim_dp.add_event(sw2)\n", " \n", "sim_dp.run()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Results 3ph EMT 7th order model with trapezoidal rule" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "work_dir = 'logs/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault/'\n", "log_name = 'EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault'\n", "print(work_dir + log_name + '.csv')\n", "ts_emt3ph_DQ7odTrapez = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Results 1ph DP transient stability classical model" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "work_dir = 'logs/DP_SynGenTrStab_SMIB_Fault_DP/'\n", "log_name = 'DP_SynGenTrStab_SMIB_Fault_DP'\n", "print(work_dir + log_name + '.csv')\n", "ts_dp1ph_TrStab = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator EMF" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.style.use('default')\n", "#plt.rcParams.update({'font.size': 22})\n", @@ -552,20 +566,21 @@ " \n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator terminal voltage" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylabel('Generator terminal voltage (V)', fontsize=18)\n", @@ -576,20 +591,21 @@ " \n", "plt.legend(fontsize=14)\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Genrerator terminal Current" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylabel('Generator terminal current (V)', fontsize=18)\n", @@ -600,20 +616,21 @@ "\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Voltage across line" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "\n", @@ -623,20 +640,21 @@ "\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Current through line" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "\n", @@ -646,20 +664,21 @@ "\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Rotor frequency" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.xlabel('time (s)', fontsize=20)\n", @@ -677,20 +696,21 @@ "\n", "plt.legend(fontsize=18)\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Rotor angular velocity $\\omega _r$" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylabel('Rotor angular velocity (rad/s)', fontsize=18)\n", @@ -702,35 +722,34 @@ "\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Rotor angle $\\delta _r$" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "for name in ['delta_r']:\n", " plt.plot(ts_emt3ph_DQ7odTrapez[name].interpolate(timestep).time[begin_idx:end_idx], ts_emt3ph_DQ7odTrapez[name].interpolate(timestep).values[begin_idx:end_idx]*180/3.14, label=name + ' Full model (9th order)')\n", " plt.plot(ts_dp1ph_TrStab[name].interpolate(timestep).time[begin_idx:end_idx], ts_dp1ph_TrStab[name].interpolate(timestep).values[begin_idx:end_idx]*180/3.14, label=name + ' Classical model (2nd order)', linestyle='--')\n" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, - "source": [], + "metadata": {}, "outputs": [], - "metadata": {} + "source": [] } ], "metadata": { @@ -757,4 +776,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +} diff --git a/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_3Bus_Fault.ipynb b/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_3Bus_Fault.ipynb index 4d0d9d3b1d..b4dd23d110 100644 --- a/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_3Bus_Fault.ipynb +++ b/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_3Bus_Fault.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -8,6 +9,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -32,6 +34,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -39,6 +42,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -130,6 +134,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -153,14 +158,14 @@ "n3_pf = dpsimpy.sp.SimNode(\"n3\", dpsimpy.PhaseType.Single)\n", "\n", "#Synchronous generator 1\n", - "gen1_pf = dpsimpy.sp.ph1.SynchronGenerator(\"Generator\", dpsimpy.LogLevel.debug)\n", + "gen1_pf = dpsimpy.sp.ph1.SynchronGenerator(\"SynGen1\", dpsimpy.LogLevel.debug)\n", "#setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side\n", "gen1_pf.set_parameters(nom_power_G1, nom_ph_ph_volt_RMS_G1, init_active_power_G1,\n", " set_point_voltage_G1 * t1_ratio, dpsimpy.PowerflowBusType.VD)\n", "gen1_pf.set_base_voltage(V_nom)\n", "\n", "#Synchronous generator 2\n", - "gen2_pf = dpsimpy.sp.ph1.SynchronGenerator(\"Generator\", dpsimpy.LogLevel.debug)\n", + "gen2_pf = dpsimpy.sp.ph1.SynchronGenerator(\"SynGen2\", dpsimpy.LogLevel.debug)\n", "#setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side\n", "gen2_pf.set_parameters(nom_power_G2, nom_ph_ph_volt_RMS_G2, init_active_power_G2,\n", " set_point_voltage_G2 * t2_ratio, dpsimpy.PowerflowBusType.PV)\n", @@ -221,6 +226,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -247,8 +253,6 @@ "gen1_dp.set_standard_parameters_PU(nom_power_G1, nom_ph_ph_volt_RMS_G1, nom_freq_G1,\n", " Xpd_G1 * t1_ratio**2, cmd_inertia_G1 * H_G1, Rs_G1,\n", " cmd_damping_G1 * Kd_G1)\n", - "init_apparent_power_G1 = gen1_pf.get_apparent_power()\n", - "gen1_dp.set_initial_values(init_apparent_power_G1, init_mech_power_G1)\n", "\n", "#Synchronous generator 2\n", "gen2_dp = dpsimpy.dp.ph1.SynchronGeneratorTrStab(\"SynGen2\", dpsimpy.LogLevel.debug)\n", @@ -256,8 +260,6 @@ "gen2_dp.set_standard_parameters_PU(nom_power_G2, nom_ph_ph_volt_RMS_G2, nom_freq_G2,\n", " Xpd_G2 * t2_ratio**2, cmd_inertia_G2 * H_G2, Rs_G2,\n", " cmd_damping_G2 * Kd_G2)\n", - "init_apparent_power_G2 = gen2_pf.get_apparent_power()\n", - "gen2_dp.set_initial_values(init_apparent_power_G2, init_mech_power_G2)\n", "gen2_dp.set_model_flags(convert_with_omega_mech=True)\n", "gen2_dp.set_reference_omega(\"w_r\", gen1_dp, \"delta_r\", gen1_dp)\n", "\n", @@ -294,7 +296,7 @@ "system_dp = dpsimpy.SystemTopology(60, [n1_dp, n2_dp, n3_dp], [gen1_dp, gen2_dp, load_dp, line12_dp, line13_dp, line23_dp, fault_dp])\n", "\n", "# Initialization of dynamic topology\n", - "system_dp.init_with_powerflow(system_pf)\n", + "system_dp.init_with_powerflow(system_pf, dpsimpy.Domain.DP)\n", "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", @@ -353,6 +355,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -360,6 +363,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -451,6 +455,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -474,14 +479,14 @@ "n3_pf = dpsimpy.sp.SimNode(\"n3\", dpsimpy.PhaseType.Single)\n", "\n", "#Synchronous generator 1\n", - "gen1_pf = dpsimpy.sp.ph1.SynchronGenerator(\"Generator\", dpsimpy.LogLevel.debug)\n", + "gen1_pf = dpsimpy.sp.ph1.SynchronGenerator(\"SynGen1\", dpsimpy.LogLevel.debug)\n", "#setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side\n", "gen1_pf.set_parameters(nom_power_G1, nom_ph_ph_volt_RMS_G1, init_active_power_G1,\n", " set_point_voltage_G1 * t1_ratio, dpsimpy.PowerflowBusType.VD)\n", "gen1_pf.set_base_voltage(V_nom)\n", "\n", "#Synchronous generator 2\n", - "gen2_pf = dpsimpy.sp.ph1.SynchronGenerator(\"Generator\", dpsimpy.LogLevel.debug)\n", + "gen2_pf = dpsimpy.sp.ph1.SynchronGenerator(\"SynGen2\", dpsimpy.LogLevel.debug)\n", "#setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side\n", "gen2_pf.set_parameters(nom_power_G2, nom_ph_ph_volt_RMS_G2, init_active_power_G2,\n", " set_point_voltage_G2 * t2_ratio, dpsimpy.PowerflowBusType.PV)\n", @@ -542,6 +547,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -563,22 +569,18 @@ "n3_sp = dpsimpy.sp.SimNode(\"n3\", dpsimpy.PhaseType.Single)\n", "\n", "#Synchronous generator 1\n", - "gen1_sp = dpsimpy.sp.ph1.SynchronGeneratorTrStab(\"SynGen\", dpsimpy.LogLevel.debug)\n", + "gen1_sp = dpsimpy.sp.ph1.SynchronGeneratorTrStab(\"SynGen1\", dpsimpy.LogLevel.debug)\n", "# Xpd is given in p.u of generator base at transfomer primary side and should be transformed to network side\n", "gen1_sp.set_standard_parameters_PU(nom_power_G1, nom_ph_ph_volt_RMS_G1, nom_freq_G1,\n", " Xpd_G1 * t1_ratio**2, cmd_inertia_G1 * H_G1, Rs_G1,\n", " cmd_damping_G1 * Kd_G1)\n", - "init_apparent_power_G1 = gen1_pf.get_apparent_power()\n", - "gen1_sp.set_initial_values(init_apparent_power_G1, init_mech_power_G1)\n", "\n", "#Synchronous generator 2\n", - "gen2_sp = dpsimpy.sp.ph1.SynchronGeneratorTrStab(\"SynGen\", dpsimpy.LogLevel.debug)\n", + "gen2_sp = dpsimpy.sp.ph1.SynchronGeneratorTrStab(\"SynGen2\", dpsimpy.LogLevel.debug)\n", "# Xpd is given in p.u of generator base at transfomer primary side and should be transformed to network side\n", "gen2_sp.set_standard_parameters_PU(nom_power_G2, nom_ph_ph_volt_RMS_G2, nom_freq_G2,\n", " Xpd_G2 * t2_ratio**2, cmd_inertia_G2 * H_G2, Rs_G2,\n", " cmd_damping_G2 * Kd_G2)\n", - "init_apparent_power_G2 = gen2_pf.get_apparent_power()\n", - "gen2_sp.set_initial_values(init_apparent_power_G2, init_mech_power_G2)\n", "gen2_sp.set_model_flags(convert_with_omega_mech=True)\n", "gen2_sp.set_reference_omega(\"w_r\", gen1_sp, \"delta_r\", gen1_sp)\n", "\n", @@ -615,7 +617,7 @@ "system_sp = dpsimpy.SystemTopology(60, [n1_sp, n2_sp, n3_sp], [gen1_sp, gen2_sp, load_sp, line12_sp, line13_sp, line23_sp, fault_sp])\n", "\n", "# Initialization of dynamic topology\n", - "system_sp.init_with_powerflow(system_pf)\n", + "system_sp.init_with_powerflow(system_pf, dpsimpy.Domain.SP)\n", "\n", "# Logging\n", "logger_sp = dpsimpy.Logger(sim_name_sp)\n", @@ -674,6 +676,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -693,6 +696,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -712,6 +716,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -753,6 +758,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -787,6 +793,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -829,6 +836,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -871,6 +879,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_3Bus_SteadyState.ipynb b/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_3Bus_SteadyState.ipynb index 7083c9a790..5ed1390d7b 100644 --- a/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_3Bus_SteadyState.ipynb +++ b/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_3Bus_SteadyState.ipynb @@ -1,15 +1,18 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "# 3 Bus (2 Generators, 1 Load) Steady state SP vs DP" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "import villas.dataprocessing.readtools as rt\n", "from villas.dataprocessing.timeseries import TimeSeries as ts\n", @@ -20,27 +23,29 @@ "import dpsimpy\n", "\n", "#%matplotlib widget" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## DP Simulation" - ], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Parameters" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "#-----------Power system-----------\n", "#Voltage level as Base Voltage\n", @@ -109,20 +114,21 @@ "final_time = 10\n", "time_step = 0.001\n", "scale_inertia= 1.0" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Powerflow for Initialization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "time_step_pf = final_time\n", "final_time_pf = final_time + time_step_pf\n", @@ -135,14 +141,14 @@ "n3_pf = dpsimpy.sp.SimNode(\"n3\", dpsimpy.PhaseType.Single)\n", "\n", "#Synchronous generator 1\n", - "gen1_pf = dpsimpy.sp.ph1.SynchronGenerator(\"Generator\", dpsimpy.LogLevel.debug)\n", + "gen1_pf = dpsimpy.sp.ph1.SynchronGenerator(\"SynGen1\", dpsimpy.LogLevel.debug)\n", "#setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side\n", "gen1_pf.set_parameters(nom_power_G1, nom_ph_ph_volt_RMS_G1, init_active_power_G1,\n", " set_point_voltage_G1 * t1_ratio, dpsimpy.PowerflowBusType.VD)\n", "gen1_pf.set_base_voltage(V_nom)\n", "\n", "#Synchronous generator 2\n", - "gen2_pf = dpsimpy.sp.ph1.SynchronGenerator(\"Generator\", dpsimpy.LogLevel.debug)\n", + "gen2_pf = dpsimpy.sp.ph1.SynchronGenerator(\"SynGen2\", dpsimpy.LogLevel.debug)\n", "#setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side\n", "gen2_pf.set_parameters(nom_power_G2, nom_ph_ph_volt_RMS_G2, init_active_power_G2,\n", " set_point_voltage_G2 * t2_ratio, dpsimpy.PowerflowBusType.PV)\n", @@ -194,20 +200,21 @@ "sim_pf.do_init_from_nodes_and_terminals(False)\n", "sim_pf.add_logger(logger_pf)\n", "sim_pf.run()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Dynamic Simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_dp = sim_name + \"_DP\"\n", "dpsimpy.Logger.set_log_dir(\"logs/\" + sim_name_dp)\n", @@ -218,22 +225,18 @@ "n3_dp = dpsimpy.dp.SimNode(\"n3\", dpsimpy.PhaseType.Single)\n", "\n", "#Synchronous generator 1\n", - "gen1_dp = dpsimpy.dp.ph1.SynchronGeneratorTrStab(\"SynGen\", dpsimpy.LogLevel.debug)\n", + "gen1_dp = dpsimpy.dp.ph1.SynchronGeneratorTrStab(\"SynGen1\", dpsimpy.LogLevel.debug)\n", "# Xpd is given in p.u of generator base at transfomer primary side and should be transformed to network side\n", "gen1_dp.set_standard_parameters_PU(nom_power_G1, nom_ph_ph_volt_RMS_G1, nom_freq_G1,\n", " Xpd_G1 * t1_ratio**2, scale_inertia * H_G1, Rs_G1,\n", " Kd_G1)\n", - "init_apparent_power_G1 = gen1_pf.get_apparent_power()\n", - "gen1_dp.set_initial_values(init_apparent_power_G1, init_mech_power_G1)\n", "\n", "#Synchronous generator 2\n", - "gen2_dp = dpsimpy.dp.ph1.SynchronGeneratorTrStab(\"SynGen\", dpsimpy.LogLevel.debug)\n", + "gen2_dp = dpsimpy.dp.ph1.SynchronGeneratorTrStab(\"SynGen2\", dpsimpy.LogLevel.debug)\n", "# Xpd is given in p.u of generator base at transfomer primary side and should be transformed to network side\n", "gen2_dp.set_standard_parameters_PU(nom_power_G2, nom_ph_ph_volt_RMS_G2, nom_freq_G2,\n", " Xpd_G2 * t2_ratio**2, scale_inertia * H_G2, Rs_G2,\n", " Kd_G2)\n", - "init_apparent_power_G2 = gen2_pf.get_apparent_power()\n", - "gen2_dp.set_initial_values(init_apparent_power_G2, init_mech_power_G2)\n", "\n", "# Load\n", "load_dp = dpsimpy.dp.ph1.RXLoad(\"Load\", dpsimpy.LogLevel.debug)\n", @@ -261,7 +264,7 @@ "system_dp = dpsimpy.SystemTopology(60, [n1_dp, n2_dp, n3_dp], [gen1_dp, gen2_dp, load_dp, line12_dp, line13_dp, line23_dp])\n", "\n", "# Initialization of dynamic topology\n", - "system_dp.init_with_powerflow(system_pf)\n", + "system_dp.init_with_powerflow(system_pf, dpsimpy.Domain.DP)\n", "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", @@ -300,27 +303,29 @@ "sim_dp.add_logger(logger_dp)\n", "\n", "sim_dp.run()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## SP Simulation" - ], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Parameters" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "#-----------Power system-----------\n", "#Voltage level as Base Voltage\n", @@ -389,20 +394,21 @@ "final_time = 10\n", "time_step = 0.001\n", "scale_inertia= 1.0" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Powerflow for Initialization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "time_step_pf = final_time\n", "final_time_pf = final_time + time_step_pf\n", @@ -415,14 +421,14 @@ "n3_pf = dpsimpy.sp.SimNode(\"n3\", dpsimpy.PhaseType.Single)\n", "\n", "#Synchronous generator 1\n", - "gen1_pf = dpsimpy.sp.ph1.SynchronGenerator(\"Generator\", dpsimpy.LogLevel.debug)\n", + "gen1_pf = dpsimpy.sp.ph1.SynchronGenerator(\"SynGen1\", dpsimpy.LogLevel.debug)\n", "#setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side\n", "gen1_pf.set_parameters(nom_power_G1, nom_ph_ph_volt_RMS_G1, init_active_power_G1,\n", " set_point_voltage_G1 * t1_ratio, dpsimpy.PowerflowBusType.VD)\n", "gen1_pf.set_base_voltage(V_nom)\n", "\n", "#Synchronous generator 2\n", - "gen2_pf = dpsimpy.sp.ph1.SynchronGenerator(\"Generator\", dpsimpy.LogLevel.debug)\n", + "gen2_pf = dpsimpy.sp.ph1.SynchronGenerator(\"SynGen2\", dpsimpy.LogLevel.debug)\n", "#setPointVoltage is defined as the voltage at the transfomer primary side and should be transformed to network side\n", "gen2_pf.set_parameters(nom_power_G2, nom_ph_ph_volt_RMS_G2, init_active_power_G2,\n", " set_point_voltage_G2 * t2_ratio, dpsimpy.PowerflowBusType.PV)\n", @@ -473,20 +479,21 @@ "sim_pf.do_init_from_nodes_and_terminals(False)\n", "sim_pf.add_logger(logger_pf)\n", "sim_pf.run()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Dynamic Simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_sp = sim_name + \"_SP\"\n", "dpsimpy.Logger.set_log_dir(\"logs/\" + sim_name_sp)\n", @@ -497,22 +504,18 @@ "n3_sp = dpsimpy.sp.SimNode(\"n3\", dpsimpy.PhaseType.Single)\n", "\n", "#Synchronous generator 1\n", - "gen1_sp = dpsimpy.sp.ph1.SynchronGeneratorTrStab(\"SynGen\", dpsimpy.LogLevel.debug)\n", + "gen1_sp = dpsimpy.sp.ph1.SynchronGeneratorTrStab(\"SynGen1\", dpsimpy.LogLevel.debug)\n", "# Xpd is given in p.u of generator base at transfomer primary side and should be transformed to network side\n", "gen1_sp.set_standard_parameters_PU(nom_power_G1, nom_ph_ph_volt_RMS_G1, nom_freq_G1,\n", " Xpd_G1 * t1_ratio**2, scale_inertia * H_G1, Rs_G1,\n", " Kd_G1)\n", - "init_apparent_power_G1 = gen1_pf.get_apparent_power()\n", - "gen1_sp.set_initial_values(init_apparent_power_G1, init_mech_power_G1)\n", "\n", "#Synchronous generator 2\n", - "gen2_sp = dpsimpy.sp.ph1.SynchronGeneratorTrStab(\"SynGen\", dpsimpy.LogLevel.debug)\n", + "gen2_sp = dpsimpy.sp.ph1.SynchronGeneratorTrStab(\"SynGen2\", dpsimpy.LogLevel.debug)\n", "# Xpd is given in p.u of generator base at transfomer primary side and should be transformed to network side\n", "gen2_sp.set_standard_parameters_PU(nom_power_G2, nom_ph_ph_volt_RMS_G2, nom_freq_G2,\n", " Xpd_G2 * t2_ratio**2, scale_inertia * H_G2, Rs_G2,\n", " Kd_G2)\n", - "init_apparent_power_G2 = gen2_pf.get_apparent_power()\n", - "gen2_sp.set_initial_values(init_apparent_power_G2, init_mech_power_G2)\n", "\n", "# Load\n", "load_sp = dpsimpy.sp.ph1.Load(\"Load\", dpsimpy.LogLevel.debug)\n", @@ -540,7 +543,7 @@ "system_sp = dpsimpy.SystemTopology(60, [n1_sp, n2_sp, n3_sp], [gen1_sp, gen2_sp, load_sp, line12_sp, line13_sp, line23_sp])\n", "\n", "# Initialization of dynamic topology\n", - "system_sp.init_with_powerflow(system_pf)\n", + "system_sp.init_with_powerflow(system_pf, dpsimpy.Domain.SP)\n", "\n", "# Logging\n", "logger_sp = dpsimpy.Logger(sim_name_sp)\n", @@ -579,58 +582,61 @@ "sim_sp.add_logger(logger_sp)\n", "\n", "sim_sp.run()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## SP Results" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "work_dir = 'logs/SP_SynGenTrStab_3Bus_SteadyState_SP/'\n", "log_name = 'SP_SynGenTrStab_3Bus_SteadyState_SP'\n", "print(work_dir + log_name + '.csv')\n", "ts_sp1ph_TrStab_dl= rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## DP Results" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "work_dir = 'logs/DP_SynGenTrStab_3Bus_SteadyState_DP/'\n", "log_name = 'DP_SynGenTrStab_3Bus_SteadyState_DP'\n", "print(work_dir + log_name + '.csv')\n", "ts_dp1ph_TrStab_dl = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator 1&2 terminal voltage" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "timestep=50e-6;\n", "t_begin=0\n", @@ -658,20 +664,21 @@ "plt.legend()\n", "\n", "f.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator 1&2 terminal Current" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "f= plt.figure(figsize=(16,8))\n", "\n", @@ -692,20 +699,21 @@ "plt.legend()\n", "\n", "f.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator 1&2 Rotor frequency" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "f= plt.figure(figsize=(16,8))\n", "\n", @@ -734,20 +742,21 @@ "plt.legend()\n", "\n", "f.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator 1&2 Rotor angular velocity $\\omega _r$" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "f= plt.figure(figsize=(16,8))\n", "\n", @@ -776,20 +785,21 @@ "plt.legend()\n", "\n", "f.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator 1&2 Rotor angle $\\delta _r$" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "f= plt.figure(figsize=(16,8))\n", "\n", @@ -818,16 +828,14 @@ "plt.legend()\n", "\n", "f.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, - "source": [], + "metadata": {}, "outputs": [], - "metadata": {} + "source": [] } ], "metadata": { diff --git a/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_SMIB_Fault.ipynb b/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_SMIB_Fault.ipynb index 8bd6b7012b..f4e889bbc5 100644 --- a/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_SMIB_Fault.ipynb +++ b/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_SMIB_Fault.ipynb @@ -1,15 +1,18 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "# SMIB Fault SP vs DP" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "import villas.dataprocessing.readtools as rt\n", "from villas.dataprocessing.timeseries import TimeSeries as ts\n", @@ -21,27 +24,29 @@ "import dpsimpy\n", "\n", "#%matplotlib widget" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## DP Simulation" - ], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Parametrization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Power System\n", "V_nom = 230e3\n", @@ -85,20 +90,21 @@ "end_time_fault = 10.2\n", "cmd_Inertia = 1.0\n", "cmd_Damping = 1.0" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Powerflow for Initialization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_pf = sim_name + \"_PF\"\n", "dpsimpy.Logger.set_log_dir(\"logs/\" + sim_name_pf)\n", @@ -110,7 +116,7 @@ "n2_pf = dpsimpy.sp.SimNode(\"n2\", dpsimpy.PhaseType.Single)\n", "\n", "# Synchronous generator ideal model\n", - "gen_pf = dpsimpy.sp.ph1.SynchronGenerator(\"Generator\", dpsimpy.LogLevel.debug)\n", + "gen_pf = dpsimpy.sp.ph1.SynchronGenerator(\"SynGen\", dpsimpy.LogLevel.debug)\n", "gen_pf.set_parameters(rated_apparent_power=nom_power, rated_voltage=nom_ph_ph_volt_RMS,\n", " set_point_active_power=init_active_power,\n", " set_point_voltage=set_point_voltage*t_ratio,\n", @@ -157,20 +163,21 @@ "sim_pf.do_init_from_nodes_and_terminals(False)\n", "sim_pf.add_logger(logger_pf)\n", "sim_pf.run()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Dynamic simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_dp = sim_name + \"_DP\" \n", "dpsimpy.Logger.set_log_dir(\"logs/\"+sim_name_dp)\n", @@ -186,9 +193,6 @@ " nom_power=nom_power, nom_volt = nom_ph_ph_volt_RMS, nom_freq=nom_freq,\n", " Xpd = Xpd*t_ratio**2, inertia=cmd_Inertia*H, Rs=Rs, D=cmd_Damping*D)\n", "\n", - "init_apparent_power = gen_pf.get_apparent_power()\n", - "gen_dp.set_initial_values(init_apparent_power, init_mech_power)\n", - "\n", "# Grid bus as Slack\n", "extnet_dp = dpsimpy.dp.ph1.NetworkInjection(\"Slack\", dpsimpy.LogLevel.debug)\n", "extnet_dp.set_parameters(V_nom)\n", @@ -212,7 +216,7 @@ "\n", "\n", "# Initialization of dynamic topology\n", - "system_dp.init_with_powerflow(system_pf)\n", + "system_dp.init_with_powerflow(system_pf, dpsimpy.Domain.DP)\n", "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", @@ -255,27 +259,29 @@ " sim_dp.add_event(sw2)\n", " \n", "sim_dp.run()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## SP Simulation" - ], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Parametrization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Power System\n", "V_nom = 230e3\n", @@ -319,20 +325,21 @@ "end_time_fault = 10.2\n", "cmd_Inertia = 1.0\n", "cmd_Damping = 1.0" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Powerflow for Initialization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_pf = sim_name + \"_PF\"\n", "dpsimpy.Logger.set_log_dir(\"logs/\" + sim_name_pf)\n", @@ -344,7 +351,7 @@ "n2_pf = dpsimpy.sp.SimNode(\"n2\", dpsimpy.PhaseType.Single)\n", "\n", "# Synchronous generator ideal model\n", - "gen_pf = dpsimpy.sp.ph1.SynchronGenerator(\"Generator\", dpsimpy.LogLevel.debug)\n", + "gen_pf = dpsimpy.sp.ph1.SynchronGenerator(\"SynGen\", dpsimpy.LogLevel.debug)\n", "gen_pf.set_parameters(rated_apparent_power=nom_power, rated_voltage=nom_ph_ph_volt_RMS,\n", " set_point_active_power=init_active_power,\n", " set_point_voltage=set_point_voltage*t_ratio,\n", @@ -391,20 +398,21 @@ "sim_pf.do_init_from_nodes_and_terminals(False)\n", "sim_pf.add_logger(logger_pf)\n", "sim_pf.run()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Dynamic simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_sp = sim_name + \"_SP\" \n", "dpsimpy.Logger.set_log_dir(\"logs/\"+sim_name_sp)\n", @@ -420,9 +428,6 @@ " nom_power=nom_power, nom_volt = nom_ph_ph_volt_RMS, nom_freq=nom_freq,\n", " Xpd = Xpd*t_ratio**2, inertia=cmd_Inertia*H, Rs=Rs, D=cmd_Damping*D)\n", "\n", - "init_apparent_power = gen_pf.get_apparent_power()\n", - "gen_sp.set_initial_values(init_apparent_power, init_mech_power)\n", - "\n", "# Grid bus as Slack\n", "extnet_sp = dpsimpy.sp.ph1.NetworkInjection(\"Slack\", dpsimpy.LogLevel.debug)\n", "\n", @@ -445,7 +450,7 @@ "\n", "\n", "# Initialization of dynamic topology\n", - "system_sp.init_with_powerflow(system_pf)\n", + "system_sp.init_with_powerflow(system_pf, dpsimpy.Domain.SP)\n", "\n", "# Logging\n", "logger_sp = dpsimpy.Logger(sim_name_sp)\n", @@ -488,78 +493,82 @@ " sim_sp.add_event(sw2)\n", " \n", "sim_sp.run()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Results 1ph SP" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "work_dir = 'logs/SP_SynGenTrStab_SMIB_Fault_SP/'\n", "log_name = 'SP_SynGenTrStab_SMIB_Fault_SP'\n", "print(work_dir + log_name + '.csv')\n", "ts_sp1ph_TrStab_dl= rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Results 1ph DP" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "work_dir = 'logs/DP_SynGenTrStab_SMIB_Fault_DP/' \n", "log_name = 'DP_SynGenTrStab_SMIB_Fault_DP'\n", "print(work_dir + log_name + '.csv')\n", "ts_dp1ph_TrStab_dl = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Results 3ph EMT Reference" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# work_dir = 'logs/EMT_SynGenTrStab_SMIB_Fault_EMT/'\n", "# log_name = 'EMT_SynGenTrStab_SMIB_Fault_EMT'\n", "# print(work_dir + log_name + '.csv')\n", "# #os.path.getsize(work_dir + log_name + '.csv')\n", "# ts_emt3ph_TrStab_dl = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator emf" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylabel('Generator emf (V)')\n", @@ -576,20 +585,21 @@ " plt.plot(ts_sp1ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], ts_sp1ph_TrStab_dl[name].interpolate(timestep).frequency_shift(60).values[begin_idx:end_idx], label=name + ' SP backshift')\n", " plt.plot(ts_dp1ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], ts_dp1ph_TrStab_dl[name].interpolate(timestep).frequency_shift(60).values[begin_idx:end_idx], label=name + ' DP backshift', linestyle='--')\n", " #plt.plot(ts_emt3ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], ts_emt3ph_TrStab_dl[name].interpolate(timestep).frequency_shift(60).values[begin_idx:end_idx], label=name + ' EMT')" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator terminal voltage" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylabel('Generator terminal voltage (V)')\n", @@ -600,20 +610,21 @@ " #plt.plot(ts_emt3ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], np.sqrt(3/2)*ts_emt3ph_TrStab_dl[name].interpolate(timestep).values[begin_idx:end_idx], label=name + ' EMT')\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Genrerator terminal Current" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylabel('Generator terminal current (A)')\n", @@ -626,20 +637,21 @@ "#plt.plot(ts_sp1ph_TrStab_dl['Ep'].interpolate(timestep).time[begin_idx:end_idx], 0.05*(ts_sp1ph_TrStab_dl['Ep'].interpolate(timestep).frequency_shift(60).values[begin_idx:end_idx]- ts_sp1ph_TrStab_dl['v_gen'].interpolate(timestep).frequency_shift(60).values[begin_idx:end_idx]))\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "Fault Current" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylabel('Fault current (A)')\n", @@ -652,20 +664,21 @@ "#plt.plot(ts_sp1ph_TrStab_dl['Ep'].interpolate(timestep).time[begin_idx:end_idx], 0.05*(ts_sp1ph_TrStab_dl['Ep'].interpolate(timestep).frequency_shift(60).values[begin_idx:end_idx]- ts_sp1ph_TrStab_dl['v_gen'].interpolate(timestep).frequency_shift(60).values[begin_idx:end_idx]))\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Voltage across line" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "\n", @@ -675,20 +688,21 @@ " #plt.plot(ts_emt3ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], np.sqrt(3/2)*ts_emt3ph_TrStab_dl[name].interpolate(timestep).values[begin_idx:end_idx], label=name + ' EMT')\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Current through line" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "\n", @@ -698,20 +712,21 @@ " #plt.plot(ts_emt3ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], np.sqrt(3/2)*ts_emt3ph_TrStab_dl[name].interpolate(timestep).values[begin_idx:end_idx], label=name + ' EMT')\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator electrical & mechanical energy" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "#plt.ylim(250e6,350e6)\n", @@ -722,20 +737,21 @@ " #plt.plot(ts_emt3ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], np.sqrt(3/2)*ts_emt3ph_TrStab_dl[name].interpolate(timestep).values[begin_idx:end_idx], label=name + ' EMT')\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Rotor frequency" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "#plt.figure(figsize=(12,8))\n", "#plt.xlabel('time (s)', fontsize=20)\n", @@ -754,20 +770,21 @@ "#plt.legend(fontsize=18)\n", "##plt.title('Post-Fault',fontsize=20)\n", "#plt.show()\n" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Rotor angular velocity $\\omega _r$" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.xlabel('time (s)', fontsize=20)\n", @@ -784,20 +801,21 @@ "plt.legend(fontsize=18)\n", "#plt.title('Post-Fault',fontsize=20)\n", "plt.show()\n" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Rotor angle $\\delta _r$" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.xlabel('time (s)', fontsize=20)\n", @@ -814,16 +832,15 @@ "plt.legend(fontsize=18)\n", "#plt.title('Post-Fault',fontsize=20)\n", "plt.show()\n" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "Frequency of load angle in 1hz-2hz range" - ], - "metadata": {} + ] } ], "metadata": { diff --git a/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_SMIB_SteadyState.ipynb b/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_SMIB_SteadyState.ipynb index 87a001197c..9f514b220b 100644 --- a/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_SMIB_SteadyState.ipynb +++ b/examples/Notebooks/Circuits/DP_SP_SynGenTrStab_SMIB_SteadyState.ipynb @@ -1,15 +1,18 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "# SMIB Steady state SP vs DP" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "import villas.dataprocessing.readtools as rt\n", "from villas.dataprocessing.timeseries import TimeSeries as ts\n", @@ -21,27 +24,29 @@ "import dpsimpy\n", "\n", "#%matplotlib widget" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## DP Simulation" - ], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Parametrization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Power System\n", "V_nom = 230e3\n", @@ -84,20 +89,21 @@ "time_step = 0.001\n", "cmd_Inertia = 1.0\n", "cmd_Damping = 1.0" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Powerflow for Initialization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_pf = sim_name + \"_PF\"\n", "dpsimpy.Logger.set_log_dir(\"logs/\" + sim_name_pf)\n", @@ -109,7 +115,7 @@ "n2_pf = dpsimpy.sp.SimNode(\"n2\", dpsimpy.PhaseType.Single)\n", "\n", "# Synchronous generator ideal model\n", - "gen_pf = dpsimpy.sp.ph1.SynchronGenerator(\"Generator\", dpsimpy.LogLevel.debug)\n", + "gen_pf = dpsimpy.sp.ph1.SynchronGenerator(\"SynGen\", dpsimpy.LogLevel.debug)\n", "gen_pf.set_parameters(rated_apparent_power=nom_power, rated_voltage=nom_ph_ph_volt_RMS,\n", " set_point_active_power=init_active_power,\n", " set_point_voltage=set_point_voltage*t_ratio,\n", @@ -150,20 +156,21 @@ "sim_pf.do_init_from_nodes_and_terminals(False)\n", "sim_pf.add_logger(logger_pf)\n", "sim_pf.run()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Dynamic simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_dp = sim_name + \"_DP\" \n", "dpsimpy.Logger.set_log_dir(\"logs/\"+sim_name_dp)\n", @@ -179,9 +186,6 @@ " nom_power=nom_power, nom_volt = nom_ph_ph_volt_RMS, nom_freq=nom_freq,\n", " Xpd = Xpd*t_ratio**2, inertia=cmd_Inertia*H, Rs=Rs, D=cmd_Damping*D)\n", "\n", - "init_apparent_power = gen_pf.get_apparent_power()\n", - "gen_dp.set_initial_values(init_apparent_power, init_mech_power)\n", - "\n", "# Grid bus as Slack\n", "extnet_dp = dpsimpy.dp.ph1.NetworkInjection(\"Slack\", dpsimpy.LogLevel.debug)\n", "extnet_dp.set_parameters(V_slack)\n", @@ -198,7 +202,7 @@ "\n", "\n", "# Initialization of dynamic topology\n", - "system_dp.init_with_powerflow(system_pf)\n", + "system_dp.init_with_powerflow(system_pf, dpsimpy.Domain.DP)\n", "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", @@ -228,27 +232,29 @@ "sim_dp.add_logger(logger_dp)\n", " \n", "sim_dp.run()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## SP Simulation" - ], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Parametrization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Power System\n", "V_nom = 230e3\n", @@ -293,20 +299,21 @@ "end_time_fault = 10.2\n", "cmd_Inertia = 1.0\n", "cmd_Damping = 1.0" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Powerflow for Initialization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_pf = sim_name + \"_PF\"\n", "dpsimpy.Logger.set_log_dir(\"logs/\" + sim_name_pf)\n", @@ -318,7 +325,7 @@ "n2_pf = dpsimpy.sp.SimNode(\"n2\", dpsimpy.PhaseType.Single)\n", "\n", "# Synchronous generator ideal model\n", - "gen_pf = dpsimpy.sp.ph1.SynchronGenerator(\"Generator\", dpsimpy.LogLevel.debug)\n", + "gen_pf = dpsimpy.sp.ph1.SynchronGenerator(\"SynGen\", dpsimpy.LogLevel.debug)\n", "gen_pf.set_parameters(rated_apparent_power=nom_power, rated_voltage=nom_ph_ph_volt_RMS,\n", " set_point_active_power=init_active_power,\n", " set_point_voltage=set_point_voltage*t_ratio,\n", @@ -358,20 +365,21 @@ "sim_pf.do_init_from_nodes_and_terminals(False)\n", "sim_pf.add_logger(logger_pf)\n", "sim_pf.run()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "### Dynamic simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "sim_name_sp = sim_name + \"_SP\" \n", "dpsimpy.Logger.set_log_dir(\"logs/\"+sim_name_sp)\n", @@ -387,9 +395,6 @@ " nom_power=nom_power, nom_volt = nom_ph_ph_volt_RMS, nom_freq=nom_freq,\n", " Xpd = Xpd*t_ratio**2, inertia=cmd_Inertia*H, Rs=Rs, D=cmd_Damping*D)\n", "\n", - "init_apparent_power = gen_pf.get_apparent_power()\n", - "gen_sp.set_initial_values(init_apparent_power, init_mech_power)\n", - "\n", "# Grid bus as Slack\n", "extnet_sp = dpsimpy.sp.ph1.NetworkInjection(\"Slack\", dpsimpy.LogLevel.debug)\n", "extnet_sp.set_parameters(V_slack)\n", @@ -412,7 +417,7 @@ "\n", "\n", "# Initialization of dynamic topology\n", - "system_sp.init_with_powerflow(system_pf)\n", + "system_sp.init_with_powerflow(system_pf, dpsimpy.Domain.SP)\n", "\n", "# Logging\n", "logger_sp = dpsimpy.Logger(sim_name_sp)\n", @@ -443,78 +448,82 @@ "sim_sp.add_logger(logger_sp)\n", " \n", "sim_sp.run()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Results 1ph SP" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "work_dir = 'logs/SP_SynGenTrStab_SMIB_SteadyState_SP/'\n", "log_name = 'SP_SynGenTrStab_SMIB_SteadyState_SP'\n", "print(work_dir + log_name + '.csv')\n", "ts_sp1ph_TrStab_dl= rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Results 1ph DP" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "work_dir = 'logs/DP_SynGenTrStab_SMIB_SteadyState_DP/' \n", "log_name = 'DP_SynGenTrStab_SMIB_SteadyState_DP'\n", "print(work_dir + log_name + '.csv')\n", "ts_dp1ph_TrStab_dl = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Results 3ph EMT Reference" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# work_dir = 'logs/EMT_SynGenTrStab_SMIB_SteadyState_EMT/'\n", "# log_name = 'EMT_SynGenTrStab_SMIB_SteadyState_EMT'\n", "# print(work_dir + log_name + '.csv')\n", "# #os.path.getsize(work_dir + log_name + '.csv')\n", "# ts_emt3ph_TrStab_dl = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator emf" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylabel('Generator emf (V)')\n", @@ -531,20 +540,21 @@ " plt.plot(ts_sp1ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], ts_sp1ph_TrStab_dl[name].interpolate(timestep).frequency_shift(60).values[begin_idx:end_idx], label=name + ' SP backshift')\n", " plt.plot(ts_dp1ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], ts_dp1ph_TrStab_dl[name].interpolate(timestep).frequency_shift(60).values[begin_idx:end_idx], label=name + ' DP backshift', linestyle='--')\n", " #plt.plot(ts_emt3ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], ts_emt3ph_TrStab_dl[name].interpolate(timestep).frequency_shift(60).values[begin_idx:end_idx], label=name + ' EMT')" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator terminal voltage" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylabel('Generator terminal voltage (V)')\n", @@ -555,20 +565,21 @@ " #plt.plot(ts_emt3ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], np.sqrt(3/2)*ts_emt3ph_TrStab_dl[name].interpolate(timestep).values[begin_idx:end_idx], label=name + ' EMT')\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Genrerator terminal Current" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylabel('Generator terminal current (A)')\n", @@ -580,20 +591,21 @@ "\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Voltage across line" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "\n", @@ -603,20 +615,21 @@ " #plt.plot(ts_emt3ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], np.sqrt(3/2)*ts_emt3ph_TrStab_dl[name].interpolate(timestep).values[begin_idx:end_idx], label=name + ' EMT')\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Current through line" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "\n", @@ -626,20 +639,21 @@ " #plt.plot(ts_emt3ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], np.sqrt(3/2)*ts_emt3ph_TrStab_dl[name].interpolate(timestep).values[begin_idx:end_idx], label=name + ' EMT')\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Generator electrical & mechanical energy" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylim(250e6,350e6)\n", @@ -650,20 +664,21 @@ " #plt.plot(ts_emt3ph_TrStab_dl[name].interpolate(timestep).time[begin_idx:end_idx], np.sqrt(3/2)*ts_emt3ph_TrStab_dl[name].interpolate(timestep).values[begin_idx:end_idx], label=name + ' EMT')\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Rotor frequency" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# plt.figure(figsize=(12,8))\n", "# plt.xlabel('time (s)', fontsize=20)\n", @@ -682,22 +697,22 @@ "# plt.legend(fontsize=18)\n", "# #plt.title('Post-Fault',fontsize=20)\n", "# plt.show()\n" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "## Rotor angular velocity $\\omega _r$" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.xlabel('time (s)', fontsize=20)\n", @@ -714,20 +729,21 @@ "plt.legend(fontsize=18)\n", "#plt.title('Post-Fault',fontsize=20)\n", "plt.show()\n" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Rotor angle $\\delta _r$" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.xlabel('time (s)', fontsize=20)\n", @@ -744,16 +760,15 @@ "plt.legend(fontsize=18)\n", "#plt.title('Post-Fault',fontsize=20)\n", "plt.show()\n" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "Frequency of load angle in 1hz-2hz range" - ], - "metadata": {} + ] } ], "metadata": { diff --git a/examples/Notebooks/Circuits/DP_Slack_PiLine_PQLoad_with_PF_Init.ipynb b/examples/Notebooks/Circuits/DP_Slack_PiLine_PQLoad_with_PF_Init.ipynb index eb19944b7c..b970007dbb 100644 --- a/examples/Notebooks/Circuits/DP_Slack_PiLine_PQLoad_with_PF_Init.ipynb +++ b/examples/Notebooks/Circuits/DP_Slack_PiLine_PQLoad_with_PF_Init.ipynb @@ -2,14 +2,16 @@ "cells": [ { "cell_type": "markdown", + "metadata": {}, "source": [ "# DP Simulation of topology with slack, line and PQ load" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "from villas.dataprocessing.readtools import *\n", "from villas.dataprocessing.timeseries import *\n", @@ -18,20 +20,20 @@ "import re\n", "\n", "# %matplotlib widget" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Parameters\n", "V_nom = 20e3\n", @@ -120,7 +122,7 @@ "system_dp = dpsimpy.SystemTopology(50, [n1_dp, n2_dp], [extnet_dp, line_dp, load_dp])\n", "\n", "# Initialization of dynamic topology\n", - "system_dp.init_with_powerflow(system_pf)\n", + "system_dp.init_with_powerflow(system_pf, dpsimpy.Domain.DP)\n", "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", @@ -149,53 +151,53 @@ "sim_dp.add_logger(logger_dp)\n", "sim_dp.add_event(load_step_event)\n", "sim_dp.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## PF results" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "modelName = 'DP_Slack_PiLine_PQLoad_with_PF_Init_PF'\n", "path = 'logs/' + modelName + '/'\n", "dpsim_result_file = path + modelName + '.csv'\n", "\n", "ts_dpsim_pf = read_timeseries_csv(dpsim_result_file)" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## DP results" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "modelName = 'DP_Slack_PiLine_PQLoad_with_PF_Init_DP'\n", "path = 'logs/' + modelName + '/'\n", "dpsim_result_file = path + modelName + '.csv'\n", "\n", "ts_dpsim = read_timeseries_csv(dpsim_result_file)" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,6))\n", "for ts_name, ts_obj in ts_dpsim.items():\n", @@ -206,13 +208,13 @@ "plt.xlim(4.9, 5.5)\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,6))\n", "for ts_name, ts_obj in ts_dpsim.items():\n", @@ -221,13 +223,13 @@ "plt.xlim(4.9, 5.5)\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "Fs = int(1 / (ts_dpsim['i12'].time[1] - ts_dpsim['i12'].time[0]))\n", "plt.figure(figsize=(12,6))\n", @@ -236,16 +238,14 @@ "plt.xlim(-6,5)\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, - "source": [], + "metadata": {}, "outputs": [], - "metadata": {} + "source": [] } ], "metadata": { diff --git a/examples/Notebooks/Circuits/DP_Slack_PiLine_VSI_with_PF_Init.ipynb b/examples/Notebooks/Circuits/DP_Slack_PiLine_VSI_with_PF_Init.ipynb index ff637bcfef..c8993f4abb 100644 --- a/examples/Notebooks/Circuits/DP_Slack_PiLine_VSI_with_PF_Init.ipynb +++ b/examples/Notebooks/Circuits/DP_Slack_PiLine_VSI_with_PF_Init.ipynb @@ -2,14 +2,16 @@ "cells": [ { "cell_type": "markdown", + "metadata": {}, "source": [ "# DP Simulation of topology with slack, line and VSI" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "from villas.dataprocessing.readtools import *\n", "from villas.dataprocessing.timeseries import *\n", @@ -18,27 +20,27 @@ "import dpsimpy\n", "\n", "# %matplotlib widget" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Simulation" - ], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Parameterization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "final_time = 1.0\n", "time_step = 1e-5\n", @@ -47,20 +49,20 @@ "cmd_scale_P = 1.0\n", "cmd_scale_I = 1.0\n", "V_nom = 20e3" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Powerflow for Initialization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "time_step_pf = final_time\n", "final_time_pf = final_time + time_step_pf\n", @@ -106,20 +108,20 @@ "sim_pf.do_init_from_nodes_and_terminals(False)\n", "sim_pf.add_logger(logger_pf)\n", "sim_pf.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Dynamic Simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "time_step_dp = time_step\n", "final_time_dp = final_time + time_step_dp\n", @@ -155,7 +157,7 @@ "system_dp = dpsimpy.SystemTopology(50, [n1_dp, n2_dp], [extnet_dp, line_dp, pv])\n", "\n", "# Initialization of dynamic topology\n", - "system_dp.init_with_powerflow(system_pf)\n", + "system_dp.init_with_powerflow(system_pf, dpsimpy.Domain.DP)\n", "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", @@ -208,53 +210,53 @@ "sim_dp.add_event(load_step_event)\n", "sim_dp.add_logger(logger_dp)\n", "sim_dp.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## PF results" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "modelName = 'DP_Slack_PiLine_VSI_with_PF_Init_PF'\n", "path = 'logs/' + modelName + '/'\n", "dpsim_result_file = path + modelName + '.csv'\n", "\n", "ts_dpsim_pf = read_timeseries_csv(dpsim_result_file)" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## DP results" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "modelName = 'DP_Slack_PiLine_VSI_with_PF_Init_DP'\n", "path = 'logs/' + modelName + '/'\n", "dpsim_result_file = path + modelName + '.csv'\n", "\n", "ts_dpsim = read_timeseries_csv(dpsim_result_file)" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "fig = plt.figure(figsize=(12,6))\n", "for ts_name, ts_obj in ts_dpsim.items():\n", @@ -268,13 +270,13 @@ "plt.xlabel('Zeit [s]')\n", "plt.ylabel('Spannung [kV]')\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,6))\n", "for ts_name, ts_obj in ts_dpsim.items():\n", @@ -283,13 +285,13 @@ "plt.xlim(4.999, 5.004)\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "fig = plt.figure(figsize=(12,6))\n", "ts_5 = ts_dpsim['i12']\n", @@ -303,9 +305,7 @@ "plt.xlabel('Zeit [s]')\n", "plt.ylabel('Stromänderung [A/Zeitschritt]')\n", "plt.show()\n" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", @@ -342,6 +342,8 @@ { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "#fig = plt.figure(figsize=(12,6))\n", "\n", @@ -358,13 +360,13 @@ "#plt.xlabel('Zeit [s]')\n", "#plt.ylabel('Stromstärke [A]')\n", "#pass" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "#plt.figure(figsize=(12,6))\n", "\n", @@ -375,16 +377,14 @@ "#plt.xlabel('Frequenz [Hz]')\n", "#plt.ylabel('Gain')\n", "#pass" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, - "source": [], + "metadata": {}, "outputs": [], - "metadata": {} + "source": [] } ], "metadata": { diff --git a/examples/Notebooks/Circuits/EMT_DP_SP_Slack_PiLine_VSI.ipynb b/examples/Notebooks/Circuits/EMT_DP_SP_Slack_PiLine_VSI.ipynb index bd3a522a00..e62c98c7a5 100644 --- a/examples/Notebooks/Circuits/EMT_DP_SP_Slack_PiLine_VSI.ipynb +++ b/examples/Notebooks/Circuits/EMT_DP_SP_Slack_PiLine_VSI.ipynb @@ -13,6 +13,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -20,6 +21,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -42,6 +44,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -100,6 +103,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -149,7 +153,7 @@ "system_emt = dpsimpy.SystemTopology(50, [n1_emt, n2_emt], [extnet_emt, line_emt, pv])\n", "\n", "# Initialization of dynamic topology\n", - "system_emt.init_with_powerflow(system_pf)\n", + "system_emt.init_with_powerflow(system_pf, dpsimpy.Domain.EMT)\n", "\n", "# Logging\n", "logger_emt = dpsimpy.Logger(sim_name_emt)\n", @@ -205,6 +209,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -212,6 +217,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -234,6 +240,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -292,6 +299,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -338,7 +346,7 @@ "system_dp = dpsimpy.SystemTopology(50, [n1_dp, n2_dp], [extnet_dp, line_dp, pv])\n", "\n", "# Initialization of dynamic topology\n", - "system_dp.init_with_powerflow(system_pf)\n", + "system_dp.init_with_powerflow(system_pf, dpsimpy.Domain.DP)\n", "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", @@ -394,6 +402,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -401,6 +410,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -423,6 +433,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -481,6 +492,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -527,7 +539,7 @@ "system_sp = dpsimpy.SystemTopology(50, [n1_sp, n2_sp], [extnet_sp, line_sp, pv])\n", "\n", "# Initialization of dynamic topology\n", - "system_sp.init_with_powerflow(system_pf)\n", + "system_sp.init_with_powerflow(system_pf, dpsimpy.Domain.SP)\n", "\n", "# Logging\n", "logger_sp = dpsimpy.Logger(sim_name_sp)\n", @@ -583,6 +595,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Circuits/EMT_DP_Slack_PiLine_VSI_Control_OnOff.ipynb b/examples/Notebooks/Circuits/EMT_DP_Slack_PiLine_VSI_Control_OnOff.ipynb index 8a74c2be7a..59a40e7bf2 100644 --- a/examples/Notebooks/Circuits/EMT_DP_Slack_PiLine_VSI_Control_OnOff.ipynb +++ b/examples/Notebooks/Circuits/EMT_DP_Slack_PiLine_VSI_Control_OnOff.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -22,6 +23,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -29,6 +31,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -51,6 +54,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -109,6 +113,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -158,7 +163,7 @@ "system_emt = dpsimpy.SystemTopology(50, [n1_emt, n2_emt], [extnet_emt, line_emt, pv])\n", "\n", "# Initialization of dynamic topology\n", - "system_emt.init_with_powerflow(system_pf)\n", + "system_emt.init_with_powerflow(system_pf, dpsimpy.Domain.EMT)\n", "\n", "# Logging\n", "logger_emt = dpsimpy.Logger(sim_name_emt)\n", @@ -214,6 +219,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -221,6 +227,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -243,6 +250,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -301,6 +309,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -350,7 +359,7 @@ "system_emt = dpsimpy.SystemTopology(50, [n1_emt, n2_emt], [extnet_emt, line_emt, pv])\n", "\n", "# Initialization of dynamic topology\n", - "system_emt.init_with_powerflow(system_pf)\n", + "system_emt.init_with_powerflow(system_pf, dpsimpy.Domain.EMT)\n", "\n", "# Logging\n", "logger_emt = dpsimpy.Logger(sim_name_emt)\n", @@ -406,6 +415,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -426,6 +436,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -446,6 +457,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -466,6 +478,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -473,6 +486,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -501,6 +515,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -526,6 +541,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -533,6 +549,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -562,6 +579,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -587,6 +605,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -594,6 +613,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -616,6 +636,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -674,6 +695,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -720,7 +742,7 @@ "system_dp = dpsimpy.SystemTopology(50, [n1_dp, n2_dp], [extnet_dp, line_dp, pv])\n", "\n", "# Initialization of dynamic topology\n", - "system_dp.init_with_powerflow(system_pf)\n", + "system_dp.init_with_powerflow(system_pf, dpsimpy.Domain.DP)\n", "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", @@ -776,6 +798,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -783,6 +806,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -805,6 +829,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -863,6 +888,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -909,7 +935,7 @@ "system_dp = dpsimpy.SystemTopology(50, [n1_dp, n2_dp], [extnet_dp, line_dp, pv])\n", "\n", "# Initialization of dynamic topology\n", - "system_dp.init_with_powerflow(system_pf)\n", + "system_dp.init_with_powerflow(system_pf, dpsimpy.Domain.DP)\n", "\n", "# Logging\n", "logger_dp = dpsimpy.Logger(sim_name_dp)\n", @@ -965,6 +991,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -985,6 +1012,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -1005,6 +1033,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -1025,6 +1054,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -1032,6 +1062,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -1060,6 +1091,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -1085,6 +1117,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -1092,6 +1125,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -1121,6 +1155,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Circuits/EMT_Slack_PiLine_PQLoad_with_PF_Init.ipynb b/examples/Notebooks/Circuits/EMT_Slack_PiLine_PQLoad_with_PF_Init.ipynb index 013d44e0f3..fe600ae32d 100644 --- a/examples/Notebooks/Circuits/EMT_Slack_PiLine_PQLoad_with_PF_Init.ipynb +++ b/examples/Notebooks/Circuits/EMT_Slack_PiLine_PQLoad_with_PF_Init.ipynb @@ -2,14 +2,16 @@ "cells": [ { "cell_type": "markdown", + "metadata": {}, "source": [ "# EMT Simulation of topology with slack, line and PQ load" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "from villas.dataprocessing.readtools import *\n", "from villas.dataprocessing.timeseries import *\n", @@ -18,20 +20,20 @@ "import re\n", "\n", "# %matplotlib widget" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "# Parameters\n", "V_nom = 20e3\n", @@ -123,7 +125,7 @@ "system_emt = dpsimpy.SystemTopology(50, [n1_emt, n2_emt], [extnet_emt, line_emt, load_emt])\n", "\n", "# Initialization of dynamic topology\n", - "system_emt.init_with_powerflow(system_pf)\n", + "system_emt.init_with_powerflow(system_pf, dpsimpy.Domain.EMT)\n", "\n", "# Logging\n", "logger_emt = dpsimpy.Logger(sim_name_emt)\n", @@ -152,53 +154,53 @@ "sim_emt.add_logger(logger_emt)\n", "sim_emt.add_event(load_step_event)\n", "sim_emt.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## PF results" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "modelName = 'EMT_Slack_PiLine_PQLoad_with_PF_Init_PF'\n", "path = 'logs/' + modelName + '/'\n", "dpsim_result_file = path + modelName + '.csv'\n", "\n", "ts_dpsim_pf = read_timeseries_csv(dpsim_result_file)" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## EMT results" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "modelName = 'EMT_Slack_PiLine_PQLoad_with_PF_Init_EMT'\n", "path = 'logs/' + modelName + '/'\n", "dpsim_result_file = path + modelName + '.csv'\n", "PEAK1PH_TO_RMS3PH = np.sqrt(3.0/2.0)\n", "ts_dpsim = read_timeseries_csv(dpsim_result_file)" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,6))\n", "for ts_name, ts_obj in ts_dpsim.items():\n", @@ -210,13 +212,13 @@ "plt.xlim(4.9,5.5)\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,6))\n", "for ts_name, ts_obj in ts_dpsim.items():\n", @@ -228,13 +230,13 @@ "plt.xlim(4.9, 5.5)\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "Fs = int(1 / (ts_dpsim['i12_0'].time[1] - ts_dpsim['i12_0'].time[0]))\n", "plt.figure(figsize=(12,6))\n", @@ -243,16 +245,14 @@ "plt.xlim(44,55)\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, - "source": [], + "metadata": {}, "outputs": [], - "metadata": {} + "source": [] } ], "metadata": { @@ -276,4 +276,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +} diff --git a/examples/Notebooks/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init.ipynb b/examples/Notebooks/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init.ipynb index d74e43d954..774f08d94d 100644 --- a/examples/Notebooks/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init.ipynb +++ b/examples/Notebooks/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init.ipynb @@ -159,7 +159,7 @@ "system_emt = dpsimpy.SystemTopology(50, [n1_emt, n2_emt], [extnet_emt, line_emt, pv])\n", "\n", "# Initialization of dynamic topology\n", - "system_emt.init_with_powerflow(system_pf)\n", + "system_emt.init_with_powerflow(system_pf, dpsimpy.Domain.EMT)\n", "\n", "# Logging\n", "logger_emt = dpsimpy.Logger(sim_name_emt)\n", diff --git a/examples/Notebooks/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init_Params.ipynb b/examples/Notebooks/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init_Params.ipynb index def43786d9..094edfd1ab 100644 --- a/examples/Notebooks/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init_Params.ipynb +++ b/examples/Notebooks/Circuits/EMT_Slack_PiLine_VSI_with_PF_Init_Params.ipynb @@ -2,31 +2,33 @@ "cells": [ { "cell_type": "markdown", + "metadata": {}, "source": [ "# Testing control params" - ], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Set up simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "import numpy as np\n", "import dpsimpy" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "def EMTSimulation(name, kp, ki):\n", " final_time = 4\n", @@ -118,7 +120,7 @@ " system_emt = dpsimpy.SystemTopology(50, [n1_emt, n2_emt], [extnet_emt, line_emt, pv])\n", "\n", " # Initialization of dynamic topology\n", - " system_emt.init_with_powerflow(system_pf)\n", + " system_emt.init_with_powerflow(system_pf, dpsimpy.Domain.EMT)\n", "\n", " # Logging\n", " logger_emt = dpsimpy.Logger(sim_name_emt)\n", @@ -171,20 +173,20 @@ " sim_emt.add_event(load_step_event)\n", " sim_emt.add_logger(logger_emt)\n", " sim_emt.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Kp study" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "from villas.dataprocessing.readtools import *\n", "from villas.dataprocessing.timeseries import *\n", @@ -197,38 +199,38 @@ "PEAK1PH_TO_RMS3PH = np.sqrt(3.0/2.0)\n", "\n", "scale_kp=np.round(np.arange(0.58,0.68,0.02),2)" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Run Simulations" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "for kp in scale_kp:\n", " modelName = 'EMT_Slack_PiLine_VSI_with_PF_Init_KP-'+str(kp)\n", " EMTSimulation(modelName, kp, 1.0)" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## EMT results" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "ts_dpsim={}\n", "for kp in scale_kp:\n", @@ -236,20 +238,20 @@ " path = 'logs/' + modelName + '/'\n", " dpsim_result_file = path + modelName + '.csv'\n", " ts_dpsim[str(kp)] = read_timeseries_csv(dpsim_result_file)" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### States - Active Power" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,6))\n", "\n", @@ -267,20 +269,20 @@ " \n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### States - Reactive Power" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,6))\n", "\n", @@ -298,20 +300,20 @@ " \n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Ki study" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "from villas.dataprocessing.readtools import *\n", "from villas.dataprocessing.timeseries import *\n", @@ -324,38 +326,38 @@ "PEAK1PH_TO_RMS3PH = np.sqrt(3.0/2.0)\n", "\n", "scale_ki=np.round(np.arange(0.1,2.1,0.2),1)" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Run Simulations" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "for ki in scale_ki:\n", " modelName = 'EMT_Slack_PiLine_VSI_with_PF_Init_KI-'+str(ki)\n", " EMTSimulation(modelName, 1.0, ki)" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## EMT results" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "ts_dpsim={}\n", "for ki in scale_ki:\n", @@ -363,20 +365,20 @@ " path = 'logs/' + modelName + '/'\n", " dpsim_result_file = path + modelName + '.csv'\n", " ts_dpsim[str(ki)] = read_timeseries_csv(dpsim_result_file)" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### States - Active Power" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,6))\n", "\n", @@ -394,20 +396,20 @@ " \n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### States - Reactive Power" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,6))\n", "\n", @@ -425,20 +427,20 @@ " \n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## Final choice" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "kp=0.66\n", "ki=1.0\n", @@ -450,20 +452,20 @@ "path = 'logs/' + modelName + '/'\n", "dpsim_result_file = path + modelName + '.csv'\n", "ts_dpsim = read_timeseries_csv(dpsim_result_file)" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### States - Active Power" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,6))\n", "\n", @@ -479,20 +481,20 @@ " \n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### States - Reactive Power" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,6))\n", "\n", @@ -508,9 +510,7 @@ " \n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] } ], "metadata": { @@ -529,4 +529,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +} diff --git a/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_JsonSyngenParams.ipynb b/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_JsonSyngenParams.ipynb index 57e86ba2d8..8f01c5e412 100644 --- a/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_JsonSyngenParams.ipynb +++ b/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_JsonSyngenParams.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -36,6 +37,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -43,6 +45,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -100,6 +103,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -122,7 +126,7 @@ "n2_pf = dpsimpy.sp.SimNode(\"n2\", dpsimpy.PhaseType.Single)\n", "\n", "# Synchronous generator ideal model\n", - "gen_pf = dpsimpy.sp.ph1.SynchronGenerator(\"Generator\", dpsimpy.LogLevel.debug)\n", + "gen_pf = dpsimpy.sp.ph1.SynchronGenerator(\"SynGen\", dpsimpy.LogLevel.debug)\n", "gen_pf.set_parameters(rated_apparent_power=555e6, rated_voltage=24e3,\n", " set_point_active_power=set_point_active_power,\n", " set_point_voltage=set_point_voltage,\n", @@ -170,6 +174,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -232,7 +237,7 @@ "\n", "\n", "# Initialization of dynamic topology\n", - "system.init_with_powerflow(system_pf)\n", + "system.init_with_powerflow(system_pf, dpsimpy.Domain.EMT)\n", "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", @@ -260,6 +265,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -267,6 +273,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -319,6 +326,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -341,7 +349,7 @@ "n2_pf = dpsimpy.sp.SimNode(\"n2\", dpsimpy.PhaseType.Single)\n", "\n", "# Synchronous generator ideal model\n", - "gen_pf = dpsimpy.sp.ph1.SynchronGenerator(\"Generator\", dpsimpy.LogLevel.debug)\n", + "gen_pf = dpsimpy.sp.ph1.SynchronGenerator(\"SynGen\", dpsimpy.LogLevel.debug)\n", "gen_pf.set_parameters(rated_apparent_power=555e6, rated_voltage=24e3,\n", " set_point_active_power=set_point_active_power,\n", " set_point_voltage=set_point_voltage,\n", @@ -389,6 +397,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -451,7 +460,7 @@ "\n", "\n", "# Initialization of dynamic topology\n", - "system.init_with_powerflow(system_pf)\n", + "system.init_with_powerflow(system_pf, dpsimpy.Domain.EMT)\n", "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", @@ -479,6 +488,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -498,6 +508,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -517,6 +528,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_ParamsModification.ipynb b/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_ParamsModification.ipynb index 1ab46d5a32..b5e5fa7842 100644 --- a/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_ParamsModification.ipynb +++ b/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_OperationalParams_SMIB_Fault_ParamsModification.ipynb @@ -1,15 +1,18 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "# Synchronous Generator dq 7th order model - Parameter Modification" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "import villas.dataprocessing.readtools as rt\n", "from villas.dataprocessing.timeseries import TimeSeries as ts\n", @@ -20,20 +23,21 @@ "import dpsimpy\n", "\n", "#matplotlib widget" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Set up simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "def Simulation(name, Ld_s):\n", " # General grid parameters\n", @@ -90,7 +94,7 @@ " n2_pf = dpsimpy.sp.SimNode(\"n2\", dpsimpy.PhaseType.Single)\n", "\n", " # Synchronous generator ideal model\n", - " gen_pf = dpsimpy.sp.ph1.SynchronGenerator(\"Generator\", dpsimpy.LogLevel.debug)\n", + " gen_pf = dpsimpy.sp.ph1.SynchronGenerator(\"SynGen\", dpsimpy.LogLevel.debug)\n", " gen_pf.set_parameters(rated_apparent_power=555e6, rated_voltage=24e3,\n", " set_point_active_power=set_point_active_power,\n", " set_point_voltage=set_point_voltage,\n", @@ -184,8 +188,7 @@ "\n", "\n", " # Initialization of dynamic topology\n", - " system.init_with_powerflow(system_pf)\n", - " gen.get_terminal(index=0).set_power(- gen_pf.get_apparent_power())\n", + " system.init_with_powerflow(system_pf, dpsimpy.Domain.EMT)\n", "\n", " # Logging\n", " logger = dpsimpy.Logger(sim_name)\n", @@ -210,90 +213,95 @@ " sim.add_logger(logger)\n", " sim.add_event(sw1)\n", " sim.run()" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Run with first parameter set" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "Simulation(name=\"SMIB_Fault_Params1\", Ld_s=0.2299)" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Results with first parameter set" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "work_dir = 'logs/SMIB_Fault_Params1/'\n", "log_name = 'SMIB_Fault_Params1'\n", "print(work_dir + log_name + '.csv')\n", "ts_smib_fault_params1 = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Run with second parameter set" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "Simulation(name=\"SMIB_Fault_Params2\", Ld_s=0.1149)" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Results with second parameter set" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "work_dir = 'logs/SMIB_Fault_Params2/'\n", "log_name = 'SMIB_Fault_Params2'\n", "print(work_dir + log_name + '.csv')\n", "ts_smib_fault_params2 = rt.read_timeseries_dpsim(work_dir + log_name + '.csv')" - ], - "outputs": [], - "metadata": {} + ] }, { + "attachments": {}, "cell_type": "markdown", + "metadata": {}, "source": [ "## Genrerator terminal Current" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,8))\n", "plt.ylabel('Generator terminal current (V)', fontsize=18)\n", @@ -304,9 +312,7 @@ "\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] } ], "metadata": { diff --git a/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_SMIB_Fault.ipynb b/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_SMIB_Fault.ipynb index b08228f00c..5d5bb39fbb 100644 --- a/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_SMIB_Fault.ipynb +++ b/examples/Notebooks/Circuits/EMT_SynGenDQ7odTrapez_SMIB_Fault.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -8,6 +9,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -35,6 +37,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -42,6 +45,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -84,6 +88,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -106,7 +111,7 @@ "n2_pf = dpsimpy.sp.SimNode(\"n2\", dpsimpy.PhaseType.Single)\n", "\n", "# Synchronous generator ideal model\n", - "gen_pf = dpsimpy.sp.ph1.SynchronGenerator(\"Generator\", dpsimpy.LogLevel.debug)\n", + "gen_pf = dpsimpy.sp.ph1.SynchronGenerator(\"SynGen\", dpsimpy.LogLevel.debug)\n", "gen_pf.set_parameters(rated_apparent_power=555e6, rated_voltage=24e3,\n", " set_point_active_power=set_point_active_power,\n", " set_point_voltage=set_point_voltage,\n", @@ -154,6 +159,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -215,7 +221,7 @@ "\n", "\n", "# Initialization of dynamic topology\n", - "system.init_with_powerflow(system_pf)\n", + "system.init_with_powerflow(system_pf, dpsimpy.Domain.EMT)\n", "\n", "# Logging\n", "logger = dpsimpy.Logger(sim_name)\n", @@ -245,6 +251,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -264,6 +271,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -287,6 +295,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -310,6 +319,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -333,6 +343,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -355,6 +366,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -377,6 +389,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -403,6 +416,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -427,6 +441,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Circuits/SP_Slack_PiLine_VSI_with_PF_Init.ipynb b/examples/Notebooks/Circuits/SP_Slack_PiLine_VSI_with_PF_Init.ipynb index 85c245d0bd..abf0935cbc 100644 --- a/examples/Notebooks/Circuits/SP_Slack_PiLine_VSI_with_PF_Init.ipynb +++ b/examples/Notebooks/Circuits/SP_Slack_PiLine_VSI_with_PF_Init.ipynb @@ -2,14 +2,16 @@ "cells": [ { "cell_type": "markdown", + "metadata": {}, "source": [ "# SP Simulation of topology with slack, line and VSI" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "from villas.dataprocessing.readtools import *\n", "from villas.dataprocessing.timeseries import *\n", @@ -18,27 +20,27 @@ "import dpsimpy\n", "\n", "# %matplotlib widget" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## SP Simulation" - ], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Parameterization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "final_time = 4.0\n", "time_step = 1e-3\n", @@ -47,20 +49,20 @@ "cmd_scale_P = 1.0\n", "cmd_scale_I = 1.0\n", "V_nom = 20e3" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Powerflow for Initialization" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "time_step_pf = final_time\n", "final_time_pf = final_time + time_step_pf\n", @@ -105,20 +107,20 @@ "sim_pf.do_init_from_nodes_and_terminals(False)\n", "sim_pf.add_logger(logger_pf)\n", "sim_pf.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "### Dynamic Simulation" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "time_step_sp = time_step\n", "final_time_sp = final_time + time_step_sp\n", @@ -154,7 +156,7 @@ "system_sp = dpsimpy.SystemTopology(50, [n1_sp, n2_sp], [extnet_sp, line_sp, pv])\n", "\n", "# Initialization of dynamic topology\n", - "system_sp.init_with_powerflow(system_pf)\n", + "system_sp.init_with_powerflow(system_pf, dpsimpy.Domain.SP)\n", "\n", "# Logging\n", "logger_sp = dpsimpy.Logger(sim_name_sp)\n", @@ -207,53 +209,53 @@ "sim_sp.add_event(load_step_event)\n", "sim_sp.add_logger(logger_sp)\n", "sim_sp.run()" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## PF results" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "modelName = 'SP_Slack_PiLine_VSI_with_PF_Init_PF'\n", "path = 'logs/' + modelName + '/'\n", "dpsim_result_file = path + modelName + '.csv'\n", "\n", "ts_dpsim_pf = read_timeseries_csv(dpsim_result_file)" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "markdown", + "metadata": {}, "source": [ "## SP results" - ], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "modelName = 'SP_Slack_PiLine_VSI_with_PF_Init_SP'\n", "path = 'logs/' + modelName + '/'\n", "dpsim_result_file = path + modelName + '.csv'\n", "\n", "ts_dpsim = read_timeseries_csv(dpsim_result_file)" - ], - "outputs": [], - "metadata": {} + ] }, { "cell_type": "code", "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "plt.figure(figsize=(12,6))\n", "for ts_name, ts_obj in ts_dpsim.items():\n", @@ -264,9 +266,7 @@ " plt.plot(ts_obj.time, ts_obj.abs().values, label=ts_name+'_pf', linestyle=':')\n", "plt.legend()\n", "plt.show()" - ], - "outputs": [], - "metadata": {} + ] } ], "metadata": { diff --git a/examples/Notebooks/Circuits/SP_Validation_ReducedOrderSG_VBR_SMIB_Fault_withControllers.ipynb b/examples/Notebooks/Circuits/SP_Validation_ReducedOrderSG_VBR_SMIB_Fault_withControllers.ipynb index e5fb16f7eb..01661e900f 100644 --- a/examples/Notebooks/Circuits/SP_Validation_ReducedOrderSG_VBR_SMIB_Fault_withControllers.ipynb +++ b/examples/Notebooks/Circuits/SP_Validation_ReducedOrderSG_VBR_SMIB_Fault_withControllers.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "id": "olympic-travel", "metadata": {}, @@ -9,6 +10,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "separate-power", "metadata": {}, @@ -40,6 +42,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "clinical-weight", "metadata": {}, @@ -83,6 +86,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "demanding-stadium", "metadata": {}, @@ -119,6 +123,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "conscious-influence", "metadata": {}, @@ -127,6 +132,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "several-waters", "metadata": {}, @@ -159,6 +165,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "eastern-fellowship", "metadata": {}, @@ -191,6 +198,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "studied-candy", "metadata": {}, @@ -223,6 +231,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "several-nevada", "metadata": {}, @@ -306,6 +315,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "innovative-porter", "metadata": {}, @@ -395,6 +405,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "excellent-elements", "metadata": {}, @@ -403,6 +414,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "polished-texas", "metadata": {}, @@ -424,6 +436,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "spectacular-survival", "metadata": {}, @@ -445,6 +458,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "impaired-address", "metadata": {}, @@ -466,6 +480,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "natural-intent", "metadata": {}, @@ -487,6 +502,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "apart-finland", "metadata": {}, @@ -508,6 +524,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "excessive-yugoslavia", "metadata": {}, @@ -531,6 +548,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "excellent-midnight", "metadata": {}, @@ -552,6 +570,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "expected-luther", "metadata": {}, @@ -573,6 +592,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "signal-democrat", "metadata": {}, @@ -594,6 +614,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "framed-phenomenon", "metadata": {}, @@ -654,6 +675,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "framed-fundamentals", "metadata": {}, @@ -689,6 +711,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "technological-administration", "metadata": {}, @@ -697,6 +720,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "american-patrol", "metadata": {}, @@ -718,6 +742,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "hungarian-david", "metadata": {}, @@ -739,6 +764,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "integral-demand", "metadata": {}, @@ -760,6 +786,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "civil-hacker", "metadata": {}, @@ -781,6 +808,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "failing-lotus", "metadata": {}, @@ -802,6 +830,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "sensitive-daisy", "metadata": {}, @@ -823,6 +852,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "persistent-scanner", "metadata": {}, @@ -844,6 +874,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "outdoor-defense", "metadata": {}, @@ -865,6 +896,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "assisted-cincinnati", "metadata": {}, @@ -886,6 +918,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "sensitive-sphere", "metadata": {}, @@ -907,6 +940,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "coordinate-cream", "metadata": {}, @@ -967,6 +1001,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "comparable-career", "metadata": {}, @@ -1003,6 +1038,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "potential-python", "metadata": {}, @@ -1011,6 +1047,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "happy-hearts", "metadata": {}, @@ -1032,6 +1069,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "loaded-specification", "metadata": {}, @@ -1053,6 +1091,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "printable-trademark", "metadata": {}, @@ -1074,6 +1113,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "comparative-stocks", "metadata": {}, @@ -1095,6 +1135,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "effective-ceremony", "metadata": {}, @@ -1116,6 +1157,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "foreign-cursor", "metadata": {}, @@ -1137,6 +1179,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "parliamentary-summary", "metadata": {}, @@ -1158,6 +1201,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "detailed-bankruptcy", "metadata": {}, @@ -1179,6 +1223,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "super-eleven", "metadata": {}, @@ -1200,6 +1245,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "monetary-wisconsin", "metadata": {}, @@ -1221,6 +1267,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "bound-waters", "metadata": {}, @@ -1242,6 +1289,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "awful-priority", "metadata": {}, @@ -1263,6 +1311,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "running-import", "metadata": {}, @@ -1323,6 +1372,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "twenty-mixer", "metadata": {}, @@ -1361,6 +1411,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "conservative-province", "metadata": {}, @@ -1369,6 +1420,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "single-restaurant", "metadata": {}, @@ -1390,6 +1442,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "large-coast", "metadata": {}, @@ -1411,6 +1464,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "upset-guard", "metadata": {}, @@ -1432,6 +1486,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "charming-lithuania", "metadata": {}, @@ -1453,6 +1508,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "posted-joseph", "metadata": {}, @@ -1474,6 +1530,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "attempted-peoples", "metadata": {}, @@ -1495,6 +1552,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "future-skill", "metadata": {}, @@ -1516,6 +1574,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "certain-vietnam", "metadata": {}, @@ -1537,6 +1596,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "becoming-tomorrow", "metadata": {}, @@ -1597,6 +1657,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "prostate-alert", "metadata": {}, @@ -1631,6 +1692,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "79cd971b-ab74-4275-a0b0-559e982766df", "metadata": {}, @@ -1662,6 +1724,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "da858f2b-4c7f-40f5-a730-ce163df83527", "metadata": {}, @@ -1705,6 +1768,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "44217f62-e73c-48f9-a564-354e4f98426d", "metadata": {}, @@ -1741,6 +1805,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "2e6e10ed-8254-4f87-bfe6-e50183133da8", "metadata": {}, @@ -1749,6 +1814,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "c531822b-436e-427a-9a3c-4179e431b9c6", "metadata": {}, @@ -1781,6 +1847,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "8172bd53-0864-434c-b92f-e1d962d576ee", "metadata": {}, @@ -1813,6 +1880,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "833898e2-2ea1-4609-a0c6-93012abe0b1b", "metadata": {}, @@ -1845,6 +1913,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "2e696445-d626-4da1-8d9e-e0142cd0e817", "metadata": {}, @@ -1926,6 +1995,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "b2e90cbc-7020-4040-92a5-58c30098a2be", "metadata": {}, @@ -2014,6 +2084,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "8d9af2b6-2d7e-4781-907d-cbbaaf68934b", "metadata": {}, @@ -2022,6 +2093,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "482d58da-a9ef-43e4-a043-edb39c348b9d", "metadata": {}, @@ -2043,6 +2115,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "c096649b-0b3d-4161-84c1-17ad5770b40a", "metadata": {}, @@ -2064,6 +2137,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "e8ada7f6-470a-4321-b6b8-ba589ab18d32", "metadata": {}, @@ -2085,6 +2159,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "6b59bd63-2789-48e7-b672-b374a843240c", "metadata": {}, @@ -2106,6 +2181,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "b15f5f30-0c69-4036-bc7e-2d6ecbc5b488", "metadata": {}, @@ -2127,6 +2203,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "e44de394-dcad-44da-ac66-8c7157870b70", "metadata": {}, @@ -2148,6 +2225,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "c609e87b-c135-4a17-9fe7-49c17ad8659c", "metadata": {}, @@ -2169,6 +2247,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "c82dd5d7-6221-4b76-a9c6-ab12fe6d5303", "metadata": {}, @@ -2190,6 +2269,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "5ec72411-7ee7-49b5-8638-eee2fd759961", "metadata": {}, @@ -2211,6 +2291,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "f8ca1cdc-3bc1-4a36-93dd-9fb1e83abfd1", "metadata": {}, @@ -2271,6 +2352,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "1f254d2a-92a0-4128-9348-26d552411268", "metadata": {}, @@ -2306,6 +2388,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "2f8110aa-48cf-4aae-ab74-070c2bce4b44", "metadata": {}, @@ -2314,6 +2397,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "8e4e23d0-c60e-4cf3-b39c-2063eedc856d", "metadata": {}, @@ -2335,6 +2419,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "26ff7c1a-247d-4872-bc19-1b0eb4601191", "metadata": {}, @@ -2356,6 +2441,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "3e56c789-d94c-48e9-aa26-f82023e1c20f", "metadata": {}, @@ -2377,6 +2463,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "621fce12-0a89-4db3-a029-28691a104845", "metadata": {}, @@ -2398,6 +2485,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "5f9a5536-dba8-4cd5-b520-0ede3528bf4f", "metadata": {}, @@ -2419,6 +2507,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "2fa39790-1a3e-4895-8bac-a4ca0f3338d0", "metadata": {}, @@ -2440,6 +2529,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "eb195100-95be-4512-9f60-f6036a21b37a", "metadata": {}, @@ -2461,6 +2551,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "c810f1ea-1dfc-47a6-8e87-668b5a3b1db2", "metadata": {}, @@ -2482,6 +2573,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "f7c06d89-5fac-4a58-8ae3-34c5c6a017ab", "metadata": {}, @@ -2503,6 +2595,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "2736d5a0-9897-42cd-a76d-00c3b7fdd3f1", "metadata": {}, @@ -2524,6 +2617,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "31dd17b6-b599-45bc-baf0-d346f9b4a9dd", "metadata": {}, @@ -2584,6 +2678,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "2645d55f-84f4-4696-8068-85eb205a3681", "metadata": {}, @@ -2620,6 +2715,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "1e38abe0-1b1b-4ae3-86ca-29a83f7b0108", "metadata": {}, @@ -2628,6 +2724,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "075ce5d4-90f9-4330-b00c-33af4aa54d5a", "metadata": {}, @@ -2649,6 +2746,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "8b8e3da2-fc0b-484f-b379-2def931371c6", "metadata": {}, @@ -2670,6 +2768,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "0a97f473-b1a6-49de-9bbc-bf6e0ac23bce", "metadata": {}, @@ -2691,6 +2790,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "c858465c-7151-410c-b1bb-5727bc8b5d48", "metadata": {}, @@ -2712,6 +2812,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "7e9a8414-9a2c-40b1-9b79-bbd2e5157660", "metadata": {}, @@ -2733,6 +2834,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "ded10ed5-a8df-41e2-be71-e8fe9a06e3fd", "metadata": {}, @@ -2754,6 +2856,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "d5bfb815-9a8f-4503-9751-fee79f31b0dd", "metadata": {}, @@ -2775,6 +2878,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "53fd895f-a6a1-4024-b64a-317f29454761", "metadata": {}, @@ -2796,6 +2900,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "effa80b0-da2f-4b96-8f4c-a051f131e65c", "metadata": {}, @@ -2817,6 +2922,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "07863832-c43a-435c-8239-686ea361b92c", "metadata": {}, @@ -2838,6 +2944,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "1be023ee-21e4-4041-a987-27d21259e79c", "metadata": {}, @@ -2859,6 +2966,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "f8efa302-ca3b-43a6-9d3b-76e7bc857521", "metadata": {}, @@ -2880,6 +2988,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "ad8bb222-672c-4141-817b-636542aed44c", "metadata": {}, @@ -2940,6 +3049,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "4b7f9125-ee3a-4011-bac3-9ebbc6331aa1", "metadata": {}, @@ -2978,6 +3088,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "d421d63f-f09b-4598-8589-ca459647e29a", "metadata": {}, @@ -2986,6 +3097,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "8258d1a3-602d-4c6a-b271-b701dd81c988", "metadata": {}, @@ -3007,6 +3119,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "c1475941-5c79-4605-b5c8-0c985b028978", "metadata": {}, @@ -3028,6 +3141,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "c87b3a30-be5d-48a4-b6bd-92fef053574e", "metadata": {}, @@ -3049,6 +3163,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "614c3ddf-2088-456a-b506-eecd20b380bc", "metadata": {}, @@ -3070,6 +3185,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "184288c3-935f-42ec-98c4-3fb13b9c86b3", "metadata": {}, @@ -3091,6 +3207,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "5f03d02b-cfb5-4f1e-8dc6-6fcad18534b7", "metadata": {}, @@ -3112,6 +3229,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "b3633186-623a-45ac-b95f-49ef599e1d88", "metadata": {}, @@ -3133,6 +3251,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "22dbf0e9-fbe7-46d6-a304-06c5396582f1", "metadata": {}, @@ -3154,6 +3273,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "82986899-27d9-4b7c-8f42-3ad00609666a", "metadata": {}, @@ -3214,6 +3334,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "4c859760-dd0c-4a0a-b974-ddbfbd6d6068", "metadata": {}, diff --git a/examples/Notebooks/Circuits/SP_Validation_ReducedOrderSG_VBR_SMIB_Fault_withPSAT.ipynb b/examples/Notebooks/Circuits/SP_Validation_ReducedOrderSG_VBR_SMIB_Fault_withPSAT.ipynb index b238975bc9..39971e8419 100644 --- a/examples/Notebooks/Circuits/SP_Validation_ReducedOrderSG_VBR_SMIB_Fault_withPSAT.ipynb +++ b/examples/Notebooks/Circuits/SP_Validation_ReducedOrderSG_VBR_SMIB_Fault_withPSAT.ipynb @@ -453,13 +453,13 @@ "\n", "### Nodes\n", "gnd_pf = dpsimpy.sp.SimNode.gnd\n", - "n1_pf = dpsimpy.sp.SimNode('n1_pf', dpsimpy.PhaseType.Single)\n", - "n2_pf = dpsimpy.sp.SimNode('n2_pf', dpsimpy.PhaseType.Single)\n", + "n1_pf = dpsimpy.sp.SimNode('n1', dpsimpy.PhaseType.Single)\n", + "n2_pf = dpsimpy.sp.SimNode('n2', dpsimpy.PhaseType.Single)\n", "\n", "### Components\n", "\n", "# syncrhon generator\n", - "gen_pf = dpsimpy.sp.ph1.SynchronGenerator('gen_pf', dpsimpy.LogLevel.debug)\n", + "gen_pf = dpsimpy.sp.ph1.SynchronGenerator('gen', dpsimpy.LogLevel.debug)\n", "gen_pf.set_parameters(rated_apparent_power=nom_power, rated_voltage=nominal_voltage_mv, \n", " set_point_active_power=set_point_active_power, set_point_voltage=set_point_voltage, \n", " powerflow_bus_type=dpsimpy.PowerflowBusType.PV)\n", @@ -467,13 +467,13 @@ "gen_pf.modify_power_flow_bus_type(dpsimpy.PowerflowBusType.PV)\n", "\n", "# Grid bus as Slack\n", - "extnet_pf = dpsimpy.sp.ph1.NetworkInjection(\"Slack\", dpsimpy.LogLevel.debug)\n", + "extnet_pf = dpsimpy.sp.ph1.NetworkInjection(\"slack\", dpsimpy.LogLevel.debug)\n", "extnet_pf.set_parameters(nominal_voltage_mv)\n", "extnet_pf.set_base_voltage(nominal_voltage_mv)\n", "extnet_pf.modify_power_flow_bus_type(dpsimpy.PowerflowBusType.VD)\n", "\n", "# PiLine\n", - "pi_line_pf = dpsimpy.sp.ph1.PiLine('Pi_Line_pf', dpsimpy.LogLevel.debug)\n", + "pi_line_pf = dpsimpy.sp.ph1.PiLine('PiLine', dpsimpy.LogLevel.debug)\n", "pi_line_pf.set_parameters(R=line_resistance, L=line_inductance, C=line_capacitance, G=line_conductance)\n", "pi_line_pf.set_base_voltage(nominal_voltage_mv)\n", "\n", @@ -517,28 +517,19 @@ "metadata": {}, "outputs": [], "source": [ - "def sp_reducedOrderSG_SMIB_fault(sim_pf, gen_pf, gen_model, final_time=10, time_step=0.001):\n", - " \n", - " # ## Extract relevant powerflow results\n", - " init_electrical_power = gen_pf.get_apparent_power()\n", - " init_mechanical_power = gen_pf.get_apparent_power().real\n", + "def sp_reducedOrderSG_SMIB_fault(sim_pf, gen_pf, gen_model, final_time=20, time_step=0.001):\n", "\n", - " ### DPsim SP simulation\n", " name = \"SP_ReducedOrderSG_SMIB_\" + gen_model\n", " dpsimpy.Logger.set_log_dir(\"logs/\" + name)\n", "\n", " ### Nodes\n", " gnd = dpsimpy.sp.SimNode.gnd\n", " n1 = dpsimpy.sp.SimNode('n1', dpsimpy.PhaseType.Single) \n", - " n1.set_initial_voltage(sim_pf.get_idobj_attr(n1_pf.name(), 'v').get()[0])\n", - "\n", " n2 = dpsimpy.sp.SimNode('n2', dpsimpy.PhaseType.Single)\n", - " n2.set_initial_voltage(sim_pf.get_idobj_attr(n2_pf.name(), 'v').get()[0])\n", - "\n", "\n", " ### Components\n", "\n", - " # syncrhon generator\n", + " # synchron generator\n", " gen = None\n", " if (gen_model==\"3Order\"):\n", " gen = dpsimpy.sp.ph1.SynchronGenerator3OrderVBR('gen', dpsimpy.LogLevel.debug)\n", @@ -563,8 +554,6 @@ " gen.set_operational_parameters_per_unit(nom_power=nom_power, nom_voltage=nominal_voltage_mv, nom_frequency=frequency, \n", " H=H, Ld=Ld, Lq=Lq, L0=L0, Ld_t=Ld_t, Lq_t=Lq_t, Td0_t=Td0_t, Tq0_t=Tq0_t,\n", " Ld_s=Ld_s, Lq_s=Lq_s, Td0_s=Td0_s, Tq0_s=Tq0_s)\t\t\n", - " gen.set_initial_values(init_complex_electrical_power=init_electrical_power, init_mechanical_power=init_mechanical_power, \n", - " init_complex_terminal_voltage=sim_pf.get_idobj_attr(n1_pf.name(), 'v').get()[0][0])\n", "\n", " # Switch\n", " switch = dpsimpy.sp.ph1.Switch('Fault', dpsimpy.LogLevel.debug)\n", @@ -607,6 +596,9 @@ " else:\n", " logger.log_attribute(\"Edq0\", \"Edq_t\", gen)\n", " \n", + " # init node voltages and SG power with power flow\n", + " system.init_with_powerflow(system_pf, dpsimpy.Domain.SP)\n", + " \n", " ### Simulation\n", " sim = dpsimpy.Simulation(name, dpsimpy.LogLevel.debug)\n", " sim.set_system(system)\n", diff --git a/examples/Notebooks/Grids/DP_CIGRE_MV_withDG.ipynb b/examples/Notebooks/Grids/DP_CIGRE_MV_withDG.ipynb index 2357f2c5ea..6b8b94907c 100644 --- a/examples/Notebooks/Grids/DP_CIGRE_MV_withDG.ipynb +++ b/examples/Notebooks/Grids/DP_CIGRE_MV_withDG.ipynb @@ -148,7 +148,7 @@ " system_dp.add(pv)\n", " system_dp.connect_component(pv, [connection_node])\n", "\n", - "system_dp.init_with_powerflow(system_pf)\n", + "system_dp.init_with_powerflow(system_pf, dpsimpy.Domain.DP)\n", "\n", "# log node voltages\n", "logger_dp= dpsimpy.Logger(sim_name)\n", diff --git a/examples/Notebooks/Grids/DP_CIGRE_MV_withDG_withLoadStep.ipynb b/examples/Notebooks/Grids/DP_CIGRE_MV_withDG_withLoadStep.ipynb index 62b19dcb06..4a52e83914 100644 --- a/examples/Notebooks/Grids/DP_CIGRE_MV_withDG_withLoadStep.ipynb +++ b/examples/Notebooks/Grids/DP_CIGRE_MV_withDG_withLoadStep.ipynb @@ -140,7 +140,7 @@ " system_dp.add(pv)\n", " system_dp.connect_component(pv, [connection_node])\n", "\n", - "system_dp.init_with_powerflow(system_pf)\n", + "system_dp.init_with_powerflow(system_pf, dpsimpy.Domain.DP)\n", "\n", "# log node voltages\n", "logger_dp= dpsimpy.Logger(sim_name)\n", diff --git a/examples/Notebooks/Grids/DP_CIGRE_MV_withoutDG.ipynb b/examples/Notebooks/Grids/DP_CIGRE_MV_withoutDG.ipynb index d550c3f390..afc9f6cb9c 100644 --- a/examples/Notebooks/Grids/DP_CIGRE_MV_withoutDG.ipynb +++ b/examples/Notebooks/Grids/DP_CIGRE_MV_withoutDG.ipynb @@ -121,7 +121,7 @@ "dpsimpy.Logger.set_log_dir('logs/' + sim_name)\n", "reader2 = dpsimpy.CIMReader(sim_name, dpsimpy.LogLevel.info, dpsimpy.LogLevel.debug)\n", "system_dp = reader2.loadCIM(50, files, dpsimpy.Domain.DP, dpsimpy.PhaseType.Single, dpsimpy.GeneratorType.PVNode)\n", - "system_dp.init_with_powerflow(system_pf)\n", + "system_dp.init_with_powerflow(system_pf, dpsimpy.Domain.DP)\n", "\n", "# log node voltages\n", "logger_dp= dpsimpy.Logger(sim_name)\n", diff --git a/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG.ipynb b/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG.ipynb index aae5c82861..b80d326ebe 100644 --- a/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG.ipynb +++ b/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -8,6 +9,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -71,6 +73,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -122,6 +125,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -155,7 +159,7 @@ " system_emt.add(pv)\n", " system_emt.connect_component(pv, [connection_node])\n", "\n", - "system_emt.init_with_powerflow(system_pf)\n", + "system_emt.init_with_powerflow(system_pf, dpsimpy.Domain.EMT)\n", "\n", "# log node voltages\n", "logger_emt= dpsimpy.Logger(sim_name)\n", @@ -210,6 +214,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -217,6 +222,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -240,6 +246,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -261,6 +268,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -278,6 +286,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -285,6 +294,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -305,6 +315,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -312,6 +323,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -337,6 +349,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -355,6 +368,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -373,6 +387,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -380,6 +395,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -401,6 +417,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -422,6 +439,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -440,6 +458,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -458,6 +477,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -479,6 +499,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -497,6 +518,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -515,6 +537,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -536,6 +559,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -554,6 +578,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -572,6 +597,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -596,6 +622,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -616,6 +643,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -635,6 +663,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG_withLoadStep.ipynb b/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG_withLoadStep.ipynb index 8cbdd1874e..a6d8d10faa 100644 --- a/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG_withLoadStep.ipynb +++ b/examples/Notebooks/Grids/EMT_CIGRE_MV_withDG_withLoadStep.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -8,6 +9,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -71,6 +73,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -122,6 +125,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -155,7 +159,7 @@ " system_emt.add(pv)\n", " system_emt.connect_component(pv, [connection_node])\n", "\n", - "system_emt.init_with_powerflow(system_pf)\n", + "system_emt.init_with_powerflow(system_pf, dpsimpy.Domain.EMT)\n", "\n", "# log node voltages\n", "logger_emt= dpsimpy.Logger(sim_name)\n", @@ -223,6 +227,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -230,6 +235,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -250,6 +256,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -271,6 +278,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -291,6 +299,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -298,6 +307,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -319,6 +329,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Grids/EMT_CIGRE_MV_withoutDG.ipynb b/examples/Notebooks/Grids/EMT_CIGRE_MV_withoutDG.ipynb index 0a415077f8..7dfbf10b54 100644 --- a/examples/Notebooks/Grids/EMT_CIGRE_MV_withoutDG.ipynb +++ b/examples/Notebooks/Grids/EMT_CIGRE_MV_withoutDG.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -8,6 +9,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -71,6 +73,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -105,6 +108,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -121,7 +125,7 @@ "reader2 = dpsimpy.CIMReader(sim_name, dpsimpy.LogLevel.info, dpsimpy.LogLevel.debug)\n", "system_emt = reader2.loadCIM(50, files, dpsimpy.Domain.EMT, dpsimpy.PhaseType.ABC, dpsimpy.GeneratorType.NONE)\n", "\n", - "system_emt.init_with_powerflow(system_pf)\n", + "system_emt.init_with_powerflow(system_pf, dpsimpy.Domain.EMT)\n", "\n", "# log node voltages\n", "logger_emt= dpsimpy.Logger(sim_name)\n", @@ -149,6 +153,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -156,6 +161,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -176,6 +182,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -197,6 +204,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -204,6 +212,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -224,6 +233,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -247,6 +257,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -265,6 +276,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -283,6 +295,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -305,6 +318,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -323,6 +337,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -341,6 +356,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -375,6 +391,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -392,6 +409,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -409,6 +427,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -431,6 +450,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -449,6 +469,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Grids/SP_WSCC9bus_SG4thOrder_Fault_PSAT_Validation.ipynb b/examples/Notebooks/Grids/SP_WSCC9bus_SG4thOrder_Fault_PSAT_Validation.ipynb index e0e02be227..3c506a702d 100644 --- a/examples/Notebooks/Grids/SP_WSCC9bus_SG4thOrder_Fault_PSAT_Validation.ipynb +++ b/examples/Notebooks/Grids/SP_WSCC9bus_SG4thOrder_Fault_PSAT_Validation.ipynb @@ -1,6 +1,7 @@ { "cells": [ { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -65,6 +66,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -83,6 +85,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -105,6 +108,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -138,6 +142,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -167,6 +172,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -194,6 +200,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -221,6 +228,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -255,6 +263,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -282,6 +291,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -309,6 +319,7 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ diff --git a/examples/Notebooks/Performance/DP_WSCC9bus_SGReducedOrderVBR_SparseLU_KLU_fault_comparison.ipynb b/examples/Notebooks/Performance/DP_WSCC9bus_SGReducedOrderVBR_SparseLU_KLU_fault_comparison.ipynb index 71e196a1dd..61092ce9da 100644 --- a/examples/Notebooks/Performance/DP_WSCC9bus_SGReducedOrderVBR_SparseLU_KLU_fault_comparison.ipynb +++ b/examples/Notebooks/Performance/DP_WSCC9bus_SGReducedOrderVBR_SparseLU_KLU_fault_comparison.ipynb @@ -149,7 +149,7 @@ " fault_dp.open()\n", " sys.add(fault_dp)\n", "\n", - " sys.init_with_powerflow(system_pf)\n", + " sys.init_with_powerflow(system_pf, dpsimpy.Domain.DP)\n", " \n", " for comp in sys.components:\n", " if comp.__class__ == dpsimpy.dp.ph1.SynchronGenerator4OrderVBR:\n", diff --git a/examples/Notebooks/Performance/DP_WSCC9bus_SGReducedOrderVBR_validate_KLU_using_different_settings.ipynb b/examples/Notebooks/Performance/DP_WSCC9bus_SGReducedOrderVBR_validate_KLU_using_different_settings.ipynb index 6e99446dd2..466439e420 100644 --- a/examples/Notebooks/Performance/DP_WSCC9bus_SGReducedOrderVBR_validate_KLU_using_different_settings.ipynb +++ b/examples/Notebooks/Performance/DP_WSCC9bus_SGReducedOrderVBR_validate_KLU_using_different_settings.ipynb @@ -109,12 +109,10 @@ " fault_dp.open()\n", " sys.add(fault_dp)\n", "\n", - " sys.init_with_powerflow(system_pf)\n", + " sys.init_with_powerflow(system_pf, dpsimpy.Domain.DP)\n", " for comp in sys.components:\n", " # I assume this is how you access the generators\n", " if \"GEN\" in comp.name():\n", - " gen_pf = system_pf.component(comp.name())\n", - " comp.get_terminal(index=0).set_power(- gen_pf.get_apparent_power())\n", " comp.scale_inertia_constant(intertia_scaling_factor)\n", " comp.set_model_as_norton_source(False)\n", "\n", diff --git a/examples/Notebooks/Performance/DP_WSCC9bus_SGReducedOrderVBR_validate_SparseLU_DenseLU_KLU_using_partial_refactorization.ipynb b/examples/Notebooks/Performance/DP_WSCC9bus_SGReducedOrderVBR_validate_SparseLU_DenseLU_KLU_using_partial_refactorization.ipynb index 70e3f6ebc9..a50001c5db 100644 --- a/examples/Notebooks/Performance/DP_WSCC9bus_SGReducedOrderVBR_validate_SparseLU_DenseLU_KLU_using_partial_refactorization.ipynb +++ b/examples/Notebooks/Performance/DP_WSCC9bus_SGReducedOrderVBR_validate_SparseLU_DenseLU_KLU_using_partial_refactorization.ipynb @@ -110,12 +110,10 @@ " fault_dp.open()\n", " sys.add(fault_dp)\n", "\n", - " sys.init_with_powerflow(system_pf)\n", + " sys.init_with_powerflow(system_pf, dpsimpy.Domain.DP)\n", " for comp in sys.components:\n", " # I assume this is how you access the generators\n", " if \"GEN\" in comp.name():\n", - " gen_pf = system_pf.component(comp.name())\n", - " comp.get_terminal(index=0).set_power(- gen_pf.get_apparent_power())\n", " comp.scale_inertia_constant(intertia_scaling_factor)\n", " comp.set_model_as_norton_source(False)\n", "\n",