DPsim
Loading...
Searching...
No Matches
EMT_Ph3_SSN_PiLine.cpp
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
6
7using namespace CPS;
8
12
14 auto copy = SharedFactory<PiLine>::make(copySuffix, mLogLevel);
15 copy->setParameters(**mSeriesRes, **mSeriesInd, **mParallelCap,
17 return copy;
18}
19
20void EMT::Ph3::SSN::PiLine::setParameters(const Matrix &seriesResistance,
21 const Matrix &seriesInductance,
22 const Matrix &parallelCapacitance,
23 const Matrix &parallelConductance) {
24 for (const Matrix *parameter : {&seriesResistance, &seriesInductance,
25 &parallelCapacitance, &parallelConductance}) {
26 if (parameter->rows() != 3 || parameter->cols() != 3)
27 throw std::invalid_argument("PiLine parameter matrices must be 3 x 3.");
28 }
29 Base::Ph3::PiLine::setParameters(seriesResistance, seriesInductance,
30 parallelCapacitance, parallelConductance);
31
32 const Matrix inverseInductance = seriesInductance.inverse();
33 const Matrix identity = Matrix::Identity(3, 3);
34 Matrix a = -inverseInductance * seriesResistance;
35 Matrix b = Matrix::Zero(3, 6);
36 b.block(0, 0, 3, 3) = -inverseInductance;
37 b.block(0, 3, 3, 3) = inverseInductance;
38 Matrix c = Matrix::Zero(6, 3);
39 c.block(0, 0, 3, 3) = -identity;
40 c.block(3, 0, 3, 3) = identity;
41 Matrix d = Matrix::Zero(6, 6);
42 d.block(0, 0, 3, 3) = parallelConductance / 2.;
43 d.block(3, 3, 3, 3) = parallelConductance / 2.;
44 Matrix d1 = Matrix::Zero(6, 6);
45 d1.block(0, 0, 3, 3) = parallelCapacitance / 2.;
46 d1.block(3, 3, 3, 3) = parallelCapacitance / 2.;
47
48 SSNComp::setParameters(a, b, c, d, d1);
49}
50
52 if ((**mParallelCond)(0, 0) <= 0.) {
53 **mParallelCond = Matrix::Zero(3, 3);
54 (**mParallelCond).diagonal().setConstant(1e-6);
56 }
58}
const Attribute< Matrix >::Ptr mParallelCond
Conductance in parallel to the line [S].
const Attribute< Matrix >::Ptr mSeriesRes
Resistance along the line [ohms].
const Attribute< Matrix >::Ptr mSeriesInd
Inductance along the line [H].
void setParameters(Matrix seriesResistance, Matrix seriesInductance, Matrix parallelCapacitance=Matrix::Zero(3, 3), Matrix parallelConductance=Matrix::Zero(3, 3)) const
const Attribute< Matrix >::Ptr mParallelCap
Capacitance in parallel to the line [F].
MultiPortVTypeSSNComp(String uid, String name, Logger::Level logLevel=Logger::Level::off)
void initializeFromNodesAndTerminals(Real frequency) override
Initializes Component variables according to power flow data stored in Nodes.
PiLine(String uid, String name, Logger::Level logLevel=Logger::Level::off)
SimPowerComp< Real >::Ptr clone(String copySuffix) override
Returns a modified copy of the component with the given suffix added to the name and without.
void setParameters(const Matrix &seriesResistance, const Matrix &seriesInductance, const Matrix &parallelCapacitance=Matrix::Zero(3, 3), const Matrix &parallelConductance=Matrix::Zero(3, 3))
void setParameters(const Matrix &A, const Matrix &B, const Matrix &C, const Matrix &D, const Matrix &D1=Matrix())
void initializeFromNodesAndTerminals(Real frequency) override
Initializes Component variables according to power flow data stored in Nodes.
String uid()
Returns unique id.
AttributeList::Ptr mAttributes
Attribute List.
spdlog::level::level_enum Level
Definition Logger.h:33
std::shared_ptr< SimPowerComp< VarType > > Ptr
Logger::Level mLogLevel
Component logger control for internal variables.
static std::shared_ptr< T > 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:79
std::string String
Definition Definitions.h:63
double Real
Definition Definitions.h:60