DPsim
EMT_Ph3_Transformer.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_Transformer.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/MNAInterface.h>
17 
18 namespace CPS {
19 namespace EMT {
20 namespace Ph3 {
22 class Transformer : public CompositePowerComp<Real>,
23  public SharedFactory<Transformer>,
24  public Base::Ph3::Transformer {
25 private:
27  std::shared_ptr<EMT::Ph3::Resistor> mSubResistor;
29  std::shared_ptr<EMT::Ph3::Inductor> mSubInductor;
30 
32  std::shared_ptr<EMT::Ph3::Resistor> mSubSnubResistor1;
34  std::shared_ptr<EMT::Ph3::Resistor> mSubSnubResistor2;
36  std::shared_ptr<EMT::Ph3::Capacitor> mSubSnubCapacitor1;
38  std::shared_ptr<EMT::Ph3::Capacitor> mSubSnubCapacitor2;
39 
41  Matrix mSnubberResistance1;
43  Matrix mSnubberResistance2;
45  Matrix mSnubberCapacitance1;
47  Matrix mSnubberCapacitance2;
48 
50  Bool mWithResistiveLosses;
51 
52 public:
54  Transformer(String uid, String name,
55  Logger::Level logLevel = Logger::Level::off,
56  Bool withResistiveLosses = false);
58  Transformer(String name, Logger::Level logLevel = Logger::Level::off)
59  : Transformer(name, name, logLevel) {}
60 
61  SimPowerComp<Real>::Ptr clone(String name) override;
62 
63  // #### General ####
65  void setParameters(Real nomVoltageEnd1, Real nomVoltageEnd2, Real ratedPower,
66  Real ratioAbs, Real ratioPhase, Matrix resistance,
67  Matrix inductance);
69  void initializeFromNodesAndTerminals(Real frequency) override;
70 
71  // #### MNA section ####
73  void mnaParentInitialize(Real omega, Real timeStep,
74  Attribute<Matrix>::Ptr leftVector) override;
76  void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override;
78  void mnaCompUpdateCurrent(const Matrix &leftVector) override;
80  void mnaCompUpdateVoltage(const Matrix &leftVector) override;
82  void mnaParentPreStep(Real time, Int timeStepCount) override;
84  void mnaParentPostStep(Real time, Int timeStepCount,
85  Attribute<Matrix>::Ptr &leftVector) override;
88  AttributeBase::List &prevStepDependencies,
89  AttributeBase::List &attributeDependencies,
90  AttributeBase::List &modifiedAttributes) override;
92  void
93  mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
94  AttributeBase::List &attributeDependencies,
95  AttributeBase::List &modifiedAttributes,
96  Attribute<Matrix>::Ptr &leftVector) override;
97 };
98 } // namespace Ph3
99 } // namespace EMT
100 } // namespace CPS
Base class for composite power components.
Transformer that includes an inductance and resistance.
void mnaParentAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
Add MNA pre step dependencies.
Transformer(String uid, String name, Logger::Level logLevel=Logger::Level::off, Bool withResistiveLosses=false)
Defines UID, name and logging level.
void mnaParentPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
MNA post step operations.
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
Stamps system matrix.
Transformer(String name, Logger::Level logLevel=Logger::Level::off)
Defines name and logging level.
void initializeFromNodesAndTerminals(Real frequency) override
Initializes component from power flow data.
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Updates internal voltage variable of the component.
SimPowerComp< Real >::Ptr clone(String name) override
DEPRECATED: Delete method.
void mnaParentPreStep(Real time, Int timeStepCount) override
MNA pre step operations.
void mnaCompUpdateCurrent(const Matrix &leftVector) override
Updates internal current variable of the component.
void mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
void setParameters(Real nomVoltageEnd1, Real nomVoltageEnd2, Real ratedPower, Real ratioAbs, Real ratioPhase, Matrix resistance, Matrix inductance)
Defines component parameters.
void mnaParentInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
Initializes internal variables of the component.
String uid()
Returns unique id.
Base class for all components that are transmitting power.
Definition: SimPowerComp.h:17