9 #include <dpsim-models/SP/SP_Ph1_SynchronGenerator.h>
14 Logger::Level logLevel)
16 mBaseVoltage(mAttributes->create<Real>(
"base_Voltage")),
17 mSetPointActivePower(mAttributes->create<Real>(
"P_set")),
18 mSetPointReactivePower(mAttributes->create<Real>(
"Q_set")),
19 mSetPointVoltage(mAttributes->create<Real>(
"V_set")),
20 mSetPointActivePowerPerUnit(mAttributes->create<Real>(
"P_set_pu")),
21 mSetPointReactivePowerPerUnit(mAttributes->create<Real>(
"Q_set_pu")),
22 mSetPointVoltagePerUnit(mAttributes->create<Real>(
"V_set_pu")) {
24 SPDLOG_LOGGER_INFO(
mSLog,
"Create {} of type {}", name, this->
type());
31 Real ratedApparentPower, Real ratedVoltage, Real setPointActivePower,
32 Real setPointVoltage, PowerflowBusType powerflowBusType,
33 Real setPointReactivePower) {
34 **mSetPointActivePower = setPointActivePower;
35 **mSetPointReactivePower = setPointReactivePower;
36 **mSetPointVoltage = setPointVoltage;
37 mPowerflowBusType = powerflowBusType;
39 SPDLOG_LOGGER_INFO(mSLog,
"Rated Apparent Power={} [VA] Rated Voltage={} [V]",
40 ratedApparentPower, ratedVoltage);
41 SPDLOG_LOGGER_INFO(mSLog,
42 "Active Power Set Point={} [W] Voltage Set Point={} [V]",
43 **mSetPointActivePower, **mSetPointVoltage);
49 **mBaseVoltage = baseVoltage;
53 Real baseApparentPower, Real baseOmega) {
54 SPDLOG_LOGGER_INFO(mSLog,
"#### Calculate Per Unit Parameters for {}",
56 mBaseApparentPower = baseApparentPower;
57 SPDLOG_LOGGER_INFO(mSLog,
"Base Power={} [VA] Base Omega={} [1/s]",
58 mBaseApparentPower, baseOmega);
60 **mSetPointActivePowerPerUnit = **mSetPointActivePower / mBaseApparentPower;
61 **mSetPointReactivePowerPerUnit =
62 **mSetPointReactivePower / mBaseApparentPower;
63 **mSetPointVoltagePerUnit = **mSetPointVoltage / **mBaseVoltage;
64 SPDLOG_LOGGER_INFO(mSLog,
65 "Active Power Set Point={} [pu] Voltage Set Point={} [pu]",
66 **mSetPointActivePowerPerUnit, **mSetPointVoltagePerUnit);
71 PowerflowBusType powerflowBusType) {
72 switch (powerflowBusType) {
73 case CPS::PowerflowBusType::PV:
74 mPowerflowBusType = powerflowBusType;
76 case CPS::PowerflowBusType::PQ:
77 throw std::invalid_argument(
78 "Setting Synchronous Generator as PQNode is currently not supported.");
80 case CPS::PowerflowBusType::VD:
81 mPowerflowBusType = powerflowBusType;
83 case CPS::PowerflowBusType::None:
86 throw std::invalid_argument(
" Invalid power flow bus type ");
94 **mSetPointReactivePower = powerInj.imag();
95 **mSetPointReactivePowerPerUnit =
96 **mSetPointReactivePower / mBaseApparentPower;
101 **mSetPointActivePower = powerInj.real();
102 **mSetPointActivePowerPerUnit = **mSetPointActivePower / mBaseApparentPower;
103 **mSetPointReactivePower = powerInj.imag();
104 **mSetPointReactivePowerPerUnit =
105 **mSetPointReactivePower / mBaseApparentPower;
109 return Complex(**mSetPointActivePower, **mSetPointReactivePower);
String type()
Get component type (cross-platform)
void modifyPowerFlowBusType(PowerflowBusType powerflowBusType) override
Modify powerflow bus type.
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.
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)
void setParameters(Real ratedApparentPower, Real ratedVoltage, Real setPointActivePower, Real setPointVoltage, PowerflowBusType powerflowBusType, Real setPointReactivepower=0)
Setter for synchronous generator parameters.
void updatePowerInjection(Complex powerInj)
Update active & reactive power injection (VD bus)
Base class for all components that are transmitting power.
Logger::Log mSLog
Component logger.