DPsim
Loading...
Searching...
No Matches
SP_Ph1_SynchronGenerator.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 <limits>
12
13#include <dpsim-models/MNASimPowerComp.h>
14#include <dpsim-models/Solver/PFSolverInterfaceBus.h>
15
16namespace CPS {
17
18namespace SP {
19namespace Ph1 {
20
21class SynchronGenerator : public SimPowerComp<Complex>,
22 public SharedFactory<SynchronGenerator>,
23 public PFSolverInterfaceBus {
24private:
26 Real mBaseVoltage;
28 Real mBaseApparentPower;
29
30public:
32 const Attribute<Real>::Ptr mSetPointActivePower;
34 const Attribute<Real>::Ptr mSetPointReactivePower;
36 const Attribute<Real>::Ptr mSetPointVoltage;
38 const Attribute<Real>::Ptr mSetPointActivePowerPerUnit;
40 const Attribute<Real>::Ptr mSetPointReactivePowerPerUnit;
42 const Attribute<Real>::Ptr mSetPointVoltagePerUnit;
44 const Attribute<Real>::Ptr mReactivePowerMax;
46 const Attribute<Real>::Ptr mReactivePowerMin;
48 const Attribute<Real>::Ptr mReactivePowerMaxPerUnit;
50 const Attribute<Real>::Ptr mReactivePowerMinPerUnit;
51
53 SynchronGenerator(String uid, String name,
54 Logger::Level logLevel = Logger::Level::off);
56 SynchronGenerator(String name, Logger::Level logLevel = Logger::Level::off)
57 : SynchronGenerator(name, name, logLevel) {}
58
61 void setParameters(Real ratedApparentPower, Real ratedVoltage,
62 Real setPointActivePower, Real setPointVoltage,
63 PowerflowBusType powerflowBusType,
64 Real setPointReactivepower = 0,
65 Real qLimMax = std::numeric_limits<Real>::infinity(),
66 Real qLimMin = -std::numeric_limits<Real>::infinity());
67 // #### Powerflow section ####
68 Real getBaseVoltage() const;
70 void setBaseVoltage(Real baseVoltage);
72 void calculatePerUnitParameters(Real baseApparentPower, Real baseOmega);
74 void modifyPowerFlowBusType(PowerflowBusType powerflowBusType) override;
76 void updateReactivePowerInjection(Complex powerInj);
78 void updatePowerInjection(Complex powerInj);
80 Complex getApparentPower() const;
81};
82} // namespace Ph1
83} // namespace SP
84} // namespace CPS
String uid()
Returns unique id.
const Attribute< Real >::Ptr mSetPointReactivePower
Reactive power set point of the machine [VAr].
const Attribute< Real >::Ptr mReactivePowerMax
Maximum reactive power limit [VAr] (default +inf = unlimited)
void modifyPowerFlowBusType(PowerflowBusType powerflowBusType) override
Modify powerflow bus type.
SynchronGenerator(String name, Logger::Level logLevel=Logger::Level::off)
Defines name and logging level.
const Attribute< Real >::Ptr mSetPointReactivePowerPerUnit
Reactive power set point of the machine [pu].
const Attribute< Real >::Ptr mReactivePowerMin
Minimum reactive power limit [VAr] (default -inf = unlimited)
const Attribute< Real >::Ptr mReactivePowerMinPerUnit
Minimum reactive power limit [pu].
Complex getApparentPower() const
Get Apparent power of Powerflow solution.
void setBaseVoltage(Real baseVoltage)
Set base voltage.
void calculatePerUnitParameters(Real baseApparentPower, Real baseOmega)
Initializes component from power flow data.
const Attribute< Real >::Ptr mSetPointActivePower
Active power set point of the machine [W].
SynchronGenerator(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and logging level.
void updateReactivePowerInjection(Complex powerInj)
Update reactive power injection (PV Bus)
const Attribute< Real >::Ptr mSetPointVoltagePerUnit
Voltage set point of the machine [pu].
void updatePowerInjection(Complex powerInj)
Update active & reactive power injection (VD bus)
const Attribute< Real >::Ptr mReactivePowerMaxPerUnit
Maximum reactive power limit [pu].
const Attribute< Real >::Ptr mSetPointVoltage
Voltage set point of the machine [V].
void setParameters(Real ratedApparentPower, Real ratedVoltage, Real setPointActivePower, Real setPointVoltage, PowerflowBusType powerflowBusType, Real setPointReactivepower=0, Real qLimMax=std::numeric_limits< Real >::infinity(), Real qLimMin=-std::numeric_limits< Real >::infinity())
const Attribute< Real >::Ptr mSetPointActivePowerPerUnit
Active power set point of the machine [pu].
SimPowerComp(String uid, String name, Logger::Level logLevel=Logger::Level::off)