Commit 644ca275 authored by Georg Martin Reinke's avatar Georg Martin Reinke
Browse files

implement getCurrent for some trivial components

parent 4794b6ef
......@@ -72,3 +72,7 @@ void Capacitor::postStep(SystemModel& system) {
currr = mGcr * deltavr - mGci * deltavi - cureqr;
curri = mGci * deltavr + mGcr * deltavi - cureqi;
}
Complex Capacitor::getCurrent(SystemModel& system) {
return Complex(currr, curri);
}
......@@ -55,6 +55,9 @@ namespace DPsim {
/// Recalculates variables detalvr, deltavi, currr and curri based on the simulation results of one time step
void postStep(SystemModel& system);
/// Return current from the previous step
Complex getCurrent(SystemModel& system);
};
}
#endif
\ No newline at end of file
#endif
......@@ -19,3 +19,7 @@ void CurrentSource::applyRightSideVectorStamp(SystemModel& system) {
void CurrentSource::step(SystemModel& system, Real time) {
this->applyRightSideVectorStamp(system);
}
Complex CurrentSource::getCurrent(SystemModel& system) {
return Complex(currentr, currenti);
}
......@@ -19,6 +19,7 @@ namespace DPsim {
void applyRightSideVectorStamp(SystemModel& system);
void step(SystemModel& system, Real time);
void postStep(SystemModel& system) { }
virtual Complex getCurrent(SystemModel& system);
};
}
#endif
......@@ -80,3 +80,7 @@ void Inductor::postStep(SystemModel& system) {
mCurrRe = mGlr * mDeltaVre - mGli * mDeltaVim + mCurEqRe;
mCurrIm = mGli * mDeltaVre + mGlr * mDeltaVim + mCurEqIm;
}
Complex Inductor::getCurrent(SystemModel& system) {
return Complex(mCurrRe, mCurrIm);
}
......@@ -60,6 +60,9 @@ namespace DPsim {
/// Recalculates variables detalvr, deltavi, currr and curri based on the simulation results of one time step
void postStep(SystemModel& system);
/// Return current from the previous step
Complex getCurrent(SystemModel& system);
};
}
#endif
\ No newline at end of file
#endif
......@@ -33,6 +33,5 @@ Complex LinearResistor::getCurrent(SystemModel& model) {
realVolt -= model.getRealFromLeftSideVector(mNode1);
imagVolt -= model.getImagFromLeftSideVector(mNode2);
}
Complex curr(realVolt*mConductance, imagVolt*mConductance);
return curr;
return Complex(realVolt*mConductance, imagVolt*mConductance);
}
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