From c913e1eee53aef457a1b2f64e947e1b4e24ca859 Mon Sep 17 00:00:00 2001 From: Jan Dinkelbach Date: Thu, 14 Sep 2023 13:54:46 +0200 Subject: [PATCH] fix setting of variable entries for norton vbr Signed-off-by: Jan Dinkelbach --- .../DP_Ph1_ReducedOrderSynchronGeneratorVBR.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/dpsim-models/src/DP/DP_Ph1_ReducedOrderSynchronGeneratorVBR.cpp b/dpsim-models/src/DP/DP_Ph1_ReducedOrderSynchronGeneratorVBR.cpp index c9b2afe711..52159e12e6 100644 --- a/dpsim-models/src/DP/DP_Ph1_ReducedOrderSynchronGeneratorVBR.cpp +++ b/dpsim-models/src/DP/DP_Ph1_ReducedOrderSynchronGeneratorVBR.cpp @@ -48,14 +48,17 @@ void DP::Ph1::ReducedOrderSynchronGeneratorVBR::mnaCompInitialize(Real omega, mDomainInterface.setDPShiftFrequency(mBase_OmMech); + // get matrix dimension to properly set variable entries + auto n = leftVector->asRawPointer()->rows(); + auto complexOffset = (UInt)(n / 2); + + // set variable matrix entries depending on equivalent representation if (mModelAsNortonSource) { - // FIXME set variable matrix entries accordingly as shown below mVariableSystemMatrixEntries.push_back(std::make_pair(matrixNodeIndex(0, 0), matrixNodeIndex(0, 0))); + mVariableSystemMatrixEntries.push_back(std::make_pair(matrixNodeIndex(0, 0) + complexOffset, matrixNodeIndex(0, 0))); + mVariableSystemMatrixEntries.push_back(std::make_pair(matrixNodeIndex(0, 0), matrixNodeIndex(0, 0) + complexOffset)); + mVariableSystemMatrixEntries.push_back(std::make_pair(matrixNodeIndex(0, 0) + complexOffset, matrixNodeIndex(0, 0) + complexOffset)); } else { - // get matrix dimension to properly set variable entries - auto n = leftVector->asRawPointer()->rows(); - auto complexOffset = (UInt)(n / 2); - // upper left mVariableSystemMatrixEntries.push_back(std::make_pair(mVirtualNodes[0]->matrixNodeIndex(), mVirtualNodes[0]->matrixNodeIndex())); mVariableSystemMatrixEntries.push_back(std::make_pair(mVirtualNodes[0]->matrixNodeIndex() + complexOffset, mVirtualNodes[0]->matrixNodeIndex())); @@ -68,12 +71,13 @@ void DP::Ph1::ReducedOrderSynchronGeneratorVBR::mnaCompInitialize(Real omega, mVariableSystemMatrixEntries.push_back(std::make_pair(matrixNodeIndex(0, 0), matrixNodeIndex(0, 0) + complexOffset)); mVariableSystemMatrixEntries.push_back(std::make_pair(matrixNodeIndex(0, 0) + complexOffset, matrixNodeIndex(0, 0) + complexOffset)); - // off diagonal + // first off diagonal mVariableSystemMatrixEntries.push_back(std::make_pair(mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(0, 0))); mVariableSystemMatrixEntries.push_back(std::make_pair(mVirtualNodes[0]->matrixNodeIndex() + complexOffset, matrixNodeIndex(0, 0))); mVariableSystemMatrixEntries.push_back(std::make_pair(mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(0, 0) + complexOffset)); mVariableSystemMatrixEntries.push_back(std::make_pair(mVirtualNodes[0]->matrixNodeIndex() + complexOffset, matrixNodeIndex(0, 0) + complexOffset)); + // second off diagonal mVariableSystemMatrixEntries.push_back(std::make_pair(matrixNodeIndex(0, 0), mVirtualNodes[0]->matrixNodeIndex())); mVariableSystemMatrixEntries.push_back(std::make_pair(matrixNodeIndex(0, 0) + complexOffset, mVirtualNodes[0]->matrixNodeIndex())); mVariableSystemMatrixEntries.push_back(std::make_pair(matrixNodeIndex(0, 0), mVirtualNodes[0]->matrixNodeIndex() + complexOffset));