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
a5d2f21b
Commit
a5d2f21b
authored
Mar 14, 2020
by
Markus Mirz
Browse files
rename TopologicalComponent
parent
106977eb
Changes
8
Hide whitespace changes
Inline
Side-by-side
Dependencies/libcps/Include/cps/CIM/Reader.h
View file @
a5d2f21b
...
...
@@ -97,7 +97,7 @@ namespace CIM {
/// as given in the component constructors (0 for the first node, -1 or GND for ground).
std
::
map
<
String
,
TopologicalNode
::
Ptr
>
mPowerflowNodes
;
/// Maps the RID of a ConductingEquipment to a PowerflowEquipment
std
::
map
<
String
,
Topological
Component
::
Ptr
>
mPowerflowEquipment
;
std
::
map
<
String
,
Topological
PowerComp
::
Ptr
>
mPowerflowEquipment
;
/// Maps the RID of a Terminal to a PowerflowTerminal
std
::
map
<
String
,
TopologicalTerminal
::
Ptr
>
mPowerflowTerminals
;
///
...
...
@@ -129,28 +129,28 @@ namespace CIM {
/// Returns simulation node index which belongs to mRID.
Matrix
::
Index
mapTopologicalNode
(
String
mrid
);
/// Maps CIM components to CPowerSystem components.
Topological
Component
::
Ptr
mapComponent
(
BaseClass
*
obj
);
Topological
PowerComp
::
Ptr
mapComponent
(
BaseClass
*
obj
);
/// Returns an RX-Line.
/// The voltage should be given in kV and the angle in degree.
/// TODO: Introduce different models such as PI and wave model.
Topological
Component
::
Ptr
mapACLineSegment
(
IEC61970
::
Base
::
Wires
::
ACLineSegment
*
line
);
Topological
PowerComp
::
Ptr
mapACLineSegment
(
IEC61970
::
Base
::
Wires
::
ACLineSegment
*
line
);
/// Returns a transformer, either ideal or with RL elements to model losses.
Topological
Component
::
Ptr
mapPowerTransformer
(
IEC61970
::
Base
::
Wires
::
PowerTransformer
*
trans
);
Topological
PowerComp
::
Ptr
mapPowerTransformer
(
IEC61970
::
Base
::
Wires
::
PowerTransformer
*
trans
);
/// Returns an IdealVoltageSource with voltage setting according to load flow data
/// at machine terminals. The voltage should be given in kV and the angle in degree.
/// TODO: Introduce real synchronous generator models here.
Topological
Component
::
Ptr
mapSynchronousMachine
(
IEC61970
::
Base
::
Wires
::
SynchronousMachine
*
machine
);
Topological
PowerComp
::
Ptr
mapSynchronousMachine
(
IEC61970
::
Base
::
Wires
::
SynchronousMachine
*
machine
);
/// Returns an PQload with voltage setting according to load flow data.
/// Currently the only option is to create an RL-load.
/// The voltage should be given in kV and the angle in degree.
/// TODO: Introduce real PQload model here.
Topological
Component
::
Ptr
mapEnergyConsumer
(
IEC61970
::
Base
::
Wires
::
EnergyConsumer
*
consumer
);
Topological
PowerComp
::
Ptr
mapEnergyConsumer
(
IEC61970
::
Base
::
Wires
::
EnergyConsumer
*
consumer
);
/// Adds CIM files to list of files to be parsed.
/// Returns an external grid injection.
Topological
Component
::
Ptr
mapExternalNetworkInjection
(
IEC61970
::
Base
::
Wires
::
ExternalNetworkInjection
*
extnet
);
Topological
PowerComp
::
Ptr
mapExternalNetworkInjection
(
IEC61970
::
Base
::
Wires
::
ExternalNetworkInjection
*
extnet
);
/// Returns a shunt
Topological
Component
::
Ptr
mapEquivalentShunt
(
IEC61970
::
Base
::
Equivalents
::
EquivalentShunt
*
shunt
);
Topological
PowerComp
::
Ptr
mapEquivalentShunt
(
IEC61970
::
Base
::
Equivalents
::
EquivalentShunt
*
shunt
);
public:
///
enum
GeneratorType
{
Static
,
Transient
};
...
...
Dependencies/libcps/Include/cps/SimPowerComp.h
View file @
a5d2f21b
...
...
@@ -26,7 +26,7 @@
namespace
CPS
{
/// Base class for all components that are transmitting power.
template
<
typename
VarType
>
class
SimPowerComp
:
public
Topological
Component
{
class
SimPowerComp
:
public
Topological
PowerComp
{
protected:
/// List of Terminals
...
...
Dependencies/libcps/Include/cps/SystemTopology.h
View file @
a5d2f21b
...
...
@@ -47,7 +47,7 @@ namespace CPS {
/// by a solver to split the network into subnetworks
IdentifiedObject
::
List
mTearComponents
;
/// Map of network components connected to network nodes
std
::
map
<
TopologicalNode
::
Ptr
,
Topological
Component
::
List
>
mComponentsAtNode
;
std
::
map
<
TopologicalNode
::
Ptr
,
Topological
PowerComp
::
List
>
mComponentsAtNode
;
// #### Deprecated ####
// Better use mFrequencies
...
...
Dependencies/libcps/Include/cps/TopologicalPowerComp.h
View file @
a5d2f21b
...
...
@@ -32,7 +32,7 @@
namespace
CPS
{
/// Base class for all electrical components that are
/// connected to nodes via terminals
class
Topological
Component
:
public
IdentifiedObject
{
class
Topological
PowerComp
:
public
IdentifiedObject
{
public:
enum
Behaviour
{
Initialization
,
Simulation
};
protected:
...
...
@@ -49,19 +49,19 @@ namespace CPS {
Bool
mBehaviour
=
Behaviour
::
Simulation
;
public:
typedef
std
::
shared_ptr
<
Topological
Component
>
Ptr
;
typedef
std
::
shared_ptr
<
Topological
PowerComp
>
Ptr
;
typedef
std
::
vector
<
Ptr
>
List
;
/// Basic constructor that takes UID, name and log level
Topological
Component
(
String
uid
,
String
name
,
Logger
::
Level
logLevel
=
Logger
::
Level
::
off
)
Topological
PowerComp
(
String
uid
,
String
name
,
Logger
::
Level
logLevel
=
Logger
::
Level
::
off
)
:
IdentifiedObject
(
uid
,
name
),
mLogLevel
(
logLevel
)
{
mSLog
=
Logger
::
get
(
name
,
logLevel
);
}
/// Basic constructor that takes name and log level and sets the UID to name as well
Topological
Component
(
String
name
,
Logger
::
Level
logLevel
=
Logger
::
Level
::
off
)
:
Topological
Component
(
name
,
name
,
logLevel
)
{
}
Topological
PowerComp
(
String
name
,
Logger
::
Level
logLevel
=
Logger
::
Level
::
off
)
:
Topological
PowerComp
(
name
,
name
,
logLevel
)
{
}
/// Destructor - does not do anything
virtual
~
Topological
Component
()
{
}
virtual
~
Topological
PowerComp
()
{
}
/// Returns nodes connected to this component
virtual
TopologicalNode
::
List
topologicalNodes
()
=
0
;
...
...
Dependencies/libcps/Source/CIM/Reader.cpp
View file @
a5d2f21b
...
...
@@ -85,7 +85,7 @@ Real Reader::unitValue(Real value, UnitMultiplier mult) {
return
value
;
}
Topological
Component
::
Ptr
Reader
::
mapComponent
(
BaseClass
*
obj
)
{
Topological
PowerComp
::
Ptr
Reader
::
mapComponent
(
BaseClass
*
obj
)
{
if
(
ACLineSegment
*
line
=
dynamic_cast
<
ACLineSegment
*>
(
obj
))
return
mapACLineSegment
(
line
);
if
(
EnergyConsumer
*
consumer
=
dynamic_cast
<
EnergyConsumer
*>
(
obj
))
...
...
@@ -166,7 +166,7 @@ void Reader::parseFiles() {
// Check if object is already in equipment list
if
(
mPowerflowEquipment
.
find
(
idObj
->
mRID
)
==
mPowerflowEquipment
.
end
())
{
Topological
Component
::
Ptr
comp
=
mapComponent
(
obj
);
Topological
PowerComp
::
Ptr
comp
=
mapComponent
(
obj
);
if
(
comp
)
mPowerflowEquipment
.
insert
(
std
::
make_pair
(
comp
->
uid
(),
comp
));
}
...
...
@@ -269,7 +269,7 @@ SystemTopology Reader::systemTopology() {
TopologicalNode
::
Ptr
node
=
term
->
topologicalNodes
();
//TopologicalNode::Ptr node = powercomp->topologicalTerminals().back()->topologicalNodes();
if
(
system
.
mComponentsAtNode
.
find
(
node
)
==
system
.
mComponentsAtNode
.
end
())
{
Topological
Component
::
List
complist
;
Topological
PowerComp
::
List
complist
;
complist
.
push_back
(
powercomp
);
system
.
mComponentsAtNode
.
insert
(
std
::
make_pair
(
node
,
complist
));
}
...
...
@@ -299,7 +299,7 @@ Matrix::Index Reader::mapTopologicalNode(String mrid) {
return
search
->
second
->
matrixNodeIndex
();
}
Topological
Component
::
Ptr
Reader
::
mapEnergyConsumer
(
EnergyConsumer
*
consumer
)
{
Topological
PowerComp
::
Ptr
Reader
::
mapEnergyConsumer
(
EnergyConsumer
*
consumer
)
{
mSLog
->
info
(
" Found EnergyConsumer {}"
,
consumer
->
name
);
if
(
mDomain
==
Domain
::
EMT
)
{
if
(
mPhase
==
PhaseType
::
ABC
)
{
...
...
@@ -335,7 +335,7 @@ TopologicalComponent::Ptr Reader::mapEnergyConsumer(EnergyConsumer* consumer) {
}
}
Topological
Component
::
Ptr
Reader
::
mapACLineSegment
(
ACLineSegment
*
line
)
{
Topological
PowerComp
::
Ptr
Reader
::
mapACLineSegment
(
ACLineSegment
*
line
)
{
mSLog
->
info
(
" Found ACLineSegment {} r={} x={} bch={} gch={}"
,
line
->
name
,
(
float
)
line
->
r
.
value
,
(
float
)
line
->
x
.
value
,
...
...
@@ -405,7 +405,7 @@ TopologicalComponent::Ptr Reader::mapACLineSegment(ACLineSegment* line) {
}
Topological
Component
::
Ptr
Reader
::
mapPowerTransformer
(
PowerTransformer
*
trans
)
{
Topological
PowerComp
::
Ptr
Reader
::
mapPowerTransformer
(
PowerTransformer
*
trans
)
{
if
(
trans
->
PowerTransformerEnd
.
size
()
!=
2
)
{
mSLog
->
warn
(
"PowerTransformer {} does not have exactly two windings, ignoring"
,
trans
->
name
);
return
nullptr
;
...
...
@@ -525,7 +525,7 @@ TopologicalComponent::Ptr Reader::mapPowerTransformer(PowerTransformer* trans) {
}
}
Topological
Component
::
Ptr
Reader
::
mapSynchronousMachine
(
SynchronousMachine
*
machine
)
{
Topological
PowerComp
::
Ptr
Reader
::
mapSynchronousMachine
(
SynchronousMachine
*
machine
)
{
mSLog
->
info
(
" Found Synchronous machine {}"
,
machine
->
name
);
if
(
mGeneratorType
==
GeneratorType
::
Transient
)
{
...
...
@@ -610,7 +610,7 @@ TopologicalComponent::Ptr Reader::mapSynchronousMachine(SynchronousMachine* mach
}
}
Topological
Component
::
Ptr
Reader
::
mapExternalNetworkInjection
(
ExternalNetworkInjection
*
extnet
)
{
Topological
PowerComp
::
Ptr
Reader
::
mapExternalNetworkInjection
(
ExternalNetworkInjection
*
extnet
)
{
mSLog
->
info
(
"Found External Network Injection {}"
,
extnet
->
name
);
if
(
mDomain
==
Domain
::
EMT
)
{
if
(
mPhase
==
PhaseType
::
ABC
)
{
...
...
@@ -633,7 +633,7 @@ TopologicalComponent::Ptr Reader::mapExternalNetworkInjection(ExternalNetworkInj
return
nullptr
;
// DP network injection not considered yet
}
Topological
Component
::
Ptr
Reader
::
mapEquivalentShunt
(
EquivalentShunt
*
shunt
){
Topological
PowerComp
::
Ptr
Reader
::
mapEquivalentShunt
(
EquivalentShunt
*
shunt
){
mSLog
->
info
(
"Found shunt {}"
,
shunt
->
name
);
Real
baseVoltage
=
0
;
...
...
@@ -732,7 +732,7 @@ void Reader::processTopologicalNode(IEC61970::Base::Topology::TopologicalNode* t
// Insert Equipment if it does not exist in the map and add reference to Terminal.
// This could be optimized because the Equipment is searched twice.
if
(
mPowerflowEquipment
.
find
(
equipment
->
mRID
)
==
mPowerflowEquipment
.
end
())
{
Topological
Component
::
Ptr
comp
=
mapComponent
(
equipment
);
Topological
PowerComp
::
Ptr
comp
=
mapComponent
(
equipment
);
if
(
comp
)
{
mPowerflowEquipment
.
insert
(
std
::
make_pair
(
equipment
->
mRID
,
comp
));
}
else
{
...
...
Dependencies/libcps/Source/SimPowerComp.cpp
View file @
a5d2f21b
...
...
@@ -23,7 +23,7 @@ using namespace CPS;
template
<
typename
VarType
>
SimPowerComp
<
VarType
>::
SimPowerComp
(
String
uid
,
String
name
,
Logger
::
Level
logLevel
)
:
Topological
Component
(
uid
,
name
,
logLevel
)
{
:
Topological
PowerComp
(
uid
,
name
,
logLevel
)
{
addAttribute
<
MatrixVar
<
VarType
>>
(
"v_intf"
,
&
mIntfVoltage
,
Flags
::
read
);
addAttribute
<
MatrixVar
<
VarType
>>
(
"i_intf"
,
&
mIntfCurrent
,
Flags
::
read
);
mTerminals
.
clear
();
...
...
Dependencies/libcps/Source/SystemTopology.cpp
View file @
a5d2f21b
...
...
@@ -247,9 +247,9 @@ Graph::Graph SystemTopology::topologyGraph() {
if
(
!
comp
)
// TODO: this is a bug in the CIM::Reader!
continue
;
Topological
Component
::
Ptr
topoComp
;
Topological
PowerComp
::
Ptr
topoComp
;
if
(
!
(
topoComp
=
std
::
dynamic_pointer_cast
<
Topological
Component
>
(
comp
)))
if
(
!
(
topoComp
=
std
::
dynamic_pointer_cast
<
Topological
PowerComp
>
(
comp
)))
continue
;
c
=
g
.
addNode
(
topoComp
->
uid
());
...
...
Source/MNASolver.cpp
View file @
a5d2f21b
...
...
@@ -84,8 +84,8 @@ void MnaSolver<VarType>::initialize() {
// Some components feature a different behaviour for simulation and initialization
for
(
auto
comp
:
mSystem
.
mComponents
)
{
auto
powerComp
=
std
::
dynamic_pointer_cast
<
CPS
::
Topological
Component
>
(
comp
);
if
(
powerComp
)
powerComp
->
setBehaviour
(
Topological
Component
::
Behaviour
::
Simulation
);
auto
powerComp
=
std
::
dynamic_pointer_cast
<
CPS
::
Topological
PowerComp
>
(
comp
);
if
(
powerComp
)
powerComp
->
setBehaviour
(
Topological
PowerComp
::
Behaviour
::
Simulation
);
auto
sigComp
=
std
::
dynamic_pointer_cast
<
CPS
::
SimSignalComp
>
(
comp
);
if
(
sigComp
)
sigComp
->
setBehaviour
(
SimSignalComp
::
Behaviour
::
Simulation
);
...
...
@@ -394,8 +394,8 @@ void MnaSolver<VarType>::steadyStateInitialization() {
Matrix
prevLeftSideVector
=
Matrix
::
Zero
(
2
*
mNumNodes
,
1
);
for
(
auto
comp
:
mSystem
.
mComponents
)
{
auto
powerComp
=
std
::
dynamic_pointer_cast
<
CPS
::
Topological
Component
>
(
comp
);
if
(
powerComp
)
powerComp
->
setBehaviour
(
Topological
Component
::
Behaviour
::
Initialization
);
auto
powerComp
=
std
::
dynamic_pointer_cast
<
CPS
::
Topological
PowerComp
>
(
comp
);
if
(
powerComp
)
powerComp
->
setBehaviour
(
Topological
PowerComp
::
Behaviour
::
Initialization
);
auto
sigComp
=
std
::
dynamic_pointer_cast
<
CPS
::
SimSignalComp
>
(
comp
);
if
(
sigComp
)
sigComp
->
setBehaviour
(
SimSignalComp
::
Behaviour
::
Initialization
);
...
...
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