DPsim
DP_Ph3_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 
9 #pragma once
10 
11 #include <dpsim-models/Base/Base_Ph3_Inductor.h>
12 #include <dpsim-models/MNASimPowerComp.h>
13 #include <dpsim-models/Solver/MNATearInterface.h>
14 
15 namespace CPS {
16 namespace DP {
17 namespace Ph3 {
25 class Inductor : public MNASimPowerComp<Complex>,
26  public Base::Ph3::Inductor,
27  public MNATearInterface,
28  public SharedFactory<Inductor> {
29 protected:
31  MatrixComp mEquivCurrent;
33  MatrixComp mEquivCond;
35  Complex mPrevCurrFac;
36 
37  void initVars(Real omega, Real timeStep);
38 
39 public:
41  Inductor(String uid, String name,
42  Logger::Level logLevel = Logger::Level::off);
44  Inductor(String name, Logger::Level logLevel = Logger::Level::off)
45  : Inductor(name, name, logLevel) {}
47  Inductor(String name, Real inductance,
48  Logger::Level logLevel = Logger::Level::off);
49 
50  SimPowerComp<Complex>::Ptr clone(String name) override;
51 
52  // #### General ####
54  void initializeFromNodesAndTerminals(Real frequency) override;
55  // #### MNA section ####
57  void mnaCompInitialize(Real omega, Real timeStep,
58  Attribute<Matrix>::Ptr leftVector) override;
60  void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override;
62  void mnaCompApplyRightSideVectorStamp(Matrix &rightVector) override;
64  void mnaCompUpdateVoltage(const Matrix &leftVector) override;
66  void mnaCompUpdateCurrent(const Matrix &leftVector) override;
67  void mnaCompPreStep(Real time, Int timeStepCount) override;
68  void mnaCompPostStep(Real time, Int timeStepCount,
69  Attribute<Matrix>::Ptr &leftVector) override;
70 
73  AttributeBase::List &prevStepDependencies,
74  AttributeBase::List &attributeDependencies,
75  AttributeBase::List &modifiedAttributes) override;
77  void
78  mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
79  AttributeBase::List &attributeDependencies,
80  AttributeBase::List &modifiedAttributes,
81  Attribute<Matrix>::Ptr &leftVector) override;
82 
83  void mnaTearInitialize(Real omega, Real timestep) override;
84  void mnaTearApplyMatrixStamp(SparseMatrixRow &tearMatrix) override;
85  void mnaTearApplyVoltageStamp(Matrix &voltageVector) override;
86  void mnaTearPostStep(Complex voltage, Complex current) override;
87 };
88 } // namespace Ph3
89 } // namespace DP
90 } // namespace CPS
void mnaCompInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
Initializes internal variables of the component.
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
Stamps system matrix.
void initializeFromNodesAndTerminals(Real frequency) override
Initializes component from power flow data.
Complex mPrevCurrFac
Coefficient in front of previous current value.
MatrixComp mEquivCurrent
DC equivalent current source [A].
void mnaCompAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
Add MNA pre step dependencies.
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Update interface voltage from MNA system result.
Inductor(String name, Logger::Level logLevel=Logger::Level::off)
Defines name, component parameters and logging level.
Inductor(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name, component parameters and logging level.
void mnaCompUpdateCurrent(const Matrix &leftVector) override
Update interface current from MNA system result.
MatrixComp mEquivCond
Equivalent conductance [S].
SimPowerComp< Complex >::Ptr clone(String name) override
Returns a modified copy of the component with the given suffix added to the name and without.
void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
void mnaCompApplyRightSideVectorStamp(Matrix &rightVector) override
Stamps right side (source) vector.
Inductor(String name, Real inductance, Logger::Level logLevel=Logger::Level::off)
Defines name, component parameters and logging level.
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