Commit 125006ec authored by Jan Dinkelbach's avatar Jan Dinkelbach Committed by Markus Mirz
Browse files

use voltage source in emt3ph VSI and update examples

parent 9be81892
......@@ -126,7 +126,7 @@ int main(int argc, char* argv[]) {
Examples::CIGREMV::logPVDecomposedAttributes(loggerDP, pv);
// load step sized in absolute terms
std::shared_ptr<SwitchEvent> loadStepEvent = Examples::createEventAddPowerConsumption("n2", 1-timeStepDP, 100.0e3, systemDP, Domain::DP, loggerDP);
std::shared_ptr<SwitchEvent> loadStepEvent = Examples::createEventAddPowerConsumption("n2", 3-timeStepDP, 100.0e3, systemDP, Domain::DP, loggerDP);
// Simulation
Simulation sim(simNameDP, Logger::Level::debug);
......
......@@ -124,7 +124,7 @@ int main(int argc, char* argv[]) {
Examples::CIGREMV::logPVDecomposedAttributes(loggerEMT, pv);
// load step sized in absolute terms
// std::shared_ptr<SwitchEvent> loadStepEvent = Examples::createEventAddPowerConsumption("n2", 1-timeStepEMT, 100e3, systemEMT, Domain::EMT, loggerEMT);
std::shared_ptr<SwitchEvent3Ph> loadStepEvent = Examples::createEventAddPowerConsumption3Ph("n2", 3-timeStepEMT, 100e3, systemEMT, Domain::EMT, loggerEMT);
// Simulation
Simulation sim(simNameEMT, Logger::Level::debug);
......@@ -133,6 +133,6 @@ int main(int argc, char* argv[]) {
sim.setFinalTime(finalTimeEMT);
sim.setDomain(Domain::EMT);
sim.addLogger(loggerEMT);
// sim.addEvent(loadStepEvent);
sim.addEvent(loadStepEvent);
sim.run();
}
\ No newline at end of file
......@@ -27,8 +27,8 @@ namespace SGIB {
Real lineInductance = 0.1;
// PV controller parameters
Real scaling_P = 10.0;
Real scaling_I = 1000.0;
Real scaling_P = 1.0;
Real scaling_I = 10.0;
Real KpPLL = 0.25/scaling_P;
Real KiPLL = 2/scaling_I;
......
......@@ -4,11 +4,11 @@
%%bash
TOP=${TOP:-$(git rev-parse --show-toplevel)}
PATH=${TOP}/build/Examples/Cxx
TIMESTEP=0.1e-3
DURATION=0.1
DURATION=8.0
EMT_Slack_PiLine_VSI_with_PF_Init --timestep=${TIMESTEP} --duration=${DURATION}
DP_Slack_PiLine_VSI_with_PF_Init --timestep=${TIMESTEP} --duration=${DURATION}
```
......
......@@ -7,11 +7,14 @@
``` python
%%bash
TOP=${TOP:-$(git rev-parse --show-toplevel)}
PATH=${TOP}/build/Examples/Cxx
EMT_Slack_PiLine_VSI_with_PF_Init
TIMESTEP=0.1e-3
DURATION=8.0
EMT_Slack_PiLine_VSI_with_PF_Init --timestep=${TIMESTEP} --duration=${DURATION}
```
%% Cell type:code id: tags:
``` python
......
......@@ -14,7 +14,7 @@
#include <cps/EMT/EMT_Ph3_Resistor.h>
#include <cps/EMT/EMT_Ph3_Inductor.h>
#include <cps/EMT/EMT_Ph3_Capacitor.h>
#include <cps/EMT/EMT_Ph3_ControlledVoltageSource.h>
#include <cps/EMT/EMT_Ph3_VoltageSource.h>
#include <cps/EMT/EMT_Ph3_Transformer.h>
#include <cps/Base/Base_AvVoltageSourceInverterDQ.h>
#include <cps/Signal/PLL.h>
......@@ -52,7 +52,7 @@ namespace Ph3 {
// ### Electrical Subcomponents ###
/// Controlled voltage source
std::shared_ptr<EMT::Ph3::ControlledVoltageSource> mSubCtrledVoltageSource;
std::shared_ptr<EMT::Ph3::VoltageSource> mSubCtrledVoltageSource;
/// Resistor Rf as part of LCL filter
std::shared_ptr<EMT::Ph3::Resistor> mSubResistorF;
/// Capacitor Cf as part of LCL filter
......
......@@ -211,15 +211,23 @@ void DP::Ph1::AvVoltageSourceInverterDQ::initializeFromNodesAndTerminals(Real fr
mSLog->info(
"\n--- Initialization from powerflow ---"
"\nVoltage across: {:s}"
"\nCurrent: {:s}"
"\nTerminal 0 voltage: {:s}"
"\nInterface voltage across: {:s}"
"\nInterface current: {:s}"
"\nTerminal 0 initial voltage: {:s}"
"\nTerminal 0 connected to {:s} = sim node {:d}"
"\n--- Initialization from powerflow finished ---",
"\nVirtual node 0 initial voltage: {:s}"
"\nVirtual node 1 initial voltage: {:s}"
"\nVirtual node 2 initial voltage: {:s}",
Logger::phasorToString(mIntfVoltage(0, 0)),
Logger::phasorToString(mIntfCurrent(0, 0)),
Logger::phasorToString(initialSingleVoltage(0)),
mTerminals[0]->node()->name(), mTerminals[0]->node()->matrixNodeIndex());
mTerminals[0]->node()->name(), mTerminals[0]->node()->matrixNodeIndex(),
Logger::phasorToString(mVirtualNodes[0]->initialSingleVoltage()),
Logger::phasorToString(mVirtualNodes[1]->initialSingleVoltage()),
Logger::phasorToString(mVirtualNodes[2]->initialSingleVoltage()));
if (mWithConnectionTransformer)
mSLog->info("\nVirtual node 3 initial voltage: {:s}", Logger::phasorToString(mVirtualNodes[3]->initialSingleVoltage()));
mSLog->info("\n--- Initialization from powerflow finished ---");
}
void DP::Ph1::AvVoltageSourceInverterDQ::mnaInitialize(Real omega, Real timeStep, Attribute<Matrix>::Ptr leftVector) {
......
......@@ -33,7 +33,7 @@ EMT::Ph3::AvVoltageSourceInverterDQ::AvVoltageSourceInverterDQ(String uid, Strin
mSubResistorC = EMT::Ph3::Resistor::make(mName + "_resC", mLogLevel);
mSubCapacitorF = EMT::Ph3::Capacitor::make(mName + "_capF", mLogLevel);
mSubInductorF = EMT::Ph3::Inductor::make(mName + "_indF", mLogLevel);
mSubCtrledVoltageSource = EMT::Ph3::ControlledVoltageSource::make(mName + "_src", mLogLevel);
mSubCtrledVoltageSource = EMT::Ph3::VoltageSource::make(mName + "_src", mLogLevel);
mSubComponents.push_back(mSubResistorF);
mSubComponents.push_back(mSubResistorC);
mSubComponents.push_back(mSubCapacitorF);
......@@ -188,8 +188,7 @@ void EMT::Ph3::AvVoltageSourceInverterDQ::initializeFromNodesAndTerminals(Real f
mIntfCurrent = intfCurrentComplex.real();
// Initialize controlled source
mVsref = vsInit.real();
mSubCtrledVoltageSource->setParameters(mVsref);
mSubCtrledVoltageSource->setParameters(mVirtualNodes[0]->initialVoltage());
// Connect electrical subcomponents
mSubCtrledVoltageSource->connect({ SimNode::GND, mVirtualNodes[0] });
......@@ -228,15 +227,23 @@ void EMT::Ph3::AvVoltageSourceInverterDQ::initializeFromNodesAndTerminals(Real f
mSLog->info(
"\n--- Initialization from powerflow ---"
"\nVoltage across: {:s}"
"\nCurrent: {:s}"
"\nTerminal 0 voltage: {:s}"
"\nInterface voltage across: {:s}"
"\nInterface current: {:s}"
"\nTerminal 0 initial voltage: {:s}"
"\nTerminal 0 connected to {:s} = sim node {:d}"
"\n--- Initialization from powerflow finished ---",
"\nVirtual node 0 initial voltage: {:s}"
"\nVirtual node 1 initial voltage: {:s}"
"\nVirtual node 2 initial voltage: {:s}",
Logger::phasorToString(intfVoltageComplex(0, 0)),
Logger::phasorToString(intfCurrentComplex(0, 0)),
Logger::phasorToString(RMS3PH_TO_PEAK1PH * initialSingleVoltage(0)),
mTerminals[0]->node()->name(), mTerminals[0]->node()->matrixNodeIndex());
Logger::phasorToString(initialSingleVoltage(0)),
mTerminals[0]->node()->name(), mTerminals[0]->node()->matrixNodeIndex(),
Logger::phasorToString(mVirtualNodes[0]->initialSingleVoltage()),
Logger::phasorToString(mVirtualNodes[1]->initialSingleVoltage()),
Logger::phasorToString(mVirtualNodes[2]->initialSingleVoltage()));
if (mWithConnectionTransformer)
mSLog->info("\nVirtual node 3 initial voltage: {:s}", Logger::phasorToString(mVirtualNodes[3]->initialSingleVoltage()));
mSLog->info("\n--- Initialization from powerflow finished ---");
}
void EMT::Ph3::AvVoltageSourceInverterDQ::mnaInitialize(Real omega, Real timeStep, Attribute<Matrix>::Ptr leftVector) {
......@@ -385,7 +392,7 @@ void EMT::Ph3::AvVoltageSourceInverterDQ::mnaAddPreStepDependencies(AttributeBas
void EMT::Ph3::AvVoltageSourceInverterDQ::mnaPreStep(Real time, Int timeStepCount) {
// pre-step of subcomponents - controlled source
mSubCtrledVoltageSource->setParameters(mVsref);
mSubCtrledVoltageSource->setParameters(PEAK1PH_TO_RMS3PH * mVsref);
// pre-step of subcomponents - others
for (auto subcomp: mSubComponents)
if (auto mnasubcomp = std::dynamic_pointer_cast<MNAInterface>(subcomp))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment