Commit 559c9d16 authored by Georg Martin Reinke's avatar Georg Martin Reinke
Browse files

implement getCurrent for more components


Former-commit-id: 72c90bac
parent f96576dc
......@@ -57,3 +57,6 @@ void InterfacedInductor::postStep(SystemModel& system) {
mVoltageIm = vposi - vnegi;
}
Complex InterfacedInductor::getCurrent(SystemModel& system) {
return Complex(mCurrentRe, mCurrentIm);
}
......@@ -24,6 +24,8 @@ namespace DPsim {
void applyRightSideVectorStamp(SystemModel& system) { }
void step(SystemModel& system, Real time);
void postStep(SystemModel& system);
Complex getCurrent(SystemModel& system);
};
}
#endif
......@@ -211,3 +211,7 @@ void RxLine::postStep(SystemModel& system) {
}
}
Complex RxLine::getCurrent(SystemModel& system) {
return Complex(mCurrRe, mCurrIm);
}
......@@ -46,6 +46,7 @@ namespace DPsim {
void applyRightSideVectorStamp(SystemModel& system) { }
void step(SystemModel& system, Real time);
void postStep(SystemModel& system);
Complex getCurrent(SystemModel& system);
};
}
......
......@@ -44,3 +44,17 @@ void VoltSourceRes::step(SystemModel& system, Real time) {
system.addCompToRightSideVector(mNode2, -mCurrentr, -mCurrenti);
}
}
Complex VoltSourceRes::getCurrent(SystemModel& system) {
Real real = mCurrentr;
Real imag = mCurrenti;
if (mNode1 >= 0) {
real += system.getRealFromLeftSideVector(mNode1)*mConductance;
imag += system.getImagFromLeftSideVector(mNode1)*mConductance;
}
if (mNode2 >= 0) {
real -= system.getRealFromLeftSideVector(mNode2)*mConductance;
imag -= system.getImagFromLeftSideVector(mNode2)*mConductance;
}
return Complex(real, imag);
}
......@@ -48,6 +48,8 @@ namespace DPsim {
void step(SystemModel& system, Real time);
void postStep(SystemModel& system) { }
Complex getCurrent(SystemModel& system);
};
}
#endif
......@@ -42,7 +42,6 @@ void VoltSourceResFreq::applyRightSideVectorStamp(SystemModel& system) {
}
}
void VoltSourceResFreq::step(SystemModel& system, Real time) {
if (time >= mSwitchTime && time < mSwitchTime + mRampTime) {
Real fadeInOut = 0.5 + 0.5 * sin((time - mSwitchTime) / mRampTime * PI + -PI / 2);
......@@ -72,3 +71,17 @@ void VoltSourceResFreq::step(SystemModel& system, Real time) {
system.addCompToRightSideVector(mNode2, -mCurrentr, -mCurrenti);
}
}
Complex VoltSourceResFreq::getCurrent(SystemModel& system) {
Real real = mCurrentr;
Real imag = mCurrenti;
if (mNode1 >= 0) {
real += system.getRealFromLeftSideVector(mNode1)*mConductance;
imag += system.getImagFromLeftSideVector(mNode1)*mConductance;
}
if (mNode2 >= 0) {
real -= system.getRealFromLeftSideVector(mNode2)*mConductance;
imag -= system.getImagFromLeftSideVector(mNode2)*mConductance;
}
return Complex(real, imag);
}
......@@ -32,6 +32,7 @@ namespace DPsim {
void applyRightSideVectorStamp(SystemModel& system);
void step(SystemModel& system, Real time);
void postStep(SystemModel& system) { }
Complex getCurrent(SystemModel& system);
};
}
......
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