DPsim
SP_Ph1_Capacitor.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_Ph1_Capacitor.h>
12 #include <dpsim-models/MNASimPowerComp.h>
13 #include <dpsim-models/Solver/MNAInterface.h>
14 #include <dpsim-models/Solver/PFSolverInterfaceBranch.h>
15 
16 namespace CPS {
17 namespace SP {
18 namespace Ph1 {
19 class Capacitor : public MNASimPowerComp<Complex>,
20  public Base::Ph1::Capacitor,
21  public SharedFactory<Capacitor>,
23 
24 protected:
35 
40 
42  Complex mImpedance;
44  Complex mAdmittance;
46  Complex mSusceptance;
47 
48 public:
50  Capacitor(String uid, String name,
51  Logger::Level logLevel = Logger::Level::off);
53  Capacitor(String name, Logger::Level logLevel = Logger::Level::off)
54  : Capacitor(name, name, logLevel) {}
55 
56  SimPowerComp<Complex>::Ptr clone(String name) override;
57 
58  // #### General ####
60  void initializeFromNodesAndTerminals(Real frequency) override;
61 
62  // #### Powerflow section ####
64  void setBaseVoltage(Real baseVoltage);
66  void calculatePerUnitParameters(Real baseApparentPower);
68  void pfApplyAdmittanceMatrixStamp(SparseMatrixCompRow &Y) override;
69 
70  // #### MNA section ####
72  void mnaCompInitialize(Real omega, Real timeStep,
73  Attribute<Matrix>::Ptr leftVector) override;
75  void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override;
77  void mnaCompUpdateVoltage(const Matrix &leftVector) override;
79  void mnaCompUpdateCurrent(const Matrix &leftVector) override;
81  void mnaCompPostStep(Real time, Int timeStepCount,
82  Attribute<Matrix>::Ptr &leftVector) override;
84  void
85  mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
86  AttributeBase::List &attributeDependencies,
87  AttributeBase::List &modifiedAttributes,
88  Attribute<Matrix>::Ptr &leftVector) override;
89 };
90 } // namespace Ph1
91 } // namespace SP
92 } // namespace CPS
String uid()
Returns unique id.
Base class for all MNA components that are transmitting power.
Common base class of all Component templates.
Complex mImpedance
Impedance [Ohm].
void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
Stamps system matrix.
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Update interface voltage from MNA system result.
void setBaseVoltage(Real baseVoltage)
Set base voltage.
Real mBaseApparentPower
base apparent power[VA]
void mnaCompUpdateCurrent(const Matrix &leftVector) override
Update interface current from MNA system result.
SimPowerComp< Complex >::Ptr clone(String name) override
Returns a modified copy of the component with the given suffix added to the name and without.
Capacitor(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and logging level.
void calculatePerUnitParameters(Real baseApparentPower)
Initializes component from power flow data.
Complex mSusceptance
Susceptance [S].
Complex mAdmittance
Admittance [S].
Complex mImpedancePerUnit
Impedance [pu].
Real mBaseAdmittance
base admittance [S]
Capacitor(String name, Logger::Level logLevel=Logger::Level::off)
Defines name, component parameters and logging level.
void initializeFromNodesAndTerminals(Real frequency) override
Initializes component from power flow data.
void mnaCompPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
MNA post step operations.
Complex mAdmittancePerUnit
Admittance [pu].
Real mBaseImpedance
base impedance [ohm]
void mnaCompInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
Initializes internal variables of the component.
Real mBaseVoltage
base voltage [V]
void pfApplyAdmittanceMatrixStamp(SparseMatrixCompRow &Y) override
Stamps admittance matrix.
Real mBaseCurrent
base current [A]
Base class for all components that are transmitting power.
Definition: SimPowerComp.h:17