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
f96576dc
Commit
f96576dc
authored
May 08, 2017
by
Georg Martin Reinke
Browse files
implement getCurrent for IdealVoltageSource
Former-commit-id:
6910b01f
parent
418f3d63
Changes
3
Hide whitespace changes
Inline
Side-by-side
Source/Components/IdealVoltageSource.cpp
View file @
f96576dc
...
...
@@ -35,4 +35,8 @@ void IdealVoltageSource::step(SystemModel& system, Real time) {
// Apply matrix stamp for equivalent current source
system
.
addRealToRightSideVector
(
system
.
getCompOffset
()
-
number
,
mVoltageDiffr
);
system
.
addRealToRightSideVector
(
2
*
system
.
getCompOffset
()
-
number
,
mVoltageDiffi
);
}
\ No newline at end of file
}
Complex
IdealVoltageSource
::
getCurrent
(
SystemModel
&
system
)
{
return
Complex
(
system
.
getRealFromLeftSideVector
(
system
.
getCompOffset
()
-
number
),
system
.
getRealFromLeftSideVector
(
2
*
system
.
getCompOffset
()
-
number
));
}
Source/Components/IdealVoltageSource.h
View file @
f96576dc
...
...
@@ -48,6 +48,7 @@ namespace DPsim {
void
postStep
(
SystemModel
&
system
)
{
}
virtual
Complex
getCurrent
(
SystemModel
&
system
);
};
}
#endif
Source/Examples/VillasTest.cpp
View file @
f96576dc
...
...
@@ -11,15 +11,14 @@ void DPsim::villasExample()
Logger
log
,
llog
,
rlog
;
std
::
vector
<
BaseComponent
*>
comps
;
External
Current
Source
*
e
c
s
=
new
External
Current
Source
(
"
i
1"
,
1
,
0
);
comps
.
push_back
(
e
c
s
);
External
Voltage
Source
*
e
v
s
=
new
External
Voltage
Source
(
"
v
1"
,
1
,
0
,
1
);
comps
.
push_back
(
e
v
s
);
comps
.
push_back
(
new
LinearResistor
(
"r1"
,
1
,
2
,
1
));
LinearResistor
*
r2
=
new
LinearResistor
(
"r2"
,
2
,
0
,
1
);
comps
.
push_back
(
r2
);
VillasInterface
*
villas
=
new
VillasInterface
(
"/villas1"
);
villas
->
registerCurrentSource
(
ecs
,
0
,
1
);
villas
->
registerExportedVoltage
(
1
,
0
,
0
,
1
);
villas
->
registerExportedCurrent
(
r2
,
2
,
3
);
villas
->
registerVoltageSource
(
evs
,
0
,
1
);
villas
->
registerExportedCurrent
(
evs
,
0
,
1
);
// Set up simulation
Real
timeStep
=
0.01
;
...
...
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