diff --git a/dpsim-models/include/dpsim-models/DP/DP_Ph1_VSIVoltageControlDQ.h b/dpsim-models/include/dpsim-models/DP/DP_Ph1_VSIVoltageControlDQ.h index 9bda6c73d..c84f7705e 100644 --- a/dpsim-models/include/dpsim-models/DP/DP_Ph1_VSIVoltageControlDQ.h +++ b/dpsim-models/include/dpsim-models/DP/DP_Ph1_VSIVoltageControlDQ.h @@ -97,7 +97,7 @@ namespace Ph1 { const Attribute::Ptr mIrcq; const Attribute::Ptr mElecActivePower; - const Attribute::Ptr mElecPassivePower; + const Attribute::Ptr mElecReactivePower; // Control outputs /// Voltage as control output after transformation interface diff --git a/dpsim-models/include/dpsim-models/EMT/EMT_Ph3_VSIVoltageControlDQ.h b/dpsim-models/include/dpsim-models/EMT/EMT_Ph3_VSIVoltageControlDQ.h index ac2c0ff49..1e602dfb2 100644 --- a/dpsim-models/include/dpsim-models/EMT/EMT_Ph3_VSIVoltageControlDQ.h +++ b/dpsim-models/include/dpsim-models/EMT/EMT_Ph3_VSIVoltageControlDQ.h @@ -93,7 +93,7 @@ namespace Ph3 { const Attribute::Ptr mIrcq; const Attribute::Ptr mElecActivePower; - const Attribute::Ptr mElecPassivePower; + const Attribute::Ptr mElecReactivePower; // Control outputs /// Voltage as control output after transformation interface diff --git a/dpsim-models/src/DP/DP_Ph1_VSIVoltageControlDQ.cpp b/dpsim-models/src/DP/DP_Ph1_VSIVoltageControlDQ.cpp index e03b961f6..229dabf80 100644 --- a/dpsim-models/src/DP/DP_Ph1_VSIVoltageControlDQ.cpp +++ b/dpsim-models/src/DP/DP_Ph1_VSIVoltageControlDQ.cpp @@ -22,7 +22,7 @@ DP::Ph1::VSIVoltageControlDQ::VSIVoltageControlDQ(String uid, String name, Logge mIrcd(mAttributes->create("Irc_d", 0)), mIrcq(mAttributes->create("Irc_q", 0)), mElecActivePower(mAttributes->create("P_elec", 0)), - mElecPassivePower(mAttributes->create("Q_elec", 0)), + mElecReactivePower(mAttributes->create("Q_elec", 0)), mVsref(mAttributes->create("Vsref", MatrixComp::Zero(1,1))), mVs(mAttributes->createDynamic("Vs")), mDroopOutput(mAttributes->createDynamic("droop_output")), @@ -94,21 +94,21 @@ DP::Ph1::VSIVoltageControlDQ::VSIVoltageControlDQ(String uid, String name, Logge } //setter target voltage and power -void DP::Ph1::VSIVoltageControlDQ::setParameters(Real Omega, Real VdRef, Real VqRef, Real Pref) { +void DP::Ph1::VSIVoltageControlDQ::setParameters(Real Omega, Real VdRef, Real VqRef, Real PRef) { mParametersSet = true; SPDLOG_LOGGER_INFO(mSLog,"General Parameters:"); SPDLOG_LOGGER_INFO(mSLog,"Nominal Omega={} [1/s]", Omega); - SPDLOG_LOGGER_INFO(mSLog,"VdRef={} [V] VqRef={} [V]", VdRef, VqRef); + SPDLOG_LOGGER_INFO(mSLog,"VdRef={} [V] VqRef={} [V] PRef={} [W]", VdRef, VqRef, PRef); mVoltageControllerVSI->setParameters(VdRef, VqRef); mVCO->setParameters(Omega); - mDroop->setParameters(Pref, Omega); + mDroop->setParameters(PRef, Omega); **mOmegaN = Omega; **mVdRef = VdRef; **mVqRef = VqRef; - **mPRef= Pref; + **mPRef= PRef; } @@ -352,13 +352,13 @@ void DP::Ph1::VSIVoltageControlDQ::controlStep(Real time, Int timeStepCount) { if(mWithConnectionTransformer) { // TODO: use DPDQ interface!!! - vcdq = Math::rotatingFrame2to1(mVirtualNodes[3]->singleVoltage(), (**mVCO->mOutputPrev)(0,0), 0); - ircdq = Math::rotatingFrame2to1(-1. * (**mSubResistorC->mIntfCurrent)(0, 0), (**mVCO->mOutputPrev)(0,0), 0); + vcdq = Math::rotatingFrame2to1(mVirtualNodes[3]->singleVoltage(), (**mVCO->mOutputPrev)(0,0), mThetaN); + ircdq = Math::rotatingFrame2to1(-1. * (**mSubResistorC->mIntfCurrent)(0, 0), (**mVCO->mOutputPrev)(0,0), mThetaN); } else{ // TODO: use DPDQ interface!!! - vcdq = Math::rotatingFrame2to1(mVirtualNodes[2]->singleVoltage(), (**mVCO->mOutputPrev)(0,0), 0); - ircdq = Math::rotatingFrame2to1(-1. * (**mSubResistorC->mIntfCurrent)(0, 0), (**mVCO->mOutputPrev)(0,0), 0); + vcdq = Math::rotatingFrame2to1(mVirtualNodes[2]->singleVoltage(), (**mVCO->mOutputPrev)(0,0), mThetaN); + ircdq = Math::rotatingFrame2to1(-1. * (**mSubResistorC->mIntfCurrent)(0, 0), (**mVCO->mOutputPrev)(0,0), mThetaN); } @@ -373,10 +373,8 @@ void DP::Ph1::VSIVoltageControlDQ::controlStep(Real time, Int timeStepCount) { mVoltageControllerVSI->signalStep(time, timeStepCount); // Transformation interface backward - // (**mVsref)(0,0) = Math::rotatingFrame2to1(Complex(mVoltageControllerVSI->attributeTyped("output_curr")->get()(0, 0), mVoltageControllerVSI->attributeTyped("output_curr")->get()(1, 0)), mThetaN, (**mVCO->mOutputPrev)(0,0)); // TODO: use DPDQ interface!!! - (**mVsref)(0,0) = Math::rotatingFrame2to1(Complex(mVoltageControllerVSI->attributeTyped("output_curr")->get()(0, 0), mVoltageControllerVSI->attributeTyped("output_curr")->get()(1, 0)), 0, (**mVCO->mOutputCurr)(0,0)); - + (**mVsref)(0,0) = Math::rotatingFrame2to1(Complex(mVoltageControllerVSI->attributeTyped("output_curr")->get()(0, 0), mVoltageControllerVSI->attributeTyped("output_curr")->get()(1, 0)), mThetaN, (**mVCO->mOutputPrev)(0,0)); // Update nominal system angle mThetaN = mThetaN + mTimeStep * **mOmegaN; diff --git a/dpsim-models/src/EMT/EMT_Ph3_VSIVoltageControlDQ.cpp b/dpsim-models/src/EMT/EMT_Ph3_VSIVoltageControlDQ.cpp index 641ccbc66..a74654c21 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_VSIVoltageControlDQ.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_VSIVoltageControlDQ.cpp @@ -22,7 +22,7 @@ EMT::Ph3::VSIVoltageControlDQ::VSIVoltageControlDQ(String uid, String name, Logg mIrcd(mAttributes->create("Irc_d", 0)), mIrcq(mAttributes->create("Irc_q", 0)), mElecActivePower(mAttributes->create("P_elec", 0)), - mElecPassivePower(mAttributes->create("Q_elec", 0)), + mElecReactivePower(mAttributes->create("Q_elec", 0)), mVsref(mAttributes->create("Vsref", Matrix::Zero(3,1))), mVs(mAttributes->createDynamic("Vs")), mDroopOutput(mAttributes->createDynamic("droop_output")), @@ -217,7 +217,7 @@ void EMT::Ph3::VSIVoltageControlDQ::initializeFromNodesAndTerminals(Real frequen **mIntfVoltage = intfVoltageComplex.real(); **mIntfCurrent = intfCurrentComplex.real(); **mElecActivePower = ( 3./2. * intfVoltageComplex(0,0) * std::conj( - intfCurrentComplex(0,0)) ).real(); - **mElecPassivePower = ( 3./2. * intfVoltageComplex(0,0) * std::conj( - intfCurrentComplex(0,0)) ).imag(); + **mElecReactivePower = ( 3./2. * intfVoltageComplex(0,0) * std::conj( - intfCurrentComplex(0,0)) ).imag(); // Initialize controlled source mSubCtrledVoltageSource->setParameters(mVirtualNodes[0]->initialVoltage(), 0.0); @@ -415,7 +415,7 @@ void EMT::Ph3::VSIVoltageControlDQ::controlStep(Real time, Int timeStepCount) { //calculation of system power **mElecActivePower = - 1. * (intfVoltageDQ(0, 0)*intfCurrentDQ(0, 0) + intfVoltageDQ(1, 0)*intfCurrentDQ(1, 0)); - **mElecPassivePower = - 1. * (intfVoltageDQ(1, 0)*intfCurrentDQ(0, 0) - intfVoltageDQ(0, 0)*intfCurrentDQ(1, 0)); + **mElecReactivePower = - 1. * (intfVoltageDQ(1, 0)*intfCurrentDQ(0, 0) - intfVoltageDQ(0, 0)*intfCurrentDQ(1, 0)); //vector of voltages **mVcd = vcdq(0, 0);