Commit 7809c23d authored by Viviane Sapucaia's avatar Viviane Sapucaia
Browse files

Exciter with Simplified VBR model

parent caa0c3c8
......@@ -40,6 +40,14 @@ int main() {
Real J = 2.8898e+04;
Real H = 3.7;
Real Ka = 20;
Real Ta = 0.2;
Real Ke = 1;
Real Te = 0.314;
Real Kf = 0.063;
Real Tf = 0.35;
Real Tr = 1;
Real Rs = 0.003;
Real Ll = 0.15;
Real Lmd = 1.6599;
......@@ -58,7 +66,7 @@ int main() {
//Real Llkq2 = 0;
// Declare circuit components
ElementPtr gen = std::make_shared<SimplifiedSynchronGeneratorEMT>("gen", 1, 2, 3,
ElementPtr gen = std::make_shared<SimplifiedVBR>("gen", 1, 2, 3,
nomPower, nomPhPhVoltRMS, nomFreq, poleNum, nomFieldCurr,
Rs, Ll, Lmd, Lmd0, Lmq, Lmq0, Rfd, Llfd, Rkd, Llkd, Rkq1, Llkq1, Rkq2, Llkq2, H);
Real loadRes = 1037.8378;
......@@ -73,27 +81,27 @@ int main() {
circElements.push_back(r3);
// Declare circuit components for resistance change
Real breakerRes = 0.001;
ElementPtr rBreaker1 = std::make_shared<ResistorEMT>("rbreak1", 1, 0, breakerRes);
ElementPtr rBreaker2 = std::make_shared<ResistorEMT>("rbreak2", 2, 0, breakerRes);
ElementPtr rBreaker3 = std::make_shared<ResistorEMT>("rbreak3", 3, 0, breakerRes);
ElementList circElementsBreakerOn;
circElementsBreakerOn.push_back(gen);
circElementsBreakerOn.push_back(rBreaker1);
circElementsBreakerOn.push_back(rBreaker2);
circElementsBreakerOn.push_back(rBreaker3);
circElementsBreakerOn.push_back(r1);
circElementsBreakerOn.push_back(r2);
circElementsBreakerOn.push_back(r3);
//Real breakerRes = 0.001;
//ElementPtr rBreaker1 = std::make_shared<ResistorEMT>("rbreak1", 1, 0, breakerRes);
//ElementPtr rBreaker2 = std::make_shared<ResistorEMT>("rbreak2", 2, 0, breakerRes);
//ElementPtr rBreaker3 = std::make_shared<ResistorEMT>("rbreak3", 3, 0, breakerRes);
//ElementList circElementsBreakerOn;
//circElementsBreakerOn.push_back(gen);
//circElementsBreakerOn.push_back(rBreaker1);
//circElementsBreakerOn.push_back(rBreaker2);
//circElementsBreakerOn.push_back(rBreaker3);
//circElementsBreakerOn.push_back(r1);
//circElementsBreakerOn.push_back(r2);
//circElementsBreakerOn.push_back(r3);
// Set up simulation
Real tf, dt, t;
Real om = 2.0*M_PI*60.0;
tf = 0.3; dt = 0.0000001; t = 0;
Int downSampling = 50;
tf = 10; dt = 0.0001; t = 0;
Int downSampling = 1;
Simulation newSim(circElements, om, dt, tf, log, SimulationType::EMT, downSampling);
newSim.setNumericalMethod(NumericalMethod::Trapezoidal_flux);
newSim.addSystemTopology(circElementsBreakerOn);
//newSim.addSystemTopology(circElementsBreakerOn);
newSim.switchSystemMatrix(0);
// Initialize generator
......@@ -103,8 +111,9 @@ int main() {
Real initVoltAngle = -DPS_PI / 2;
Real fieldVoltage = 7.0821;
Real mechPower = 5.5558e5;
shared_ptr<SimplifiedSynchronGeneratorEMT> genPtr = std::dynamic_pointer_cast<SimplifiedSynchronGeneratorEMT>(gen);
shared_ptr<SimplifiedVBR> genPtr = std::dynamic_pointer_cast<SimplifiedVBR>(gen);
genPtr->init(om, dt, initActivePower, initReactivePower, initTerminalVolt, initVoltAngle, fieldVoltage, mechPower);
genPtr->AddExciter(Ta, Ka, Te, Ke, Tf, Kf, Tr, Lmd, Rfd);
// Calculate initial values for circuit at generator connection point
Real initApparentPower = sqrt(pow(initActivePower, 2) + pow(initReactivePower, 2));
......@@ -120,8 +129,8 @@ int main() {
Real lastLogTime = 0;
Real logTimeStep = 0.00005;
newSim.setSwitchTime(0.1, 1);
newSim.setSwitchTime(0.2, 0);
//newSim.setSwitchTime(0.1, 1);
//newSim.setSwitchTime(0.2, 0);
// Main Simulation Loop
while (newSim.getTime() < tf) {
......
......@@ -16,10 +16,10 @@ figure(1)
hold off
plot(VoltageVector(:,1),VoltageVector(:,2));
hold on
plot(VoltageVector(:,1),VoltageVector(:,3));
plot(VoltageVector(:,1),VoltageVector(:,4));
% plot(VoltageVector(:,1),VoltageVector(:,3));
% plot(VoltageVector(:,1),VoltageVector(:,4));
% plot(tout,voltages(:,1),'--')
plot(tout,voltages(:,1),'--')
% plot(tout,voltages(:,2),'--')
% plot(tout,voltages(:,3),'--')
% plot(Results_PLECS(:,1),Results_PLECS(:,2),'--');
......@@ -34,10 +34,10 @@ figure(2)
hold off
plot(CurrentVector(:,1),CurrentVector(:,2));
hold on
plot(CurrentVector(:,1),CurrentVector(:,3));
plot(CurrentVector(:,1),CurrentVector(:,4));
% plot(CurrentVector(:,1),CurrentVector(:,3));
% plot(CurrentVector(:,1),CurrentVector(:,4));
% plot(tout,currents(:,1),'--')
plot(tout,currents(:,1),'--')
% plot(tout,currents(:,2),'--')
% plot(tout,currents(:,3),'--')
......
......@@ -67,7 +67,7 @@ void Exciter::step(Real mVd, Real mVq, Real Vref, Real dt, Real time) {
Real dUf = (mVr - mVse - mKe*mVf) / mTe;
mVis = Euler(mVis, -1, mKf, dt / mTf, dUf);
// Amplifier equation
mVr = Euler(mVr, -1, mKa, dt / mTa, mVref - mVm - mVis);
mVr = Euler(mVr, -1, mKa, dt / mTa, Vref - mVm - mVis);
// Exciter
mVse = 0.0039*exp(mVf*1.555);
mVf = Euler(mVf, -mKe, 1, dt / mTe, mVr - mVse);
......
......@@ -92,8 +92,8 @@ void SimplifiedVBR::init(Real om, Real dt,
// Correcting variables
mThetaMech = mThetaMech + PI / 2;
mMechTorque = -mMechTorque;
mIq = -mIq;
mId = -mId;
//mIq = -mIq;
//mId = -mId;
// #### VBR Model Dynamic variables #######################################
......@@ -153,7 +153,8 @@ void SimplifiedVBR::stepInPerUnit(Real om, Real dt, Real time, NumericalMethod n
// Calculate mechanical variables with euler
mElecTorque = (mPsimd*mIq - mPsimq*mId);
mOmMech = mOmMech + dt * (1. / (2. * mH) * (mElecTorque - mMechTorque));
mOmMech = mOmMech + dt * (1. / (2. * mH) * (mMechTorque - mElecTorque));
//mOmMech = 1;
mThetaMech = mThetaMech + dt * (mOmMech* mBase_OmMech);
Matrix R(2, 2);
......@@ -166,6 +167,9 @@ void SimplifiedVBR::stepInPerUnit(Real om, Real dt, Real time, NumericalMethod n
mIq = mDqStatorCurrents(0, 0);
mId = mDqStatorCurrents(1, 0);
mVq = -mRs*mIq - mOmMech*mDLd*mId + mDVq;
mVd = -mRs*mId + mOmMech*mDLq*mIq + mDVd;
mIa = inverseParkTransform(mThetaMech, mIq, mId, 0)(0);
mIb = inverseParkTransform(mThetaMech, mIq, mId, 0)(1);
mIc = inverseParkTransform(mThetaMech, mIq, mId, 0)(2);
......@@ -220,20 +224,20 @@ void SimplifiedVBR::stepInPerUnit(Real om, Real dt, Real time, NumericalMethod n
// Load resistance
if (time < 0.1 )
{
//if (time < 0.1 )
//{
R_load <<
1037.8378 / mBase_Z, 0, 0,
0, 1037.8378 / mBase_Z, 0,
0, 0, 1037.8378 / mBase_Z;
}
else
{
R_load <<
103.78378 / mBase_Z, 0, 0,
0, 103.78378 / mBase_Z, 0,
0, 0, 103.78378 / mBase_Z;
}
//}
//else
//{
// R_load <<
// 103.78378 / mBase_Z, 0, 0,
// 0, 103.78378 / mBase_Z, 0,
// 0, 0, 103.78378 / mBase_Z;
//}
}
......
......@@ -26,7 +26,7 @@
#include <iostream>
#include <vector>
#include "Config.h"
  • Unfortunately, this change breaks compilation with Real-time support on Linux platforms.

    We need to find a better way to compile DPsim with Cmake on Windows as well :(

Please register or sign in to reply
//#include "Config.h"
#ifdef WITH_RT
#include <signal.h>
......
......@@ -185,9 +185,7 @@
<ClInclude Include="..\..\Source\Utilities.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\Examples\C++\DPsimExample.cpp" />
<ClCompile Include="..\..\Examples\C++\ShmemTest.cpp" />
<ClCompile Include="..\..\Examples\C++\SynchronGenUnitTest.cpp" />
<ClCompile Include="..\..\Examples\Cxx\SynchronGenerators\SimpSynGenThreePhaseFault.cpp" />
<ClCompile Include="..\..\Source\Components\BaseComponent.cpp" />
<ClCompile Include="..\..\Source\Components\CapacitorDP.cpp" />
<ClCompile Include="..\..\Source\Components\CurrentSourceDP.cpp" />
......
......@@ -161,15 +161,6 @@
<ClCompile Include="..\..\Source\IntegrationMethod.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="..\..\Examples\C++\DPsimExample.cpp">
<Filter>Quelldateien\Examples</Filter>
</ClCompile>
<ClCompile Include="..\..\Examples\C++\ShmemTest.cpp">
<Filter>Quelldateien\Examples</Filter>
</ClCompile>
<ClCompile Include="..\..\Examples\C++\SynchronGenUnitTest.cpp">
<Filter>Quelldateien\Examples</Filter>
</ClCompile>
<ClCompile Include="..\..\Source\Components\VoltSourceResFreqEMT.cpp">
<Filter>Quelldateien\Components</Filter>
</ClCompile>
......@@ -257,5 +248,8 @@
<ClCompile Include="..\..\Source\Components\Exciter.cpp">
<Filter>Quelldateien\Components</Filter>
</ClCompile>
<ClCompile Include="..\..\Examples\Cxx\SynchronGenerators\SimpSynGenThreePhaseFault.cpp">
<Filter>Quelldateien\Examples</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
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