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);
34
35 std::shared_ptr<EMT::SimNode> mNode1, mNode2;
36 std::shared_ptr<EMT::Ph3::Resistor> mRes1, mRes2;
37 std::shared_ptr<EMT::Ph3::ControlledCurrentSource> mSrc1, mSrc2;
39
40 // Ringbuffers for the values of previous timesteps
41 // TODO make these matrix attributes
46
47 Eigen::Matrix<Real, 3, 1> interpolate(const Matrix &data) const;
48
49public:
50 typedef std::shared_ptr<DecouplingLineEMT_Ph3> Ptr;
51
54
57
59 Logger::Level logLevel = Logger::Level::info);
60
62 Matrix resistance, Matrix inductance, Matrix capacitance);
63 void initialize(Real omega, Real timeStep);
64 void step(Real time, Int timeStepCount);
65 void postStep();
68
69 class PreStep : public Task {
70 public:
72 : Task(**line.mName + ".MnaPreStep"), mLine(line) {
73 mPrevStepDependencies.push_back(mLine.mStates);
74 mModifiedAttributes.push_back(mLine.mSrc1->mCurrentRef);
75 mModifiedAttributes.push_back(mLine.mSrc2->mCurrentRef);
76 }
77
78 void execute(Real time, Int timeStepCount);
79
80 private:
82 };
83
84 class PostStep : public Task {
85 public:
87 : Task(**line.mName + ".PostStep"), mLine(line) {
88 mAttributeDependencies.push_back(mLine.mRes1->mIntfVoltage);
89 mAttributeDependencies.push_back(mLine.mRes1->mIntfCurrent);
90 mAttributeDependencies.push_back(mLine.mRes2->mIntfVoltage);
91 mAttributeDependencies.push_back(mLine.mRes2->mIntfCurrent);
92 mModifiedAttributes.push_back(mLine.mStates);
93 }
94
95 void execute(Real time, Int timeStepCount);
96
97 private:
99 };
100};
101} // namespace Signal
102} // namespace CPS
AttributePointer< Attribute< T > > Ptr
Definition Attribute.h:249
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
Eigen::Matrix< Real, 3, 1 > interpolate(const Matrix &data) const
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:34
SimSignalComp(String uid, String name, Logger::Level logLevel=Logger::Level::off)
std::vector< AttributeBase::Ptr > mModifiedAttributes
Definition Task.h:70
std::vector< AttributeBase::Ptr > mPrevStepDependencies
Definition Task.h:71
std::vector< AttributeBase::Ptr > mAttributeDependencies
Definition Task.h:69
Task()
Definition Task.h:30
std::vector< Ptr > List
Definition Task.h:28
std::string mName
Definition Task.h:68
struct dps_magma_data data
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
Definition Definitions.h:79
std::string String
Definition Definitions.h:63
double Real
Definition Definitions.h:60
int Int
Definition Definitions.h:59
unsigned int UInt
Definition Definitions.h:58