Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
Power System Simulation and Optimization
DPsim
DPsim
Commits
644ca275
Commit
644ca275
authored
May 08, 2017
by
Georg Martin Reinke
Browse files
implement getCurrent for some trivial components
parent
4794b6ef
Changes
7
Hide whitespace changes
Inline
Side-by-side
Source/Components/Capacitor.cpp
View file @
644ca275
...
...
@@ -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
);
}
Source/Components/Capacitor.h
View file @
644ca275
...
...
@@ -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
Source/Components/CurrentSource.cpp
View file @
644ca275
...
...
@@ -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
);
}
Source/Components/CurrentSource.h
View file @
644ca275
...
...
@@ -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
Source/Components/Inductor.cpp
View file @
644ca275
...
...
@@ -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
);
}
Source/Components/Inductor.h
View file @
644ca275
...
...
@@ -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
Source/Components/LinearResistor.cpp
View file @
644ca275
...
...
@@ -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
);
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment