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
f8042150
Commit
f8042150
authored
Sep 18, 2017
by
Georg Martin Reinke
Browse files
add Python attributes to many components
Former-commit-id:
348e7d7f
parent
0ac69ef5
Changes
11
Hide whitespace changes
Inline
Side-by-side
Source/Components/Capacitor.cpp
View file @
f8042150
...
...
@@ -4,6 +4,7 @@ using namespace DPsim;
Capacitor
::
Capacitor
(
std
::
string
name
,
Int
src
,
Int
dest
,
Real
capacitance
)
:
BaseComponent
(
name
,
src
,
dest
)
{
this
->
capacitance
=
capacitance
;
attrMap
[
"capacitance"
]
=
{
AttrReal
,
&
this
->
capacitance
};
};
void
Capacitor
::
applySystemMatrixStamp
(
SystemModel
&
system
)
{
...
...
Source/Components/Inductor.cpp
View file @
f8042150
...
...
@@ -4,6 +4,7 @@ using namespace DPsim;
Inductor
::
Inductor
(
std
::
string
name
,
int
src
,
int
dest
,
double
inductance
)
:
BaseComponent
(
name
,
src
,
dest
)
{
mInductance
=
inductance
;
attrMap
[
"inductance"
]
=
{
AttrReal
,
&
mInductance
};
}
void
Inductor
::
applySystemMatrixStamp
(
SystemModel
&
system
)
{
...
...
Source/Components/InductorEMT.cpp
View file @
f8042150
...
...
@@ -4,6 +4,7 @@ using namespace DPsim;
InductorEMT
::
InductorEMT
(
std
::
string
name
,
int
src
,
int
dest
,
double
inductance
)
:
BaseComponent
(
name
,
src
,
dest
)
{
mInductance
=
inductance
;
attrMap
[
"inductance"
]
=
{
AttrReal
,
&
mInductance
};
}
void
InductorEMT
::
applySystemMatrixStamp
(
SystemModel
&
system
)
{
...
...
Source/Components/InterfacedInductor.cpp
View file @
f8042150
...
...
@@ -4,6 +4,7 @@ using namespace DPsim;
InterfacedInductor
::
InterfacedInductor
(
std
::
string
name
,
int
src
,
int
dest
,
Real
inductance
)
:
BaseComponent
(
name
,
src
,
dest
)
{
this
->
mInductance
=
inductance
;
attrMap
[
"inductance"
]
=
{
AttrReal
,
&
mInductance
};
}
...
...
Source/Components/LinearResistor.cpp
View file @
f8042150
...
...
@@ -4,11 +4,11 @@ using namespace DPsim;
LinearResistor
::
LinearResistor
(
std
::
string
name
,
int
src
,
int
dest
,
Real
resistance
)
:
BaseComponent
(
name
,
src
,
dest
)
{
this
->
mResistance
=
resistance
;
this
->
mConduc
tance
=
1.0
/
r
esistance
;
attrMap
[
"resis
tance
"
]
=
{
AttrReal
,
&
this
->
mR
esistance
}
;
}
void
LinearResistor
::
applySystemMatrixStamp
(
SystemModel
&
system
)
{
this
->
mConductance
=
1.0
/
mResistance
;
// Set diagonal entries
if
(
mNode1
>=
0
)
{
system
.
addCompToSystemMatrix
(
mNode1
,
mNode1
,
mConductance
,
0
);
...
...
Source/Components/LinearResistorEMT.cpp
View file @
f8042150
...
...
@@ -4,10 +4,11 @@ using namespace DPsim;
LinearResistorEMT
::
LinearResistorEMT
(
std
::
string
name
,
int
src
,
int
dest
,
Real
resistance
)
:
BaseComponent
(
name
,
src
,
dest
)
{
this
->
mResistance
=
resistance
;
this
->
mConduc
tance
=
1.0
/
r
esistance
;
attrMap
[
"resis
tance
"
]
=
{
AttrReal
,
&
this
->
mR
esistance
}
;
}
void
LinearResistorEMT
::
applySystemMatrixStamp
(
SystemModel
&
system
)
{
this
->
mConductance
=
1.0
/
mResistance
;
// Set diagonal entries
if
(
mNode1
>=
0
)
{
system
.
addRealToSystemMatrix
(
mNode1
,
mNode1
,
mConductance
);
...
...
Source/Components/PQLoad.cpp
View file @
f8042150
...
...
@@ -8,6 +8,14 @@ PQLoad::PQLoad(std::string name, int src, int dest, Real p, Real q, Real volt, R
mActivePower
=
p
;
mReactivePower
=
q
;
mSvVoltage
=
volt
;
// the parameters of the RxLine shouldn't be modified directly; the face that
// this component inherits from RxLine is just an implementation details that
// may change
attrMap
.
erase
(
attrMap
.
find
(
"resistance"
));
attrMap
.
erase
(
attrMap
.
find
(
"inductance"
));
attrMap
[
"activePower"
]
=
{
AttrReal
,
&
this
->
mActivePower
};
attrMap
[
"reactivePower"
]
=
{
AttrReal
,
&
this
->
mReactivePower
};
attrMap
[
"svVoltage"
]
=
{
AttrReal
,
&
this
->
mSvVoltage
};
}
void
PQLoad
::
init
(
Real
om
,
Real
dt
)
{
...
...
@@ -18,3 +26,13 @@ void PQLoad::init(Real om, Real dt) {
mInductance
=
reactance
/
om
;
RxLine
::
init
(
om
,
dt
);
}
void
PQLoad
::
applySystemMatrixStamp
(
SystemModel
&
system
)
{
// powers / svvoltage might have changed, so update them
Real
abs
=
mActivePower
*
mActivePower
+
mReactivePower
*
mReactivePower
;
mResistance
=
mSvVoltage
*
mSvVoltage
*
mActivePower
/
abs
;
mConductance
=
1.0
/
mResistance
;
Real
reactance
=
mSvVoltage
*
mSvVoltage
*
mReactivePower
/
abs
;
mInductance
=
reactance
/
system
.
getOmega
();
RxLine
::
applySystemMatrixStamp
(
system
);
}
Source/Components/PQLoad.h
View file @
f8042150
...
...
@@ -13,6 +13,7 @@ namespace DPsim {
public:
PQLoad
(
std
::
string
name
,
int
src
,
int
dest
,
Real
p
,
Real
q
,
Real
volt
,
Real
angle
);
void
init
(
Real
om
,
Real
dt
);
void
applySystemMatrixStamp
(
SystemModel
&
);
};
};
...
...
Source/Components/PiLine.cpp
View file @
f8042150
...
...
@@ -4,13 +4,15 @@ using namespace DPsim;
PiLine
::
PiLine
(
std
::
string
name
,
int
node1
,
int
node2
,
int
node3
,
Real
resistance
,
Real
inductance
,
Real
capacitance
)
:
BaseComponent
(
name
,
node1
,
node2
,
node3
)
{
mResistance
=
resistance
;
mConductance
=
1.0
/
resistance
;
mInductance
=
inductance
;
mCapacitance
=
capacitance
/
2
;
mCapacitance
=
capacitance
;
attrMap
[
"resistance"
]
=
{
AttrReal
,
&
this
->
mResistance
};
attrMap
[
"inductance"
]
=
{
AttrReal
,
&
this
->
mInductance
};
attrMap
[
"capacitance"
]
=
{
AttrReal
,
&
this
->
mCapacitance
};
}
void
PiLine
::
applySystemMatrixStamp
(
SystemModel
&
system
)
{
mConductance
=
1.0
/
mResistance
;
Real
a
=
system
.
getTimeStep
()
/
(
2.
*
mInductance
);
Real
b
=
system
.
getTimeStep
()
*
system
.
getOmega
()
/
2.
;
mGlr
=
a
/
(
1
+
b
*
b
);
...
...
@@ -43,9 +45,9 @@ void PiLine::applySystemMatrixStamp(SystemModel& system) {
system
.
addCompToSystemMatrix
(
mNode2
,
mNode3
,
-
mGlr
,
-
mGli
);
}
//capacitive part
mGcr
=
2.0
*
mCapacitance
/
system
.
getTimeStep
();
mGci
=
system
.
getOmega
()
*
mCapacitance
;
//capacitive part
(only using half of nominal capaticance)
mGcr
=
mCapacitance
/
system
.
getTimeStep
();
mGci
=
system
.
getOmega
()
*
mCapacitance
/
2
;
if
(
mNode1
>=
0
)
{
system
.
addCompToSystemMatrix
(
mNode1
,
mNode1
,
mGcr
,
mGci
);
...
...
Source/Components/PiLine.h
View file @
f8042150
...
...
@@ -95,4 +95,4 @@ namespace DPsim {
};
}
#endif
\ No newline at end of file
#endif
Source/Components/RxLine.cpp
View file @
f8042150
...
...
@@ -216,4 +216,3 @@ void RxLine::postStep(SystemModel& system) {
Complex
RxLine
::
getCurrent
(
SystemModel
&
system
)
{
return
Complex
(
mCurrRe
,
mCurrIm
);
}
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