Skip to content

Commit

Permalink
add SG models to dpsimpy
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Moraga <[email protected]>
  • Loading branch information
martinmoraga committed Jan 10, 2023
1 parent 808ad36 commit 8cb7df6
Show file tree
Hide file tree
Showing 19 changed files with 69 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ namespace Base {
Real mEf_prev;

protected:
//
ModApproach mModApproach;
//
/// Model flag indicating whether the machine is modeled as current or voltage source
/// Default: currentsource (recommended)
Bool mModelAsCurrentSource = true;
// Model flag indicating the SG order to be used
SGOrder mSGOrder;

// ### Base quantities (stator refered) ###
/// Nominal power
Real mNomPower;
Expand Down Expand Up @@ -190,8 +192,9 @@ namespace Base {
public:
/// Destructor - does nothing.
virtual ~ReducedOrderSynchronGenerator() { }
///
void setModellingApproach(ModApproach modApproach);
/// modelAsCurrentSource=true --> SG is modeled as current source, otherwise as voltage source
/// Both implementations are equivalent, but the current source implementation is more efficient
virtual void setModelAsCurrentSource(Bool modelAsCurrentSource);
///
void setBaseParameters(Real nomPower, Real nomVolt, Real nomFreq);
/// Initialization for 3 Order SynGen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Ph1 {
/// voltage behind reactance phase a
Complex mEvbr;
/// norton equivalent current of mEvbr
Matrix mIvbr;
Complex mIvbr;

protected:
/// Resistance matrix in dq reference frame
Expand Down
1 change: 0 additions & 1 deletion dpsim-models/include/dpsim-models/Definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ namespace CPS {
enum class PowerflowBusType { PV, PQ, VD, None };
enum class GeneratorType {PVNode, IdealVoltageSource, IdealCurrentSource, TransientStability, FullOrder, FullOrderVBR, SG6aOrderVBR, SG6bOrderVBR, SG4OrderVBR, SG3OrderVBR, None};
enum class SGOrder {SG3Order, SG4Order, SG6aOrder, SG6bOrder};
enum class ModApproach {VoltageSource, CurrentSource};


// ### Exceptions ###
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace Ph1 {
/// voltage behind reactance phase a
Complex mEvbr;
/// norton equivalent current of mEvbr
Matrix mIvbr;
Complex mIvbr;

private:
/// Resistance matrix in dq reference frame
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ namespace Ph1 {
SynchronGenerator4OrderDCIM(const String & uid, const String & name, Logger::Level logLevel = Logger::Level::off);
///
SynchronGenerator4OrderDCIM(const String & name, Logger::Level logLevel = Logger::Level::off);
///
void setModellingApproach(ModApproach modApproach) const;
/// DCIM is only implmented as current source!
void setModelAsCurrentSource(Bool modelAsCurrentSource) const {
mSLog->debug("DCIM model can only be used as current source!");
}
};
}
}
Expand Down
24 changes: 10 additions & 14 deletions dpsim-models/src/Base/Base_ReducedOrderSynchronGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Base::ReducedOrderSynchronGenerator<Real>::ReducedOrderSynchronGenerator(
mDelta(Attribute<Real>::create("delta", mAttributes)),
mEf(Attribute<Real>::create("Ef", mAttributes)) {

mModApproach = ModApproach::CurrentSource;
//
mSimTime = 0.0;

// declare state variables
Expand All @@ -44,7 +44,7 @@ Base::ReducedOrderSynchronGenerator<Complex>::ReducedOrderSynchronGenerator(
mDelta(Attribute<Real>::create("delta", mAttributes)),
mEf(Attribute<Real>::create("Ef", mAttributes)) {

mModApproach = ModApproach::CurrentSource;
//
mSimTime = 0.0;

// declare state variables
Expand All @@ -54,9 +54,11 @@ Base::ReducedOrderSynchronGenerator<Complex>::ReducedOrderSynchronGenerator(
}

template <typename VarType>
void Base::ReducedOrderSynchronGenerator<VarType>::setModellingApproach(ModApproach modApproach) {
mModApproach = modApproach;
if (mModApproach == ModApproach::VoltageSource)
void Base::ReducedOrderSynchronGenerator<VarType>::setModelAsCurrentSource(Bool modelAsCurrentSource) {
mModelAsCurrentSource = modelAsCurrentSource;

if (!mModelAsCurrentSource)
// SG is modeled as voltage source
this->setVirtualNodeNumber(2);
}

Expand Down Expand Up @@ -139,16 +141,10 @@ void Base::ReducedOrderSynchronGenerator<VarType>::setOperationalParametersPerUn
mH = H;
}

template <>
void Base::ReducedOrderSynchronGenerator<Real>::scaleInertiaConstant(Real scalingFactor) {
mH = mH * scalingFactor;
mSLog->info("Scaling inertia with factor {:e}:\n resulting inertia: {:e}\n", scalingFactor, mH);
}

template <>
void Base::ReducedOrderSynchronGenerator<Complex>::scaleInertiaConstant(Real scalingFactor) {
template <typename VarType>
void Base::ReducedOrderSynchronGenerator<VarType>::scaleInertiaConstant(Real scalingFactor) {
mH = mH * scalingFactor;
mSLog->info("Scaling inertia with factor {:e}:\n resulting inertia: {:e}\n", scalingFactor, mH);
this->mSLog->info("Scaling inertia with factor {:e}:\n resulting inertia: {:e}\n", scalingFactor, mH);
}

template <typename VarType>
Expand Down
36 changes: 14 additions & 22 deletions dpsim-models/src/DP/DP_Ph1_ReducedOrderSynchronGeneratorVBR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ DP::Ph1::ReducedOrderSynchronGeneratorVBR::ReducedOrderSynchronGeneratorVBR

mPhaseType = PhaseType::Single;
setTerminalNumber(1);
if (mModApproach == ModApproach::VoltageSource) {
setVirtualNodeNumber(2);
}

// model variables
**mIntfVoltage = MatrixComp::Zero(1, 1);
Expand Down Expand Up @@ -82,9 +79,9 @@ void DP::Ph1::ReducedOrderSynchronGeneratorVBR::mnaInitialize(Real omega,

Base::ReducedOrderSynchronGenerator<Complex>::mnaInitialize(omega, timeStep, leftVector);

if (mModApproach == ModApproach::CurrentSource) {
if (mModelAsCurrentSource) {
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(matrixNodeIndex(0, 0), matrixNodeIndex(0, 0)));
} else if (mModApproach == ModApproach::VoltageSource) {
} else {
// upper left
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(mVirtualNodes[0]->matrixNodeIndex(), mVirtualNodes[0]->matrixNodeIndex()));

Expand All @@ -102,12 +99,12 @@ void DP::Ph1::ReducedOrderSynchronGeneratorVBR::mnaInitialize(Real omega,
}

void DP::Ph1::ReducedOrderSynchronGeneratorVBR::mnaApplySystemMatrixStamp(Matrix& systemMatrix) {
if (mModApproach == ModApproach::CurrentSource) {
if (mModelAsCurrentSource) {
// Stamp conductance matrix
// set buttom right block
Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(0, 0), mConductanceMatrix);

} else if (mModApproach == ModApproach::VoltageSource) {
} else {
// Stamp voltage source
Math::setMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(), mVirtualNodes[1]->matrixNodeIndex(), Complex(-1, 0));
Math::setMatrixElement(systemMatrix, mVirtualNodes[1]->matrixNodeIndex(), mVirtualNodes[0]->matrixNodeIndex(), Complex(1, 0));
Expand All @@ -127,15 +124,14 @@ void DP::Ph1::ReducedOrderSynchronGeneratorVBR::mnaApplySystemMatrixStamp(Matrix
}

void DP::Ph1::ReducedOrderSynchronGeneratorVBR::mnaApplyRightSideVectorStamp(Matrix& rightVector) {
if (mModApproach == ModApproach::CurrentSource) {
if (mModelAsCurrentSource) {
// compute equivalent northon circuit in abc reference frame
Matrix Evbr = Matrix::Zero(2,1);
Evbr << mEvbr.real(), mEvbr.imag();
mIvbr = mConductanceMatrix * Evbr;

Math::setVectorElement(rightVector, matrixNodeIndex(0,0), Complex(mIvbr(0,0), mIvbr(1,0)));
mIvbr = Complex(mConductanceMatrix(0,0) * mEvbr.real() + mConductanceMatrix(0,1) * mEvbr.imag(),
mConductanceMatrix(1,0) * mEvbr.real() + mConductanceMatrix(1,1) * mEvbr.imag());

Math::setVectorElement(rightVector, matrixNodeIndex(0,0), mIvbr);

} else if (mModApproach == ModApproach::VoltageSource) {
} else {
Math::setVectorElement(rightVector, mVirtualNodes[1]->matrixNodeIndex(), mEvbr);
}
}
Expand All @@ -152,14 +148,10 @@ void DP::Ph1::ReducedOrderSynchronGeneratorVBR::mnaPostStep(const Matrix& leftVe
**mVdq = parkTransform * Vabc / mBase_V_RMS;

// update armature current
if (mModApproach == ModApproach::CurrentSource) {
Matrix intfVoltage = Matrix::Zero(2,1);
intfVoltage << (**mIntfVoltage)(0, 0).real(), (**mIntfVoltage)(0, 0).imag();
Matrix Iconductance = Matrix::Zero(2,1);
Iconductance = mConductanceMatrix * intfVoltage;
(**mIntfCurrent)(0, 0) = Complex(mIvbr(0,0), mIvbr(1,0)) - Complex(Iconductance(0,0), Iconductance(1,0));
}
else if (mModApproach == ModApproach::VoltageSource) {
if (mModelAsCurrentSource) {
(**mIntfCurrent)(0, 0) = mIvbr - Complex(mConductanceMatrix(0,0) * (**mIntfVoltage)(0, 0).real() + mConductanceMatrix(0,1) * (**mIntfVoltage)(0, 0).imag(),
mConductanceMatrix(1,0) * (**mIntfVoltage)(0, 0).real() + mConductanceMatrix(1,1) * (**mIntfVoltage)(0, 0).imag());
} else {
(**mIntfCurrent)(0, 0) = Math::complexFromVectorElement(leftVector, mVirtualNodes[1]->matrixNodeIndex());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void EMT::Ph3::ReducedOrderSynchronGeneratorVBR::mnaInitialize(Real omega,

Base::ReducedOrderSynchronGenerator<Real>::mnaInitialize(omega, timeStep, leftVector);

if (mModApproach == ModApproach::CurrentSource) {
if (mModelAsCurrentSource) {
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), matrixNodeIndex(0, 1)));
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(matrixNodeIndex(0, 0), matrixNodeIndex(0, 2)));
Expand All @@ -62,7 +62,7 @@ void EMT::Ph3::ReducedOrderSynchronGeneratorVBR::mnaInitialize(Real omega,
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(matrixNodeIndex(0, 2), matrixNodeIndex(0, 0)));
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(matrixNodeIndex(0, 2), matrixNodeIndex(0, 1)));
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(matrixNodeIndex(0, 2), matrixNodeIndex(0, 2)));
} else if (mModApproach == ModApproach::VoltageSource) {
} else {
// upper left block
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(mVirtualNodes[0]->matrixNodeIndex(PhaseType::A), mVirtualNodes[0]->matrixNodeIndex(PhaseType::A)));
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(mVirtualNodes[0]->matrixNodeIndex(PhaseType::A), mVirtualNodes[0]->matrixNodeIndex(PhaseType::B)));
Expand Down Expand Up @@ -114,7 +114,7 @@ void EMT::Ph3::ReducedOrderSynchronGeneratorVBR::mnaInitialize(Real omega,

void EMT::Ph3::ReducedOrderSynchronGeneratorVBR::mnaApplySystemMatrixStamp(Matrix& systemMatrix) {

if (mModApproach == ModApproach::CurrentSource) {
if (mModelAsCurrentSource) {
// Stamp conductance matrix
Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(0, 0), mConductanceMatrix(0, 0));
Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(0, 1), mConductanceMatrix(0, 1));
Expand All @@ -126,7 +126,7 @@ void EMT::Ph3::ReducedOrderSynchronGeneratorVBR::mnaApplySystemMatrixStamp(Matri
Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(0, 1), mConductanceMatrix(2, 1));
Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 2), matrixNodeIndex(0, 2), mConductanceMatrix(2, 2));
}
else if (mModApproach == ModApproach::VoltageSource) {
else {
// Stamp voltage source
Math::addToMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(PhaseType::A), mVirtualNodes[1]->matrixNodeIndex(PhaseType::A), -1);
Math::addToMatrixElement(systemMatrix, mVirtualNodes[1]->matrixNodeIndex(PhaseType::A), mVirtualNodes[0]->matrixNodeIndex(PhaseType::A), 1);
Expand Down Expand Up @@ -183,15 +183,15 @@ void EMT::Ph3::ReducedOrderSynchronGeneratorVBR::mnaApplySystemMatrixStamp(Matri
}

void EMT::Ph3::ReducedOrderSynchronGeneratorVBR::mnaApplyRightSideVectorStamp(Matrix& rightVector) {
if (mModApproach == ModApproach::CurrentSource) {
if (mModelAsCurrentSource) {
// compute equivalent northon circuit in abc reference frame
mIvbr = mConductanceMatrix * mEvbr;

Math::setVectorElement(rightVector, matrixNodeIndex(0,0), mIvbr(0, 0));
Math::setVectorElement(rightVector, matrixNodeIndex(0,1), mIvbr(1, 0));
Math::setVectorElement(rightVector, matrixNodeIndex(0,2), mIvbr(2, 0));
}
else if (mModApproach == ModApproach::VoltageSource) {
else {
Math::setVectorElement(rightVector, mVirtualNodes[1]->matrixNodeIndex(PhaseType::A), mEvbr(0, 0));
Math::setVectorElement(rightVector, mVirtualNodes[1]->matrixNodeIndex(PhaseType::B), mEvbr(1, 0));
Math::setVectorElement(rightVector, mVirtualNodes[1]->matrixNodeIndex(PhaseType::C), mEvbr(2, 0));
Expand All @@ -208,11 +208,11 @@ void EMT::Ph3::ReducedOrderSynchronGeneratorVBR::mnaPostStep(const Matrix& leftV
**mVdq0 = mAbcToDq0 * **mIntfVoltage / mBase_V;

// update armature current
if (mModApproach == ModApproach::CurrentSource) {
if (mModelAsCurrentSource) {
Matrix Iconductance = mConductanceMatrix * **mIntfVoltage;
(**mIntfCurrent) = mIvbr - Iconductance;
}
else if (mModApproach == ModApproach::VoltageSource){
else {
(**mIntfCurrent)(0, 0) = Math::realFromVectorElement(leftVector, mVirtualNodes[1]->matrixNodeIndex(PhaseType::A));
(**mIntfCurrent)(1, 0) = Math::realFromVectorElement(leftVector, mVirtualNodes[1]->matrixNodeIndex(PhaseType::B));
(**mIntfCurrent)(2, 0) = Math::realFromVectorElement(leftVector, mVirtualNodes[1]->matrixNodeIndex(PhaseType::C));
Expand Down
33 changes: 13 additions & 20 deletions dpsim-models/src/SP/SP_Ph1_ReducedOrderSynchronGeneratorVBR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ SP::Ph1::ReducedOrderSynchronGeneratorVBR::ReducedOrderSynchronGeneratorVBR

mPhaseType = PhaseType::Single;
setTerminalNumber(1);
if (mModApproach == ModApproach::VoltageSource)
setVirtualNodeNumber(2);

// model variables
**mIntfVoltage = MatrixComp::Zero(1, 1);
Expand Down Expand Up @@ -50,9 +48,9 @@ void SP::Ph1::ReducedOrderSynchronGeneratorVBR::mnaInitialize(Real omega,

Base::ReducedOrderSynchronGenerator<Complex>::mnaInitialize(omega, timeStep, leftVector);

if (mModApproach == ModApproach::CurrentSource) {
if (mModelAsCurrentSource) {
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(matrixNodeIndex(0, 0), matrixNodeIndex(0, 0)));
} else if (mModApproach == ModApproach::VoltageSource) {
} else {
// upper left
mVariableSystemMatrixEntries.push_back(std::make_pair<UInt,UInt>(mVirtualNodes[0]->matrixNodeIndex(), mVirtualNodes[0]->matrixNodeIndex()));

Expand All @@ -71,12 +69,12 @@ void SP::Ph1::ReducedOrderSynchronGeneratorVBR::mnaInitialize(Real omega,

void SP::Ph1::ReducedOrderSynchronGeneratorVBR::mnaApplySystemMatrixStamp(Matrix& systemMatrix) {

if (mModApproach == ModApproach::CurrentSource) {
if (mModelAsCurrentSource) {
// Stamp conductance matrix
// set buttom right block
Math::addToMatrixElement(systemMatrix, matrixNodeIndex(0, 0), matrixNodeIndex(0, 0), mConductanceMatrix);
}
else if (mModApproach == ModApproach::VoltageSource) {
else {
// Stamp voltage source
Math::setMatrixElement(systemMatrix, mVirtualNodes[0]->matrixNodeIndex(), mVirtualNodes[1]->matrixNodeIndex(), Complex(-1, 0));
Math::setMatrixElement(systemMatrix, mVirtualNodes[1]->matrixNodeIndex(), mVirtualNodes[0]->matrixNodeIndex(), Complex(1, 0));
Expand All @@ -96,15 +94,14 @@ void SP::Ph1::ReducedOrderSynchronGeneratorVBR::mnaApplySystemMatrixStamp(Matrix
}

void SP::Ph1::ReducedOrderSynchronGeneratorVBR::mnaApplyRightSideVectorStamp(Matrix& rightVector) {
if (mModApproach == ModApproach::CurrentSource) {
if (mModelAsCurrentSource) {
// compute equivalent northon circuit in abc reference frame
Matrix Evbr = Matrix::Zero(2,1);
Evbr << mEvbr.real(), mEvbr.imag();
mIvbr = mConductanceMatrix * Evbr;
mIvbr = Complex(mConductanceMatrix(0,0) * mEvbr.real() + mConductanceMatrix(0,1) * mEvbr.imag(),
mConductanceMatrix(1,0) * mEvbr.real() + mConductanceMatrix(1,1) * mEvbr.imag());

Math::setVectorElement(rightVector, matrixNodeIndex(0,0), Complex(mIvbr(0,0), mIvbr(1,0)));
Math::setVectorElement(rightVector, matrixNodeIndex(0,0), mIvbr);
}
else if (mModApproach == ModApproach::VoltageSource) {
else {
Math::setVectorElement(rightVector, mVirtualNodes[1]->matrixNodeIndex(), mEvbr);
}
}
Expand All @@ -119,14 +116,10 @@ void SP::Ph1::ReducedOrderSynchronGeneratorVBR::mnaPostStep(const Matrix& leftVe
**mVdq = mComplexAToDq * Vabc / mBase_V_RMS;

// update armature current
if (mModApproach == ModApproach::CurrentSource) {
Matrix intfVoltage = Matrix::Zero(2,1);
intfVoltage << (**mIntfVoltage)(0, 0).real(), (**mIntfVoltage)(0, 0).imag();
Matrix Iconductance = Matrix::Zero(2,1);
Iconductance = mConductanceMatrix * intfVoltage;
(**mIntfCurrent)(0, 0) = Complex(mIvbr(0,0), mIvbr(1,0)) - Complex(Iconductance(0,0), Iconductance(1,0));
}
else if (mModApproach == ModApproach::VoltageSource) {
if (mModelAsCurrentSource) {
(**mIntfCurrent)(0, 0) = mIvbr - Complex(mConductanceMatrix(0,0) * (**mIntfVoltage)(0, 0).real() + mConductanceMatrix(0,1) * (**mIntfVoltage)(0, 0).imag(),
mConductanceMatrix(1,0) * (**mIntfVoltage)(0, 0).real() + mConductanceMatrix(1,1) * (**mIntfVoltage)(0, 0).imag());
} else {
(**mIntfCurrent)(0, 0) = Math::complexFromVectorElement(leftVector, mVirtualNodes[1]->matrixNodeIndex());
}

Expand Down
8 changes: 1 addition & 7 deletions dpsim-models/src/SP/SP_Ph1_SynchronGenerator4OrderDCIM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ SP::Ph1::SynchronGenerator4OrderDCIM::SynchronGenerator4OrderDCIM
: Base::ReducedOrderSynchronGenerator<Complex>(uid, name, logLevel),
mEdq_t(Attribute<Matrix>::create("Edq_t", mAttributes)) {

//
setTerminalNumber(1);
mModApproach = ModApproach::CurrentSource;

// model variables
**mEdq_t = Matrix::Zero(2,1);
Expand Down Expand Up @@ -82,12 +82,6 @@ void SP::Ph1::SynchronGenerator4OrderDCIM::stepInPerUnit() {
(**mIntfCurrent)(0,0) = Complex(Ia(0,0), Ia(1,0)) * mBase_I_RMS;
}

void SP::Ph1::SynchronGenerator4OrderDCIM::setModellingApproach(ModApproach modApproach) const {
if (mModApproach == ModApproach::VoltageSource)
mSLog->debug("DCIM is only implemented as CurrentSource!");
}


void SP::Ph1::SynchronGenerator4OrderDCIM::mnaApplyRightSideVectorStamp(Matrix& rightVector) {
Math::setVectorElement(rightVector, matrixNodeIndex(0), (**mIntfCurrent)(0, 0));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ int main(int argc, char* argv[]) {
syngenKundur.Ld_t, syngenKundur.Lq_t, syngenKundur.Td0_t, syngenKundur.Tq0_t,
syngenKundur.Ld_s, syngenKundur.Lq_s, syngenKundur.Td0_s, syngenKundur.Tq0_s);
genDP->setInitialValues(initElecPower, initMechPower, n1PF->voltage()(0,0));
genDP->setModellingApproach(ModApproach::CurrentSource);
genDP->setModelAsCurrentSource(true);

//Grid bus as Slack
auto extnetDP = DP::Ph1::NetworkInjection::make("Slack", logLevel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ int main(int argc, char* argv[]) {
genDP->setInitialValues(GridParams.initComplexElectricalPower, GridParams.mechPower,
Complex(GridParams.VnomMV * cos(GridParams.initVoltAngle),
GridParams.VnomMV * sin(GridParams.initVoltAngle)));
genDP->setModellingApproach(ModApproach::CurrentSource);
genDP->setModelAsCurrentSource(true);

// Exciter
std::shared_ptr<Signal::Exciter> exciterDP = nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ int main(int argc, char* argv[]) {
syngenKundur.Ld_t, syngenKundur.Lq_t, syngenKundur.Td0_t, syngenKundur.Tq0_t,
syngenKundur.Ld_s, syngenKundur.Lq_s, syngenKundur.Td0_s, syngenKundur.Tq0_s);
genDP->setInitialValues(initElecPower, initMechPower, n1PF->voltage()(0,0));
genDP->setModellingApproach(ModApproach::CurrentSource);
genDP->setModelAsCurrentSource(true);

//Grid bus as Slack
auto extnetDP = DP::Ph1::NetworkInjection::make("Slack", logLevel);
Expand Down
Loading

0 comments on commit 8cb7df6

Please sign in to comment.