DPsim
Loading...
Searching...
No Matches
DecouplingLineEMT_Ph3.h
Go to the documentation of this file.
1/* Copyright 2017-2021 Institute for Automation of Complex Power Systems,
2 * EONERC, RWTH Aachen University
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
7 *********************************************************************************/
8
9#pragma once
10
13#include <vector>
14
17#include <dpsim-models/Task.h>
18
19namespace CPS {
20namespace Signal {
22 public SharedFactory<DecouplingLineEMT_Ph3> {
23protected:
25 Matrix mResistance = Matrix::Zero(3, 3);
26 Matrix mInductance = Matrix::Zero(3, 3);
27 Matrix mCapacitance = Matrix::Zero(3, 3);
29
30 std::shared_ptr<EMT::SimNode> mNode1, mNode2;
31 std::shared_ptr<EMT::Ph3::Resistor> mRes1, mRes2;
32 std::shared_ptr<EMT::Ph3::ControlledCurrentSource> mSrc1, mSrc2;
34
35 // Ringbuffers for the values of previous timesteps
36 // TODO make these matrix attributes
41
43
44public:
45 typedef std::shared_ptr<DecouplingLineEMT_Ph3> Ptr;
46
49
52
54 Logger::Level logLevel = Logger::Level::info);
55
57 Matrix resistance, Matrix inductance, Matrix capacitance);
58 void initialize(Real omega, Real timeStep);
59 void step(Real time, Int timeStepCount);
60 void postStep();
63
64 class PreStep : public Task {
65 public:
67 : Task(**line.mName + ".MnaPreStep"), mLine(line) {
68 mPrevStepDependencies.push_back(mLine.mStates);
69 mModifiedAttributes.push_back(mLine.mSrc1->mCurrentRef);
70 mModifiedAttributes.push_back(mLine.mSrc2->mCurrentRef);
71 }
72
73 void execute(Real time, Int timeStepCount);
74
75 private:
77 };
78
79 class PostStep : public Task {
80 public:
82 : Task(**line.mName + ".PostStep"), mLine(line) {
83 mAttributeDependencies.push_back(mLine.mRes1->mIntfVoltage);
84 mAttributeDependencies.push_back(mLine.mRes1->mIntfCurrent);
85 mAttributeDependencies.push_back(mLine.mRes2->mIntfVoltage);
86 mAttributeDependencies.push_back(mLine.mRes2->mIntfCurrent);
87 mModifiedAttributes.push_back(mLine.mStates);
88 }
89
90 void execute(Real time, Int timeStepCount);
91
92 private:
94 };
95};
96} // namespace Signal
97} // namespace CPS
AttributePointer< Attribute< T > > Ptr
Definition Attribute.h:250
std::vector< Ptr > List
spdlog::level::level_enum Level
Definition Logger.h:33
void execute(Real time, Int timeStepCount)
PostStep(DecouplingLineEMT_Ph3 &line)
std::shared_ptr< EMT::Ph3::ControlledCurrentSource > mSrc2
std::shared_ptr< DecouplingLineEMT_Ph3 > Ptr
void setParameters(SimNode< Real >::Ptr node1, SimNode< Real >::Ptr node2, Matrix resistance, Matrix inductance, Matrix capacitance)
void initialize(Real omega, Real timeStep)
void step(Real time, Int timeStepCount)
std::shared_ptr< EMT::Ph3::Resistor > mRes1
std::shared_ptr< EMT::Ph3::ControlledCurrentSource > mSrc1
const Attribute< Matrix >::Ptr mSrcCur2Ref
std::shared_ptr< EMT::SimNode > mNode2
std::shared_ptr< EMT::SimNode > mNode1
std::shared_ptr< EMT::Ph3::Resistor > mRes2
DecouplingLineEMT_Ph3(String name, Logger::Level logLevel=Logger::Level::info)
const Attribute< Matrix >::Ptr mSrcCur1Ref
const Attribute< Matrix >::Ptr mStates
FIXME: workaround for dependency analysis as long as the states aren't attributes.
std::shared_ptr< SimNode< VarType > > Ptr
Definition SimNode.h:32
SimSignalComp(String uid, String name, Logger::Level logLevel=Logger::Level::off)
std::vector< AttributeBase::Ptr > mModifiedAttributes
Definition Task.h:53
std::vector< AttributeBase::Ptr > mPrevStepDependencies
Definition Task.h:54
std::vector< AttributeBase::Ptr > mAttributeDependencies
Definition Task.h:52
Task()
Definition Task.h:30
std::vector< Ptr > List
Definition Task.h:28
std::string mName
Definition Task.h:51
struct dps_magma_data data
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
Definition Definitions.h:81
std::string String
Definition Definitions.h:65
double Real
Definition Definitions.h:62
int Int
Definition Definitions.h:61
unsigned int UInt
Definition Definitions.h:60