DPsim
SP_Ph1_Load.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/PowerProfile.h>
13 #include <dpsim-models/SP/SP_Ph1_Capacitor.h>
14 #include <dpsim-models/SP/SP_Ph1_Inductor.h>
15 #include <dpsim-models/SP/SP_Ph1_PQNode.h>
16 #include <dpsim-models/SP/SP_Ph1_PVNode.h>
17 #include <dpsim-models/SP/SP_Ph1_Resistor.h>
18 #include <dpsim-models/SP/SP_Ph1_VDNode.h>
19 #include <dpsim-models/Solver/PFSolverInterfaceBus.h>
20 
21 namespace CPS {
22 namespace SP {
23 namespace Ph1 {
24 class Load : public CompositePowerComp<Complex>,
25  public SharedFactory<Load>,
26  public PFSolverInterfaceBus {
27 public:
38 
39 private:
41  Real mBaseApparentPower;
43  Real mBaseOmega;
45  Real mResistance;
47  Real mConductance;
49  Real mReactance;
51  Real mInductance;
53  Real mCapacitance;
54 
56  std::shared_ptr<SP::Ph1::Inductor> mSubInductor;
58  std::shared_ptr<SP::Ph1::Capacitor> mSubCapacitor;
60  std::shared_ptr<SP::Ph1::Resistor> mSubResistor;
61 
62 public:
64  Load(String uid, String name, Logger::Level logLevel = Logger::Level::off);
66  Load(String name, Logger::Level logLevel = Logger::Level::off)
67  : Load(name, name, logLevel) {}
69  void setParameters(Real activePower, Real reactivePower, Real nominalVoltage);
70 
71  // #### General ####
73  void initializeFromNodesAndTerminals(Real frequency) override;
77  bool use_profile = false;
79  void updatePQ(Real time);
80 
81  // #### Powerflow section ####
83  void calculatePerUnitParameters(Real baseApparentPower, Real baseOmega);
85  void modifyPowerFlowBusType(PowerflowBusType powerflowBusType) override;
86 
87  // #### MNA section ####
89  void mnaCompUpdateCurrent(const Matrix &leftVector) override;
91  void mnaCompUpdateVoltage(const Matrix &leftVector) override;
92 
94  void mnaParentPostStep(Real time, Int timeStepCount,
95  Attribute<Matrix>::Ptr &leftVector) override;
96 
97  void
98  mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
99  AttributeBase::List &attributeDependencies,
100  AttributeBase::List &modifiedAttributes,
101  Attribute<Matrix>::Ptr &leftVector) override;
102 };
103 } // namespace Ph1
104 } // namespace SP
105 
106 } // namespace CPS
Base class for composite power components.
String uid()
Returns unique id.
Common base class of all Component templates.
const Attribute< Real >::Ptr mReactivePower
Reactive power [VAr].
Definition: SP_Ph1_Load.h:33
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Updates internal voltage variable of the component.
void modifyPowerFlowBusType(PowerflowBusType powerflowBusType) override
Modify powerflow bus type.
Definition: SP_Ph1_Load.cpp:63
const Attribute< Real >::Ptr mActivePower
Active power [Watt].
Definition: SP_Ph1_Load.h:31
const Attribute< Real >::Ptr mReactivePowerPerUnit
Reactive power [pu].
Definition: SP_Ph1_Load.h:37
void initializeFromNodesAndTerminals(Real frequency) override
Initializes component from power flow data.
Definition: SP_Ph1_Load.cpp:98
PowerProfile mLoadProfile
Load profile data.
Definition: SP_Ph1_Load.h:75
Load(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and logging level.
Definition: SP_Ph1_Load.cpp:16
Load(String name, Logger::Level logLevel=Logger::Level::off)
Defines name and logging level.
Definition: SP_Ph1_Load.h:66
const Attribute< Real >::Ptr mNomVoltage
Nominal voltage [V].
Definition: SP_Ph1_Load.h:29
void updatePQ(Real time)
Update PQ for this load for power flow calculation at next time step.
Definition: SP_Ph1_Load.cpp:84
void mnaParentPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
MNA post step operations.
const Attribute< Real >::Ptr mActivePowerPerUnit
Active power [pu].
Definition: SP_Ph1_Load.h:35
void mnaCompUpdateCurrent(const Matrix &leftVector) override
Updates internal current variable of the component.
bool use_profile
Use the assigned load profile.
Definition: SP_Ph1_Load.h:77
void calculatePerUnitParameters(Real baseApparentPower, Real baseOmega)
Calculates component's parameters in specified per-unit system.
Definition: SP_Ph1_Load.cpp:47