From 5335eee2b511ecae5c7bb113ffe9ebac50142260 Mon Sep 17 00:00:00 2001 From: Marvin Tollnitsch Date: Tue, 14 May 2024 15:10:49 +0200 Subject: [PATCH] adjust code style - remove commented code and adjust parameter names for "setParameters" in "EMT_Ph3_CurrentSource.cpp" - rename member variables in SSN components (camel-casing, 'm'-prefix) - change access specifiers from protected to private for SSN component attributes and "ssnUpdateState()" - remove "isLinear()" for linear SSN components - set linear SSN component classes as final Signed-off-by: Marvin Tollnitsch --- .../EMT/EMT_Ph1_SSN_Full_Serial_RLC.h | 27 ++- .../dpsim-models/EMT/EMT_Ph3_CurrentSource.h | 8 +- .../dpsim-models/EMT/EMT_Ph3_SSN_Capacitor.h | 19 +- .../EMT/EMT_Ph3_SSN_Full_Serial_RLC.h | 30 ++-- .../dpsim-models/EMT/EMT_Ph3_SSN_Inductor.h | 18 +- .../src/EMT/EMT_Ph1_SSN_Full_Serial_RLC.cpp | 58 +++---- .../src/EMT/EMT_Ph3_CurrentSource.cpp | 51 +++--- .../src/EMT/EMT_Ph3_SSN_Capacitor.cpp | 26 +-- .../src/EMT/EMT_Ph3_SSN_Full_Serial_RLC.cpp | 164 +++++++++--------- dpsim-models/src/EMT/EMT_Ph3_SSN_Inductor.cpp | 106 +++++------ 10 files changed, 241 insertions(+), 266 deletions(-) diff --git a/dpsim-models/include/dpsim-models/EMT/EMT_Ph1_SSN_Full_Serial_RLC.h b/dpsim-models/include/dpsim-models/EMT/EMT_Ph1_SSN_Full_Serial_RLC.h index 110ed15081..c9afa52118 100644 --- a/dpsim-models/include/dpsim-models/EMT/EMT_Ph1_SSN_Full_Serial_RLC.h +++ b/dpsim-models/include/dpsim-models/EMT/EMT_Ph1_SSN_Full_Serial_RLC.h @@ -35,17 +35,6 @@ namespace SSN { public Base::Ph1::Capacitor, public Base::Ph1::Resistor { - protected: - Matrix State = Matrix::Zero(2, 1); - Matrix yHistory = Matrix::Zero(1, 1); - - Matrix Dufour_u_n_t = Matrix::Zero(1, 1); - - Matrix Dufour_A_k_hat = Matrix::Zero(2, 2); - Matrix Dufour_B_k_hat = Matrix::Zero(2, 1); - Matrix Dufour_B_k_n_hat = Matrix::Zero(2, 1); - Matrix Dufour_W_k_n = Matrix::Zero(1, 1); - Matrix Dufour_C_k_n = Matrix(1, 2); public: /// Defines UID, name, component parameters and logging level Full_Serial_RLC(String uid, String name, Logger::Level logLevel = Logger::Level::off); @@ -79,12 +68,20 @@ namespace SSN { void mnaCompAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override; /// Add MNA post step dependencies void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute::Ptr &leftVector) override; + + private: + Matrix mState = Matrix::Zero(2, 1); + Matrix mYHistory = Matrix::Zero(1, 1); + + Matrix mDufourUNT = Matrix::Zero(1, 1); + + Matrix mDufourAKHat = Matrix::Zero(2, 2); + Matrix mDufourBKHat = Matrix::Zero(2, 1); + Matrix mDufourBKNHat = Matrix::Zero(2, 1); + Matrix mDufourWKN = Matrix::Zero(1, 1); + Matrix mDufourCKN = Matrix(1, 2); void ssnUpdateState(); - bool isLinear() const - { - return true; - } }; } } diff --git a/dpsim-models/include/dpsim-models/EMT/EMT_Ph3_CurrentSource.h b/dpsim-models/include/dpsim-models/EMT/EMT_Ph3_CurrentSource.h index 2306458ea3..aaea8886db 100644 --- a/dpsim-models/include/dpsim-models/EMT/EMT_Ph3_CurrentSource.h +++ b/dpsim-models/include/dpsim-models/EMT/EMT_Ph3_CurrentSource.h @@ -46,13 +46,7 @@ namespace CPS { /// Initializes component from power flow data void initializeFromNodesAndTerminals(Real frequency); /// Setter for reference Current - void setParameters(MatrixComp CurrentRef, Real SrcFreq = 50.0); - /// Setter for reference voltage - //void setParameters(MatrixComp voltageRef, Real srcFreq = 50.0); - /// Setter for reference signal of type frequency ramp - //void setParameters(MatrixComp voltageRef, Real freqStart, Real rocof, Real timeStart, Real duration, bool smoothRamp = true); - /// Setter for reference signal of type cosine frequency modulation - //void setParameters(MatrixComp voltageRef, Real modulationFrequency, Real modulationAmplitude, Real baseFrequency = 50.0, bool zigzag = false); + void setParameters(MatrixComp currentRef, Real srcFreq = 50.0); // #### MNA section #### /// Initializes internal variables of the component diff --git a/dpsim-models/include/dpsim-models/EMT/EMT_Ph3_SSN_Capacitor.h b/dpsim-models/include/dpsim-models/EMT/EMT_Ph3_SSN_Capacitor.h index 37aff50cef..8ba07bf8c2 100644 --- a/dpsim-models/include/dpsim-models/EMT/EMT_Ph3_SSN_Capacitor.h +++ b/dpsim-models/include/dpsim-models/EMT/EMT_Ph3_SSN_Capacitor.h @@ -28,16 +28,10 @@ namespace CPS { /// over this if focussing on SSN model implementation is not the circuit's goal since /// this model increases the system matrix dimensions by 1x1 (added virtual node, /// real voltage source MNA scheme). - class Capacitor : + class Capacitor final: public MNASimPowerComp, public Base::Ph3::Capacitor, - public SharedFactory { - protected: - Matrix Dufour_B_k_hat = Matrix::Zero(3, 3); - Matrix Dufour_W_k_n = Matrix::Zero(3, 3); - //rightsideVector history term - Matrix mHistoricVoltage = Matrix::Zero(3, 1); - + public SharedFactory { public: /// Defines UID, name and logging level Capacitor(String uid, String name, Logger::Level logLevel = Logger::Level::off); @@ -71,10 +65,11 @@ namespace CPS { /// Add MNA post step dependencies void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute::Ptr &leftVector) override; - bool isLinear() const - { - return true; - } + private: + Matrix mDufourBKHat = Matrix::Zero(3, 3); + Matrix mDufourWKN = Matrix::Zero(3, 3); + //rightsideVector history term + Matrix mHistoricVoltage = Matrix::Zero(3, 1); }; } } diff --git a/dpsim-models/include/dpsim-models/EMT/EMT_Ph3_SSN_Full_Serial_RLC.h b/dpsim-models/include/dpsim-models/EMT/EMT_Ph3_SSN_Full_Serial_RLC.h index ce4c7572a1..dd858bc9da 100644 --- a/dpsim-models/include/dpsim-models/EMT/EMT_Ph3_SSN_Full_Serial_RLC.h +++ b/dpsim-models/include/dpsim-models/EMT/EMT_Ph3_SSN_Full_Serial_RLC.h @@ -28,24 +28,13 @@ namespace CPS{ /// across the whole circuit. States and past inputs are updated after each /// time step and are used to calculate the current (input) voltage, /// represented as MNA node voltages. - class Full_Serial_RLC: + class Full_Serial_RLC final: public MNASimPowerComp, public SharedFactory, public Base::Ph3::Resistor, public Base::Ph3::Inductor, public Base::Ph3::Capacitor { - protected: - Matrix State = Matrix::Zero(6, 1); - Matrix yHistory = Matrix::Zero(3, 1); - - Matrix Dufour_u_n_t = Matrix::Zero(3, 1); - - Matrix Dufour_A_k_hat = Matrix::Zero(6, 6); - Matrix Dufour_B_k_hat = Matrix::Zero(6, 3); - Matrix Dufour_B_k_n_hat = Matrix::Zero(6, 3); - Matrix Dufour_W_k_n = Matrix::Zero(3, 3); - Matrix Dufour_C_k_n = Matrix(3, 6); public: /// Defines UID, name, component parameters and logging level Full_Serial_RLC(String uid, String name, Logger::Level logLevel = Logger::Level::off); @@ -80,12 +69,19 @@ namespace CPS{ /// Add MNA post step dependencies void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute::Ptr &leftVector) override; - void ssnUpdateState(); + private: + Matrix mState = Matrix::Zero(6, 1); + Matrix mYHistory = Matrix::Zero(3, 1); - bool isLinear() const - { - return true; - } + Matrix mDufourUNT = Matrix::Zero(3, 1); + + Matrix mDufourAKHat = Matrix::Zero(6, 6); + Matrix mDufourBKHat = Matrix::Zero(6, 3); + Matrix mDufourBKNHat = Matrix::Zero(6, 3); + Matrix mDufourWKN = Matrix::Zero(3, 3); + Matrix mDufourCKN = Matrix(3, 6); + + void ssnUpdateState(); }; } } diff --git a/dpsim-models/include/dpsim-models/EMT/EMT_Ph3_SSN_Inductor.h b/dpsim-models/include/dpsim-models/EMT/EMT_Ph3_SSN_Inductor.h index bb9d338448..794f658fb1 100644 --- a/dpsim-models/include/dpsim-models/EMT/EMT_Ph3_SSN_Inductor.h +++ b/dpsim-models/include/dpsim-models/EMT/EMT_Ph3_SSN_Inductor.h @@ -27,17 +27,11 @@ namespace CPS{ /// state update timings differ. This component is meant to show a V-type SSN model /// implementation based on a simple example element. The RC model should be used /// over this otherwise. - class Inductor: + class Inductor final: public MNASimPowerComp, public Base::Ph3::Inductor, public SharedFactory { - protected: - //rightsideVector history term - Matrix historicCurrent = Matrix::Zero(3, 1); - //dependency on latest Voltage, represented by Conductance in system matrix - Matrix Dufour_B_k_hat = Matrix::Zero(3, 3); - Matrix Dufour_W_k_n = Matrix::Zero(3, 3); public: /// Defines UID, name, component parameters and logging level Inductor(String uid, String name, Logger::Level logLevel = Logger::Level::off); @@ -71,10 +65,12 @@ namespace CPS{ /// Add MNA post step dependencies void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute::Ptr &leftVector) override; - bool isLinear() const - { - return true; - } + private: + //rightsideVector history term + Matrix mHistoricCurrent = Matrix::Zero(3, 1); + //dependency on latest Voltage, represented by Conductance in system matrix + Matrix mDufourBKHat = Matrix::Zero(3, 3); + Matrix mDufourWKN = Matrix::Zero(3, 3); }; } } diff --git a/dpsim-models/src/EMT/EMT_Ph1_SSN_Full_Serial_RLC.cpp b/dpsim-models/src/EMT/EMT_Ph1_SSN_Full_Serial_RLC.cpp index 95b7d9350b..a8cd5dae0f 100644 --- a/dpsim-models/src/EMT/EMT_Ph1_SSN_Full_Serial_RLC.cpp +++ b/dpsim-models/src/EMT/EMT_Ph1_SSN_Full_Serial_RLC.cpp @@ -51,20 +51,20 @@ void EMT::Ph1::SSN::Full_Serial_RLC::mnaCompInitialize(Real omega, Real timeStep updateMatrixNodeIndices(); - State = Matrix::Zero(2, 1); - yHistory = Matrix::Zero(1, 1); + mState = Matrix::Zero(2, 1); + mYHistory = Matrix::Zero(1, 1); - Dufour_A_k_hat = Matrix::Zero(2, 2); - Dufour_B_k_hat = Matrix::Zero(2, 1); - Dufour_B_k_n_hat = Matrix::Zero(2, 1); - Dufour_W_k_n = Matrix::Zero(1, 1); - Dufour_C_k_n = Matrix(1, 2); + mDufourAKHat = Matrix::Zero(2, 2); + mDufourBKHat = Matrix::Zero(2, 1); + mDufourBKNHat = Matrix::Zero(2, 1); + mDufourWKN = Matrix::Zero(1, 1); + mDufourCKN = Matrix(1, 2); - Dufour_A_k_hat(0, 0) = 1.- (( 2.*(timeStep*timeStep))/(4.* (**mInductance)* (**mCapacitance) + + mDufourAKHat(0, 0) = 1.- (( 2.*(timeStep*timeStep))/(4.* (**mInductance)* (**mCapacitance) + 2. * timeStep * (**mCapacitance) * (**mResistance) + timeStep*timeStep) ); - Dufour_A_k_hat(0, 1) = (timeStep/(2. * (**mCapacitance))) * (1. + ((4. * (**mInductance) * (**mCapacitance) - + mDufourAKHat(0, 1) = (timeStep/(2. * (**mCapacitance))) * (1. + ((4. * (**mInductance) * (**mCapacitance) - 2. * timeStep * (**mResistance) * (**mCapacitance) - (timeStep*timeStep))/ ( @@ -72,12 +72,12 @@ void EMT::Ph1::SSN::Full_Serial_RLC::mnaCompInitialize(Real omega, Real timeStep 2. * timeStep * (**mResistance) * (**mCapacitance) + (timeStep*timeStep)) )); - Dufour_A_k_hat(1, 0) = -1. *((4. * (**mCapacitance) * timeStep)/( + mDufourAKHat(1, 0) = -1. *((4. * (**mCapacitance) * timeStep)/( 4. * (**mInductance) * (**mCapacitance) + 2. * timeStep* (**mCapacitance)* (**mResistance) + (timeStep*timeStep) )); - Dufour_A_k_hat(1, 1) = (4. * (**mInductance) * (**mCapacitance) - + mDufourAKHat(1, 1) = (4. * (**mInductance) * (**mCapacitance) - 2. * timeStep * (**mResistance) * (**mCapacitance) - (timeStep*timeStep))/ ( @@ -86,21 +86,21 @@ void EMT::Ph1::SSN::Full_Serial_RLC::mnaCompInitialize(Real omega, Real timeStep (timeStep*timeStep) ); - Dufour_B_k_hat(0, 0) = (timeStep*timeStep)/ + mDufourBKHat(0, 0) = (timeStep*timeStep)/ (4. * (**mInductance) * (**mCapacitance) + 2. * timeStep * (**mCapacitance) * (**mResistance) + (timeStep * timeStep)); - Dufour_B_k_hat(1, 0) = (timeStep * 2. * (**mCapacitance))/ + mDufourBKHat(1, 0) = (timeStep * 2. * (**mCapacitance))/ (4. * (**mInductance) * (**mCapacitance) + 2. * timeStep * (**mCapacitance) * (**mResistance) + (timeStep * timeStep)); - Dufour_B_k_n_hat = Dufour_B_k_hat; + mDufourBKNHat = mDufourBKHat; - Dufour_C_k_n(0, 1) = 1.; + mDufourCKN(0, 1) = 1.; - Dufour_W_k_n = Dufour_C_k_n * Dufour_B_k_n_hat; + mDufourWKN = mDufourCKN * mDufourBKNHat; ///FIXME: mIntfCurrent is state 2 and is potentially directly initialized by other initialization methodes (e.g. FromNodesAndTerminals). /// State 1, which is Voltage over the capacitor, is not directly initialized and has to be calculated from the states. This is why @@ -108,9 +108,9 @@ void EMT::Ph1::SSN::Full_Serial_RLC::mnaCompInitialize(Real omega, Real timeStep /// in this case, so calculation of state 1 would always assume zero as the past value of state 1 and also takes mIntfCurrent /// for the calculation ->State 1 is ahead of state 2 by one step, but also always (wrongly?) assumes past state 1 to be zero. /// How to handle properly? - State(1, 0) = (**mIntfCurrent)(0, 0); + mState(1, 0) = (**mIntfCurrent)(0, 0); ssnUpdateState(); - State(1, 0) = (**mIntfCurrent)(0, 0); + mState(1, 0) = (**mIntfCurrent)(0, 0); **mRightVector = Matrix::Zero(leftVector->get().rows(), 1); @@ -126,27 +126,27 @@ void EMT::Ph1::SSN::Full_Serial_RLC::mnaCompInitialize(Real omega, Real timeStep void EMT::Ph1::SSN::Full_Serial_RLC::mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMatrix) { if (terminalNotGrounded(0)) - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0), matrixNodeIndex(0), Dufour_W_k_n(0,0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0), matrixNodeIndex(0), mDufourWKN(0,0)); if (terminalNotGrounded(1)) - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1), matrixNodeIndex(1), Dufour_W_k_n(0,0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1), matrixNodeIndex(1), mDufourWKN(0,0)); if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0), matrixNodeIndex(1), -Dufour_W_k_n(0,0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1), matrixNodeIndex(0), -Dufour_W_k_n(0,0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0), matrixNodeIndex(1), -mDufourWKN(0,0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1), matrixNodeIndex(0), -mDufourWKN(0,0)); } } void EMT::Ph1::SSN::Full_Serial_RLC::mnaCompApplyRightSideVectorStamp(Matrix& rightVector) { // Update internal state - yHistory = Dufour_C_k_n * (Dufour_A_k_hat * State + Dufour_B_k_hat * **mIntfVoltage); + mYHistory = mDufourCKN * (mDufourAKHat * mState + mDufourBKHat * **mIntfVoltage); if (terminalNotGrounded(0)) - Math::setVectorElement(rightVector, matrixNodeIndex(0), yHistory(0,0)); + Math::setVectorElement(rightVector, matrixNodeIndex(0), mYHistory(0,0)); if (terminalNotGrounded(1)) - Math::setVectorElement(rightVector, matrixNodeIndex(1), -yHistory(0,0)); + Math::setVectorElement(rightVector, matrixNodeIndex(1), -mYHistory(0,0)); SPDLOG_LOGGER_DEBUG(mSLog, "\nHistory current term (mnaCompApplyRightSideVectorStamp): {:s}", - Logger::matrixToString(yHistory)); + Logger::matrixToString(mYHistory)); mSLog->flush(); } @@ -175,7 +175,7 @@ void EMT::Ph1::SSN::Full_Serial_RLC::mnaCompPostStep(Real time, Int timeStepCoun void EMT::Ph1::SSN::Full_Serial_RLC::mnaCompUpdateVoltage(const Matrix& leftVector) { // v1 - v0 - Dufour_u_n_t = **mIntfVoltage; + mDufourUNT = **mIntfVoltage; (**mIntfVoltage)(0,0) = 0.; if (terminalNotGrounded(1)) (**mIntfVoltage)(0,0) = Math::realFromVectorElement(leftVector, matrixNodeIndex(1)); @@ -190,7 +190,7 @@ void EMT::Ph1::SSN::Full_Serial_RLC::mnaCompUpdateVoltage(const Matrix& leftVect void EMT::Ph1::SSN::Full_Serial_RLC::mnaCompUpdateCurrent(const Matrix& leftVector) { - **mIntfCurrent = yHistory + Dufour_W_k_n * **mIntfVoltage; + **mIntfCurrent = mYHistory + mDufourWKN * **mIntfVoltage; SPDLOG_LOGGER_DEBUG(mSLog, "\nUpdate Current: {:s}", @@ -209,5 +209,5 @@ void EMT::Ph1::SSN::Full_Serial_RLC::setParameters(Real resistance, Real inducta void EMT::Ph1::SSN::Full_Serial_RLC::ssnUpdateState() { - State = Dufour_A_k_hat * State + Dufour_B_k_hat * Dufour_u_n_t + Dufour_B_k_n_hat * **mIntfVoltage; + mState = mDufourAKHat * mState + mDufourBKHat * mDufourUNT + mDufourBKNHat * **mIntfVoltage; } \ No newline at end of file diff --git a/dpsim-models/src/EMT/EMT_Ph3_CurrentSource.cpp b/dpsim-models/src/EMT/EMT_Ph3_CurrentSource.cpp index f88c4f3fc6..544e8b5689 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_CurrentSource.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_CurrentSource.cpp @@ -23,6 +23,30 @@ EMT::Ph3::CurrentSource::CurrentSource(String uid, String name, Logger::Level lo **mIntfCurrent = Matrix::Zero(3, 1); } +SimPowerComp::Ptr EMT::Ph3::CurrentSource::clone(String name) { + auto copy = CurrentSource::make(name, mLogLevel); + // TODO: implement setParameters + // copy->setParameters(attributeTyped("I_ref")->get(), attributeTyped("f_src")->get()); + return copy; +} + +void EMT::Ph3::CurrentSource::setParameters(MatrixComp currentRef, Real srcFreq) +{ + auto srcSigSine = Signal::SineWaveGenerator::make(**mName + "_sw"); + // Complex(1,0) is used as initialPhasor for signal generator as only phase is used + srcSigSine->setParameters(Complex(1,0), srcFreq); + mSrcSig = srcSigSine; + + **mCurrentRef = currentRef; + mSrcFreq->setReference(mSrcSig->mFreq); + + mSLog->info("\nCurrent reference phasor [I]: {:s}" + "\nFrequency [Hz]: {:s}", + Logger::matrixCompToString(currentRef), + Logger::realToString(srcFreq)); + + mParametersSet = true; +} void EMT::Ph3::CurrentSource::initializeFromNodesAndTerminals(Real frequency) { SPDLOG_LOGGER_INFO(mSLog, "\n--- Initialization from node voltages and terminal ---"); @@ -64,14 +88,6 @@ void EMT::Ph3::CurrentSource::initializeFromNodesAndTerminals(Real frequency) { mSLog->flush(); } -SimPowerComp::Ptr EMT::Ph3::CurrentSource::clone(String name) { - auto copy = CurrentSource::make(name, mLogLevel); - // TODO: implement setParameters - // copy->setParameters(attributeTyped("I_ref")->get(), attributeTyped("f_src")->get()); - return copy; -} - - void EMT::Ph3::CurrentSource::mnaCompInitialize(Real omega, Real timeStep, Attribute::Ptr leftVector) { updateMatrixNodeIndices(); } @@ -138,23 +154,4 @@ void EMT::Ph3::CurrentSource::mnaCompUpdateVoltage(const Matrix& leftVector) { (**mIntfVoltage)(1, 0) = (**mIntfVoltage)(1, 0) - Math::realFromVectorElement(leftVector, matrixNodeIndex(0, 1)); (**mIntfVoltage)(2, 0) = (**mIntfVoltage)(2, 0) - Math::realFromVectorElement(leftVector, matrixNodeIndex(0, 2)); } -} - - -void EMT::Ph3::CurrentSource::setParameters(MatrixComp CurrentRef, Real SrcFreq) -{ - auto srcSigSine = Signal::SineWaveGenerator::make(**mName + "_sw"); - // Complex(1,0) is used as initialPhasor for signal generator as only phase is used - srcSigSine->setParameters(Complex(1,0), SrcFreq); - mSrcSig = srcSigSine; - - **mCurrentRef = CurrentRef; - mSrcFreq->setReference(mSrcSig->mFreq); - - mSLog->info("\nCurrent reference phasor [I]: {:s}" - "\nFrequency [Hz]: {:s}", - Logger::matrixCompToString(CurrentRef), - Logger::realToString(SrcFreq)); - - mParametersSet = true; } \ No newline at end of file diff --git a/dpsim-models/src/EMT/EMT_Ph3_SSN_Capacitor.cpp b/dpsim-models/src/EMT/EMT_Ph3_SSN_Capacitor.cpp index 468a35b55c..1b02f248d0 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_SSN_Capacitor.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_SSN_Capacitor.cpp @@ -62,9 +62,9 @@ void EMT::Ph3::SSN::Capacitor::initializeFromNodesAndTerminals(Real frequency) { void EMT::Ph3::SSN::Capacitor::mnaCompInitialize(Real omega, Real timeStep, Attribute::Ptr leftVector) { updateMatrixNodeIndices(); - mHistoricVoltage = Dufour_B_k_hat * **mIntfCurrent + **mIntfVoltage; - Dufour_B_k_hat = timeStep * (2.0 * **mCapacitance).inverse(); - Dufour_W_k_n = Dufour_B_k_hat; + mHistoricVoltage = mDufourBKHat * **mIntfCurrent + **mIntfVoltage; + mDufourBKHat = timeStep * (2.0 * **mCapacitance).inverse(); + mDufourWKN = mDufourBKHat; **mRightVector = Matrix::Zero(leftVector->get().rows(), 1); } @@ -91,22 +91,22 @@ void EMT::Ph3::SSN::Capacitor::mnaCompApplySystemMatrixStamp(SparseMatrixRow& sy Math::addToMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(PhaseType::C), matrixNodeIndex(1, 2), 1); } //mesh equations are independent from grounded terminals - Math::addToMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(PhaseType::A), mVirtualNodes[0]->matrixNodeIndex(PhaseType::A), -Dufour_W_k_n(0, 0)); - Math::addToMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(PhaseType::A), mVirtualNodes[0]->matrixNodeIndex(PhaseType::B), -Dufour_W_k_n(0, 1)); - Math::addToMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(PhaseType::A), mVirtualNodes[0]->matrixNodeIndex(PhaseType::C), -Dufour_W_k_n(0, 2)); + Math::addToMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(PhaseType::A), mVirtualNodes[0]->matrixNodeIndex(PhaseType::A), -mDufourWKN(0, 0)); + Math::addToMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(PhaseType::A), mVirtualNodes[0]->matrixNodeIndex(PhaseType::B), -mDufourWKN(0, 1)); + Math::addToMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(PhaseType::A), mVirtualNodes[0]->matrixNodeIndex(PhaseType::C), -mDufourWKN(0, 2)); - Math::addToMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(PhaseType::B), mVirtualNodes[0]->matrixNodeIndex(PhaseType::A), -Dufour_W_k_n(1, 0)); - Math::addToMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(PhaseType::B), mVirtualNodes[0]->matrixNodeIndex(PhaseType::B), -Dufour_W_k_n(1, 1)); - Math::addToMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(PhaseType::B), mVirtualNodes[0]->matrixNodeIndex(PhaseType::C), -Dufour_W_k_n(1, 2)); + Math::addToMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(PhaseType::B), mVirtualNodes[0]->matrixNodeIndex(PhaseType::A), -mDufourWKN(1, 0)); + Math::addToMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(PhaseType::B), mVirtualNodes[0]->matrixNodeIndex(PhaseType::B), -mDufourWKN(1, 1)); + Math::addToMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(PhaseType::B), mVirtualNodes[0]->matrixNodeIndex(PhaseType::C), -mDufourWKN(1, 2)); - Math::addToMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(PhaseType::C), mVirtualNodes[0]->matrixNodeIndex(PhaseType::A), -Dufour_W_k_n(2, 0)); - Math::addToMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(PhaseType::C), mVirtualNodes[0]->matrixNodeIndex(PhaseType::B), -Dufour_W_k_n(2, 1)); - Math::addToMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(PhaseType::C), mVirtualNodes[0]->matrixNodeIndex(PhaseType::C), -Dufour_W_k_n(2, 2)); + Math::addToMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(PhaseType::C), mVirtualNodes[0]->matrixNodeIndex(PhaseType::A), -mDufourWKN(2, 0)); + Math::addToMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(PhaseType::C), mVirtualNodes[0]->matrixNodeIndex(PhaseType::B), -mDufourWKN(2, 1)); + Math::addToMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(PhaseType::C), mVirtualNodes[0]->matrixNodeIndex(PhaseType::C), -mDufourWKN(2, 2)); } void EMT::Ph3::SSN::Capacitor::mnaCompApplyRightSideVectorStamp(Matrix& rightVector) { - mHistoricVoltage = Dufour_B_k_hat * **mIntfCurrent + **mIntfVoltage; + mHistoricVoltage = mDufourBKHat * **mIntfCurrent + **mIntfVoltage; Math::setVectorElement(rightVector, mVirtualNodes[0]->matrixNodeIndex(PhaseType::A), mHistoricVoltage(0, 0)); Math::setVectorElement(rightVector, mVirtualNodes[0]->matrixNodeIndex(PhaseType::B), mHistoricVoltage(1, 0)); Math::setVectorElement(rightVector, mVirtualNodes[0]->matrixNodeIndex(PhaseType::C), mHistoricVoltage(2, 0)); diff --git a/dpsim-models/src/EMT/EMT_Ph3_SSN_Full_Serial_RLC.cpp b/dpsim-models/src/EMT/EMT_Ph3_SSN_Full_Serial_RLC.cpp index 6648cc37b5..bafb046290 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_SSN_Full_Serial_RLC.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_SSN_Full_Serial_RLC.cpp @@ -78,25 +78,25 @@ void EMT::Ph3::SSN::Full_Serial_RLC::mnaCompInitialize(Real omega, Real timeStep updateMatrixNodeIndices(); - State = Matrix::Zero(6, 1); - yHistory = Matrix::Zero(3, 1); + mState = Matrix::Zero(6, 1); + mYHistory = Matrix::Zero(3, 1); - //Fill Dufour_A_k_hat + //Fill mDufourAKHat //State Equation one, phases A,B,C: top left submatrix - Dufour_A_k_hat(0, 0) = 1.- ((2.*(timeStep*timeStep))/(4.* (**mInductance)(0, 0)* (**mCapacitance)(0, 0) + + mDufourAKHat(0, 0) = 1.- ((2.*(timeStep*timeStep))/(4.* (**mInductance)(0, 0)* (**mCapacitance)(0, 0) + 2. * timeStep * (**mCapacitance)(0, 0) * (**mResistance)(0, 0) + timeStep*timeStep) ); - Dufour_A_k_hat(1, 1) = 1.- ((2.*(timeStep*timeStep))/(4.* (**mInductance)(1, 1)* (**mCapacitance)(1, 1) + + mDufourAKHat(1, 1) = 1.- ((2.*(timeStep*timeStep))/(4.* (**mInductance)(1, 1)* (**mCapacitance)(1, 1) + 2. * timeStep * (**mCapacitance)(1, 1) * (**mResistance)(1, 1) + timeStep*timeStep) ); - Dufour_A_k_hat(2, 2) = 1.- ((2.*(timeStep*timeStep))/(4.* (**mInductance)(2, 2)*(**mCapacitance)(2, 2) + + mDufourAKHat(2, 2) = 1.- ((2.*(timeStep*timeStep))/(4.* (**mInductance)(2, 2)*(**mCapacitance)(2, 2) + 2. * timeStep * (**mCapacitance)(2, 2) * (**mResistance)(2, 2) + timeStep*timeStep) ); //State Equation one, phases A,B,C: top right submatrix - Dufour_A_k_hat(0, 3) = (timeStep/(2. * (**mCapacitance)(0, 0))) * (1. + ((4. * (**mInductance)(0, 0) * (**mCapacitance)(0, 0) - + mDufourAKHat(0, 3) = (timeStep/(2. * (**mCapacitance)(0, 0))) * (1. + ((4. * (**mInductance)(0, 0) * (**mCapacitance)(0, 0) - 2. * timeStep * (**mResistance)(0, 0) * (**mCapacitance)(0, 0) - (timeStep*timeStep))/ ( @@ -105,7 +105,7 @@ void EMT::Ph3::SSN::Full_Serial_RLC::mnaCompInitialize(Real omega, Real timeStep (timeStep*timeStep)) ) ); - Dufour_A_k_hat(1, 4) = (timeStep/(2. * (**mCapacitance)(1, 1))) * (1. + ((4. * (**mInductance)(1, 1) * (**mCapacitance)(1, 1) - + mDufourAKHat(1, 4) = (timeStep/(2. * (**mCapacitance)(1, 1))) * (1. + ((4. * (**mInductance)(1, 1) * (**mCapacitance)(1, 1) - 2. * timeStep * (**mResistance)(1, 1) * (**mCapacitance)(1, 1) - (timeStep*timeStep))/ ( @@ -114,7 +114,7 @@ void EMT::Ph3::SSN::Full_Serial_RLC::mnaCompInitialize(Real omega, Real timeStep (timeStep*timeStep)) ) ); - Dufour_A_k_hat(2, 5) = (timeStep/(2. * (**mCapacitance)(2, 2))) * (1. + ((4. * (**mInductance)(2, 2) * (**mCapacitance)(2, 2) - + mDufourAKHat(2, 5) = (timeStep/(2. * (**mCapacitance)(2, 2))) * (1. + ((4. * (**mInductance)(2, 2) * (**mCapacitance)(2, 2) - 2. * timeStep * (**mResistance)(2, 2) * (**mCapacitance)(2, 2) - (timeStep*timeStep))/ ( @@ -124,23 +124,23 @@ void EMT::Ph3::SSN::Full_Serial_RLC::mnaCompInitialize(Real omega, Real timeStep ) ); //State Equation two, phases A,B,C: bottom left submatrix - Dufour_A_k_hat(3, 0) = - ((4. * (**mCapacitance)(0, 0) * timeStep)/( + mDufourAKHat(3, 0) = - ((4. * (**mCapacitance)(0, 0) * timeStep)/( 4. * (**mInductance)(0, 0) * (**mCapacitance)(0, 0) + 2. * timeStep* (**mCapacitance)(0, 0)* (**mResistance)(0, 0) + (timeStep*timeStep) )); - Dufour_A_k_hat(4, 1) = - ((4. * (**mCapacitance)(1, 1) * timeStep)/( + mDufourAKHat(4, 1) = - ((4. * (**mCapacitance)(1, 1) * timeStep)/( 4. * (**mInductance)(1, 1) * (**mCapacitance)(1, 1) + 2. * timeStep* (**mCapacitance)(1, 1)* (**mResistance)(1, 1) + (timeStep*timeStep) )); - Dufour_A_k_hat(5, 2) = - ((4. * (**mCapacitance)(2, 2) * timeStep)/( + mDufourAKHat(5, 2) = - ((4. * (**mCapacitance)(2, 2) * timeStep)/( 4. * (**mInductance)(2, 2) * (**mCapacitance)(2, 2) + 2. * timeStep* (**mCapacitance)(2, 2)* (**mResistance)(2, 2) + (timeStep*timeStep) )); //State Equation two, phases A,B,C: bottom right submatrix - Dufour_A_k_hat(3, 3) = (4. * (**mInductance)(0, 0) * (**mCapacitance)(0, 0) - + mDufourAKHat(3, 3) = (4. * (**mInductance)(0, 0) * (**mCapacitance)(0, 0) - 2. * timeStep * (**mResistance)(0, 0) * (**mCapacitance)(0, 0) - (timeStep*timeStep))/ ( @@ -148,7 +148,7 @@ void EMT::Ph3::SSN::Full_Serial_RLC::mnaCompInitialize(Real omega, Real timeStep 2. * timeStep * (**mResistance)(0, 0) * (**mCapacitance)(0, 0) + (timeStep*timeStep) ); - Dufour_A_k_hat(4, 4) = (4. * (**mInductance)(1, 1) * (**mCapacitance)(1, 1) - + mDufourAKHat(4, 4) = (4. * (**mInductance)(1, 1) * (**mCapacitance)(1, 1) - 2. * timeStep * (**mResistance)(1, 1) * (**mCapacitance)(1, 1) - (timeStep*timeStep))/ ( @@ -156,7 +156,7 @@ void EMT::Ph3::SSN::Full_Serial_RLC::mnaCompInitialize(Real omega, Real timeStep 2. * timeStep * (**mResistance)(1, 1) * (**mCapacitance)(1, 1) + (timeStep*timeStep) ); - Dufour_A_k_hat(5, 5) = (4. * (**mInductance)(2, 2) * (**mCapacitance)(2, 2) - + mDufourAKHat(5, 5) = (4. * (**mInductance)(2, 2) * (**mCapacitance)(2, 2) - 2. * timeStep * (**mResistance)(2, 2) * (**mCapacitance)(2, 2) - (timeStep*timeStep))/ ( @@ -165,42 +165,42 @@ void EMT::Ph3::SSN::Full_Serial_RLC::mnaCompInitialize(Real omega, Real timeStep (timeStep*timeStep) ); - ///Fill Dufour_B_k_hat + ///Fill mDufourBKHat //State Equation one, phases A,B,C: top submatrix - Dufour_B_k_hat(0, 0) = (timeStep*timeStep)/ + mDufourBKHat(0, 0) = (timeStep*timeStep)/ (4. * (**mInductance)(0, 0) * (**mCapacitance)(0, 0) + 2. * timeStep * (**mCapacitance)(0, 0) * (**mResistance)(0, 0) + (timeStep * timeStep)); - Dufour_B_k_hat(1, 1) = (timeStep*timeStep)/ + mDufourBKHat(1, 1) = (timeStep*timeStep)/ (4. * (**mInductance)(1, 1) * (**mCapacitance)(1, 1) + 2. * timeStep * (**mCapacitance)(1, 1) * (**mResistance)(1, 1) + (timeStep * timeStep)); - Dufour_B_k_hat(2, 2) = (timeStep*timeStep)/ + mDufourBKHat(2, 2) = (timeStep*timeStep)/ (4. * (**mInductance)(2, 2) * (**mCapacitance)(2, 2) + 2. * timeStep * (**mCapacitance)(2, 2) * (**mResistance)(2, 2) + (timeStep * timeStep)); //State Equation two, phases A,B,C: bottom submatrix - Dufour_B_k_hat(3, 0) = (timeStep * 2. * (**mCapacitance)(0, 0))/ + mDufourBKHat(3, 0) = (timeStep * 2. * (**mCapacitance)(0, 0))/ (4. * (**mInductance)(0, 0) * (**mCapacitance)(0, 0) + 2. * timeStep * (**mCapacitance)(0, 0) * (**mResistance)(0, 0) + (timeStep * timeStep)); - Dufour_B_k_hat(4, 1) = (timeStep * 2. * (**mCapacitance)(1, 1))/ + mDufourBKHat(4, 1) = (timeStep * 2. * (**mCapacitance)(1, 1))/ (4. * (**mInductance)(1, 1) * (**mCapacitance)(1, 1) + 2. * timeStep * (**mCapacitance)(1, 1) * (**mResistance)(1, 1) + (timeStep * timeStep)); - Dufour_B_k_hat(5, 2) = (timeStep * 2. * (**mCapacitance)(2, 2))/ + mDufourBKHat(5, 2) = (timeStep * 2. * (**mCapacitance)(2, 2))/ (4. * (**mInductance)(2, 2) * (**mCapacitance)(2, 2) + 2. * timeStep * (**mCapacitance)(2, 2) * (**mResistance)(2, 2) + (timeStep * timeStep)); - Dufour_B_k_n_hat = Dufour_B_k_hat; + mDufourBKNHat = mDufourBKHat; - Dufour_C_k_n(0, 3) = 1.; - Dufour_C_k_n(1, 4) = 1.; - Dufour_C_k_n(2, 5) = 1.; + mDufourCKN(0, 3) = 1.; + mDufourCKN(1, 4) = 1.; + mDufourCKN(2, 5) = 1.; - Dufour_W_k_n = Dufour_C_k_n * Dufour_B_k_hat; + mDufourWKN = mDufourCKN * mDufourBKHat; ///FIXME: mIntfCurrent is state 2 and is potentially directly initialized by other initialization methodes (e.g. FromNodesAndTerminals). /// State 1, which is Voltage over the capacitor, is not directly initialized and has to be calculated from the states. This is why @@ -208,13 +208,13 @@ void EMT::Ph3::SSN::Full_Serial_RLC::mnaCompInitialize(Real omega, Real timeStep /// in this case, so calculation of state 1 would always assume zero as the past value of state 1 and also takes mIntfCurrent /// for the calculation ->State 1 is ahead of state 2 by one step, but also always (wrongly?) assumes past state 1 to be zero. /// How to handle properly? - State(3, 0) = (**mIntfCurrent)(0, 0); - State(4, 0) = (**mIntfCurrent)(1, 0); - State(5, 0) = (**mIntfCurrent)(2, 0); + mState(3, 0) = (**mIntfCurrent)(0, 0); + mState(4, 0) = (**mIntfCurrent)(1, 0); + mState(5, 0) = (**mIntfCurrent)(2, 0); ssnUpdateState(); - State(3, 0) = (**mIntfCurrent)(0, 0); - State(4, 0) = (**mIntfCurrent)(1, 0); - State(5, 0) = (**mIntfCurrent)(2, 0); + mState(3, 0) = (**mIntfCurrent)(0, 0); + mState(4, 0) = (**mIntfCurrent)(1, 0); + mState(5, 0) = (**mIntfCurrent)(2, 0); **mRightVector = Matrix::Zero(leftVector->get().rows(), 1); @@ -231,70 +231,70 @@ void EMT::Ph3::SSN::Full_Serial_RLC::mnaCompInitialize(Real omega, Real timeStep void EMT::Ph3::SSN::Full_Serial_RLC::mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMatrix) { if (terminalNotGrounded(0)) { // set upper left block, 3x3 entries - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(0, 0), Dufour_W_k_n(0, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(0, 1), Dufour_W_k_n(0, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(0, 2), Dufour_W_k_n(0, 2)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(0, 0), Dufour_W_k_n(1, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(0, 1), Dufour_W_k_n(1, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(0, 2), Dufour_W_k_n(1, 2)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(0, 0), Dufour_W_k_n(2, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(0, 1), Dufour_W_k_n(2, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(0, 2), Dufour_W_k_n(2, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(0, 0), mDufourWKN(0, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(0, 1), mDufourWKN(0, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(0, 2), mDufourWKN(0, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(0, 0), mDufourWKN(1, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(0, 1), mDufourWKN(1, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(0, 2), mDufourWKN(1, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(0, 0), mDufourWKN(2, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(0, 1), mDufourWKN(2, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(0, 2), mDufourWKN(2, 2)); } if (terminalNotGrounded(1)) { // set buttom right block, 3x3 entries - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(1, 0), Dufour_W_k_n(0, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(1, 1), Dufour_W_k_n(0, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(1, 2), Dufour_W_k_n(0, 2)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(1, 0), Dufour_W_k_n(1, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(1, 1), Dufour_W_k_n(1, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(1, 2), Dufour_W_k_n(1, 2)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(1, 0), Dufour_W_k_n(2, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(1, 1), Dufour_W_k_n(2, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(1, 2), Dufour_W_k_n(2, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(1, 0), mDufourWKN(0, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(1, 1), mDufourWKN(0, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(1, 2), mDufourWKN(0, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(1, 0), mDufourWKN(1, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(1, 1), mDufourWKN(1, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(1, 2), mDufourWKN(1, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(1, 0), mDufourWKN(2, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(1, 1), mDufourWKN(2, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(1, 2), mDufourWKN(2, 2)); } // Set off diagonal blocks, 2x3x3 entries if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(1, 0), -Dufour_W_k_n(0, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(1, 1), -Dufour_W_k_n(0, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(1, 2), -Dufour_W_k_n(0, 2)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(1, 0), -Dufour_W_k_n(1, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(1, 1), -Dufour_W_k_n(1, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(1, 2), -Dufour_W_k_n(1, 2)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(1, 0), -Dufour_W_k_n(2, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(1, 1), -Dufour_W_k_n(2, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(1, 2), -Dufour_W_k_n(2, 2)); - - - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(0, 0), -Dufour_W_k_n(0, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(0, 1), -Dufour_W_k_n(0, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(0, 2), -Dufour_W_k_n(0, 2)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(0, 0), -Dufour_W_k_n(1, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(0, 1), -Dufour_W_k_n(1, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(0, 2), -Dufour_W_k_n(1, 2)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(0, 0), -Dufour_W_k_n(2, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(0, 1), -Dufour_W_k_n(2, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(0, 2), -Dufour_W_k_n(2, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(1, 0), -mDufourWKN(0, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(1, 1), -mDufourWKN(0, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(1, 2), -mDufourWKN(0, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(1, 0), -mDufourWKN(1, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(1, 1), -mDufourWKN(1, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(1, 2), -mDufourWKN(1, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(1, 0), -mDufourWKN(2, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(1, 1), -mDufourWKN(2, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(1, 2), -mDufourWKN(2, 2)); + + + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(0, 0), -mDufourWKN(0, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(0, 1), -mDufourWKN(0, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(0, 2), -mDufourWKN(0, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(0, 0), -mDufourWKN(1, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(0, 1), -mDufourWKN(1, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(0, 2), -mDufourWKN(1, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(0, 0), -mDufourWKN(2, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(0, 1), -mDufourWKN(2, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(0, 2), -mDufourWKN(2, 2)); } } void EMT::Ph3::SSN::Full_Serial_RLC::mnaCompApplyRightSideVectorStamp(Matrix& rightVector) { // Update history term - yHistory = Dufour_C_k_n * (Dufour_A_k_hat * State + Dufour_B_k_hat * **mIntfVoltage); + mYHistory = mDufourCKN * (mDufourAKHat * mState + mDufourBKHat * **mIntfVoltage); if (terminalNotGrounded(0)) { - Math::setVectorElement(rightVector, matrixNodeIndex(0, 0), yHistory(0, 0)); - Math::setVectorElement(rightVector, matrixNodeIndex(0, 1), yHistory(1, 0)); - Math::setVectorElement(rightVector, matrixNodeIndex(0, 2), yHistory(2, 0)); + Math::setVectorElement(rightVector, matrixNodeIndex(0, 0), mYHistory(0, 0)); + Math::setVectorElement(rightVector, matrixNodeIndex(0, 1), mYHistory(1, 0)); + Math::setVectorElement(rightVector, matrixNodeIndex(0, 2), mYHistory(2, 0)); } if (terminalNotGrounded(1)) { - Math::setVectorElement(rightVector, matrixNodeIndex(1, 0), -yHistory(0, 0)); - Math::setVectorElement(rightVector, matrixNodeIndex(1, 1), -yHistory(1, 0)); - Math::setVectorElement(rightVector, matrixNodeIndex(1, 2), -yHistory(2, 0)); + Math::setVectorElement(rightVector, matrixNodeIndex(1, 0), -mYHistory(0, 0)); + Math::setVectorElement(rightVector, matrixNodeIndex(1, 1), -mYHistory(1, 0)); + Math::setVectorElement(rightVector, matrixNodeIndex(1, 2), -mYHistory(2, 0)); } SPDLOG_LOGGER_DEBUG(mSLog, "\nHistory current term (mnaCompApplyRightSideVectorStamp): {:s}", - Logger::matrixToString(yHistory)); + Logger::matrixToString(mYHistory)); mSLog->flush(); } @@ -323,7 +323,7 @@ void EMT::Ph3::SSN::Full_Serial_RLC::mnaCompPostStep(Real time, Int timeStepCoun void EMT::Ph3::SSN::Full_Serial_RLC::mnaCompUpdateVoltage(const Matrix& leftVector) { // v1 - v0 - Dufour_u_n_t = **mIntfVoltage; + mDufourUNT = **mIntfVoltage; **mIntfVoltage = Matrix::Zero(3, 1); if (terminalNotGrounded(1)) { (**mIntfVoltage)(0, 0) = Math::realFromVectorElement(leftVector, matrixNodeIndex(1, 0)); @@ -342,7 +342,7 @@ void EMT::Ph3::SSN::Full_Serial_RLC::mnaCompUpdateVoltage(const Matrix& leftVect } void EMT::Ph3::SSN::Full_Serial_RLC::mnaCompUpdateCurrent(const Matrix& leftVector) { - **mIntfCurrent = yHistory + Dufour_W_k_n * **mIntfVoltage; + **mIntfCurrent = mYHistory + mDufourWKN * **mIntfVoltage; SPDLOG_LOGGER_DEBUG(mSLog, "\nUpdate Current: {:s}", @@ -361,5 +361,5 @@ void EMT::Ph3::SSN::Full_Serial_RLC::setParameters(Matrix resistance, Matrix ind void EMT::Ph3::SSN::Full_Serial_RLC::ssnUpdateState() { - State = Dufour_A_k_hat * State + Dufour_B_k_hat * Dufour_u_n_t + Dufour_B_k_n_hat * **mIntfVoltage; + mState = mDufourAKHat * mState + mDufourBKHat * mDufourUNT + mDufourBKNHat * **mIntfVoltage; } \ No newline at end of file diff --git a/dpsim-models/src/EMT/EMT_Ph3_SSN_Inductor.cpp b/dpsim-models/src/EMT/EMT_Ph3_SSN_Inductor.cpp index c753882c96..4bc05ab969 100644 --- a/dpsim-models/src/EMT/EMT_Ph3_SSN_Inductor.cpp +++ b/dpsim-models/src/EMT/EMT_Ph3_SSN_Inductor.cpp @@ -16,7 +16,7 @@ EMT::Ph3::SSN::Inductor::Inductor(String uid, String name, Logger::Level logLeve setTerminalNumber(2); **mIntfVoltage = Matrix::Zero(3, 1); **mIntfCurrent = Matrix::Zero(3, 1); - historicCurrent = Matrix::Zero(3, 1); + mHistoricCurrent = Matrix::Zero(3, 1); } SimPowerComp::Ptr EMT::Ph3::SSN::Inductor::clone(String name) { @@ -63,9 +63,9 @@ void EMT::Ph3::SSN::Inductor::mnaCompInitialize(Real omega, Real timeStep, Attri updateMatrixNodeIndices(); //update history term - Dufour_B_k_hat = (timeStep / 2. * (**mInductance).inverse()); - Dufour_W_k_n = Dufour_B_k_hat; - historicCurrent = Dufour_B_k_hat * **mIntfVoltage + **mIntfCurrent; + mDufourBKHat = (timeStep / 2. * (**mInductance).inverse()); + mDufourWKN = mDufourBKHat; + mHistoricCurrent = mDufourBKHat * **mIntfVoltage + **mIntfCurrent; **mRightVector = Matrix::Zero(leftVector->get().rows(), 1); @@ -77,79 +77,79 @@ void EMT::Ph3::SSN::Inductor::mnaCompInitialize(Real omega, Real timeStep, Attri "\n--- MNA initialization finished ---", Logger::matrixToString(**mIntfVoltage), Logger::matrixToString(**mIntfCurrent), - Logger::matrixToString(historicCurrent)); + Logger::matrixToString(mHistoricCurrent)); mSLog->flush(); } void EMT::Ph3::SSN::Inductor::mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMatrix) { if (terminalNotGrounded(0)) { // set upper left block, 3x3 entries - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(0, 0), Dufour_W_k_n(0, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(0, 1), Dufour_W_k_n(0, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(0, 2), Dufour_W_k_n(0, 2)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(0, 0), Dufour_W_k_n(1, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(0, 1), Dufour_W_k_n(1, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(0, 2), Dufour_W_k_n(1, 2)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(0, 0), Dufour_W_k_n(2, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(0, 1), Dufour_W_k_n(2, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(0, 2), Dufour_W_k_n(2, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(0, 0), mDufourWKN(0, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(0, 1), mDufourWKN(0, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(0, 2), mDufourWKN(0, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(0, 0), mDufourWKN(1, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(0, 1), mDufourWKN(1, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(0, 2), mDufourWKN(1, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(0, 0), mDufourWKN(2, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(0, 1), mDufourWKN(2, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(0, 2), mDufourWKN(2, 2)); } if (terminalNotGrounded(1)) { // set buttom right block, 3x3 entries - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(1, 0), Dufour_W_k_n(0, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(1, 1), Dufour_W_k_n(0, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(1, 2), Dufour_W_k_n(0, 2)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(1, 0), Dufour_W_k_n(1, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(1, 1), Dufour_W_k_n(1, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(1, 2), Dufour_W_k_n(1, 2)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(1, 0), Dufour_W_k_n(2, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(1, 1), Dufour_W_k_n(2, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(1, 2), Dufour_W_k_n(2, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(1, 0), mDufourWKN(0, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(1, 1), mDufourWKN(0, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(1, 2), mDufourWKN(0, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(1, 0), mDufourWKN(1, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(1, 1), mDufourWKN(1, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(1, 2), mDufourWKN(1, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(1, 0), mDufourWKN(2, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(1, 1), mDufourWKN(2, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(1, 2), mDufourWKN(2, 2)); } // Set off diagonal blocks, 2x3x3 entries if (terminalNotGrounded(0) && terminalNotGrounded(1)) { - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(1, 0), -Dufour_W_k_n(0, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(1, 1), -Dufour_W_k_n(0, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(1, 2), -Dufour_W_k_n(0, 2)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(1, 0), -Dufour_W_k_n(1, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(1, 1), -Dufour_W_k_n(1, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(1, 2), -Dufour_W_k_n(1, 2)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(1, 0), -Dufour_W_k_n(2, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(1, 1), -Dufour_W_k_n(2, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(1, 2), -Dufour_W_k_n(2, 2)); - - - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(0, 0), -Dufour_W_k_n(0, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(0, 1), -Dufour_W_k_n(0, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(0, 2), -Dufour_W_k_n(0, 2)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(0, 0), -Dufour_W_k_n(1, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(0, 1), -Dufour_W_k_n(1, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(0, 2), -Dufour_W_k_n(1, 2)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(0, 0), -Dufour_W_k_n(2, 0)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(0, 1), -Dufour_W_k_n(2, 1)); - Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(0, 2), -Dufour_W_k_n(2, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(1, 0), -mDufourWKN(0, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(1, 1), -mDufourWKN(0, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(1, 2), -mDufourWKN(0, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(1, 0), -mDufourWKN(1, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(1, 1), -mDufourWKN(1, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 1), matrixNodeIndex(1, 2), -mDufourWKN(1, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(1, 0), -mDufourWKN(2, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(1, 1), -mDufourWKN(2, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(1, 2), -mDufourWKN(2, 2)); + + + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(0, 0), -mDufourWKN(0, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(0, 1), -mDufourWKN(0, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 0), matrixNodeIndex(0, 2), -mDufourWKN(0, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(0, 0), -mDufourWKN(1, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(0, 1), -mDufourWKN(1, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 1), matrixNodeIndex(0, 2), -mDufourWKN(1, 2)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(0, 0), -mDufourWKN(2, 0)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(0, 1), -mDufourWKN(2, 1)); + Math::addToMatrixElement(systemMatrix, matrixNodeIndex(1, 2), matrixNodeIndex(0, 2), -mDufourWKN(2, 2)); } SPDLOG_LOGGER_INFO(mSLog, "\nEquivalent Conductance: {:s}", - Logger::matrixToString(Dufour_B_k_hat)); + Logger::matrixToString(mDufourBKHat)); } void EMT::Ph3::SSN::Inductor::mnaCompApplyRightSideVectorStamp(Matrix& rightVector) { // Update internal state - historicCurrent = Dufour_B_k_hat * **mIntfVoltage + **mIntfCurrent; + mHistoricCurrent = mDufourBKHat * **mIntfVoltage + **mIntfCurrent; if (terminalNotGrounded(0)) { - Math::setVectorElement(rightVector, matrixNodeIndex(0, 0), historicCurrent(0, 0)); - Math::setVectorElement(rightVector, matrixNodeIndex(0, 1), historicCurrent(1, 0)); - Math::setVectorElement(rightVector, matrixNodeIndex(0, 2), historicCurrent(2, 0)); + Math::setVectorElement(rightVector, matrixNodeIndex(0, 0), mHistoricCurrent(0, 0)); + Math::setVectorElement(rightVector, matrixNodeIndex(0, 1), mHistoricCurrent(1, 0)); + Math::setVectorElement(rightVector, matrixNodeIndex(0, 2), mHistoricCurrent(2, 0)); } if (terminalNotGrounded(1)) { - Math::setVectorElement(rightVector, matrixNodeIndex(1, 0), -historicCurrent(0, 0)); - Math::setVectorElement(rightVector, matrixNodeIndex(1, 1), -historicCurrent(1, 0)); - Math::setVectorElement(rightVector, matrixNodeIndex(1, 2), -historicCurrent(2, 0)); + Math::setVectorElement(rightVector, matrixNodeIndex(1, 0), -mHistoricCurrent(0, 0)); + Math::setVectorElement(rightVector, matrixNodeIndex(1, 1), -mHistoricCurrent(1, 0)); + Math::setVectorElement(rightVector, matrixNodeIndex(1, 2), -mHistoricCurrent(2, 0)); } SPDLOG_LOGGER_DEBUG(mSLog, "\nHistory current term (mnaCompApplyRightSideVectorStamp): {:s}", - Logger::matrixToString(historicCurrent)); + Logger::matrixToString(mHistoricCurrent)); mSLog->flush(); } @@ -195,7 +195,7 @@ void EMT::Ph3::SSN::Inductor::mnaCompUpdateVoltage(const Matrix& leftVector) { } void EMT::Ph3::SSN::Inductor::mnaCompUpdateCurrent(const Matrix& leftVector) { - **mIntfCurrent = historicCurrent + Dufour_W_k_n * **mIntfVoltage; + **mIntfCurrent = mHistoricCurrent + mDufourWKN * **mIntfVoltage; SPDLOG_LOGGER_DEBUG(mSLog, "\nUpdate Current: {:s}", Logger::matrixToString(**mIntfCurrent)