DPsim
Loading...
Searching...
No Matches
EMT_Ph3_PiLine.h
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
11#include <dpsim-models/Base/Base_Ph3_PiLine.h>
12#include <dpsim-models/CompositePowerComp.h>
13#include <dpsim-models/EMT/EMT_Ph3_Capacitor.h>
14#include <dpsim-models/EMT/EMT_Ph3_Inductor.h>
15#include <dpsim-models/EMT/EMT_Ph3_Resistor.h>
16#include <dpsim-models/Solver/MNATearInterface.h>
17
18namespace CPS {
19namespace EMT {
20namespace Ph3 {
25class PiLine : public CompositePowerComp<Real>,
26 public MNATearInterface,
27 public Base::Ph3::PiLine,
28 public SharedFactory<PiLine> {
29protected:
32 std::shared_ptr<Inductor> mSubSeriesInductor;
34 std::shared_ptr<Resistor> mSubSeriesResistor;
36 std::shared_ptr<Resistor> mSubParallelResistor0;
37 // Parallel Capacitor submodel at Terminal 0
38 std::shared_ptr<Capacitor> mSubParallelCapacitor0;
40 std::shared_ptr<Resistor> mSubParallelResistor1;
41 // Parallel capacitor submodel at Terminal 1
42 std::shared_ptr<Capacitor> mSubParallelCapacitor1;
44 std::vector<const Matrix *> mRightVectorStamps;
45
46public:
48 PiLine(String uid, String name, Logger::Level logLevel = Logger::Level::off);
50 PiLine(String name, Logger::Level logLevel = Logger::Level::off)
51 : PiLine(name, name, logLevel) {}
52
53 SimPowerComp<Real>::Ptr clone(String copySuffix) override;
54
55 // #### General ####
57 void createSubComponents() override;
59 void initializeParentFromNodesAndTerminals(Real frequency) override;
60
61 // #### MNA section ####
63 void mnaCompUpdateCurrent(const Matrix &leftVector) override;
65 void mnaCompUpdateVoltage(const Matrix &leftVector) override;
67 void mnaParentPreStep(Real time, Int timeStepCount) override;
69 void mnaParentPostStep(Real time, Int timeStepCount,
70 Attribute<Matrix>::Ptr &leftVector) override;
73 AttributeBase::List &prevStepDependencies,
74 AttributeBase::List &attributeDependencies,
75 AttributeBase::List &modifiedAttributes) override;
77 void
78 mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
79 AttributeBase::List &attributeDependencies,
80 AttributeBase::List &modifiedAttributes,
81 Attribute<Matrix>::Ptr &leftVector) override;
82
83 MNAInterface::List mnaTearGroundComponents() override;
84 void mnaTearInitialize(Real omega, Real timeStep) override;
85 void mnaTearApplyMatrixStamp(SparseMatrixRow &tearMatrix) override;
86 void mnaTearApplyVoltageStamp(Matrix &voltageVector) override;
87 void mnaTearPostStep(MatrixComp voltage, MatrixComp current) override;
88};
89} // namespace Ph3
90} // namespace EMT
91} // namespace CPS
CompositePowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
PiLine(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and logging level.
SimPowerComp< Real >::Ptr clone(String copySuffix) override
DEPRECATED: Delete method.
void mnaParentPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
MNA post step operations.
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Updates internal voltage variable of the component.
std::shared_ptr< Resistor > mSubParallelResistor0
Parallel Resistor submodel at Terminal 0.
void mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
void initializeParentFromNodesAndTerminals(Real frequency) override
Derives values from power flow data and pushes them to subcomponents.
PiLine(String name, Logger::Level logLevel=Logger::Level::off)
Defines name and logging level.
void mnaCompUpdateCurrent(const Matrix &leftVector) override
Updates internal current variable of the component.
void mnaParentPreStep(Real time, Int timeStepCount) override
MNA pre step operations.
std::shared_ptr< Inductor > mSubSeriesInductor
std::shared_ptr< Resistor > mSubSeriesResistor
Series Resistor submodel.
void createSubComponents() override
Constructs and registers MNA subcomponents; idempotent.
std::vector< const Matrix * > mRightVectorStamps
solver
void mnaParentAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
Add MNA pre step dependencies.
std::shared_ptr< Resistor > mSubParallelResistor1
Parallel resistor submodel at Terminal 1.
String uid()
Returns unique id.