Commit a17da899 authored by Markus Mirz's avatar Markus Mirz
Browse files

fixed errors after merge

parent 8733d403
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
#include <CIMModel.hpp> #include <CIMModel.hpp>
#include <IEC61970.hpp> #include <IEC61970.hpp>
#include "../Definitions.h"
#include "CIM/Reader.h" #include "Reader.h"
#include "Components.h" #include "Components.h"
using namespace DPsim; using namespace DPsim;
...@@ -103,7 +103,7 @@ ElementPtr Reader::mapACLineSegment(ACLineSegment* line) { ...@@ -103,7 +103,7 @@ ElementPtr Reader::mapACLineSegment(ACLineSegment* line) {
mLogger->Log(LogLevel::INFO) << "Create RxLine " << line->name << " node1=" << nodes[0] << " node2=" << nodes[1] mLogger->Log(LogLevel::INFO) << "Create RxLine " << line->name << " node1=" << nodes[0] << " node2=" << nodes[1]
<< " R=" << r << " X=" << x << std::endl; << " R=" << r << " X=" << x << std::endl;
return make_shared<RxLineDP>(line->name, nodes[0], nodes[1], r, x/mFrequency); return std::make_shared<RxLineDP>(line->name, nodes[0], nodes[1], r, x/mFrequency);
} }
void Reader::mapAsynchronousMachine(AsynchronousMachine* machine) { void Reader::mapAsynchronousMachine(AsynchronousMachine* machine) {
...@@ -136,7 +136,7 @@ ElementPtr Reader::mapExternalNetworkInjection(ExternalNetworkInjection* inj) { ...@@ -136,7 +136,7 @@ ElementPtr Reader::mapExternalNetworkInjection(ExternalNetworkInjection* inj) {
mLogger->Log(LogLevel::INFO) << "IdealVoltageSource " << inj->name << " rid=" << inj->mRID << " node1=" << node mLogger->Log(LogLevel::INFO) << "IdealVoltageSource " << inj->name << " rid=" << inj->mRID << " node1=" << node
<< " V=" << voltAbs << "<" << voltPhase << std::endl; << " V=" << voltAbs << "<" << voltPhase << std::endl;
return make_shared<IdealVoltageSource>(inj->name, node, 0, initVoltage); return std::make_shared<IdealVoltageSource>(inj->name, node, 0, initVoltage);
} }
ElementPtr Reader::mapPowerTransformer(PowerTransformer* trans) { ElementPtr Reader::mapPowerTransformer(PowerTransformer* trans) {
...@@ -208,7 +208,7 @@ ElementPtr Reader::mapSynchronousMachine(SynchronousMachine* machine) { ...@@ -208,7 +208,7 @@ ElementPtr Reader::mapSynchronousMachine(SynchronousMachine* machine) {
// TODO is it appropiate to use this resistance here // TODO is it appropiate to use this resistance here
mLogger->Log(LogLevel::INFO) << "Create IdealVoltageSource " << machine->name << " node=" << node mLogger->Log(LogLevel::INFO) << "Create IdealVoltageSource " << machine->name << " node=" << node
<< " V=" << voltAbs << "<" << voltPhase << std::endl; << " V=" << voltAbs << "<" << voltPhase << std::endl;
return make_shared<IdealVoltageSource>(machine->name, node, 0, initVoltage); return std::make_shared<IdealVoltageSource>(machine->name, node, 0, initVoltage);
} }
ElementPtr Reader::mapComponent(BaseClass* obj) { ElementPtr Reader::mapComponent(BaseClass* obj) {
......
...@@ -36,7 +36,7 @@ void IdealTransformerDP::applySystemMatrixStamp(SystemModel& system) { ...@@ -36,7 +36,7 @@ void IdealTransformerDP::applySystemMatrixStamp(SystemModel& system) {
system.setCompSystemMatrixElement(mVirtualNodes[0], mNode1, 1.0, 0); system.setCompSystemMatrixElement(mVirtualNodes[0], mNode1, 1.0, 0);
} }
if (mNode2 >= 0) { if (mNode2 >= 0) {
system.setCompSystemMatrixElement(mNode2, mVirtualNodes[0], mRatio.real, mRatio.imag); system.setCompSystemMatrixElement(mNode2, mVirtualNodes[0], mRatio.real(), mRatio.imag());
system.setCompSystemMatrixElement(mVirtualNodes[0], mNode2, -mRatio.real, -mRatio.imag); system.setCompSystemMatrixElement(mVirtualNodes[0], mNode2, -mRatio.real(), -mRatio.imag());
} }
} }
...@@ -38,17 +38,11 @@ TransformerDP::TransformerDP(String name, Int node1, Int node2, Real ratioAbs, R ...@@ -38,17 +38,11 @@ TransformerDP::TransformerDP(String name, Int node1, Int node2, Real ratioAbs, R
} }
} }
// TODO: implement RX losses
void TransformerDP::init(Real om, Real dt) { void TransformerDP::init(Real om, Real dt) {
Real abs = mActivePower*mActivePower + mReactivePower*mReactivePower; mInductor = std::make_shared<InductorDP>(mName + "_ind", mNode1, mNode2, mInductance);
mResistance = mSvVoltage*mSvVoltage*mActivePower / abs; mInductor->init(om, dt);
mConductance = 1.0 / mResistance;
mReactance = mSvVoltage*mSvVoltage*mReactivePower / abs;
mInductance = mReactance / om;
inductor = std::make_shared<InductorDP>(mName + "_ind", mNode1, mNode2, mInductance);
resistor = std::make_shared<ResistorDP>(mName + "_res", mNode1, mNode2, mResistance);
inductor->init(om, dt);
resistor->init(om, dt);
} }
void TransformerDP::applySystemMatrixStamp(SystemModel& system) { void TransformerDP::applySystemMatrixStamp(SystemModel& system) {
...@@ -57,12 +51,12 @@ void TransformerDP::applySystemMatrixStamp(SystemModel& system) { ...@@ -57,12 +51,12 @@ void TransformerDP::applySystemMatrixStamp(SystemModel& system) {
system.setCompSystemMatrixElement(mVirtualNodes[0], mNode1, 1.0, 0); system.setCompSystemMatrixElement(mVirtualNodes[0], mNode1, 1.0, 0);
} }
if (mNode2 >= 0) { if (mNode2 >= 0) {
system.setCompSystemMatrixElement(mNode2, mVirtualNodes[0], mRatioRe, mRatioIm); system.setCompSystemMatrixElement(mNode2, mVirtualNodes[0], mRatio.real(), mRatio.imag());
system.setCompSystemMatrixElement(mVirtualNodes[0], mNode2, -mRatioRe, -mRatioIm); system.setCompSystemMatrixElement(mVirtualNodes[0], mNode2, -mRatio.real(), -mRatio.imag());
} }
if (mNumVirtualNodes == 2) { if (mNumVirtualNodes == 2) {
// Add inductive part to system matrix // Add inductive part to system matrix
inductor->applySystemMatrixStamp(system); mInductor->applySystemMatrixStamp(system);
} }
} }
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