Commit bf042443 authored by Felix Wege's avatar Felix Wege
Browse files

made all power components set parametersSet flag


Former-commit-id: 63ec8a7e
parent 23da7fb8
......@@ -89,6 +89,8 @@ void DP::Ph1::AvVoltageSourceInverterDQ::setParameters(Real sysOmega, Complex sy
mCf = Cf;
mRf = Rf;
mRc = Rc;
parametersSet = true;
}
......
......@@ -33,6 +33,7 @@ DP::Ph1::ControlledVoltageSource::ControlledVoltageSource(String uid, String nam
void DP::Ph1::ControlledVoltageSource::setParameters(MatrixComp voltageRefABC) {
mIntfVoltage = voltageRefABC;
parametersSet = true;
}
PowerComponent<Complex>::Ptr DP::Ph1::ControlledVoltageSource::clone(String name) {
......
......@@ -39,6 +39,7 @@ DP::Ph1::CurrentSource::CurrentSource(String name, Complex current, Logger::Leve
void DP::Ph1::CurrentSource::setParameters(Complex current) {
attribute<Complex>("I_ref")->set(current);
parametersSet = true;
}
PowerComponent<Complex>::Ptr DP::Ph1::CurrentSource::clone(String name) {
......
......@@ -40,6 +40,8 @@ void DP::Ph1::Inverter::setParameters(std::vector<Int> carrierHarms, std::vector
mVin = inputVoltage;
mModIdx = ratio;
mPhaseMod = phase;
parametersSet= true;
}
void DP::Ph1::Inverter::initializeFromPowerflow(Real frequency) {
......
......@@ -53,6 +53,8 @@ void DP::Ph1::NetworkInjection::initialize(Matrix frequencies) {
void DP::Ph1::NetworkInjection::setParameters(Complex voltageRef, Real srcFreq) {
attribute<Complex>("V_ref")->set(voltageRef);
attribute<Real>("f_src")->set(srcFreq);
parametersSet = true;
}
void DP::Ph1::NetworkInjection::initializeFromPowerflow(Real frequency) {
......
......@@ -59,6 +59,8 @@ void DP::Ph1::PQLoadCS::setParameters(Real activePower, Real reactivePower, Real
attribute<Real>("P")->set(activePower);
attribute<Real>("Q")->set(reactivePower);
attribute<Real>("V_nom")->set(nomVolt);
parametersSet = true;
}
PowerComponent<Complex>::Ptr DP::Ph1::PQLoadCS::clone(String name) {
......@@ -74,7 +76,7 @@ void DP::Ph1::PQLoadCS::initializeFromPowerflow(Real frequency) {
mReactivePower = attribute<Real>("Q");
mNomVoltage = attribute<Real>("V_nom");
// Get power from Terminals if it was not set previously.
if (mActivePower->get() == 0 && mReactivePower->get() == 0) {
if (mActivePower->get() == 0 && mReactivePower->get() == 0 && !parametersSet) {
mActivePower->set(mTerminals[0]->singleActivePower());
mReactivePower->set(mTerminals[0]->singleReactivePower());
mNomVoltage->set(std::abs(mTerminals[0]->initialSingleVoltage()));
......
......@@ -49,6 +49,8 @@ void DP::Ph1::Transformer::setParameters(Real ratioAbs, Real ratioPhase,
setVirtualNodeNumber(3);
else
setVirtualNodeNumber(2);
parametersSet = true;
}
void DP::Ph1::Transformer::initialize(Matrix frequencies) {
......
......@@ -46,6 +46,8 @@ void DP::Ph1::VoltageSource::initialize(Matrix frequencies) {
void DP::Ph1::VoltageSource::setParameters(Complex voltageRef, Real srcFreq) {
attribute<Complex>("V_ref")->set(voltageRef);
attribute<Real>("f_src")->set(srcFreq);
parametersSet = true;
}
void DP::Ph1::VoltageSource::initializeFromPowerflow(Real frequency) {
......
......@@ -44,6 +44,8 @@ void DP::Ph1::VoltageSourceNorton::setParameters(Complex voltage, Real srcFreq,
mResistance = resistance;
mConductance = 1. / mResistance;
mEquivCurrent = mVoltageRef / mResistance;
parametersSet = true;
}
void DP::Ph1::VoltageSourceNorton::mnaInitialize(Real omega, Real timeStep, Attribute<Matrix>::Ptr leftVector) {
......
......@@ -48,6 +48,8 @@ void DP::Ph1::VoltageSourceRamp::setParameters(Complex voltage, Complex addVolta
mAddSrcFreq = addSrcFreq;
mSwitchTime = switchTime;
mRampTime = rampTime;
parametersSet = true;
}
void DP::Ph1::VoltageSourceRamp::initialize(Matrix frequencies) {
......
......@@ -89,6 +89,8 @@ void DP::Ph3::AvVoltageSourceInverterDQ::setParameters(Real sysOmega, Complex sy
mRf = Rf;
mRc = Rc;
parametersSet = true;
}
void DP::Ph3::AvVoltageSourceInverterDQ::addMonitoredNodes( std::shared_ptr<Capacitor> cap, std::shared_ptr<Inductor> inductor) {
......
......@@ -35,6 +35,7 @@ DP::Ph3::ControlledVoltageSource::ControlledVoltageSource(String uid, String nam
void DP::Ph3::ControlledVoltageSource::setParameters(MatrixComp voltageRefABC) {
mIntfVoltage = voltageRefABC;
parametersSet = true;
}
PowerComponent<Complex>::Ptr DP::Ph3::ControlledVoltageSource::clone(String name) {
......
......@@ -44,6 +44,7 @@ PowerComponent<Complex>::Ptr DP::Ph3::VoltageSource::clone(String name) {
void DP::Ph3::VoltageSource::setParameters(Complex voltageRef) {
attribute<Complex>("V_ref")->set(voltageRef);
parametersSet = true;
}
void DP::Ph3::VoltageSource::initializeFromPowerflow(Real frequency) {
......
......@@ -42,6 +42,8 @@ PowerComponent<Real>::Ptr EMT::Ph1::CurrentSource::clone(String name) {
void EMT::Ph1::CurrentSource::setParameters(Complex currentRef, Real srcFreq) {
attribute<Complex>("I_ref")->set(currentRef);
attribute<Real>("f_src")->set(srcFreq);
parametersSet = true;
}
void EMT::Ph1::CurrentSource::mnaInitialize(Real omega, Real timeStep, Attribute<Matrix>::Ptr leftVector) {
......
......@@ -36,6 +36,8 @@ EMT::Ph1::VoltageSource::VoltageSource(String uid, String name, Logger::Level lo
void EMT::Ph1::VoltageSource::setParameters(Complex voltageRef, Real srcFreq) {
attribute<Complex>("V_ref")->set(voltageRef);
attribute<Real>("f_src")->set(srcFreq);
parametersSet = true;
}
PowerComponent<Real>::Ptr EMT::Ph1::VoltageSource::clone(String name) {
......
......@@ -43,6 +43,8 @@ void EMT::Ph1::VoltageSourceNorton::setParameters(Complex voltage, Real srcFreq,
mResistance = resistance;
mConductance = 1. / mResistance;
parametersSet = true;
}
void EMT::Ph1::VoltageSourceNorton::mnaInitialize(Real omega, Real timeStep, Attribute<Matrix>::Ptr leftVector) {
......
......@@ -49,6 +49,8 @@ void EMT::Ph1::VoltageSourceRamp::setParameters(Complex voltage, Complex addVolt
mAddSrcFreq = addSrcFreq;
mSwitchTime = switchTime;
mRampTime = rampTime;
parametersSet = true;
}
void EMT::Ph1::VoltageSourceRamp::initialize(Matrix frequencies) {
......
......@@ -74,6 +74,8 @@ void EMT::Ph3::AvVoltSourceInverterStateSpace::setParameters(Real sysOmega, Comp
// init with nodes at nominal voltage and branches have zero current flow.
Real srcFreq = 2. * M_PI * sysOmega;
Base::Ph1::VoltageSource::setParameters(sysVoltNom, srcFreq);
parametersSet = true;
}
void EMT::Ph3::AvVoltSourceInverterStateSpace::initializeStates(Real omega, Real timeStep,
......
......@@ -96,6 +96,8 @@ void EMT::Ph3::AvVoltageSourceInverterDQ::setParameters(Real sysOmega, Complex s
mRf = Rf;
mRc = Rc;
parametersSet = true;
}
PowerComponent<Real>::Ptr EMT::Ph3::AvVoltageSourceInverterDQ::clone(String name) {
......
......@@ -36,6 +36,8 @@ EMT::Ph3::ControlledVoltageSource::ControlledVoltageSource(String uid, String na
void EMT::Ph3::ControlledVoltageSource::setParameters(Matrix voltageRefABC) {
mIntfVoltage = voltageRefABC;
parametersSet = true;
}
PowerComponent<Real>::Ptr EMT::Ph3::ControlledVoltageSource::clone(String name) {
......
Supports Markdown
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