DPsim
EMT_Ph3_SSN_Inductor.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 #pragma once
9 
10 #include <dpsim-models/Base/Base_Ph3_Inductor.h>
11 #include <dpsim-models/MNASimPowerComp.h>
12 #include <dpsim-models/Solver/MNAInterface.h>
13 
14 namespace CPS {
15 namespace EMT {
16 namespace Ph3 {
17 namespace SSN {
30 class Inductor final : public MNASimPowerComp<Real>,
31  public Base::Ph3::Inductor,
32  public SharedFactory<Inductor> {
33 public:
35  Inductor(String uid, String name,
36  Logger::Level logLevel = Logger::Level::off);
38  Inductor(String name, Logger::Level logLevel = Logger::Level::off)
39  : Inductor(name, name, logLevel) {}
40 
41  SimPowerComp<Real>::Ptr clone(String name) override;
42 
43  // #### General ####
45  void initializeFromNodesAndTerminals(Real frequency) override;
46 
47  // #### MNA section ####
49  void mnaCompInitialize(Real omega, Real timeStep,
50  Attribute<Matrix>::Ptr leftVector) override;
52  void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override;
54  void mnaCompApplyRightSideVectorStamp(Matrix &rightVector) override;
56  void mnaCompUpdateVoltage(const Matrix &leftVector) override;
58  void mnaCompUpdateCurrent(const Matrix &leftVector) override;
60  void mnaCompPreStep(Real time, Int timeStepCount) override;
62  void mnaCompPostStep(Real time, Int timeStepCount,
63  Attribute<Matrix>::Ptr &leftVector) override;
66  AttributeBase::List &prevStepDependencies,
67  AttributeBase::List &attributeDependencies,
68  AttributeBase::List &modifiedAttributes) override;
70  void
71  mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
72  AttributeBase::List &attributeDependencies,
73  AttributeBase::List &modifiedAttributes,
74  Attribute<Matrix>::Ptr &leftVector) override;
75 
76 private:
77  //rightsideVector history term
78  Matrix mHistoricCurrent = Matrix::Zero(3, 1);
79  //dependency on latest Voltage, represented by Conductance in system matrix
80  Matrix mDufourBKHat = Matrix::Zero(3, 3);
81  Matrix mDufourWKN = Matrix::Zero(3, 3);
82 };
83 } // namespace SSN
84 } // namespace Ph3
85 } // namespace EMT
86 } // namespace CPS
void mnaCompUpdateCurrent(const Matrix &leftVector) override
Update interface current from MNA system result.
void mnaCompApplyRightSideVectorStamp(Matrix &rightVector) override
Stamps right side (source) vector.
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Update interface voltage from MNA system result.
void initializeFromNodesAndTerminals(Real frequency) override
Initializes component from power flow data.
void mnaCompAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
Add MNA pre step dependencies.
SimPowerComp< Real >::Ptr clone(String name) override
Returns a modified copy of the component with the given suffix added to the name and without.
void mnaCompInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
Initializes internal variables of the component.
void mnaCompPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
MNA post step operations.
void mnaCompPreStep(Real time, Int timeStepCount) override
MNA pre step operations.
Inductor(String name, Logger::Level logLevel=Logger::Level::off)
Defines name and logging level.
Inductor(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name, component parameters and logging level.
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
Stamps system matrix.
void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
String uid()
Returns unique id.
Base class for all MNA components that are transmitting power.
Base class for all components that are transmitting power.
Definition: SimPowerComp.h:17