Commit 2e33a77b authored by Jan Dinkelbach's avatar Jan Dinkelbach Committed by Markus Mirz
Browse files

make inheritance from TopologicalPowerComp virtual to enable use in component base classes

parent 872b0cb6
......@@ -15,7 +15,7 @@
namespace CPS {
/// Base class for all components that are transmitting power.
template <typename VarType>
class SimPowerComp : public TopologicalPowerComp {
class SimPowerComp : public virtual TopologicalPowerComp {
protected:
/// List of Terminals
......
......@@ -11,8 +11,9 @@
using namespace CPS;
DP::Ph1::AvVoltageSourceInverterDQ::AvVoltageSourceInverterDQ(String uid, String name, Logger::Level logLevel, Bool withTrafo)
:SimPowerComp<Complex>(uid, name, logLevel) {
DP::Ph1::AvVoltageSourceInverterDQ::AvVoltageSourceInverterDQ(String uid, String name, Logger::Level logLevel, Bool withTrafo) :
SimPowerComp<Complex>(uid, name, logLevel),
TopologicalPowerComp(uid, name, logLevel) {
if (withTrafo) {
setVirtualNodeNumber(5);
mConnectionTransformer = DP::Ph1::Transformer::make(mName + "_trans", Logger::Level::debug);
......
......@@ -12,7 +12,7 @@ using namespace CPS;
using namespace CPS::DP::Ph1;
DP::Ph1::Capacitor::Capacitor(String uid, String name, Logger::Level logLevel)
: SimPowerComp<Complex>(uid, name, logLevel) {
: SimPowerComp<Complex>(uid, name, logLevel), TopologicalPowerComp(uid, name, logLevel) {
mEquivCurrent = { 0, 0 };
mIntfVoltage = MatrixComp::Zero(1,1);
mIntfCurrent = MatrixComp::Zero(1,1);
......
......@@ -11,7 +11,7 @@
using namespace CPS;
DP::Ph1::ControlledVoltageSource::ControlledVoltageSource(String uid, String name, Logger::Level logLevel)
: SimPowerComp<Complex>(uid, name, logLevel) {
: SimPowerComp<Complex>(uid, name, logLevel), TopologicalPowerComp(uid, name, logLevel) {
setVirtualNodeNumber(1);
setTerminalNumber(2);
mIntfVoltage = MatrixComp::Zero(1, 1);
......
......@@ -11,7 +11,7 @@
using namespace CPS;
DP::Ph1::CurrentSource::CurrentSource(String uid, String name, Logger::Level logLevel)
: SimPowerComp<Complex>(uid, name, logLevel) {
: SimPowerComp<Complex>(uid, name, logLevel), TopologicalPowerComp(uid, name, logLevel) {
setTerminalNumber(2);
mIntfVoltage = MatrixComp::Zero(1,1);
mIntfCurrent = MatrixComp::Zero(1,1);
......
......@@ -11,7 +11,7 @@
using namespace CPS;
DP::Ph1::Inductor::Inductor(String uid, String name, Logger::Level logLevel)
: SimPowerComp<Complex>(uid, name, logLevel) {
: SimPowerComp<Complex>(uid, name, logLevel), TopologicalPowerComp(uid, name, logLevel) {
mEquivCurrent = { 0, 0 };
mIntfVoltage = MatrixComp::Zero(1,1);
mIntfCurrent = MatrixComp::Zero(1,1);
......
......@@ -14,7 +14,7 @@ using namespace CPS;
using namespace std;
DP::Ph1::Inverter::Inverter(String uid, String name, Logger::Level logLevel)
: SimPowerComp<Complex>(uid, name, logLevel) {
: SimPowerComp<Complex>(uid, name, logLevel), TopologicalPowerComp(uid, name, logLevel) {
setTerminalNumber(1);
setVirtualNodeNumber(1);
mIntfVoltage = MatrixComp::Zero(1,1);
......
......@@ -11,7 +11,7 @@
using namespace CPS;
DP::Ph1::NetworkInjection::NetworkInjection(String uid, String name, Logger::Level logLevel)
: SimPowerComp<Complex>(uid, name, logLevel) {
: SimPowerComp<Complex>(uid, name, logLevel), TopologicalPowerComp(uid, name, logLevel) {
setVirtualNodeNumber(1);
setTerminalNumber(1);
mIntfVoltage = MatrixComp::Zero(1,1);
......
......@@ -12,7 +12,7 @@ using namespace CPS;
DP::Ph1::PQLoadCS::PQLoadCS(String uid, String name,
Logger::Level logLevel)
: SimPowerComp<Complex>(uid, name, logLevel) {
: SimPowerComp<Complex>(uid, name, logLevel), TopologicalPowerComp(uid, name, logLevel) {
setTerminalNumber(1);
mIntfVoltage = MatrixComp::Zero(1, 1);
mIntfCurrent = MatrixComp::Zero(1, 1);
......
......@@ -11,7 +11,7 @@
using namespace CPS;
DP::Ph1::PiLine::PiLine(String uid, String name, Logger::Level logLevel)
: SimPowerComp<Complex>(uid, name, logLevel) {
: SimPowerComp<Complex>(uid, name, logLevel), TopologicalPowerComp(uid, name, logLevel) {
setVirtualNodeNumber(1);
setTerminalNumber(2);
......
......@@ -12,7 +12,7 @@ using namespace CPS;
DP::Ph1::RXLoad::RXLoad(String uid, String name,
Logger::Level logLevel)
: SimPowerComp<Complex>(uid, name, logLevel) {
: SimPowerComp<Complex>(uid, name, logLevel), TopologicalPowerComp(uid, name, logLevel) {
setTerminalNumber(1);
mSLog->info("Create {} {}", this->type(), name);
......
......@@ -11,7 +11,7 @@
using namespace CPS;
DP::Ph1::ResIndSeries::ResIndSeries(String uid, String name, Logger::Level logLevel)
: SimPowerComp<Complex>(uid, name, logLevel) {
: SimPowerComp<Complex>(uid, name, logLevel), TopologicalPowerComp(uid, name, logLevel) {
mEquivCurrent = { 0, 0 };
mIntfVoltage = MatrixComp::Zero(1,1);
mIntfCurrent = MatrixComp::Zero(1,1);
......
......@@ -11,7 +11,7 @@
using namespace CPS;
DP::Ph1::Resistor::Resistor(String uid, String name, Logger::Level logLevel)
: SimPowerComp<Complex>(uid, name, logLevel) {
: SimPowerComp<Complex>(uid, name, logLevel), TopologicalPowerComp(uid, name, logLevel) {
mIntfVoltage = MatrixComp::Zero(1,1);
mIntfCurrent = MatrixComp::Zero(1,1);
setTerminalNumber(2);
......
......@@ -11,7 +11,7 @@
using namespace CPS;
DP::Ph1::RxLine::RxLine(String uid, String name, Logger::Level logLevel)
: SimPowerComp<Complex>(uid, name, logLevel) {
: SimPowerComp<Complex>(uid, name, logLevel), TopologicalPowerComp(uid, name, logLevel) {
setVirtualNodeNumber(1);
setTerminalNumber(2);
......
......@@ -11,7 +11,7 @@
using namespace CPS;
DP::Ph1::Switch::Switch(String uid, String name, Logger::Level logLevel)
: SimPowerComp<Complex>(uid, name, logLevel) {
: SimPowerComp<Complex>(uid, name, logLevel), TopologicalPowerComp(uid, name, logLevel) {
setTerminalNumber(2);
mIntfVoltage = MatrixComp::Zero(1,1);
mIntfCurrent = MatrixComp::Zero(1,1);
......
......@@ -13,7 +13,7 @@ using namespace CPS;
DP::Ph1::SynchronGeneratorIdeal::SynchronGeneratorIdeal(String uid, String name,
Logger::Level logLevel)
: SimPowerComp<Complex>(uid, name, logLevel) {
: SimPowerComp<Complex>(uid, name, logLevel), TopologicalPowerComp(uid, name, logLevel) {
setVirtualNodeNumber(1);
setTerminalNumber(1);
mIntfVoltage = MatrixComp::Zero(1,1);
......
......@@ -10,7 +10,7 @@
using namespace CPS;
DP::Ph1::SynchronGeneratorTrStab::SynchronGeneratorTrStab(String uid, String name, Logger::Level logLevel)
: SimPowerComp<Complex>(uid, name, logLevel) {
: SimPowerComp<Complex>(uid, name, logLevel), TopologicalPowerComp(uid, name, logLevel) {
setVirtualNodeNumber(2);
setTerminalNumber(1);
mIntfVoltage = MatrixComp::Zero(1, 1);
......
......@@ -11,10 +11,14 @@
using namespace CPS;
DP::Ph1::Transformer::Transformer(String uid, String name,
Logger::Level logLevel)
: SimPowerComp<Complex>(uid, name, logLevel) {
Logger::Level logLevel, Bool withResistiveLosses)
: SimPowerComp<Complex>(uid, name, logLevel), TopologicalPowerComp(uid, name, logLevel) {
if (withResistiveLosses)
setVirtualNodeNumber(3);
else
setVirtualNodeNumber(2);
setTerminalNumber(2);
setVirtualNodeNumber(1);
mSLog->info("Create {} {}", this->type(), name);
mIntfVoltage = MatrixComp::Zero(1,1);
......@@ -34,12 +38,8 @@ SimPowerComp<Complex>::Ptr DP::Ph1::Transformer::clone(String name) {
void DP::Ph1::Transformer::setParameters(Real ratioAbs, Real ratioPhase,
Real resistance, Real inductance) {
Base::Ph1::Transformer::setParameters(ratioAbs, ratioPhase, resistance, inductance);
if (resistance > 0)
setVirtualNodeNumber(3);
else
setVirtualNodeNumber(2);
Base::Ph1::Transformer::setParameters(ratioAbs, ratioPhase, resistance, inductance);
mSLog->info("Resistance={} [Ohm] Inductance={} [Ohm] (referred to primary side)", resistance, inductance);
mSLog->info("Tap Ratio={} [ ] Phase Shift={} [deg]", ratioAbs, ratioPhase);
......
......@@ -11,7 +11,7 @@
using namespace CPS;
DP::Ph1::VoltageSource::VoltageSource(String uid, String name, Logger::Level logLevel)
: SimPowerComp<Complex>(uid, name, logLevel) {
: SimPowerComp<Complex>(uid, name, logLevel), TopologicalPowerComp(uid, name, logLevel) {
setVirtualNodeNumber(1);
setTerminalNumber(2);
mIntfVoltage = MatrixComp::Zero(1,1);
......
......@@ -11,7 +11,7 @@
using namespace CPS;
DP::Ph1::VoltageSourceNorton::VoltageSourceNorton(String uid, String name, Logger::Level logLevel)
: SimPowerComp<Complex>(uid, name, logLevel) {
: SimPowerComp<Complex>(uid, name, logLevel), TopologicalPowerComp(uid, name, logLevel) {
setTerminalNumber(2);
mIntfVoltage = MatrixComp::Zero(1,1);
mIntfCurrent = MatrixComp::Zero(1,1);
......
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