DPsim
EMTComponents.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/EMTComponents.h>
15 #include <dpsim/pybind/Utils.h>
16 
17 namespace py = pybind11;
18 using namespace pybind11::literals;
19 
20 void addEMTComponents(py::module_ mEMT) {
21  py::class_<CPS::EMT::SimNode, std::shared_ptr<CPS::EMT::SimNode>,
22  CPS::TopologicalNode>(mEMT, "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::EMT::SimNode::setInitialVoltage, py::const_))
30  .def("set_initial_voltage",
31  py::overload_cast<CPS::Complex>(
32  &CPS::EMT::SimNode::setInitialVoltage, py::const_))
33  .def("set_initial_voltage",
34  py::overload_cast<CPS::Complex, int>(
35  &CPS::EMT::SimNode::setInitialVoltage, py::const_))
36  .def_readonly_static("gnd", &CPS::EMT::SimNode::GND);
37 
38  py::module mEMTPh1 = mEMT.def_submodule(
39  "ph1", "single phase electromagnetic-transient models");
40  addEMTPh1Components(mEMTPh1);
41  py::module mEMTPh3 =
42  mEMT.def_submodule("ph3", "three phase electromagnetic-transient models");
43  addEMTPh3Components(mEMTPh3);
44 }
45 
46 void addEMTPh1Components(py::module_ mEMTPh1) {
48  std::shared_ptr<CPS::EMT::Ph1::CurrentSource>,
49  CPS::SimPowerComp<CPS::Real>>(mEMTPh1, "CurrentSource",
50  py::multiple_inheritance())
51  .def(py::init<std::string>())
52  .def(py::init<std::string, CPS::Logger::Level>())
53  .def("set_parameters", &CPS::EMT::Ph1::CurrentSource::setParameters,
54  "I_ref"_a, "f_src"_a = -1)
56  .def_property("I_ref", createAttributeGetter<CPS::Complex>("I_ref"),
57  createAttributeSetter<CPS::Complex>("I_ref"))
58  .def_property("f_src", createAttributeGetter<CPS::Real>("f_src"),
59  createAttributeSetter<CPS::Real>("f_src"));
60 
62  std::shared_ptr<CPS::EMT::Ph1::VoltageSource>,
63  CPS::SimPowerComp<CPS::Real>>(mEMTPh1, "VoltageSource",
64  py::multiple_inheritance())
65  .def(py::init<std::string>())
66  .def(py::init<std::string, CPS::Logger::Level>())
67  .def("set_parameters", &CPS::EMT::Ph1::VoltageSource::setParameters,
68  "V_ref"_a, "f_src"_a = -1)
70  .def_property("V_ref", createAttributeGetter<CPS::Complex>("V_ref"),
71  createAttributeSetter<CPS::Complex>("V_ref"))
72  .def_property("f_src", createAttributeGetter<CPS::Real>("f_src"),
73  createAttributeSetter<CPS::Real>("f_src"));
74 
75  py::class_<CPS::EMT::Ph1::Resistor, std::shared_ptr<CPS::EMT::Ph1::Resistor>,
76  CPS::SimPowerComp<CPS::Real>>(mEMTPh1, "Resistor",
77  py::multiple_inheritance())
78  .def(py::init<std::string>())
79  .def(py::init<std::string, CPS::Logger::Level>())
80  .def("set_parameters", &CPS::EMT::Ph1::Resistor::setParameters, "R"_a)
81  .def("connect", &CPS::EMT::Ph1::Resistor::connect)
82  .def_property("R", createAttributeGetter<CPS::Real>("R"),
83  createAttributeSetter<CPS::Real>("R"));
84 
85  py::class_<CPS::EMT::Ph1::Capacitor,
86  std::shared_ptr<CPS::EMT::Ph1::Capacitor>,
87  CPS::SimPowerComp<CPS::Real>>(mEMTPh1, "Capacitor",
88  py::multiple_inheritance())
89  .def(py::init<std::string>())
90  .def(py::init<std::string, CPS::Logger::Level>())
91  .def("set_parameters", &CPS::EMT::Ph1::Capacitor::setParameters, "C"_a)
92  .def("connect", &CPS::EMT::Ph1::Capacitor::connect)
93  .def_property("C", createAttributeGetter<CPS::Real>("C"),
94  createAttributeSetter<CPS::Real>("C"));
95 
96  py::class_<CPS::EMT::Ph1::Inductor, std::shared_ptr<CPS::EMT::Ph1::Inductor>,
97  CPS::SimPowerComp<CPS::Real>>(mEMTPh1, "Inductor",
98  py::multiple_inheritance())
99  .def(py::init<std::string>())
100  .def(py::init<std::string, CPS::Logger::Level>())
101  .def("set_parameters", &CPS::EMT::Ph1::Inductor::setParameters, "L"_a)
102  .def("connect", &CPS::EMT::Ph1::Inductor::connect)
103  .def_property("L", createAttributeGetter<CPS::Real>("L"),
104  createAttributeSetter<CPS::Real>("L"));
105 
106  py::class_<CPS::EMT::Ph1::Switch, std::shared_ptr<CPS::EMT::Ph1::Switch>,
108  mEMTPh1, "Switch", py::multiple_inheritance())
109  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
110  "loglevel"_a = CPS::Logger::Level::off)
111  .def("set_parameters", &CPS::EMT::Ph1::Switch::setParameters,
112  "open_resistance"_a, "closed_resistance"_a,
113  "closed"_a = false) // cppcheck-suppress assignBoolToPointer
114  .def("open", &CPS::EMT::Ph1::Switch::open)
115  .def("close", &CPS::EMT::Ph1::Switch::close)
116  .def("connect", &CPS::EMT::Ph1::Switch::connect);
117 }
118 
119 void addEMTPh3Components(py::module_ mEMTPh3) {
120  py::class_<CPS::EMT::Ph3::VoltageSource,
121  std::shared_ptr<CPS::EMT::Ph3::VoltageSource>,
122  CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "VoltageSource",
123  py::multiple_inheritance())
124  .def(py::init<std::string>())
125  .def(py::init<std::string, CPS::Logger::Level>())
126  .def("set_parameters",
127  py::overload_cast<CPS::MatrixComp, CPS::Real>(
129  "V_ref"_a, "f_src"_a = 50)
130  .def("connect", &CPS::EMT::Ph3::VoltageSource::connect)
131  .def_property("V_ref", createAttributeGetter<CPS::MatrixComp>("V_ref"),
132  createAttributeSetter<CPS::MatrixComp>("V_ref"))
133  .def_property("f_src", createAttributeGetter<CPS::Real>("f_src"),
134  createAttributeSetter<CPS::Real>("f_src"));
135 
136  py::class_<CPS::EMT::Ph3::CurrentSource,
137  std::shared_ptr<CPS::EMT::Ph3::CurrentSource>,
138  CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "CurrentSource",
139  py::multiple_inheritance())
140  .def(py::init<std::string>())
141  .def(py::init<std::string, CPS::Logger::Level>())
142  .def("set_parameters",
143  py::overload_cast<CPS::MatrixComp, CPS::Real>(
145  "I_ref"_a, "f_src"_a = 50)
146  .def("connect", &CPS::EMT::Ph3::VoltageSource::connect)
147  .def_property("I_ref", createAttributeGetter<CPS::MatrixComp>("I_ref"),
148  createAttributeSetter<CPS::MatrixComp>("V_ref"))
149  .def_property("f_src", createAttributeGetter<CPS::Real>("f_src"),
150  createAttributeSetter<CPS::Real>("f_src"));
151 
152  py::class_<CPS::EMT::Ph3::Resistor, std::shared_ptr<CPS::EMT::Ph3::Resistor>,
153  CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "Resistor",
154  py::multiple_inheritance())
155  .def(py::init<std::string>())
156  .def(py::init<std::string, CPS::Logger::Level>())
157  .def("set_parameters", &CPS::EMT::Ph3::Resistor::setParameters, "R"_a)
158  .def("connect", &CPS::EMT::Ph3::Resistor::connect);
159 
160  py::class_<CPS::EMT::Ph3::Capacitor,
161  std::shared_ptr<CPS::EMT::Ph3::Capacitor>,
162  CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "Capacitor",
163  py::multiple_inheritance())
164  .def(py::init<std::string>())
165  .def(py::init<std::string, CPS::Logger::Level>())
166  .def("set_parameters", &CPS::EMT::Ph3::Capacitor::setParameters, "C"_a)
167  .def("connect", &CPS::EMT::Ph3::Capacitor::connect);
168 
169  py::class_<CPS::EMT::Ph3::Inductor, std::shared_ptr<CPS::EMT::Ph3::Inductor>,
170  CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "Inductor",
171  py::multiple_inheritance())
172  .def(py::init<std::string>())
173  .def(py::init<std::string, CPS::Logger::Level>())
174  .def("set_parameters", &CPS::EMT::Ph3::Inductor::setParameters, "L"_a)
175  .def("connect", &CPS::EMT::Ph3::Inductor::connect);
176 
178  std::shared_ptr<CPS::EMT::Ph3::NetworkInjection>,
179  CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "NetworkInjection",
180  py::multiple_inheritance())
181  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
182  "loglevel"_a = CPS::Logger::Level::off)
183  .def("set_parameters",
184  py::overload_cast<CPS::MatrixComp, CPS::Real>(
186  "V_ref"_a, "f_src"_a = 50)
188 
189  py::class_<CPS::EMT::Ph3::PiLine, std::shared_ptr<CPS::EMT::Ph3::PiLine>,
190  CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "PiLine",
191  py::multiple_inheritance())
192  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
193  "loglevel"_a = CPS::Logger::Level::off)
194  .def("set_parameters", &CPS::EMT::Ph3::PiLine::setParameters,
195  "series_resistance"_a, "series_inductance"_a,
196  "parallel_capacitance"_a = zeroMatrix(3),
197  "parallel_conductance"_a = zeroMatrix(3))
198  .def("connect", &CPS::EMT::Ph3::PiLine::connect);
199 
200  py::class_<CPS::EMT::Ph3::RXLoad, std::shared_ptr<CPS::EMT::Ph3::RXLoad>,
201  CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "RXLoad",
202  py::multiple_inheritance())
203  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
204  "loglevel"_a = CPS::Logger::Level::off)
205  .def("set_parameters", &CPS::EMT::Ph3::RXLoad::setParameters,
206  "active_power"_a, "reactive_power"_a, "volt"_a)
207  .def("connect", &CPS::EMT::Ph3::RXLoad::connect);
208 
209  py::class_<CPS::EMT::Ph3::Switch, std::shared_ptr<CPS::EMT::Ph3::Switch>,
211  mEMTPh3, "Switch", py::multiple_inheritance())
212  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
213  "loglevel"_a = CPS::Logger::Level::off)
214  .def("set_parameters", &CPS::EMT::Ph3::Switch::setParameters,
215  "open_resistance"_a, "closed_resistance"_a,
216  // cppcheck-suppress assignBoolToPointer
217  "closed"_a = false)
218  .def("open", &CPS::EMT::Ph3::Switch::openSwitch)
219  .def("close", &CPS::EMT::Ph3::Switch::closeSwitch)
220  .def("connect", &CPS::EMT::Ph3::Switch::connect);
221 
223  std::shared_ptr<CPS::EMT::Ph3::SynchronGeneratorDQTrapez>,
224  CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "SynchronGeneratorDQTrapez",
225  py::multiple_inheritance())
226  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
227  "loglevel"_a = CPS::Logger::Level::off)
228  .def("set_parameters_operational_per_unit",
230  setParametersOperationalPerUnit,
231  "nom_power"_a, "nom_volt"_a, "nom_freq"_a, "pole_number"_a,
232  "nom_field_cur"_a, "Rs"_a, "Ld"_a, "Lq"_a, "Ld_t"_a, "Lq_t"_a,
233  "Ld_s"_a, "Lq_s"_a, "Ll"_a, "Td0_t"_a, "Tq0_t"_a, "Td0_s"_a,
234  "Tq0_s"_a, "inertia"_a)
235  .def("set_parameters_fundamental_per_unit",
237  setParametersFundamentalPerUnit,
238  "nom_power"_a, "nom_volt"_a, "nom_freq"_a, "pole_number"_a,
239  "nom_field_cur"_a, "Rs"_a, "Ll"_a, "Lmd"_a, "Lmq"_a, "Rfd"_a,
240  "Llfd"_a, "Rkd"_a, "Llkd"_a, "Rkq1"_a, "Llkq1"_a, "Rkq2"_a,
241  "Llkq2"_a, "inertia"_a, "init_active_power"_a,
242  "init_reactive_power"_a, "init_terminal_volt"_a, "init_volt_angle"_a,
243  "init_mech_power"_a)
244  .def("apply_parameters_from_json",
245  [](std::shared_ptr<CPS::EMT::Ph3::SynchronGeneratorDQTrapez> syngen,
246  const CPS::String json) {
247  DPsim::Utils::applySynchronousGeneratorParametersFromJson(
248  json::parse(json), syngen);
249  })
250  .def("set_initial_values",
252  "init_active_power"_a, "init_reactive_power"_a,
253  "init_terminal_volt"_a, "init_volt_angle"_a, "init_mech_power"_a);
254 
256  std::shared_ptr<CPS::EMT::Ph3::ReducedOrderSynchronGeneratorVBR>,
258  mEMTPh3, "ReducedOrderSynchronGeneratorVBR", py::multiple_inheritance());
259 
261  std::shared_ptr<CPS::EMT::Ph3::SynchronGenerator3OrderVBR>,
263  mEMTPh3, "SynchronGenerator3OrderVBR", py::multiple_inheritance())
264  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
265  "loglevel"_a = CPS::Logger::Level::off)
266  .def("set_operational_parameters_per_unit",
267  py::overload_cast<CPS::Real, CPS::Real, CPS::Real, CPS::Real,
268  CPS::Real, CPS::Real, CPS::Real, CPS::Real,
269  CPS::Real>(
271  setOperationalParametersPerUnit),
272  "nom_power"_a, "nom_voltage"_a, "nom_frequency"_a, "H"_a, "Ld"_a,
273  "Lq"_a, "L0"_a, "Ld_t"_a, "Td0_t"_a)
275 
277  std::shared_ptr<CPS::EMT::Ph3::SynchronGenerator4OrderVBR>,
279  mEMTPh3, "SynchronGenerator4OrderVBR", py::multiple_inheritance())
280  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
281  "loglevel"_a = CPS::Logger::Level::off)
282  .def("set_operational_parameters_per_unit",
283  py::overload_cast<CPS::Real, CPS::Real, CPS::Real, CPS::Real,
284  CPS::Real, CPS::Real, CPS::Real, CPS::Real,
285  CPS::Real, CPS::Real, CPS::Real>(
287  setOperationalParametersPerUnit),
288  "nom_power"_a, "nom_voltage"_a, "nom_frequency"_a, "H"_a, "Ld"_a,
289  "Lq"_a, "L0"_a, "Ld_t"_a, "Lq_t"_a, "Td0_t"_a, "Tq0_t"_a)
291 
293  std::shared_ptr<CPS::EMT::Ph3::SynchronGenerator5OrderVBR>,
295  mEMTPh3, "SynchronGenerator5OrderVBR", py::multiple_inheritance())
296  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
297  "loglevel"_a = CPS::Logger::Level::off)
298  .def("set_operational_parameters_per_unit",
299  py::overload_cast<CPS::Real, CPS::Real, CPS::Real, CPS::Real,
300  CPS::Real, CPS::Real, CPS::Real, CPS::Real,
301  CPS::Real, CPS::Real, CPS::Real, CPS::Real,
302  CPS::Real, CPS::Real, CPS::Real, CPS::Real>(
304  setOperationalParametersPerUnit),
305  "nom_power"_a, "nom_voltage"_a, "nom_frequency"_a, "H"_a, "Ld"_a,
306  "Lq"_a, "L0"_a, "Ld_t"_a, "Lq_t"_a, "Td0_t"_a, "Tq0_t"_a, "Ld_s"_a,
307  "Lq_s"_a, "Td0_s"_a, "Tq0_s"_a, "Taa"_a)
309 
311  std::shared_ptr<CPS::EMT::Ph3::SynchronGenerator6aOrderVBR>,
313  mEMTPh3, "SynchronGenerator6aOrderVBR", py::multiple_inheritance())
314  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
315  "loglevel"_a = CPS::Logger::Level::off)
316  .def("set_operational_parameters_per_unit",
317  py::overload_cast<CPS::Real, CPS::Real, CPS::Real, CPS::Real,
318  CPS::Real, CPS::Real, CPS::Real, CPS::Real,
319  CPS::Real, CPS::Real, CPS::Real, CPS::Real,
320  CPS::Real, CPS::Real, CPS::Real, CPS::Real>(
322  setOperationalParametersPerUnit),
323  "nom_power"_a, "nom_voltage"_a, "nom_frequency"_a, "H"_a, "Ld"_a,
324  "Lq"_a, "L0"_a, "Ld_t"_a, "Lq_t"_a, "Td0_t"_a, "Tq0_t"_a, "Ld_s"_a,
325  "Lq_s"_a, "Td0_s"_a, "Tq0_s"_a, "Taa"_a)
327 
329  std::shared_ptr<CPS::EMT::Ph3::SynchronGenerator6bOrderVBR>,
331  mEMTPh3, "SynchronGenerator6bOrderVBR", py::multiple_inheritance())
332  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
333  "loglevel"_a = CPS::Logger::Level::off)
334  .def("set_operational_parameters_per_unit",
335  py::overload_cast<CPS::Real, CPS::Real, CPS::Real, CPS::Real,
336  CPS::Real, CPS::Real, CPS::Real, CPS::Real,
337  CPS::Real, CPS::Real, CPS::Real, CPS::Real,
338  CPS::Real, CPS::Real, CPS::Real, CPS::Real>(
340  setOperationalParametersPerUnit),
341  "nom_power"_a, "nom_voltage"_a, "nom_frequency"_a, "H"_a, "Ld"_a,
342  "Lq"_a, "L0"_a, "Ld_t"_a, "Lq_t"_a, "Td0_t"_a, "Tq0_t"_a, "Ld_s"_a,
343  "Lq_s"_a, "Td0_s"_a, "Tq0_s"_a, "Taa"_a = 0)
345 
346 #ifdef WITH_SUNDIALS
347 
349  std::shared_ptr<CPS::EMT::Ph3::SynchronGeneratorDQODE>,
350  CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "SynchronGeneratorDQODE",
351  py::multiple_inheritance())
352  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
353  "loglevel"_a = CPS::Logger::Level::off)
354  .def("set_parameters_operational_per_unit",
356  setParametersOperationalPerUnit,
357  "nom_power"_a, "nom_volt"_a, "nom_freq"_a, "pole_number"_a,
358  "nom_field_cur"_a, "Rs"_a, "Ld"_a, "Lq"_a, "Ld_t"_a, "Lq_t"_a,
359  "Ld_s"_a, "Lq_s"_a, "Ll"_a, "Td0_t"_a, "Tq0_t"_a, "Td0_s"_a,
360  "Tq0_s"_a, "inertia"_a)
361  .def("set_parameters_fundamental_per_unit",
363  setParametersFundamentalPerUnit,
364  "nom_power"_a, "nom_volt"_a, "nom_freq"_a, "pole_number"_a,
365  "nom_field_cur"_a, "Rs"_a, "Ll"_a, "Lmd"_a, "Lmq"_a, "Rfd"_a,
366  "Llfd"_a, "Rkd"_a, "Llkd"_a, "Rkq1"_a, "Llkq1"_a, "Rkq2"_a,
367  "Llkq2"_a, "inertia"_a, "init_active_power"_a,
368  "init_reactive_power"_a, "init_terminal_volt"_a, "init_volt_angle"_a,
369  "init_mech_power"_a)
370  .def("apply_parameters_from_json",
371  [](std::shared_ptr<CPS::EMT::Ph3::SynchronGeneratorDQODE> syngen,
372  const CPS::String json) {
373  DPsim::Utils::applySynchronousGeneratorParametersFromJson(
374  json::parse(json), syngen);
375  })
376  .def("set_initial_values",
378  "init_active_power"_a, "init_reactive_power"_a,
379  "init_terminal_volt"_a, "init_volt_angle"_a, "init_mech_power"_a);
380 
381 #endif
382 
384  std::shared_ptr<CPS::EMT::Ph3::AvVoltageSourceInverterDQ>,
385  CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "AvVoltageSourceInverterDQ",
386  py::multiple_inheritance())
387  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
388  "loglevel"_a = CPS::Logger::Level::off)
389  .def(py::init<std::string, std::string, CPS::Logger::Level, CPS::Bool>(),
390  "uid"_a, "name"_a, "loglevel"_a = CPS::Logger::Level::off,
391  // cppcheck-suppress assignBoolToPointer
392  "with_trafo"_a = false)
393  .def("set_parameters",
395  "sys_omega"_a, "sys_volt_nom"_a, "p_ref"_a, "q_ref"_a)
396  .def("set_filter_parameters",
398  "Lf"_a, "Cf"_a, "Rf"_a, "Rc"_a)
399  .def("set_controller_parameters",
401  "Kp_pll"_a, "Ki_pll"_a, "Kp_power_ctrl"_a, "Ki_power_ctrl"_a,
402  "Kp_curr_ctrl"_a, "Ki_curr_ctrl"_a, "omega_cutoff"_a)
403  .def("set_transformer_parameters",
405  "nom_voltage_end_1"_a, "nom_voltage_end_2"_a, "rated_power"_a,
406  "ratio_abs"_a, "ratio_phase"_a, "resistance"_a, "inductance"_a,
407  "omega"_a)
408  .def("set_initial_state_values",
410  "p_init"_a, "q_init"_a, "phi_d_init"_a, "phi_q_init"_a,
411  "gamma_d_init"_a, "gamma_q_init"_a)
412  .def("with_control",
413  &CPS::EMT::Ph3::AvVoltageSourceInverterDQ::withControl)
415 
416  py::class_<CPS::EMT::Ph3::Transformer,
417  std::shared_ptr<CPS::EMT::Ph3::Transformer>,
418  CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "Transformer",
419  py::multiple_inheritance())
420  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
421  "loglevel"_a = CPS::Logger::Level::off)
422  .def(py::init<std::string, std::string, CPS::Logger::Level, CPS::Bool>(),
423  "uid"_a, "name"_a, "loglevel"_a = CPS::Logger::Level::off,
424  // cppcheck-suppress assignBoolToPointer
425  "with_resistive_losses"_a = false)
426  .def("set_parameters", &CPS::EMT::Ph3::Transformer::setParameters,
427  "nom_voltage_end_1"_a, "nom_voltage_end_2"_a, "rated_power"_a,
428  "ratio_abs"_a, "ratio_phase"_a, "resistance"_a, "inductance"_a)
429  .def("connect", &CPS::EMT::Ph3::Transformer::connect);
430 
432  std::shared_ptr<CPS::EMT::Ph3::SeriesResistor>,
433  CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "SeriesResistor",
434  py::multiple_inheritance())
435  .def(py::init<std::string>())
436  .def(py::init<std::string, CPS::Logger::Level>())
437  .def("set_parameters", &CPS::EMT::Ph3::SeriesResistor::setParameters,
438  "R"_a)
439  .def("connect", &CPS::EMT::Ph3::SeriesResistor::connect);
440 
441  py::class_<CPS::EMT::Ph3::SeriesSwitch,
442  std::shared_ptr<CPS::EMT::Ph3::SeriesSwitch>,
444  mEMTPh3, "SeriesSwitch", py::multiple_inheritance())
445  .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
446  "loglevel"_a = CPS::Logger::Level::off)
447  .def("set_parameters", &CPS::EMT::Ph3::SeriesSwitch::setParameters,
448  "open_resistance"_a, "closed_resistance"_a,
449  // cppcheck-suppress assignBoolToPointer
450  "closed"_a = false)
451  .def("open", &CPS::EMT::Ph3::SeriesSwitch::open)
452  .def("close", &CPS::EMT::Ph3::SeriesSwitch::close)
453  .def("connect", &CPS::EMT::Ph3::SeriesSwitch::connect);
454 
456  std::shared_ptr<CPS::EMT::Ph3::SSN::Full_Serial_RLC>,
457  CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "Full_Serial_RLC",
458  py::multiple_inheritance())
459  .def(py::init<std::string>())
460  .def(py::init<std::string, CPS::Logger::Level>())
461  .def("set_parameters",
462  &CPS::EMT::Ph3::SSN::Full_Serial_RLC::setParameters, "R"_a, "L"_a,
463  "C"_a)
465  .def_property("R", createAttributeGetter<CPS::Real>("R"),
466  createAttributeSetter<CPS::Real>("R"))
467  .def_property("L", createAttributeGetter<CPS::Real>("L"),
468  createAttributeSetter<CPS::Real>("L"))
469  .def_property("C", createAttributeGetter<CPS::Real>("C"),
470  createAttributeSetter<CPS::Real>("C"));
471 }
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(Matrix capacitance)
Sets model specific parameters.
void setParameters(Matrix inductance)
Sets model specific parameters.
void setParameters(Matrix resistance)
Sets model specific parameters.
Dynamic Phasor Three-Phase Switch.
Ideal current source model.
Ideal Voltage source model.
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, Real omega)
Setter for parameters of transformer.
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 setFilterParameters(Real Lf, Real Cf, Real Rf, Real Rc)
Setter for parameters of filter.
void setParameters(Real sysOmega, Real sysVoltNom, Real Pref, Real Qref)
Setter for gengit eral parameters of inverter.
Ideal current source model.
void setParameters(MatrixComp currentRef, Real srcFreq=50.0)
Setter for reference current.
void setParameters(MatrixComp voltageRef, Real srcFreq=50.0)
Setter for reference voltage parameters.
Base class for EMT VBR simplefied synchronous generator models.
EMT three-phase switch.
Voltage-Behind-Reactance (VBR) implementation of 3rd order synchronous generator model.
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...
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...
void setInitialValues(Real initActivePower, Real initReactivePower, Real initTerminalVolt, Real initVoltAngle, Real initMechPower)
Initialize states according to desired initial electrical powerflow and mechanical input power.
Transformer that includes an inductance and resistance.
void setParameters(Real nomVoltageEnd1, Real nomVoltageEnd2, Real ratedPower, Real ratioAbs, Real ratioPhase, Matrix resistance, Matrix inductance)
Defines component parameters.
Ideal Voltage source model.
void setParameters(MatrixComp voltageRef, Real srcFreq=50.0)
Setter for reference voltage and frequency with a sine wave generator.
Base class for all components that are transmitting power.
Definition: SimPowerComp.h:17
void connect(typename SimNode< Real >::List nodes)
Sets all nodes and checks for nominal number of Nodes for this Component.