DPsim
DPComponents.cpp
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 #include <DPsim.h>
10 #include <dpsim-models/CSVReader.h>
11 #include <dpsim-models/IdentifiedObject.h>
12 #include <dpsim/RealTimeSimulation.h>
13 #include <dpsim/Simulation.h>
14 #include <dpsim/pybind/DPComponents.h>
15 #include <dpsim/pybind/Utils.h>
16 
17 namespace py = pybind11;
18 using namespace pybind11::literals;
19 
20 void addDPComponents(py::module_ mDP) {
21  py::class_<CPS::DP::SimNode, std::shared_ptr<CPS::DP::SimNode>,
22  CPS::TopologicalNode>(mDP, "SimNode", py::module_local())
23  .def(py::init<std::string>())
24  .def(py::init<std::string, CPS::PhaseType>())
25  .def(py::init<std::string, CPS::PhaseType,
26  const std::vector<CPS::Complex>>())
27  .def("set_initial_voltage",
28  py::overload_cast<CPS::MatrixComp>(
29  &CPS::DP::SimNode::setInitialVoltage, py::const_))
30  .def("set_initial_voltage",
31  py::overload_cast<CPS::Complex>(&CPS::DP::SimNode::setInitialVoltage,
32  py::const_))
33  .def("set_initial_voltage",
34  py::overload_cast<CPS::Complex, int>(
35  &CPS::DP::SimNode::setInitialVoltage, py::const_))
36  .def("single_voltage", &CPS::DP::SimNode::singleVoltage,
37  "phase_type"_a = CPS::PhaseType::Single)
38  .def_readonly_static("gnd", &CPS::DP::SimNode::GND);
39 
40  py::module mDPPh1 =
41  mDP.def_submodule("ph1", "single phase dynamic phasor models");
42  addDPPh1Components(mDPPh1);
43 
44  py::module mDPPh3 =
45  mDP.def_submodule("ph3", "triple phase dynamic phasor models");
46  addDPPh3Components(mDPPh3);
47 }
48 
49 void addDPPh1Components(py::module_ mDPPh1) {
50  py::class_<CPS::DP::Ph1::VoltageSource,
51  std::shared_ptr<CPS::DP::Ph1::VoltageSource>,
52  CPS::SimPowerComp<CPS::Complex>>(mDPPh1, "VoltageSource",
53  py::multiple_inheritance())
54  .def(py::init<std::string>())
55  .def(py::init<std::string, CPS::Logger::Level>())
56  .def("set_parameters",
57  py::overload_cast<CPS::Complex, CPS::Real>(
59  "V_ref"_a, "f_src"_a = 0)
60  .def("connect", &CPS::DP::Ph1::VoltageSource::connect)
61  .def_property("V_ref", createAttributeGetter<CPS::Complex>("V_ref"),
62  createAttributeSetter<CPS::Complex>("V_ref"))
63  .def_property("f_src", createAttributeGetter<CPS::Real>("f_src"),
64  createAttributeSetter<CPS::Real>("f_src"));
65 
67  std::shared_ptr<CPS::DP::Ph1::VoltageSourceNorton>,
68  CPS::SimPowerComp<CPS::Complex>>(mDPPh1, "VoltageSourceNorton",
69  py::multiple_inheritance())
70  .def(py::init<std::string>())
71  .def(py::init<std::string, CPS::Logger::Level>())
72  .def("set_parameters",
73  py::overload_cast<CPS::Complex, CPS::Real>(
75  "V_ref"_a, "f_src"_a = -1)
77 
78  py::class_<CPS::DP::Ph1::CurrentSource,
79  std::shared_ptr<CPS::DP::Ph1::CurrentSource>,
80  CPS::SimPowerComp<CPS::Complex>>(mDPPh1, "CurrentSource",
81  py::multiple_inheritance())
82  .def(py::init<std::string>())
83  .def(py::init<std::string, CPS::Logger::Level>())
84  .def("set_parameters", &CPS::DP::Ph1::CurrentSource::setParameters,
85  "I_ref"_a)
86  .def("connect", &CPS::DP::Ph1::CurrentSource::connect)
87  .def_property("I_ref", createAttributeGetter<CPS::Complex>("I_ref"),
88  createAttributeSetter<CPS::Complex>("I_ref"));
89 
90  py::class_<CPS::DP::Ph1::Resistor, std::shared_ptr<CPS::DP::Ph1::Resistor>,
91  CPS::SimPowerComp<CPS::Complex>>(mDPPh1, "Resistor",
92  py::multiple_inheritance())
93  .def(py::init<std::string>())
94  .def(py::init<std::string, CPS::Logger::Level>())
95  .def("set_parameters", &CPS::DP::Ph1::Resistor::setParameters, "R"_a)
96  .def("connect", &CPS::DP::Ph1::Resistor::connect)
97  .def_property("R", createAttributeGetter<CPS::Real>("R"),
98  createAttributeSetter<CPS::Real>("R"));
99 
100  py::class_<CPS::DP::Ph1::Capacitor, std::shared_ptr<CPS::DP::Ph1::Capacitor>,
101  CPS::SimPowerComp<CPS::Complex>>(mDPPh1, "Capacitor",
102  py::multiple_inheritance())
103  .def(py::init<std::string>())
104  .def(py::init<std::string, CPS::Logger::Level>())
105  .def("set_parameters", &CPS::DP::Ph1::Capacitor::setParameters, "C"_a)
106  .def("connect", &CPS::DP::Ph1::Capacitor::connect)
107  .def_property("C", createAttributeGetter<CPS::Real>("C"),
108  createAttributeSetter<CPS::Real>("C"));
109 
110  py::class_<CPS::DP::Ph1::Inductor, std::shared_ptr<CPS::DP::Ph1::Inductor>,
111  CPS::SimPowerComp<CPS::Complex>>(mDPPh1, "Inductor",
112  py::multiple_inheritance())
113  .def(py::init<std::string>())
114  .def(py::init<std::string, CPS::Logger::Level>())
115  .def("set_parameters", &CPS::DP::Ph1::Inductor::setParameters, "L"_a)
116  .def("connect", &CPS::DP::Ph1::Inductor::connect)
117  .def_property("L", createAttributeGetter<CPS::Real>("L"),
118  createAttributeSetter<CPS::Real>("L"));
119 
121  std::shared_ptr<CPS::DP::Ph1::NetworkInjection>,
122  CPS::SimPowerComp<CPS::Complex>>(mDPPh1, "NetworkInjection",
123  py::multiple_inheritance())
124  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
125  "loglevel"_a = CPS::Logger::Level::off)
126  .def("set_parameters",
127  py::overload_cast<CPS::Complex, CPS::Real>(
129  "V_ref"_a, "f_src"_a = 0)
130  .def("connect", &CPS::DP::Ph1::NetworkInjection::connect);
131 
132  py::class_<CPS::DP::Ph1::PiLine, std::shared_ptr<CPS::DP::Ph1::PiLine>,
133  CPS::SimPowerComp<CPS::Complex>>(mDPPh1, "PiLine",
134  py::multiple_inheritance())
135  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
136  "loglevel"_a = CPS::Logger::Level::off)
137  .def("set_parameters", &CPS::DP::Ph1::PiLine::setParameters,
138  "series_resistance"_a, "series_inductance"_a,
139  "parallel_capacitance"_a = 0, "parallel_conductance"_a = 0)
140  .def("connect", &CPS::DP::Ph1::PiLine::connect);
141 
142  py::class_<CPS::DP::Ph1::RXLoad, std::shared_ptr<CPS::DP::Ph1::RXLoad>,
143  CPS::SimPowerComp<CPS::Complex>>(mDPPh1, "RXLoad",
144  py::multiple_inheritance())
145  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
146  "loglevel"_a = CPS::Logger::Level::off)
147  .def("set_parameters", &CPS::DP::Ph1::RXLoad::setParameters,
148  "active_power"_a, "reactive_power"_a, "volt"_a)
149  .def("connect", &CPS::DP::Ph1::RXLoad::connect);
150 
151  py::class_<CPS::DP::Ph1::Switch, std::shared_ptr<CPS::DP::Ph1::Switch>,
153  mDPPh1, "Switch", py::multiple_inheritance())
154  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
155  "loglevel"_a = CPS::Logger::Level::off)
156  .def("set_parameters", &CPS::DP::Ph1::Switch::setParameters,
157  "open_resistance"_a, "closed_resistance"_a,
158  // cppcheck-suppress assignBoolToPointer
159  "closed"_a = false)
160  .def("open", &CPS::DP::Ph1::Switch::open)
161  .def("close", &CPS::DP::Ph1::Switch::close)
162  .def("connect", &CPS::DP::Ph1::Switch::connect);
163 
164  py::class_<CPS::DP::Ph1::varResSwitch,
165  std::shared_ptr<CPS::DP::Ph1::varResSwitch>,
167  mDPPh1, "varResSwitch", py::multiple_inheritance())
168  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
169  "loglevel"_a = CPS::Logger::Level::off)
170  .def("set_parameters", &CPS::DP::Ph1::varResSwitch::setParameters,
171  "open_resistance"_a, "closed_resistance"_a,
172  // cppcheck-suppress assignBoolToPointer
173  "closed"_a = false)
174  .def("open", &CPS::DP::Ph1::varResSwitch::open)
175  .def("close", &CPS::DP::Ph1::varResSwitch::close)
176  .def("set_init_parameters",
177  &CPS::DP::Ph1::varResSwitch::setInitParameters, "time_step"_a)
178  .def("connect", &CPS::DP::Ph1::varResSwitch::connect);
179 
181  std::shared_ptr<CPS::DP::Ph1::SynchronGeneratorTrStab>,
182  CPS::SimPowerComp<CPS::Complex>>(mDPPh1, "SynchronGeneratorTrStab",
183  py::multiple_inheritance())
184  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
185  "loglevel"_a = CPS::Logger::Level::off)
186  .def("set_standard_parameters_PU",
188  "nom_power"_a, "nom_volt"_a, "nom_freq"_a, "Xpd"_a, "inertia"_a,
189  "Rs"_a = 0, "D"_a = 0)
190  .def("set_fundamental_parameters_PU",
192  "nom_power"_a, "nom_volt"_a, "nom_freq"_a, "Ll"_a, "Lmd"_a, "Llfd"_a,
193  "H"_a, "D"_a = 0)
194  .def("set_initial_values",
195  &CPS::DP::Ph1::SynchronGeneratorTrStab::setInitialValues,
196  "elec_power"_a, "mech_power"_a)
198  .def("set_model_flags",
200  "convert_with_omega_mech"_a)
201  .def(
202  "set_reference_omega",
204  std::string refOmegaName, CPS::IdentifiedObject::Ptr refOmegaComp,
205  std::string refDeltaName,
206  CPS::IdentifiedObject::Ptr refDeltaComp) {
207  gen.setReferenceOmega(
208  refOmegaComp->attributeTyped<CPS::Real>(refOmegaName),
209  refDeltaComp->attributeTyped<CPS::Real>(refDeltaName));
210  },
211  "ref_omega_name"_a = "w_r", "ref_omage_comp"_a,
212  "ref_delta_name"_a = "delta_r", "ref_delta_comp"_a);
213 
215  std::shared_ptr<CPS::DP::Ph1::ReducedOrderSynchronGeneratorVBR>,
217  mDPPh1, "ReducedOrderSynchronGeneratorVBR", py::multiple_inheritance());
218 
220  std::shared_ptr<CPS::DP::Ph1::SynchronGenerator3OrderVBR>,
222  mDPPh1, "SynchronGenerator3OrderVBR", py::multiple_inheritance())
223  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
224  "loglevel"_a = CPS::Logger::Level::off)
225  .def("set_operational_parameters_per_unit",
226  py::overload_cast<CPS::Real, CPS::Real, CPS::Real, CPS::Real,
227  CPS::Real, CPS::Real, CPS::Real, CPS::Real,
228  CPS::Real>(
230  setOperationalParametersPerUnit),
231  "nom_power"_a, "nom_voltage"_a, "nom_frequency"_a, "H"_a, "Ld"_a,
232  "Lq"_a, "L0"_a, "Ld_t"_a, "Td0_t"_a)
234 
236  std::shared_ptr<CPS::DP::Ph1::SynchronGenerator4OrderVBR>,
238  mDPPh1, "SynchronGenerator4OrderVBR", py::multiple_inheritance())
239  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
240  "loglevel"_a = CPS::Logger::Level::off)
241  .def("set_operational_parameters_per_unit",
242  py::overload_cast<CPS::Real, CPS::Real, CPS::Real, CPS::Real,
243  CPS::Real, CPS::Real, CPS::Real, CPS::Real,
244  CPS::Real, CPS::Real, CPS::Real>(
246  setOperationalParametersPerUnit),
247  "nom_power"_a, "nom_voltage"_a, "nom_frequency"_a, "H"_a, "Ld"_a,
248  "Lq"_a, "L0"_a, "Ld_t"_a, "Lq_t"_a, "Td0_t"_a, "Tq0_t"_a)
250 
252  std::shared_ptr<CPS::DP::Ph1::SynchronGenerator5OrderVBR>,
254  mDPPh1, "SynchronGenerator5OrderVBR", py::multiple_inheritance())
255  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
256  "loglevel"_a = CPS::Logger::Level::off)
257  .def("set_operational_parameters_per_unit",
258  py::overload_cast<CPS::Real, CPS::Real, CPS::Real, CPS::Real,
259  CPS::Real, CPS::Real, CPS::Real, CPS::Real,
260  CPS::Real, CPS::Real, CPS::Real, CPS::Real,
261  CPS::Real, CPS::Real, CPS::Real, CPS::Real>(
263  setOperationalParametersPerUnit),
264  "nom_power"_a, "nom_voltage"_a, "nom_frequency"_a, "H"_a, "Ld"_a,
265  "Lq"_a, "L0"_a, "Ld_t"_a, "Lq_t"_a, "Td0_t"_a, "Tq0_t"_a, "Ld_s"_a,
266  "Lq_s"_a, "Td0_s"_a, "Tq0_s"_a, "Taa"_a)
268 
270  std::shared_ptr<CPS::DP::Ph1::SynchronGenerator6aOrderVBR>,
272  mDPPh1, "SynchronGenerator6aOrderVBR", py::multiple_inheritance())
273  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
274  "loglevel"_a = CPS::Logger::Level::off)
275  .def("set_operational_parameters_per_unit",
276  py::overload_cast<CPS::Real, CPS::Real, CPS::Real, CPS::Real,
277  CPS::Real, CPS::Real, CPS::Real, CPS::Real,
278  CPS::Real, CPS::Real, CPS::Real, CPS::Real,
279  CPS::Real, CPS::Real, CPS::Real, CPS::Real>(
281  setOperationalParametersPerUnit),
282  "nom_power"_a, "nom_voltage"_a, "nom_frequency"_a, "H"_a, "Ld"_a,
283  "Lq"_a, "L0"_a, "Ld_t"_a, "Lq_t"_a, "Td0_t"_a, "Tq0_t"_a, "Ld_s"_a,
284  "Lq_s"_a, "Td0_s"_a, "Tq0_s"_a, "Taa"_a)
286 
288  std::shared_ptr<CPS::DP::Ph1::SynchronGenerator6bOrderVBR>,
290  mDPPh1, "SynchronGenerator6bOrderVBR", py::multiple_inheritance())
291  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
292  "loglevel"_a = CPS::Logger::Level::off)
293  .def("set_operational_parameters_per_unit",
294  py::overload_cast<CPS::Real, CPS::Real, CPS::Real, CPS::Real,
295  CPS::Real, CPS::Real, CPS::Real, CPS::Real,
296  CPS::Real, CPS::Real, CPS::Real, CPS::Real,
297  CPS::Real, CPS::Real, CPS::Real, CPS::Real>(
299  setOperationalParametersPerUnit),
300  "nom_power"_a, "nom_voltage"_a, "nom_frequency"_a, "H"_a, "Ld"_a,
301  "Lq"_a, "L0"_a, "Ld_t"_a, "Lq_t"_a, "Td0_t"_a, "Tq0_t"_a, "Ld_s"_a,
302  "Lq_s"_a, "Td0_s"_a, "Tq0_s"_a, "Taa"_a = 0)
304 
306  std::shared_ptr<CPS::DP::Ph1::SynchronGenerator4OrderTPM>,
308  CPS::MNASyncGenInterface>(mDPPh1, "SynchronGenerator4OrderTPM",
309  py::multiple_inheritance())
310  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
311  "loglevel"_a = CPS::Logger::Level::off)
312  .def("set_operational_parameters_per_unit",
313  py::overload_cast<CPS::Real, CPS::Real, CPS::Real, CPS::Real,
314  CPS::Real, CPS::Real, CPS::Real, CPS::Real,
315  CPS::Real, CPS::Real, CPS::Real>(
317  setOperationalParametersPerUnit),
318  "nom_power"_a, "nom_voltage"_a, "nom_frequency"_a, "H"_a, "Ld"_a,
319  "Lq"_a, "L0"_a, "Ld_t"_a, "Lq_t"_a, "Td0_t"_a, "Tq0_t"_a)
321 
323  std::shared_ptr<CPS::DP::Ph1::SynchronGenerator4OrderPCM>,
325  CPS::MNASyncGenInterface>(mDPPh1, "SynchronGenerator4OrderPCM",
326  py::multiple_inheritance())
327  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
328  "loglevel"_a = CPS::Logger::Level::off)
329  .def("set_operational_parameters_per_unit",
330  py::overload_cast<CPS::Real, CPS::Real, CPS::Real, CPS::Real,
331  CPS::Real, CPS::Real, CPS::Real, CPS::Real,
332  CPS::Real, CPS::Real, CPS::Real>(
334  setOperationalParametersPerUnit),
335  "nom_power"_a, "nom_voltage"_a, "nom_frequency"_a, "H"_a, "Ld"_a,
336  "Lq"_a, "L0"_a, "Ld_t"_a, "Lq_t"_a, "Td0_t"_a, "Tq0_t"_a)
338 
340  std::shared_ptr<CPS::DP::Ph1::SynchronGenerator6OrderPCM>,
342  CPS::MNASyncGenInterface>(mDPPh1, "SynchronGenerator6OrderPCM",
343  py::multiple_inheritance())
344  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
345  "loglevel"_a = CPS::Logger::Level::off)
346  .def("set_operational_parameters_per_unit",
347  py::overload_cast<CPS::Real, CPS::Real, CPS::Real, CPS::Real,
348  CPS::Real, CPS::Real, CPS::Real, CPS::Real,
349  CPS::Real, CPS::Real, CPS::Real, CPS::Real,
350  CPS::Real, CPS::Real, CPS::Real, CPS::Real>(
352  setOperationalParametersPerUnit),
353  "nom_power"_a, "nom_voltage"_a, "nom_frequency"_a, "H"_a, "Ld"_a,
354  "Lq"_a, "L0"_a, "Ld_t"_a, "Lq_t"_a, "Td0_t"_a, "Tq0_t"_a, "Ld_s"_a,
355  "Lq_s"_a, "Td0_s"_a, "Tq0_s"_a, "Taa"_a = 0)
357 
359  std::shared_ptr<CPS::DP::Ph1::AvVoltageSourceInverterDQ>,
361  mDPPh1, "AvVoltageSourceInverterDQ", py::multiple_inheritance())
362  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
363  "loglevel"_a = CPS::Logger::Level::off)
364  .def(py::init<std::string, std::string, CPS::Logger::Level, CPS::Bool>(),
365  "uid"_a, "name"_a, "loglevel"_a = CPS::Logger::Level::off,
366  // cppcheck-suppress assignBoolToPointer
367  "with_trafo"_a = false)
368  .def("set_parameters",
370  "sys_omega"_a, "sys_volt_nom"_a, "p_ref"_a, "q_ref"_a)
371  .def("set_filter_parameters",
373  "Lf"_a, "Cf"_a, "Rf"_a, "Rc"_a)
374  .def("set_controller_parameters",
376  "Kp_pll"_a, "Ki_pll"_a, "Kp_power_ctrl"_a, "Ki_power_ctrl"_a,
377  "Kp_curr_ctrl"_a, "Ki_curr_ctrl"_a, "omega_cutoff"_a)
378  .def("set_transformer_parameters",
380  "nom_voltage_end_1"_a, "nom_voltage_end_2"_a, "rated_power"_a,
381  "ratio_abs"_a, "ratio_phase"_a, "resistance"_a, "inductance"_a)
382  .def("set_initial_state_values",
384  "p_init"_a, "q_init"_a, "phi_d_init"_a, "phi_q_init"_a,
385  "gamma_d_init"_a, "gamma_q_init"_a)
386  .def("with_control",
387  &CPS::DP::Ph1::AvVoltageSourceInverterDQ::withControl)
389 
390  py::class_<CPS::DP::Ph1::Inverter, std::shared_ptr<CPS::DP::Ph1::Inverter>,
391  CPS::SimPowerComp<CPS::Complex>>(mDPPh1, "Inverter",
392  py::multiple_inheritance())
393  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
394  "loglevel"_a = CPS::Logger::Level::off)
395  .def("set_parameters", &CPS::DP::Ph1::Inverter::setParameters,
396  "carrier_harms"_a, "modul_harms"_a, "input_voltage"_a, "ratio"_a,
397  "phase"_a)
398  .def("connect", &CPS::DP::Ph1::Inverter::connect);
399 
400  py::class_<CPS::DP::Ph1::Transformer,
401  std::shared_ptr<CPS::DP::Ph1::Transformer>,
402  CPS::SimPowerComp<CPS::Complex>>(mDPPh1, "Transformer",
403  py::multiple_inheritance())
404  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
405  "loglevel"_a = CPS::Logger::Level::off)
406  .def(py::init<std::string, std::string, CPS::Logger::Level, CPS::Bool>(),
407  "uid"_a, "name"_a, "loglevel"_a = CPS::Logger::Level::off,
408  // cppcheck-suppress assignBoolToPointer
409  "with_resistive_losses"_a =
410  false)
411  .def("set_parameters",
412  py::overload_cast<CPS::Real, CPS::Real, CPS::Real, CPS::Real,
413  CPS::Real, CPS::Real>(
415  "nom_voltage_end_1"_a, "nom_voltage_end_2"_a, "ratio_abs"_a,
416  "ratio_phase"_a, "resistance"_a, "inductance"_a)
417  .def("set_parameters",
418  py::overload_cast<CPS::Real, CPS::Real, CPS::Real, CPS::Real,
419  CPS::Real, CPS::Real, CPS::Real>(
421  "nom_voltage_end_1"_a, "nom_voltage_end_2"_a, "rated_power"_a,
422  "ratio_abs"_a, "ratio_phase"_a, "resistance"_a, "inductance"_a)
423  .def("connect", &CPS::DP::Ph1::Transformer::connect);
424 }
425 
426 void addDPPh3Components(py::module_ mDPPh3) {
427 
428 #ifdef WITH_SUNDIALS
429 
431  std::shared_ptr<CPS::DP::Ph3::SynchronGeneratorDQODE>,
432  CPS::SimPowerComp<CPS::Complex>>(mDPPh3, "SynchronGeneratorDQODE",
433  py::multiple_inheritance())
434  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
435  "loglevel"_a = CPS::Logger::Level::off)
436  .def("set_parameters_fundamental_per_unit",
438  setParametersFundamentalPerUnit,
439  "nom_power"_a, "nom_volt"_a, "nom_freq"_a, "pole_number"_a,
440  "nom_field_cur"_a, "Rs"_a, "Ll"_a, "Lmd"_a, "Lmq"_a, "Rfd"_a,
441  "Llfd"_a, "Rkd"_a, "Llkd"_a, "Rkq1"_a, "Llkq1"_a, "Rkq2"_a,
442  "Llkq2"_a, "inertia"_a, "init_active_power"_a,
443  "init_reactive_power"_a, "init_terminal_volt"_a, "init_volt_angle"_a,
444  "init_mech_power"_a)
446 
447 #endif
448 
450  std::shared_ptr<CPS::DP::Ph3::SynchronGeneratorDQTrapez>,
452  mDPPh3, "SynchronGeneratorDQTrapez", py::multiple_inheritance())
453  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
454  "loglevel"_a = CPS::Logger::Level::off)
455  .def("set_parameters_fundamental_per_unit",
457  setParametersFundamentalPerUnit,
458  "nom_power"_a, "nom_volt"_a, "nom_freq"_a, "pole_number"_a,
459  "nom_field_cur"_a, "Rs"_a, "Ll"_a, "Lmd"_a, "Lmq"_a, "Rfd"_a,
460  "Llfd"_a, "Rkd"_a, "Llkd"_a, "Rkq1"_a, "Llkq1"_a, "Rkq2"_a,
461  "Llkq2"_a, "inertia"_a, "init_active_power"_a,
462  "init_reactive_power"_a, "init_terminal_volt"_a, "init_volt_angle"_a,
463  "init_mech_power"_a)
465 
466  py::class_<CPS::DP::Ph3::SeriesResistor,
467  std::shared_ptr<CPS::DP::Ph3::SeriesResistor>,
468  CPS::SimPowerComp<CPS::Complex>>(mDPPh3, "SeriesResistor",
469  py::multiple_inheritance())
470  .def(py::init<std::string>())
471  .def(py::init<std::string, CPS::Logger::Level>())
472  .def("set_parameters", &CPS::DP::Ph3::SeriesResistor::setParameters,
473  "R"_a)
474  .def("connect", &CPS::DP::Ph3::SeriesResistor::connect);
475 
476  py::class_<CPS::DP::Ph3::SeriesSwitch,
477  std::shared_ptr<CPS::DP::Ph3::SeriesSwitch>,
479  mDPPh3, "SeriesSwitch", py::multiple_inheritance())
480  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
481  "loglevel"_a = CPS::Logger::Level::off)
482  .def("set_parameters", &CPS::DP::Ph3::SeriesSwitch::setParameters,
483  "open_resistance"_a, "closed_resistance"_a,
484  // cppcheck-suppress assignBoolToPointer
485  "closed"_a = false)
486  .def("open", &CPS::DP::Ph3::SeriesSwitch::open)
487  .def("close", &CPS::DP::Ph3::SeriesSwitch::close)
488  .def("connect", &CPS::DP::Ph3::SeriesSwitch::connect);
489 }
void setParameters(Real capacitance)
Sets model specific parameters.
void setParameters(Real inductance)
Sets model specific parameters.
Dynamic Phasor Three-Phase Switch.
void close()
Close switch.
void open()
Open switch.
void setParameters(Real sysOmega, Real sysVoltNom, Real Pref, Real Qref)
Setter for general parameters of inverter.
void setInitialStateValues(Real pInit, Real qInit, Real phi_dInit, Real phi_qInit, Real gamma_dInit, Real gamma_qInit)
Setter for initial values applied in controllers.
void setControllerParameters(Real Kp_pll, Real Ki_pll, Real Kp_powerCtrl, Real Ki_powerCtrl, Real Kp_currCtrl, Real Ki_currCtrl, Real Omega_cutoff)
Setter for parameters of control loops.
void setTransformerParameters(Real nomVoltageEnd1, Real nomVoltageEnd2, Real ratedPower, Real ratioAbs, Real ratioPhase, Real resistance, Real inductance)
Setter for parameters of transformer.
void setFilterParameters(Real Lf, Real Cf, Real Rf, Real Rc)
Setter for parameters of filter.
Dynamic phasor ideal current source.
void setParameters(Complex voltageRef, Real srcFreq=0.0)
void setParameters(Real activePower, Real ReactivePower, Real volt)
Set model specific parameters.
Base class for DP VBR synchronous generator model single phase.
Voltage-Behind-Reactance (VBR) implementation of 3rd order synchronous generator model.
4 Order Synchronous generator model for transient stability analysis
4 Order Synchronous generator model for transient stability analysis
Voltage-Behind-Reactance (VBR) implementation of 4th order synchronous generator model.
Voltage-Behind-Reactance (VBR) implementation of 5th type 2 order synchronous generator model Ref: Mi...
6 Order Synchronous generator model for transient stability analysis
Voltage-Behind-Reactance (VBR) implementation of 6th order synchronous generator model Marconato's mo...
Voltage-Behind-Reactance (VBR) implementation of 6th order synchronous generator model Anderson - Fou...
Synchronous generator model for transient stability analysis.
void setStandardParametersPU(Real nomPower, Real nomVolt, Real nomFreq, Real Xpd, Real inertia, Real Rs=0, Real D=0)
Initializes the machine parameters.
void setModelFlags(Bool convertWithOmegaMech)
Flags to modify model behavior.
void setFundamentalParametersPU(Real nomPower, Real nomVolt, Real nomFreq, Real Ll, Real Lmd, Real Llfd, Real inertia, Real D=0)
Initializes the machine parameters.
Transformer that includes an inductance and resistance.
void setParameters(Real nomVoltageEnd1, Real nomVoltageEnd2, Real ratioAbs, Real ratioPhase, Real resistance, Real inductance)
Defines component parameters.
Ideal Voltage source model.
void setParameters(Complex voltageRef, Real srcFreq=0.0)
Resistive dynamic phasor voltage source.
void setParameters(Complex voltage, Real srcFreq=-1, Real resistance=1e9)
THISISBAD: This declaration and Base::Ph1::VoltageSource::setParameters(Complex, Real) are ambiguous ...
Switch with variable resistance to avoid numerical oscillations, when an inductive current is suddenl...
Dynamic phasor three-phase switch.
Interface to be used by synchronous generators.
Base class for all components that are transmitting power.
Definition: SimPowerComp.h:17
void connect(typename SimNode< Complex >::List nodes)
Sets all nodes and checks for nominal number of Nodes for this Component.