Commit b1815d60 authored by Georg Martin Reinke's avatar Georg Martin Reinke
Browse files

implement complex Python attributes; use Complex more consequently


Former-commit-id: ad4b3f2d
parent b15be9d0
...@@ -104,7 +104,7 @@ BaseComponent* CIMReader::mapExternalNetworkInjection(ExternalNetworkInjection* ...@@ -104,7 +104,7 @@ BaseComponent* CIMReader::mapExternalNetworkInjection(ExternalNetworkInjection*
} }
std::cerr << "IdealVoltageSource " << inj->name << " rid=" << inj->mRID << " node1=" << node << " node2=0 "; std::cerr << "IdealVoltageSource " << inj->name << " rid=" << inj->mRID << " node1=" << node << " node2=0 ";
std::cerr << " V=" << volt->v.value << "<" << volt->angle.value << std::endl; std::cerr << " V=" << volt->v.value << "<" << volt->angle.value << std::endl;
return new IdealVoltageSource(inj->name, node, 0, volt->v.value, volt->angle.value*PI/180, ++mNumVoltageSources); return new IdealVoltageSource(inj->name, node, 0, Complex(volt->v.value, volt->angle.value*PI/180), ++mNumVoltageSources);
} }
BaseComponent* CIMReader::mapPowerTransformer(PowerTransformer* trans) { BaseComponent* CIMReader::mapPowerTransformer(PowerTransformer* trans) {
...@@ -145,7 +145,7 @@ BaseComponent* CIMReader::mapSynchronousMachine(SynchronousMachine* machine) { ...@@ -145,7 +145,7 @@ BaseComponent* CIMReader::mapSynchronousMachine(SynchronousMachine* machine) {
std::cerr << "VoltSourceRes " << machine->name << " rid=" << machine->mRID << " node1=" << node << " node2=0 "; std::cerr << "VoltSourceRes " << machine->name << " rid=" << machine->mRID << " node1=" << node << " node2=0 ";
std::cerr << " V=" << volt->v.value << "<" << volt->angle.value << " R=" << machine->r.value << std::endl; std::cerr << " V=" << volt->v.value << "<" << volt->angle.value << " R=" << machine->r.value << std::endl;
// TODO is it appropiate to use this resistance here // TODO is it appropiate to use this resistance here
return new VoltSourceRes(machine->name, node, 0, volt->v.value, volt->angle.value*PI/180, machine->r.value); return new VoltSourceRes(machine->name, node, 0, Complex(volt->v.value, volt->angle.value*PI/180), machine->r.value);
} }
BaseComponent* CIMReader::mapComponent(BaseClass* obj) { BaseComponent* CIMReader::mapComponent(BaseClass* obj) {
......
...@@ -14,6 +14,7 @@ namespace DPsim { ...@@ -14,6 +14,7 @@ namespace DPsim {
AttrReal, AttrReal,
AttrInt, AttrInt,
AttrString, // value should be *std::string, not *char! AttrString, // value should be *std::string, not *char!
AttrComplex
}; };
struct CompAttr { struct CompAttr {
......
...@@ -2,17 +2,17 @@ ...@@ -2,17 +2,17 @@
using namespace DPsim; using namespace DPsim;
CurrentSource::CurrentSource(std::string name, int src, int dest, double current, double phase) : BaseComponent(name, src, dest) { CurrentSource::CurrentSource(std::string name, int src, int dest, Complex current) : BaseComponent(name, src, dest) {
this->currentr = current*cos(phase); this->mCurrent = current;
this->currenti = current*sin(phase); attrMap["current"] = {AttrComplex, &this->mCurrent};
}; };
void CurrentSource::applyRightSideVectorStamp(SystemModel& system) { void CurrentSource::applyRightSideVectorStamp(SystemModel& system) {
if (mNode1 >= 0) { if (mNode1 >= 0) {
system.addCompToRightSideVector(mNode1, currentr, currenti); system.addCompToRightSideVector(mNode1, mCurrent.real(), mCurrent.imag());
} }
if (mNode2 >= 0) { if (mNode2 >= 0) {
system.addCompToRightSideVector(mNode2, -currentr, -currenti); system.addCompToRightSideVector(mNode2, -mCurrent.real(), mCurrent.imag());
} }
} }
...@@ -21,5 +21,5 @@ void CurrentSource::step(SystemModel& system, Real time) { ...@@ -21,5 +21,5 @@ void CurrentSource::step(SystemModel& system, Real time) {
} }
Complex CurrentSource::getCurrent(SystemModel &system) { Complex CurrentSource::getCurrent(SystemModel &system) {
return Complex(currentr, currenti); return mCurrent;
} }
...@@ -7,12 +7,11 @@ namespace DPsim { ...@@ -7,12 +7,11 @@ namespace DPsim {
class CurrentSource : public BaseComponent { class CurrentSource : public BaseComponent {
protected: protected:
double currentr; Complex mCurrent;
double currenti;
public: public:
CurrentSource() { ; }; CurrentSource() { ; };
CurrentSource(std::string name, int src, int dest, double current, double phase); CurrentSource(std::string name, int src, int dest, Complex current);
void init(Real om, Real dt) { } void init(Real om, Real dt) { }
void applySystemMatrixStamp(SystemModel& system) { } void applySystemMatrixStamp(SystemModel& system) { }
......
...@@ -2,11 +2,10 @@ ...@@ -2,11 +2,10 @@
using namespace DPsim; using namespace DPsim;
ExternalCurrentSource::ExternalCurrentSource(std::string name, int src, int dest, Real initCurrent, Real initPhase) : ExternalCurrentSource::ExternalCurrentSource(std::string name, int src, int dest, Complex initCurrent) :
CurrentSource(name, src, dest, initCurrent, initPhase) { CurrentSource(name, src, dest, initCurrent) {
} }
void ExternalCurrentSource::setCurrent(Real real, Real imag) { void ExternalCurrentSource::setCurrent(Real real, Real imag) {
this->currentr = real; this->mCurrent = Complex(real, imag);
this->currenti = imag;
} }
...@@ -9,7 +9,7 @@ namespace DPsim { ...@@ -9,7 +9,7 @@ namespace DPsim {
public: public:
ExternalCurrentSource() {}; ExternalCurrentSource() {};
ExternalCurrentSource(std::string name, int src, int dest, Real initCurrent, Real initPhase); ExternalCurrentSource(std::string name, int src, int dest, Complex current);
void setCurrent(Real real, Real imag); void setCurrent(Real real, Real imag);
}; };
......
...@@ -2,11 +2,10 @@ ...@@ -2,11 +2,10 @@
using namespace DPsim; using namespace DPsim;
ExternalVoltageSource::ExternalVoltageSource(std::string name, int src, int dest, Real initVoltage, Real initPhase, int num) : ExternalVoltageSource::ExternalVoltageSource(std::string name, int src, int dest, Complex voltage, int num) :
IdealVoltageSource(name, src, dest, initVoltage, initPhase, num) { IdealVoltageSource(name, src, dest, voltage, num) {
} }
void ExternalVoltageSource::setVoltage(Real real, Real imag) { void ExternalVoltageSource::setVoltage(Real real, Real imag) {
this->mVoltageDiffr = real; this->mVoltage = Complex(real, imag);
this->mVoltageDiffi = imag;
} }
...@@ -9,7 +9,7 @@ namespace DPsim { ...@@ -9,7 +9,7 @@ namespace DPsim {
public: public:
ExternalVoltageSource() {}; ExternalVoltageSource() {};
ExternalVoltageSource(std::string name, int src, int dest, Real initVoltage, Real initPhase, int num); ExternalVoltageSource(std::string name, int src, int dest, Complex voltage, int num);
void setVoltage(Real real, Real imag); void setVoltage(Real real, Real imag);
}; };
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
using namespace DPsim; using namespace DPsim;
IdealVoltageSource::IdealVoltageSource(std::string name, int src, int dest, Real voltage, Real phase, int num) : BaseComponent(name, src, dest) { IdealVoltageSource::IdealVoltageSource(std::string name, int src, int dest, Complex voltage, int num) : BaseComponent(name, src, dest) {
this->number = num; this->number = num;
this->mVoltageDiffr = voltage*cos(phase); this->mVoltage = voltage;
this->mVoltageDiffi = voltage*sin(phase); attrMap["voltage"] = {AttrComplex, &this->mVoltage};
} }
void IdealVoltageSource::applySystemMatrixStamp(SystemModel& system) { void IdealVoltageSource::applySystemMatrixStamp(SystemModel& system) {
...@@ -27,14 +27,14 @@ void IdealVoltageSource::applySystemMatrixStamp(SystemModel& system) { ...@@ -27,14 +27,14 @@ void IdealVoltageSource::applySystemMatrixStamp(SystemModel& system) {
void IdealVoltageSource::applyRightSideVectorStamp(SystemModel& system) { void IdealVoltageSource::applyRightSideVectorStamp(SystemModel& system) {
// Apply matrix stamp for equivalent current source // Apply matrix stamp for equivalent current source
system.addRealToRightSideVector(system.getCompOffset() - number, mVoltageDiffr); system.addRealToRightSideVector(system.getCompOffset() - number, mVoltage.real());
system.addRealToRightSideVector(2 * system.getCompOffset() - number, mVoltageDiffi); system.addRealToRightSideVector(2 * system.getCompOffset() - number, mVoltage.imag());
} }
void IdealVoltageSource::step(SystemModel& system, Real time) { void IdealVoltageSource::step(SystemModel& system, Real time) {
// Apply matrix stamp for equivalent current source // Apply matrix stamp for equivalent current source
system.addRealToRightSideVector(system.getCompOffset() - number, mVoltageDiffr); system.addRealToRightSideVector(system.getCompOffset() - number, mVoltage.real());
system.addRealToRightSideVector(2 * system.getCompOffset() - number, mVoltageDiffi); system.addRealToRightSideVector(2 * system.getCompOffset() - number, mVoltage.imag());
} }
Complex IdealVoltageSource::getCurrent(SystemModel& system) { Complex IdealVoltageSource::getCurrent(SystemModel& system) {
......
...@@ -15,9 +15,8 @@ namespace DPsim { ...@@ -15,9 +15,8 @@ namespace DPsim {
protected: protected:
// ### Ideal Voltage source parameters ### // ### Ideal Voltage source parameters ###
/// Real and imaginary part of the voltage [V] /// Complex voltage [V]
Real mVoltageDiffr; Complex mVoltage;
Real mVoltageDiffi;
Real mVoltageAtSourcer; Real mVoltageAtSourcer;
Real mVoltageAtSourcei; Real mVoltageAtSourcei;
...@@ -33,7 +32,7 @@ namespace DPsim { ...@@ -33,7 +32,7 @@ namespace DPsim {
IdealVoltageSource() { ; }; IdealVoltageSource() { ; };
/// define paramenters of the voltage source /// define paramenters of the voltage source
IdealVoltageSource(std::string name, int src, int dest, Real voltage, Real phase, int num); IdealVoltageSource(std::string name, int src, int dest, Complex voltage, int num);
void init(Real om, Real dt) { } void init(Real om, Real dt) { }
......
...@@ -2,16 +2,17 @@ ...@@ -2,16 +2,17 @@
using namespace DPsim; using namespace DPsim;
VoltSourceRes::VoltSourceRes(std::string name, int src, int dest, Real voltage, Real phase, Real resistance) : BaseComponent(name, src, dest) { VoltSourceRes::VoltSourceRes(std::string name, int src, int dest, Complex voltage, Real resistance) : BaseComponent(name, src, dest) {
this->mVoltageDiffr = voltage*cos(phase); this->mVoltage = voltage;
this->mVoltageDiffi = voltage*sin(phase);
this->mResistance = resistance; this->mResistance = resistance;
this->mConductance = 1. / resistance; attrMap["voltage"] = {AttrComplex, &this->mVoltage};
this->mCurrentr = mVoltageDiffr / resistance; attrMap["resistance"] = {AttrReal, &this->mResistance};
this->mCurrenti = mVoltageDiffi / resistance;
} }
void VoltSourceRes::applySystemMatrixStamp(SystemModel& system) { void VoltSourceRes::applySystemMatrixStamp(SystemModel& system) {
mConductance = 1. / mResistance;
mCurrentr = mVoltage.real() / mResistance;
mCurrenti = mVoltage.imag() / mResistance;
// Apply matrix stamp for equivalent resistance // Apply matrix stamp for equivalent resistance
if (mNode1 >= 0) { if (mNode1 >= 0) {
system.addCompToSystemMatrix(mNode1, mNode1, mConductance, 0); system.addCompToSystemMatrix(mNode1, mNode1, mConductance, 0);
......
...@@ -14,10 +14,8 @@ namespace DPsim { ...@@ -14,10 +14,8 @@ namespace DPsim {
protected: protected:
// ### Real Voltage source parameters ### // ### Real Voltage source parameters ###
/// Real part of the voltage [V] /// Complex voltage [V]
Real mVoltageDiffr; Complex mVoltage;
/// Imaginary part of the voltage [V]
Real mVoltageDiffi;
/// Resistance [ohm] /// Resistance [ohm]
Real mResistance; Real mResistance;
...@@ -34,7 +32,7 @@ namespace DPsim { ...@@ -34,7 +32,7 @@ namespace DPsim {
VoltSourceRes() { ; }; VoltSourceRes() { ; };
/// define voltage source paramenters /// define voltage source paramenters
VoltSourceRes(std::string name, int src, int dest, Real voltage, Real phase, Real resistance); VoltSourceRes(std::string name, int src, int dest, Complex voltage, Real resistance);
void init(Real om, Real dt) { } void init(Real om, Real dt) { }
......
...@@ -2,16 +2,13 @@ ...@@ -2,16 +2,13 @@
using namespace DPsim; using namespace DPsim;
VoltSourceResEMT::VoltSourceResEMT(std::string name, int src, int dest, Real voltage, Real phase, Real resistance) : BaseComponent(name, src, dest) { VoltSourceResEMT::VoltSourceResEMT(std::string name, int src, int dest, Complex voltage, Real resistance) : BaseComponent(name, src, dest) {
mVoltageAmp = voltage; mVoltage = voltage;
mVoltagePhase = phase;
mResistance = resistance; mResistance = resistance;
mVoltageDiff = mVoltageAmp*cos(mVoltagePhase);
mConductance = 1. / mResistance;
mCurrent = mVoltageDiff / mResistance;
} }
void VoltSourceResEMT::applySystemMatrixStamp(SystemModel& system) { void VoltSourceResEMT::applySystemMatrixStamp(SystemModel& system) {
mConductance = 1. / mResistance;
// Apply matrix stamp for equivalent resistance // Apply matrix stamp for equivalent resistance
if (mNode1 >= 0) { if (mNode1 >= 0) {
system.addRealToSystemMatrix(mNode1, mNode1, mConductance); system.addRealToSystemMatrix(mNode1, mNode1, mConductance);
...@@ -26,6 +23,7 @@ void VoltSourceResEMT::applySystemMatrixStamp(SystemModel& system) { ...@@ -26,6 +23,7 @@ void VoltSourceResEMT::applySystemMatrixStamp(SystemModel& system) {
} }
void VoltSourceResEMT::applyRightSideVectorStamp(SystemModel& system) { void VoltSourceResEMT::applyRightSideVectorStamp(SystemModel& system) {
mCurrent = mVoltage.real() / mResistance;
// Apply matrix stamp for equivalent current source // Apply matrix stamp for equivalent current source
if (mNode1 >= 0) { if (mNode1 >= 0) {
system.addRealToRightSideVector(mNode1, mCurrent); system.addRealToRightSideVector(mNode1, mCurrent);
...@@ -37,7 +35,7 @@ void VoltSourceResEMT::applyRightSideVectorStamp(SystemModel& system) { ...@@ -37,7 +35,7 @@ void VoltSourceResEMT::applyRightSideVectorStamp(SystemModel& system) {
void VoltSourceResEMT::step(SystemModel& system, Real time) { void VoltSourceResEMT::step(SystemModel& system, Real time) {
mVoltageDiff = mVoltageAmp * cos(mVoltagePhase + system.getOmega() * time); mVoltageDiff = std::abs(mVoltage) * cos(std::arg(mVoltage) + system.getOmega() * time);
mCurrent = mVoltageDiff / mResistance; mCurrent = mVoltageDiff / mResistance;
if (mNode1 >= 0) { if (mNode1 >= 0) {
......
...@@ -7,6 +7,7 @@ namespace DPsim { ...@@ -7,6 +7,7 @@ namespace DPsim {
class VoltSourceResEMT : public BaseComponent { class VoltSourceResEMT : public BaseComponent {
protected: protected:
Complex mVoltage;
Real mVoltageAmp; Real mVoltageAmp;
Real mVoltagePhase; Real mVoltagePhase;
Real mVoltageDiff; Real mVoltageDiff;
...@@ -16,7 +17,7 @@ namespace DPsim { ...@@ -16,7 +17,7 @@ namespace DPsim {
public: public:
VoltSourceResEMT() { ; }; VoltSourceResEMT() { ; };
VoltSourceResEMT(std::string name, int src, int dest, Real voltage, Real phase, Real resistance); VoltSourceResEMT(std::string name, int src, int dest, Complex voltage, Real resistance);
void init(Real om, Real dt) { } void init(Real om, Real dt) { }
void applySystemMatrixStamp(SystemModel& system); void applySystemMatrixStamp(SystemModel& system);
......
...@@ -18,7 +18,7 @@ void DPsim::simulationExample1() ...@@ -18,7 +18,7 @@ void DPsim::simulationExample1()
rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv"); rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv");
std::vector<BaseComponent*> circElements0; std::vector<BaseComponent*> circElements0;
circElements0.push_back(new VoltSourceRes("v_in", 1, 0, 10, 0, 1)); circElements0.push_back(new VoltSourceRes("v_in", 1, 0, Complex(10, 0), 1));
circElements0.push_back(new Inductor("l_1", 1, 2, 0.02)); circElements0.push_back(new Inductor("l_1", 1, 2, 0.02));
circElements0.push_back(new Inductor("l_2", 2, 0, 0.1)); circElements0.push_back(new Inductor("l_2", 2, 0, 0.1));
circElements0.push_back(new Inductor("l_3", 2, 3, 0.05)); circElements0.push_back(new Inductor("l_3", 2, 3, 0.05));
...@@ -58,7 +58,7 @@ void DPsim::simulationExample1L2() ...@@ -58,7 +58,7 @@ void DPsim::simulationExample1L2()
rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv"); rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv");
std::vector<BaseComponent*> circElements0; std::vector<BaseComponent*> circElements0;
circElements0.push_back(new VoltSourceRes("v_in", 1, 0, 10, 0, 1)); circElements0.push_back(new VoltSourceRes("v_in", 1, 0, Complex(10, 0), 1));
circElements0.push_back(new Inductor("l_1", 1, 2, 0.02)); circElements0.push_back(new Inductor("l_1", 1, 2, 0.02));
circElements0.push_back(new Inductor("l_2", 2, 0, 0.1)); circElements0.push_back(new Inductor("l_2", 2, 0, 0.1));
circElements0.push_back(new Inductor("l_3", 2, 3, 0.05)); circElements0.push_back(new Inductor("l_3", 2, 3, 0.05));
...@@ -98,7 +98,7 @@ void DPsim::simulationExample2() ...@@ -98,7 +98,7 @@ void DPsim::simulationExample2()
rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv"); rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv");
std::vector<BaseComponent*> circElements0; std::vector<BaseComponent*> circElements0;
circElements0.push_back(new VoltSourceRes("v_in", 1, 0, 10, 0, 1)); circElements0.push_back(new VoltSourceRes("v_in", 1, 0, Complex(10, 0), 1));
circElements0.push_back(new Inductor("l_1", 1, 2, 0.02)); circElements0.push_back(new Inductor("l_1", 1, 2, 0.02));
circElements0.push_back(new Inductor("l_2", 2, 0, 0.1)); circElements0.push_back(new Inductor("l_2", 2, 0, 0.1));
...@@ -136,7 +136,7 @@ void DPsim::simulationExample3() ...@@ -136,7 +136,7 @@ void DPsim::simulationExample3()
rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv"); rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv");
std::vector<BaseComponent*> circElements0; std::vector<BaseComponent*> circElements0;
circElements0.push_back(new VoltSourceRes("v_in", 1, 0, 10, 0, 1)); circElements0.push_back(new VoltSourceRes("v_in", 1, 0, Complex(10, 0), 1));
circElements0.push_back(new Capacitor("c_1", 1, 2, 0.001)); circElements0.push_back(new Capacitor("c_1", 1, 2, 0.001));
circElements0.push_back(new Inductor("l_1", 2, 0, 0.001)); circElements0.push_back(new Inductor("l_1", 2, 0, 0.001));
circElements0.push_back(new LinearResistor("r_2", 2, 0, 1)); circElements0.push_back(new LinearResistor("r_2", 2, 0, 1));
...@@ -175,7 +175,7 @@ void DPsim::simulationExampleIdealVS() ...@@ -175,7 +175,7 @@ void DPsim::simulationExampleIdealVS()
rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv"); rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv");
std::vector<BaseComponent*> circElements0; std::vector<BaseComponent*> circElements0;
circElements0.push_back(new IdealVoltageSource("v_in", 1, 2, 10, 0, 1)); circElements0.push_back(new IdealVoltageSource("v_in", 1, 2, Complex(10, 0), 1));
circElements0.push_back(new LinearResistor("r_1", 1, 0, 1)); circElements0.push_back(new LinearResistor("r_1", 1, 0, 1));
circElements0.push_back(new LinearResistor("r_2", 2, 0, 1)); circElements0.push_back(new LinearResistor("r_2", 2, 0, 1));
circElements0.push_back(new LinearResistor("r_3", 2, 0, 1)); circElements0.push_back(new LinearResistor("r_3", 2, 0, 1));
...@@ -214,7 +214,7 @@ void DPsim::simulationExampleIdealVS2() ...@@ -214,7 +214,7 @@ void DPsim::simulationExampleIdealVS2()
rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv"); rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv");
std::vector<BaseComponent*> circElements0; std::vector<BaseComponent*> circElements0;
circElements0.push_back(new IdealVoltageSource("v_in", 1, 0, 10, 0, 1)); circElements0.push_back(new IdealVoltageSource("v_in", 1, 0, Complex(10, 0), 1));
circElements0.push_back(new LinearResistor("r_1", 1, 2, 1)); circElements0.push_back(new LinearResistor("r_1", 1, 2, 1));
circElements0.push_back(new Capacitor("c_1", 2, 3, 0.001)); circElements0.push_back(new Capacitor("c_1", 2, 3, 0.001));
circElements0.push_back(new Inductor("l_1", 3, 0, 0.001)); circElements0.push_back(new Inductor("l_1", 3, 0, 0.001));
...@@ -255,13 +255,13 @@ void DPsim::simulationExampleIdealVS3() ...@@ -255,13 +255,13 @@ void DPsim::simulationExampleIdealVS3()
rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv"); rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv");
std::vector<BaseComponent*> circElements0; std::vector<BaseComponent*> circElements0;
circElements0.push_back(new IdealVoltageSource("v_1", 1, 0, 10, 0, 1)); circElements0.push_back(new IdealVoltageSource("v_1", 1, 0, Complex(10, 0), 1));
circElements0.push_back(new LinearResistor("r_1", 1, 2, 1)); circElements0.push_back(new LinearResistor("r_1", 1, 2, 1));
circElements0.push_back(new LinearResistor("r_2", 2, 0, 1)); circElements0.push_back(new LinearResistor("r_2", 2, 0, 1));
circElements0.push_back(new LinearResistor("r_3", 2, 3, 1)); circElements0.push_back(new LinearResistor("r_3", 2, 3, 1));
circElements0.push_back(new LinearResistor("r_4", 3, 0, 1)); circElements0.push_back(new LinearResistor("r_4", 3, 0, 1));
circElements0.push_back(new LinearResistor("r_5", 3, 4, 1)); circElements0.push_back(new LinearResistor("r_5", 3, 4, 1));
circElements0.push_back(new IdealVoltageSource("v_2", 4, 0, 20, 0, 2)); circElements0.push_back(new IdealVoltageSource("v_2", 4, 0, Complex(20, 0), 2));
...@@ -300,7 +300,7 @@ void DPsim::simulationExampleRXLine() ...@@ -300,7 +300,7 @@ void DPsim::simulationExampleRXLine()
rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv"); rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv");
std::vector<BaseComponent*> circElements0; std::vector<BaseComponent*> circElements0;
circElements0.push_back(new IdealVoltageSource("v_1", 1, 0, 10, 0, 1)); circElements0.push_back(new IdealVoltageSource("v_1", 1, 0, Complex(10, 0), 1));
circElements0.push_back(new RxLine("Line_1", 1, 2, 3, 0.1, 0.001)); circElements0.push_back(new RxLine("Line_1", 1, 2, 3, 0.1, 0.001));
circElements0.push_back(new LinearResistor("r_1", 2, 0, 20)); circElements0.push_back(new LinearResistor("r_1", 2, 0, 20));
...@@ -339,7 +339,7 @@ void DPsim::simulationExampleRXLine2() ...@@ -339,7 +339,7 @@ void DPsim::simulationExampleRXLine2()
rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv"); rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv");
std::vector<BaseComponent*> circElements0; std::vector<BaseComponent*> circElements0;
circElements0.push_back(new IdealVoltageSource("v_1", 1, 0, 10, 0, 1)); circElements0.push_back(new IdealVoltageSource("v_1", 1, 0, Complex(10, 0), 1));
circElements0.push_back(new Inductor("l_L", 2, 3, 0.001)); circElements0.push_back(new Inductor("l_L", 2, 3, 0.001));
circElements0.push_back(new LinearResistor("r_L", 1, 2, 0.1)); circElements0.push_back(new LinearResistor("r_L", 1, 2, 0.1));
...@@ -380,7 +380,7 @@ void DPsim::simulationExampleRXLine3() ...@@ -380,7 +380,7 @@ void DPsim::simulationExampleRXLine3()
rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv"); rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv");
std::vector<BaseComponent*> circElements0; std::vector<BaseComponent*> circElements0;
circElements0.push_back(new IdealVoltageSource("v_1", 1, 0, 10, 0, 1)); circElements0.push_back(new IdealVoltageSource("v_1", 1, 0, Complex(10, 0), 1));
circElements0.push_back(new RxLine("Line_1", 1, 2, 0.1, 0.001)); circElements0.push_back(new RxLine("Line_1", 1, 2, 0.1, 0.001));
circElements0.push_back(new LinearResistor("r_1", 2, 0, 20)); circElements0.push_back(new LinearResistor("r_1", 2, 0, 20));
...@@ -419,7 +419,7 @@ void DPsim::simulationExamplePiLine() ...@@ -419,7 +419,7 @@ void DPsim::simulationExamplePiLine()
rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv"); rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv");
std::vector<BaseComponent*> circElements0; std::vector<BaseComponent*> circElements0;
circElements0.push_back(new IdealVoltageSource("v_1", 1, 0, 345, 0, 1)); circElements0.push_back(new IdealVoltageSource("v_1", 1, 0, Complex(345, 0), 1));
circElements0.push_back(new LinearResistor("r1", 1, 2, 5)); circElements0.push_back(new LinearResistor("r1", 1, 2, 5));
circElements0.push_back(new PiLine("PiLine1", 2, 3, 4, 6.4, 0.186, 0.004)); circElements0.push_back(new PiLine("PiLine1", 2, 3, 4, 6.4, 0.186, 0.004));
circElements0.push_back(new LinearResistor("r_load", 3, 0, 150)); circElements0.push_back(new LinearResistor("r_load", 3, 0, 150));
...@@ -460,7 +460,7 @@ void DPsim::simulationExamplePiLine2() ...@@ -460,7 +460,7 @@ void DPsim::simulationExamplePiLine2()
rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv"); rightVectorLog("Logs/RightVectorLog_" + fileName.str() + ".csv");
std::vector<BaseComponent*> circElements0; std::vector<BaseComponent*> circElements0;
circElements0.push_back(new IdealVoltageSource("v_1", 1, 0, 345, 0, 1)); circElements0.push_back(new IdealVoltageSource("v_1", 1, 0, Complex(345, 0), 1));
circElements0.push_back(new LinearResistor("r1", 1, 2, 5)); circElements0.push_back(new LinearResistor("r1", 1, 2, 5));
circElements0