DPsim
DP_Ph1_PQLoadCS.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_CurrentSource.h>
13 #include <dpsim-models/PowerProfile.h>
14 #include <dpsim-models/Solver/MNAInterface.h>
15 
16 namespace CPS {
17 namespace DP {
18 namespace Ph1 {
21 class PQLoadCS : public CompositePowerComp<Complex>,
22  public SharedFactory<PQLoadCS> {
23 protected:
25  std::shared_ptr<DP::Ph1::CurrentSource> mSubCurrentSource;
26  void updateSetPoint();
27  void updateIntfValues();
28 
29 public:
30  const Attribute<Real>::Ptr mActivePower;
31  const Attribute<Real>::Ptr mReactivePower;
32  const Attribute<Real>::Ptr mNomVoltage;
33 
35  PQLoadCS(String uid, String name,
36  Logger::Level logLevel = Logger::Level::off);
38  PQLoadCS(String name, Logger::Level logLevel = Logger::Level::off);
40  PQLoadCS(String name, Real activePower, Real reactivePower, Real volt,
41  Logger::Level logLevel = Logger::Level::off);
43  PQLoadCS(String uid, String name, Real activePower, Real reactivePower,
44  Real nomVolt, Logger::Level logLevel = Logger::Level::off);
45 
46  void setParameters(Real activePower, Real reactivePower, Real nomVolt);
47  SimPowerComp<Complex>::Ptr clone(String name) override;
48 
49  // #### General ####
51  void initializeFromNodesAndTerminals(Real frequency) override;
52 
53  // #### MNA section ####
55  void mnaParentPreStep(Real time, Int timeStepCount) override;
56  void mnaParentPostStep(Real time, Int timeStepCount,
57  Attribute<Matrix>::Ptr &leftVector) override;
58 
59  void mnaParentAddPreStepDependencies(
60  AttributeBase::List &prevStepDependencies,
61  AttributeBase::List &attributeDependencies,
62  AttributeBase::List &modifiedAttributes) override;
63  void
64  mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
65  AttributeBase::List &attributeDependencies,
66  AttributeBase::List &modifiedAttributes,
67  Attribute<Matrix>::Ptr &leftVector) override;
68 };
69 } // namespace Ph1
70 } // namespace DP
71 } // namespace CPS
Base class for composite power components.
PQ-load represented by a current source.
PQLoadCS(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and logging level.
void mnaParentPreStep(Real time, Int timeStepCount) override
MNA pre and post step operations.
SimPowerComp< Complex >::Ptr clone(String name) override
DEPRECATED: Delete method.
void initializeFromNodesAndTerminals(Real frequency) override
Initializes component from power flow data.
std::shared_ptr< DP::Ph1::CurrentSource > mSubCurrentSource
Internal current source.
String uid()
Returns unique id.
Base class for all components that are transmitting power.
Definition: SimPowerComp.h:17