DPsim
Loading...
Searching...
No Matches
EMT_Ph3_AvVoltSourceInverterStateSpace.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Institute for Automation of Complex Power Systems, EONERC, RWTH Aachen University
2// SPDX-License-Identifier: MPL-2.0
3
4#pragma once
5
6#include <array>
7#include <vector>
8
10
11namespace CPS {
12namespace EMT {
13namespace Ph3 {
14
17 public SharedFactory<AvVoltSourceInverterStateSpace> {
18private:
19 static constexpr Int mStateSize = 14;
20
21 enum StateIndex : Int {
22 ThetaPLL = 0,
23 PhiPLL = 1,
24 PFiltered = 2,
25 QFiltered = 3,
26 PhiD = 4,
27 PhiQ = 5,
28 GammaD = 6,
29 GammaQ = 7,
30 VcA = 8,
31 VcB = 9,
32 VcC = 10,
33 IfA = 11,
34 IfB = 12,
35 IfC = 13
36 };
37
38 Real mLf;
39 Real mCf;
40 Real mRf;
41 Real mRc;
42
43 Real mOmegaN;
44 Real mKpPLL;
45 Real mKiPLL;
46
47 Real mOmegaCutoff;
48 Real mPRef;
49 Real mQRef;
50 Real mKpPowerCtrl;
51 Real mKiPowerCtrl;
52 Real mKpCurrCtrl;
53 Real mKiCurrCtrl;
54
55 const Attribute<Real>::Ptr mVcD;
56 const Attribute<Real>::Ptr mVcQ;
57 const Attribute<Real>::Ptr mIrcD;
58 const Attribute<Real>::Ptr mIrcQ;
59 const Attribute<Real>::Ptr mPInst;
60 const Attribute<Real>::Ptr mQInst;
61 const Attribute<Real>::Ptr mOmegaPLL;
62
63 Matrix getParkTransformMatrix(Real theta) const;
64 Matrix getInverseParkTransformMatrix(Real theta) const;
65 void buildStateSpaceModel(const Matrix &x, const Matrix &u, Matrix &A,
66 Matrix &B, Matrix &C, Matrix &D, Matrix &E,
67 Matrix &F) const;
68
69protected:
70 Bool updateComponentParameters() override final;
71 void updateLogAttributes(const Matrix &u) const override final;
72
73public:
75
77 Logger::Level logLevel = Logger::Level::off);
79 Logger::Level logLevel = Logger::Level::off)
81
82 std::vector<String> getLocalStateNames() const override final;
83
84 std::vector<SSNComp::LocalAbcStateBlock>
85 getLocalAbcStateBlocks() const override final;
86
87 void setParameters(Real lf, Real cf, Real rf, Real rc, Real omegaN,
88 Real kpPLL, Real kiPLL, Real omegaCutoff, Real pRef,
89 Real qRef, Real kpPowerCtrl, Real kiPowerCtrl,
90 Real kpCurrCtrl, Real kiCurrCtrl);
91
92 void initializeFromNodesAndTerminals(Real frequency) override final;
93};
94
95} // namespace Ph3
96} // namespace EMT
97} // namespace CPS
AttributePointer< Attribute< T > > Ptr
Definition Attribute.h:250
void setParameters(Real lf, Real cf, Real rf, Real rc, Real omegaN, Real kpPLL, Real kiPLL, Real omegaCutoff, Real pRef, Real qRef, Real kpPowerCtrl, Real kiPowerCtrl, Real kpCurrCtrl, Real kiCurrCtrl)
AvVoltSourceInverterStateSpace(String name, Logger::Level logLevel=Logger::Level::off)
std::vector< SSNComp::LocalAbcStateBlock > getLocalAbcStateBlocks() const override final
std::vector< String > getLocalStateNames() const override final
AvVoltSourceInverterStateSpace(String uid, String name, Logger::Level logLevel=Logger::Level::off)
void initializeFromNodesAndTerminals(Real frequency) override final
Initializes Component variables according to power flow data stored in Nodes.
void updateLogAttributes(const Matrix &u) const override final
Update derived attributes used for logging/inspection.
TwoTerminalVTypeVariableSSNComp(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Abstract base class for EMT state-space nodal (SSN) components.
Definition EMT_SSNComp.h:24
String uid()
Returns unique id.
spdlog::level::level_enum Level
Definition Logger.h:33
static std::shared_ptr< AvVoltSourceInverterStateSpace > make(Args &&...args)
Definition PtrFactory.h:19
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
bool Bool
Definition Definitions.h:64