DPsim
Loading...
Searching...
No Matches
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
21namespace CPS {
22namespace SP {
23namespace Ph1 {
24class Load : public CompositePowerComp<Complex>,
25 public SharedFactory<Load>,
26 public PFSolverInterfaceBus {
27public:
29 const Attribute<Real>::Ptr mActivePower;
31 const Attribute<Real>::Ptr mReactivePower;
33 const Attribute<Real>::Ptr mActivePowerPerUnit;
35 const Attribute<Real>::Ptr mReactivePowerPerUnit;
36
37private:
39 Real mNomVoltage;
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
62public:
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) {}
68
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 Real getNomVoltage() const;
85 void calculatePerUnitParameters(Real baseApparentPower, Real baseOmega);
87 void modifyPowerFlowBusType(PowerflowBusType powerflowBusType) override;
88
89 // #### MNA section ####
91 void mnaCompUpdateCurrent(const Matrix &leftVector) override;
93 void mnaCompUpdateVoltage(const Matrix &leftVector) override;
94
96 void mnaParentPostStep(Real time, Int timeStepCount,
97 Attribute<Matrix>::Ptr &leftVector) override;
98
99 void
100 mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
101 AttributeBase::List &attributeDependencies,
102 AttributeBase::List &modifiedAttributes,
103 Attribute<Matrix>::Ptr &leftVector) override;
104};
105} // namespace Ph1
106} // namespace SP
107
108} // namespace CPS
CompositePowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
String uid()
Returns unique id.
const Attribute< Real >::Ptr mReactivePower
Reactive power [VAr].
Definition SP_Ph1_Load.h:31
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Updates internal voltage variable of the component.
void modifyPowerFlowBusType(PowerflowBusType powerflowBusType) override
Modify powerflow bus type.
const Attribute< Real >::Ptr mActivePower
Active power [Watt].
Definition SP_Ph1_Load.h:29
const Attribute< Real >::Ptr mReactivePowerPerUnit
Reactive power [pu].
Definition SP_Ph1_Load.h:35
Real getNomVoltage() const
Get nominal voltage.
void initializeFromNodesAndTerminals(Real frequency) override
Initializes component from power flow data.
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.
Load(String name, Logger::Level logLevel=Logger::Level::off)
Defines name and logging level.
Definition SP_Ph1_Load.h:66
void updatePQ(Real time)
Update PQ for this load for power flow calculation at next time step.
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:33
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.