DPsim
DP_Ph1_RXLoad.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/CompositePowerComp.h>
12 #include <dpsim-models/DP/DP_Ph1_Capacitor.h>
13 #include <dpsim-models/DP/DP_Ph1_Inductor.h>
14 #include <dpsim-models/DP/DP_Ph1_Resistor.h>
15 #include <dpsim-models/Solver/MNAInterface.h>
16 
17 namespace CPS {
18 namespace DP {
19 namespace Ph1 {
21 class RXLoad : public CompositePowerComp<Complex>,
22  public SharedFactory<RXLoad> {
23 protected:
28  Real mReactance;
34  std::shared_ptr<DP::Ph1::Inductor> mSubInductor;
36  std::shared_ptr<DP::Ph1::Capacitor> mSubCapacitor;
38  std::shared_ptr<DP::Ph1::Resistor> mSubResistor;
40  std::vector<const Matrix *> mRightVectorStamps;
41 
42 public:
50  RXLoad(String uid, String name, Logger::Level logLevel = Logger::Level::off);
52  RXLoad(String name, Logger::Level logLevel = Logger::Level::off);
53 
54  // #### General ####
56  void initializeFromNodesAndTerminals(Real frequency) override;
58  void setParameters(Real activePower, Real ReactivePower, Real volt);
59 
60  // #### MNA section ####
62  void mnaCompUpdateCurrent(const Matrix &leftVector) override;
64  void mnaCompUpdateVoltage(const Matrix &leftVector) override;
66  void mnaParentPreStep(Real time, Int timeStepCount) override;
68  void mnaParentPostStep(Real time, Int timeStepCount,
69  Attribute<Matrix>::Ptr &leftVector) override;
72  AttributeBase::List &prevStepDependencies,
73  AttributeBase::List &attributeDependencies,
74  AttributeBase::List &modifiedAttributes) override;
76  void
77  mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
78  AttributeBase::List &attributeDependencies,
79  AttributeBase::List &modifiedAttributes,
80  Attribute<Matrix>::Ptr &leftVector) override;
81 };
82 } // namespace Ph1
83 } // namespace DP
84 } // namespace CPS
Base class for composite power components.
Constant impedance load model consisting of RLC elements.
Definition: DP_Ph1_RXLoad.h:22
std::shared_ptr< DP::Ph1::Inductor > mSubInductor
Internal inductor.
Definition: DP_Ph1_RXLoad.h:34
RXLoad(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and logging level.
Real mInductance
Inductance [H].
Definition: DP_Ph1_RXLoad.h:30
void mnaParentPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
MNA post step operations.
const Attribute< Real >::Ptr mActivePower
Active power [Watt].
Definition: DP_Ph1_RXLoad.h:44
Real mReactance
Reactance [Ohm].
Definition: DP_Ph1_RXLoad.h:28
const Attribute< Real >::Ptr mReactivePower
Reactive power [VAr].
Definition: DP_Ph1_RXLoad.h:46
Real mCapacitance
Capacitance [F].
Definition: DP_Ph1_RXLoad.h:32
void mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
std::shared_ptr< DP::Ph1::Capacitor > mSubCapacitor
Internal capacitor.
Definition: DP_Ph1_RXLoad.h:36
std::vector< const Matrix * > mRightVectorStamps
Right side vectors of subcomponents.
Definition: DP_Ph1_RXLoad.h:40
const Attribute< Real >::Ptr mNomVoltage
Nominal voltage [V].
Definition: DP_Ph1_RXLoad.h:48
void setParameters(Real activePower, Real ReactivePower, Real volt)
Set model specific parameters.
std::shared_ptr< DP::Ph1::Resistor > mSubResistor
Internal resistance.
Definition: DP_Ph1_RXLoad.h:38
void mnaParentAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
Add MNA pre step dependencies.
void mnaParentPreStep(Real time, Int timeStepCount) override
MNA pre step operations.
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Update interface voltage from MNA system result.
void initializeFromNodesAndTerminals(Real frequency) override
Initialize component from power flow data.
void mnaCompUpdateCurrent(const Matrix &leftVector) override
Update interface current from MNA system result.
String uid()
Returns unique id.