Commit 8888d6f5 authored by Jan Dinkelbach's avatar Jan Dinkelbach
Browse files

fix for averaged inverter initialization and update of virtual nodes and use...

fix for averaged inverter initialization and update of virtual nodes and use for transformation interface
parent 230b4e4b
......@@ -97,7 +97,7 @@ namespace CPS {
// #### MNA Section ####
///
void mnaUpdateVoltage(Matrix& leftVector);
void mnaUpdateVoltage(const Matrix& leftVector);
///
void mnaInitializeHarm(std::vector<Attribute<Matrix>::Ptr> leftVector);
///
......@@ -137,10 +137,10 @@ namespace CPS {
typename SimNode<VarType>::Ptr SimNode<VarType>::GND = SimNode<VarType>::make();
template<>
void SimNode<Real>::mnaUpdateVoltage(Matrix& leftVector);
void SimNode<Real>::mnaUpdateVoltage(const Matrix& leftVector);
template<>
void SimNode<Complex>::mnaUpdateVoltage(Matrix& leftVector);
void SimNode<Complex>::mnaUpdateVoltage(const Matrix& leftVector);
template<>
void SimNode<Complex>::mnaInitializeHarm(std::vector<Attribute<Matrix>::Ptr> leftVector);
......
......@@ -165,11 +165,7 @@ void DP::Ph1::AvVoltageSourceInverterDQ::setInitialStateValues(Real thetaPLLInit
}
void DP::Ph1::AvVoltageSourceInverterDQ::initialize(Matrix frequencies) {
mFrequencies = frequencies;
mNumFreqs = static_cast<UInt>(mFrequencies.size());
mIntfVoltage = MatrixComp::Zero(1, mNumFreqs);
mIntfCurrent = MatrixComp::Zero(1, mNumFreqs);
SimPowerComp<Complex>::initialize(frequencies);
}
......@@ -349,7 +345,7 @@ void DP::Ph1::AvVoltageSourceInverterDQ::addControlStepDependencies(AttributeBas
void DP::Ph1::AvVoltageSourceInverterDQ::controlStep(Real time, Int timeStepCount) {
// Transformation interface forward
Complex vcdq, ircdq;
vcdq = rotatingFrame2to1(mVirtualNodes[4]->initialSingleVoltage(), mPLL->attribute<Matrix>("output_prev")->get()(0, 0), mOmegaN * time);
vcdq = rotatingFrame2to1(mVirtualNodes[4]->singleVoltage(), mPLL->attribute<Matrix>("output_prev")->get()(0, 0), mOmegaN * time);
ircdq = rotatingFrame2to1(-1. * mSubResistorC->attribute<MatrixComp>("i_intf")->get()(0, 0), mPLL->attribute<Matrix>("output_prev")->get()(0, 0), mOmegaN * time);
mVcdq(0, 0) = vcdq.real();
mVcdq(1, 0) = vcdq.imag();
......@@ -428,6 +424,7 @@ void DP::Ph1::AvVoltageSourceInverterDQ::mnaUpdateCurrent(const Matrix& leftvect
}
void DP::Ph1::AvVoltageSourceInverterDQ::mnaUpdateVoltage(const Matrix& leftVector) {
mVirtualNodes[4]->mnaUpdateVoltage(leftVector);
mIntfVoltage(0, 0) = 0;
if (terminalNotGrounded(1))
mIntfVoltage(0,0) = Math::complexFromVectorElement(leftVector, matrixNodeIndex(1));
......
......@@ -59,7 +59,7 @@ void SimNode<Complex>::setVoltage(Complex newVoltage) {
}
template<>
void SimNode<Real>::mnaUpdateVoltage(Matrix& leftVector) {
void SimNode<Real>::mnaUpdateVoltage(const Matrix& leftVector) {
if (mMatrixNodeIndex[0] >= 0) mVoltage(0,0) = Math::realFromVectorElement(leftVector, mMatrixNodeIndex[0]);
if (mPhaseType == PhaseType::ABC) {
if (mMatrixNodeIndex[1] >= 0) mVoltage(1,0) = Math::realFromVectorElement(leftVector, mMatrixNodeIndex[1]);
......@@ -68,7 +68,7 @@ void SimNode<Real>::mnaUpdateVoltage(Matrix& leftVector) {
}
template<>
void SimNode<Complex>::mnaUpdateVoltage(Matrix& leftVector) {
void SimNode<Complex>::mnaUpdateVoltage(const Matrix& leftVector) {
for (UInt freq = 0; freq < mNumFreqs; freq++) {
if (mMatrixNodeIndex[0] >= 0) mVoltage(0,freq) = Math::complexFromVectorElement(leftVector, mMatrixNodeIndex[0], mNumFreqs, freq);
if (mPhaseType == PhaseType::ABC) {
......
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