Skip to content

Commit

Permalink
fix setting of variable entries for norton vbr
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Dinkelbach <jdinkelbach@eonerc.rwth-aachen.de>
  • Loading branch information
dinkelbachjan authored and philipp-fensch committed Sep 14, 2023
1 parent 5676dc5 commit c913e1e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions dpsim-models/src/DP/DP_Ph1_ReducedOrderSynchronGeneratorVBR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<UInt,UInt>(matrixNodeIndex(0, 0), matrixNodeIndex(0, 0)));
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(matrixNodeIndex(0, 0) + complexOffset, matrixNodeIndex(0, 0)));
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(matrixNodeIndex(0, 0), matrixNodeIndex(0, 0) + complexOffset));
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(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<UInt,UInt>(mVirtualNodes[0]->matrixNodeIndex(), mVirtualNodes[0]->matrixNodeIndex()));
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(mVirtualNodes[0]->matrixNodeIndex() + complexOffset, mVirtualNodes[0]->matrixNodeIndex()));
Expand All @@ -68,12 +71,13 @@ void DP::Ph1::ReducedOrderSynchronGeneratorVBR::mnaCompInitialize(Real omega,
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(matrixNodeIndex(0, 0), matrixNodeIndex(0, 0) + complexOffset));
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(matrixNodeIndex(0, 0) + complexOffset, matrixNodeIndex(0, 0) + complexOffset));

// off diagonal
// first off diagonal
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(0, 0)));
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(mVirtualNodes[0]->matrixNodeIndex() + complexOffset, matrixNodeIndex(0, 0)));
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(mVirtualNodes[0]->matrixNodeIndex(), matrixNodeIndex(0, 0) + complexOffset));
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(mVirtualNodes[0]->matrixNodeIndex() + complexOffset, matrixNodeIndex(0, 0) + complexOffset));

// second off diagonal
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(matrixNodeIndex(0, 0), mVirtualNodes[0]->matrixNodeIndex()));
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(matrixNodeIndex(0, 0) + complexOffset, mVirtualNodes[0]->matrixNodeIndex()));
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(matrixNodeIndex(0, 0), mVirtualNodes[0]->matrixNodeIndex() + complexOffset));
Expand Down

0 comments on commit c913e1e

Please sign in to comment.