DPsim
Loading...
Searching...
No Matches
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#ifdef WITH_JSON
18#include <nlohmann/json.hpp>
19using json = nlohmann::json;
20#endif
21
22namespace py = pybind11;
23using namespace pybind11::literals;
24
25void addEMTComponents(py::module_ mEMT) {
26 py::class_<CPS::EMT::SimNode, std::shared_ptr<CPS::EMT::SimNode>,
27 CPS::TopologicalNode>(mEMT, "SimNode", py::module_local())
28 .def(py::init<std::string>())
29 .def(py::init<std::string, CPS::PhaseType>())
30 .def(py::init<std::string, CPS::PhaseType,
31 const std::vector<CPS::Complex>>())
32 .def("set_initial_voltage",
33 py::overload_cast<CPS::MatrixComp>(
34 &CPS::EMT::SimNode::setInitialVoltage, py::const_))
35 .def("set_initial_voltage",
36 py::overload_cast<CPS::Complex>(
37 &CPS::EMT::SimNode::setInitialVoltage, py::const_))
38 .def("set_initial_voltage",
39 py::overload_cast<CPS::Complex, int>(
40 &CPS::EMT::SimNode::setInitialVoltage, py::const_))
41 .def_readonly_static("gnd", &CPS::EMT::SimNode::GND);
42
43 py::module mEMTPh1 = mEMT.def_submodule(
44 "ph1", "single phase electromagnetic-transient models");
45 addEMTPh1Components(mEMTPh1);
46 py::module mEMTPh3 =
47 mEMT.def_submodule("ph3", "three phase electromagnetic-transient models");
48 addEMTPh3Components(mEMTPh3);
49}
50
51void addEMTPh1Components(py::module_ mEMTPh1) {
53 std::shared_ptr<CPS::EMT::Ph1::CurrentSource>,
54 CPS::SimPowerComp<CPS::Real>>(mEMTPh1, "CurrentSource",
55 py::multiple_inheritance())
56 .def(py::init<std::string>())
57 .def(py::init<std::string, CPS::Logger::Level>())
58 .def("set_parameters", &CPS::EMT::Ph1::CurrentSource::setParameters,
59 "I_ref"_a, "f_src"_a = -1)
61 .def_property("I_ref", createAttributeGetter<CPS::Complex>("I_ref"),
62 createAttributeSetter<CPS::Complex>("I_ref"))
63 .def_property("f_src", createAttributeGetter<CPS::Real>("f_src"),
64 createAttributeSetter<CPS::Real>("f_src"));
65
67 std::shared_ptr<CPS::EMT::Ph1::VoltageSource>,
68 CPS::SimPowerComp<CPS::Real>>(mEMTPh1, "VoltageSource",
69 py::multiple_inheritance())
70 .def(py::init<std::string>())
71 .def(py::init<std::string, CPS::Logger::Level>())
72 .def("set_parameters", &CPS::EMT::Ph1::VoltageSource::setParameters,
73 "V_ref"_a, "f_src"_a = -1)
75 .def_property("V_ref", createAttributeGetter<CPS::Complex>("V_ref"),
76 createAttributeSetter<CPS::Complex>("V_ref"))
77 .def_property("f_src", createAttributeGetter<CPS::Real>("f_src"),
78 createAttributeSetter<CPS::Real>("f_src"));
79
80 py::class_<CPS::EMT::Ph1::Resistor, std::shared_ptr<CPS::EMT::Ph1::Resistor>,
81 CPS::SimPowerComp<CPS::Real>>(mEMTPh1, "Resistor",
82 py::multiple_inheritance())
83 .def(py::init<std::string>())
84 .def(py::init<std::string, CPS::Logger::Level>())
85 .def("set_parameters", &CPS::EMT::Ph1::Resistor::setParameters, "R"_a)
86 .def("connect", &CPS::EMT::Ph1::Resistor::connect)
87 .def_property("R", createAttributeGetter<CPS::Real>("R"),
88 createAttributeSetter<CPS::Real>("R"));
89
90 py::class_<CPS::EMT::Ph1::Capacitor,
91 std::shared_ptr<CPS::EMT::Ph1::Capacitor>,
92 CPS::SimPowerComp<CPS::Real>>(mEMTPh1, "Capacitor",
93 py::multiple_inheritance())
94 .def(py::init<std::string>())
95 .def(py::init<std::string, CPS::Logger::Level>())
96 .def("set_parameters", &CPS::EMT::Ph1::Capacitor::setParameters, "C"_a)
97 .def("connect", &CPS::EMT::Ph1::Capacitor::connect)
98 .def_property("C", createAttributeGetter<CPS::Real>("C"),
99 createAttributeSetter<CPS::Real>("C"));
100
101 py::class_<CPS::EMT::Ph1::Inductor, std::shared_ptr<CPS::EMT::Ph1::Inductor>,
102 CPS::SimPowerComp<CPS::Real>>(mEMTPh1, "Inductor",
103 py::multiple_inheritance())
104 .def(py::init<std::string>())
105 .def(py::init<std::string, CPS::Logger::Level>())
106 .def("set_parameters", &CPS::EMT::Ph1::Inductor::setParameters, "L"_a)
107 .def("connect", &CPS::EMT::Ph1::Inductor::connect)
108 .def_property("L", createAttributeGetter<CPS::Real>("L"),
109 createAttributeSetter<CPS::Real>("L"));
110
111 py::class_<CPS::EMT::Ph1::Switch, std::shared_ptr<CPS::EMT::Ph1::Switch>,
113 mEMTPh1, "Switch", py::multiple_inheritance())
114 .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
115 "loglevel"_a = CPS::Logger::Level::off)
116 .def("set_parameters", &CPS::EMT::Ph1::Switch::setParameters,
117 "open_resistance"_a, "closed_resistance"_a,
118 "closed"_a = false) // cppcheck-suppress assignBoolToPointer
119 .def("open", &CPS::EMT::Ph1::Switch::open)
120 .def("close", &CPS::EMT::Ph1::Switch::close)
121 .def("connect", &CPS::EMT::Ph1::Switch::connect);
122}
123
124void addEMTPh3Components(py::module_ mEMTPh3) {
126 std::shared_ptr<CPS::EMT::Ph3::VoltageSource>,
127 CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "VoltageSource",
128 py::multiple_inheritance())
129 .def(py::init<std::string>())
130 .def(py::init<std::string, CPS::Logger::Level>())
131 .def("set_parameters",
132 py::overload_cast<CPS::MatrixComp, CPS::Real>(
134 "V_ref"_a, "f_src"_a = 50)
136 .def_property("V_ref", createAttributeGetter<CPS::MatrixComp>("V_ref"),
137 createAttributeSetter<CPS::MatrixComp>("V_ref"))
138 .def_property("f_src", createAttributeGetter<CPS::Real>("f_src"),
139 createAttributeSetter<CPS::Real>("f_src"));
140
142 std::shared_ptr<CPS::EMT::Ph3::ControlledVoltageSource>,
143 CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "ControlledVoltageSource",
144 py::multiple_inheritance())
145 .def(py::init<std::string>())
146 .def(py::init<std::string, CPS::Logger::Level>())
147 .def("set_parameters",
148 py::overload_cast<CPS::Matrix>(
150 "V_ref"_a)
152 .def_property("V_ref", createAttributeGetter<CPS::MatrixComp>("V_ref"),
153 createAttributeSetter<CPS::MatrixComp>("V_ref"));
154
156 std::shared_ptr<CPS::EMT::Ph3::CurrentSource>,
157 CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "CurrentSource",
158 py::multiple_inheritance())
159 .def(py::init<std::string>())
160 .def(py::init<std::string, CPS::Logger::Level>())
161 .def("set_parameters",
162 py::overload_cast<CPS::MatrixComp, CPS::Real>(
164 "I_ref"_a, "f_src"_a = 50)
166 .def_property("I_ref", createAttributeGetter<CPS::MatrixComp>("I_ref"),
167 createAttributeSetter<CPS::MatrixComp>("V_ref"))
168 .def_property("f_src", createAttributeGetter<CPS::Real>("f_src"),
169 createAttributeSetter<CPS::Real>("f_src"));
170
171 py::class_<CPS::EMT::Ph3::Resistor, std::shared_ptr<CPS::EMT::Ph3::Resistor>,
172 CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "Resistor",
173 py::multiple_inheritance())
174 .def(py::init<std::string>())
175 .def(py::init<std::string, CPS::Logger::Level>())
176 .def("set_parameters", &CPS::EMT::Ph3::Resistor::setParameters, "R"_a)
177 .def("connect", &CPS::EMT::Ph3::Resistor::connect);
178
179 py::class_<CPS::EMT::Ph3::Capacitor,
180 std::shared_ptr<CPS::EMT::Ph3::Capacitor>,
181 CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "Capacitor",
182 py::multiple_inheritance())
183 .def(py::init<std::string>())
184 .def(py::init<std::string, CPS::Logger::Level>())
185 .def("set_parameters", &CPS::EMT::Ph3::Capacitor::setParameters, "C"_a)
186 .def("connect", &CPS::EMT::Ph3::Capacitor::connect);
187
188 py::class_<CPS::EMT::Ph3::Inductor, std::shared_ptr<CPS::EMT::Ph3::Inductor>,
189 CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "Inductor",
190 py::multiple_inheritance())
191 .def(py::init<std::string>())
192 .def(py::init<std::string, CPS::Logger::Level>())
193 .def("set_parameters", &CPS::EMT::Ph3::Inductor::setParameters, "L"_a)
194 .def("connect", &CPS::EMT::Ph3::Inductor::connect);
195
197 std::shared_ptr<CPS::EMT::Ph3::NetworkInjection>,
198 CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "NetworkInjection",
199 py::multiple_inheritance())
200 .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
201 "loglevel"_a = CPS::Logger::Level::off)
202 .def("set_parameters",
203 py::overload_cast<CPS::MatrixComp, CPS::Real>(
205 "V_ref"_a, "f_src"_a = 50)
207
208 py::class_<CPS::EMT::Ph3::PiLine, std::shared_ptr<CPS::EMT::Ph3::PiLine>,
209 CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "PiLine",
210 py::multiple_inheritance())
211 .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
212 "loglevel"_a = CPS::Logger::Level::off)
213 .def("set_parameters", &CPS::EMT::Ph3::PiLine::setParameters,
214 "series_resistance"_a, "series_inductance"_a,
215 "parallel_capacitance"_a = zeroMatrix(3),
216 "parallel_conductance"_a = zeroMatrix(3))
217 .def("connect", &CPS::EMT::Ph3::PiLine::connect);
218
219 py::class_<CPS::EMT::Ph3::RXLoad, std::shared_ptr<CPS::EMT::Ph3::RXLoad>,
220 CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "RXLoad",
221 py::multiple_inheritance())
222 .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
223 "loglevel"_a = CPS::Logger::Level::off)
224 .def("set_parameters", &CPS::EMT::Ph3::RXLoad::setParameters,
225 "active_power"_a, "reactive_power"_a, "volt"_a,
226 // cppcheck-suppress assignBoolToPointer
227 "reactance_in_series"_a = false)
228 .def("connect", &CPS::EMT::Ph3::RXLoad::connect);
229
230 py::class_<CPS::EMT::Ph3::Switch, std::shared_ptr<CPS::EMT::Ph3::Switch>,
232 mEMTPh3, "Switch", py::multiple_inheritance())
233 .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
234 "loglevel"_a = CPS::Logger::Level::off)
235 .def("set_parameters", &CPS::EMT::Ph3::Switch::setParameters,
236 "open_resistance"_a, "closed_resistance"_a,
237 // cppcheck-suppress assignBoolToPointer
238 "closed"_a = false)
239 .def("open", &CPS::EMT::Ph3::Switch::openSwitch)
240 .def("close", &CPS::EMT::Ph3::Switch::closeSwitch)
241 .def("connect", &CPS::EMT::Ph3::Switch::connect);
242
244 std::shared_ptr<CPS::EMT::Ph3::SynchronGeneratorDQTrapez>,
245 CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "SynchronGeneratorDQTrapez",
246 py::multiple_inheritance())
247 .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
248 "loglevel"_a = CPS::Logger::Level::off)
249 .def("set_parameters_operational_per_unit",
251 setParametersOperationalPerUnit,
252 "nom_power"_a, "nom_volt"_a, "nom_freq"_a, "pole_number"_a,
253 "nom_field_cur"_a, "Rs"_a, "Ld"_a, "Lq"_a, "Ld_t"_a, "Lq_t"_a,
254 "Ld_s"_a, "Lq_s"_a, "Ll"_a, "Td0_t"_a, "Tq0_t"_a, "Td0_s"_a,
255 "Tq0_s"_a, "inertia"_a)
256 .def("set_parameters_fundamental_per_unit",
258 setParametersFundamentalPerUnit,
259 "nom_power"_a, "nom_volt"_a, "nom_freq"_a, "pole_number"_a,
260 "nom_field_cur"_a, "Rs"_a, "Ll"_a, "Lmd"_a, "Lmq"_a, "Rfd"_a,
261 "Llfd"_a, "Rkd"_a, "Llkd"_a, "Rkq1"_a, "Llkq1"_a, "Rkq2"_a,
262 "Llkq2"_a, "inertia"_a, "init_active_power"_a,
263 "init_reactive_power"_a, "init_terminal_volt"_a, "init_volt_angle"_a,
264 "init_mech_power"_a)
265#ifdef WITH_JSON
266 .def("apply_parameters_from_json",
267 [](std::shared_ptr<CPS::EMT::Ph3::SynchronGeneratorDQTrapez> syngen,
268 const CPS::String json) {
269 DPsim::Utils::applySynchronousGeneratorParametersFromJson(
270 json::parse(json), syngen);
271 })
272#endif
273 .def("set_initial_values",
274 &CPS::EMT::Ph3::SynchronGeneratorDQTrapez::setInitialValues,
275 "init_active_power"_a, "init_reactive_power"_a,
276 "init_terminal_volt"_a, "init_volt_angle"_a, "init_mech_power"_a);
277
279 std::shared_ptr<CPS::EMT::Ph3::ReducedOrderSynchronGeneratorVBR>,
281 mEMTPh3, "ReducedOrderSynchronGeneratorVBR", py::multiple_inheritance());
282
284 std::shared_ptr<CPS::EMT::Ph3::SynchronGenerator3OrderVBR>,
286 mEMTPh3, "SynchronGenerator3OrderVBR", py::multiple_inheritance())
287 .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
288 "loglevel"_a = CPS::Logger::Level::off)
289 .def("set_operational_parameters_per_unit",
290 py::overload_cast<CPS::Real, CPS::Real, CPS::Real, CPS::Real,
291 CPS::Real, CPS::Real, CPS::Real, CPS::Real,
292 CPS::Real>(
294 setOperationalParametersPerUnit),
295 "nom_power"_a, "nom_voltage"_a, "nom_frequency"_a, "H"_a, "Ld"_a,
296 "Lq"_a, "L0"_a, "Ld_t"_a, "Td0_t"_a)
298
300 std::shared_ptr<CPS::EMT::Ph3::SynchronGenerator4OrderVBR>,
302 mEMTPh3, "SynchronGenerator4OrderVBR", py::multiple_inheritance())
303 .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
304 "loglevel"_a = CPS::Logger::Level::off)
305 .def("set_operational_parameters_per_unit",
306 py::overload_cast<CPS::Real, CPS::Real, CPS::Real, CPS::Real,
307 CPS::Real, CPS::Real, CPS::Real, CPS::Real,
308 CPS::Real, CPS::Real, CPS::Real>(
310 setOperationalParametersPerUnit),
311 "nom_power"_a, "nom_voltage"_a, "nom_frequency"_a, "H"_a, "Ld"_a,
312 "Lq"_a, "L0"_a, "Ld_t"_a, "Lq_t"_a, "Td0_t"_a, "Tq0_t"_a)
314
316 std::shared_ptr<CPS::EMT::Ph3::SynchronGenerator5OrderVBR>,
318 mEMTPh3, "SynchronGenerator5OrderVBR", py::multiple_inheritance())
319 .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
320 "loglevel"_a = CPS::Logger::Level::off)
321 .def("set_operational_parameters_per_unit",
322 py::overload_cast<CPS::Real, CPS::Real, CPS::Real, CPS::Real,
323 CPS::Real, CPS::Real, CPS::Real, CPS::Real,
324 CPS::Real, CPS::Real, CPS::Real, CPS::Real,
325 CPS::Real, CPS::Real, CPS::Real, CPS::Real>(
327 setOperationalParametersPerUnit),
328 "nom_power"_a, "nom_voltage"_a, "nom_frequency"_a, "H"_a, "Ld"_a,
329 "Lq"_a, "L0"_a, "Ld_t"_a, "Lq_t"_a, "Td0_t"_a, "Tq0_t"_a, "Ld_s"_a,
330 "Lq_s"_a, "Td0_s"_a, "Tq0_s"_a, "Taa"_a)
332
334 std::shared_ptr<CPS::EMT::Ph3::SynchronGenerator6aOrderVBR>,
336 mEMTPh3, "SynchronGenerator6aOrderVBR", py::multiple_inheritance())
337 .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
338 "loglevel"_a = CPS::Logger::Level::off)
339 .def("set_operational_parameters_per_unit",
340 py::overload_cast<CPS::Real, CPS::Real, CPS::Real, CPS::Real,
341 CPS::Real, CPS::Real, CPS::Real, CPS::Real,
342 CPS::Real, CPS::Real, CPS::Real, CPS::Real,
343 CPS::Real, CPS::Real, CPS::Real, CPS::Real>(
345 setOperationalParametersPerUnit),
346 "nom_power"_a, "nom_voltage"_a, "nom_frequency"_a, "H"_a, "Ld"_a,
347 "Lq"_a, "L0"_a, "Ld_t"_a, "Lq_t"_a, "Td0_t"_a, "Tq0_t"_a, "Ld_s"_a,
348 "Lq_s"_a, "Td0_s"_a, "Tq0_s"_a, "Taa"_a)
350
352 std::shared_ptr<CPS::EMT::Ph3::SynchronGenerator6bOrderVBR>,
354 mEMTPh3, "SynchronGenerator6bOrderVBR", py::multiple_inheritance())
355 .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
356 "loglevel"_a = CPS::Logger::Level::off)
357 .def("set_operational_parameters_per_unit",
358 py::overload_cast<CPS::Real, CPS::Real, CPS::Real, CPS::Real,
359 CPS::Real, CPS::Real, CPS::Real, CPS::Real,
360 CPS::Real, CPS::Real, CPS::Real, CPS::Real,
361 CPS::Real, CPS::Real, CPS::Real, CPS::Real>(
363 setOperationalParametersPerUnit),
364 "nom_power"_a, "nom_voltage"_a, "nom_frequency"_a, "H"_a, "Ld"_a,
365 "Lq"_a, "L0"_a, "Ld_t"_a, "Lq_t"_a, "Td0_t"_a, "Tq0_t"_a, "Ld_s"_a,
366 "Lq_s"_a, "Td0_s"_a, "Tq0_s"_a, "Taa"_a = 0)
368
369#ifdef WITH_SUNDIALS
370
372 std::shared_ptr<CPS::EMT::Ph3::SynchronGeneratorDQODE>,
373 CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "SynchronGeneratorDQODE",
374 py::multiple_inheritance())
375 .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
376 "loglevel"_a = CPS::Logger::Level::off)
377 .def("set_parameters_operational_per_unit",
379 setParametersOperationalPerUnit,
380 "nom_power"_a, "nom_volt"_a, "nom_freq"_a, "pole_number"_a,
381 "nom_field_cur"_a, "Rs"_a, "Ld"_a, "Lq"_a, "Ld_t"_a, "Lq_t"_a,
382 "Ld_s"_a, "Lq_s"_a, "Ll"_a, "Td0_t"_a, "Tq0_t"_a, "Td0_s"_a,
383 "Tq0_s"_a, "inertia"_a)
384 .def("set_parameters_fundamental_per_unit",
386 setParametersFundamentalPerUnit,
387 "nom_power"_a, "nom_volt"_a, "nom_freq"_a, "pole_number"_a,
388 "nom_field_cur"_a, "Rs"_a, "Ll"_a, "Lmd"_a, "Lmq"_a, "Rfd"_a,
389 "Llfd"_a, "Rkd"_a, "Llkd"_a, "Rkq1"_a, "Llkq1"_a, "Rkq2"_a,
390 "Llkq2"_a, "inertia"_a, "init_active_power"_a,
391 "init_reactive_power"_a, "init_terminal_volt"_a, "init_volt_angle"_a,
392 "init_mech_power"_a)
393#ifdef WITH_JSON
394 .def("apply_parameters_from_json",
395 [](std::shared_ptr<CPS::EMT::Ph3::SynchronGeneratorDQODE> syngen,
396 const CPS::String json) {
397 DPsim::Utils::applySynchronousGeneratorParametersFromJson(
398 json::parse(json), syngen);
399 })
400#endif
401 .def("set_initial_values",
402 &CPS::EMT::Ph3::SynchronGeneratorDQODE::setInitialValues,
403 "init_active_power"_a, "init_reactive_power"_a,
404 "init_terminal_volt"_a, "init_volt_angle"_a, "init_mech_power"_a);
405
406#endif
407
409 std::shared_ptr<CPS::EMT::Ph3::AvVoltageSourceInverterDQ>,
410 CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "AvVoltageSourceInverterDQ",
411 py::multiple_inheritance())
412 .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
413 "loglevel"_a = CPS::Logger::Level::off)
414 .def(py::init<std::string, std::string, CPS::Logger::Level, CPS::Bool>(),
415 "uid"_a, "name"_a, "loglevel"_a = CPS::Logger::Level::off,
416 // cppcheck-suppress assignBoolToPointer
417 "with_trafo"_a = false)
418 .def("set_parameters",
420 "sys_omega"_a, "sys_volt_nom"_a, "p_ref"_a, "q_ref"_a)
421 .def("set_filter_parameters",
423 "Lf"_a, "Cf"_a, "Rf"_a, "Rc"_a)
424 .def("set_controller_parameters",
426 "Kp_pll"_a, "Ki_pll"_a, "Kp_power_ctrl"_a, "Ki_power_ctrl"_a,
427 "Kp_curr_ctrl"_a, "Ki_curr_ctrl"_a, "omega_cutoff"_a)
428 .def("set_transformer_parameters",
430 "nom_voltage_end_1"_a, "nom_voltage_end_2"_a, "rated_power"_a,
431 "ratio_abs"_a, "ratio_phase"_a, "resistance"_a, "inductance"_a,
432 "omega"_a)
433 .def("set_initial_state_values",
435 "p_init"_a, "q_init"_a, "phi_d_init"_a, "phi_q_init"_a,
436 "gamma_d_init"_a, "gamma_q_init"_a)
437 .def("with_control",
438 &CPS::EMT::Ph3::AvVoltageSourceInverterDQ::withControl)
440
442 std::shared_ptr<CPS::EMT::Ph3::Transformer>,
443 CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "Transformer",
444 py::multiple_inheritance())
445 .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
446 "loglevel"_a = CPS::Logger::Level::off)
447 .def(py::init<std::string, std::string, CPS::Logger::Level, CPS::Bool>(),
448 "uid"_a, "name"_a, "loglevel"_a = CPS::Logger::Level::off,
449 // cppcheck-suppress assignBoolToPointer
450 "with_resistive_losses"_a = false)
451 .def("set_parameters", &CPS::EMT::Ph3::Transformer::setParameters,
452 "nom_voltage_end_1"_a, "nom_voltage_end_2"_a, "rated_power"_a,
453 "ratio_abs"_a, "ratio_phase"_a, "resistance"_a, "inductance"_a)
454 .def("connect", &CPS::EMT::Ph3::Transformer::connect);
455
457 std::shared_ptr<CPS::EMT::Ph3::SeriesResistor>,
458 CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "SeriesResistor",
459 py::multiple_inheritance())
460 .def(py::init<std::string>())
461 .def(py::init<std::string, CPS::Logger::Level>())
462 .def("set_parameters", &CPS::EMT::Ph3::SeriesResistor::setParameters,
463 "R"_a)
465
467 std::shared_ptr<CPS::EMT::Ph3::SeriesSwitch>,
469 mEMTPh3, "SeriesSwitch", py::multiple_inheritance())
470 .def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
471 "loglevel"_a = CPS::Logger::Level::off)
472 .def("set_parameters", &CPS::EMT::Ph3::SeriesSwitch::setParameters,
473 "open_resistance"_a, "closed_resistance"_a,
474 // cppcheck-suppress assignBoolToPointer
475 "closed"_a = false)
478 .def("connect", &CPS::EMT::Ph3::SeriesSwitch::connect);
479
481 std::shared_ptr<CPS::EMT::Ph3::SSN::Full_Serial_RLC>,
482 CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "Full_Serial_RLC",
483 py::multiple_inheritance())
484 .def(py::init<std::string>())
485 .def(py::init<std::string, CPS::Logger::Level>())
486 .def("set_parameters",
487 &CPS::EMT::Ph3::SSN::Full_Serial_RLC::setParameters, "R"_a, "L"_a,
488 "C"_a)
490 .def_property("R", createAttributeGetter<CPS::Real>("R"),
491 createAttributeSetter<CPS::Real>("R"))
492 .def_property("L", createAttributeGetter<CPS::Real>("L"),
493 createAttributeSetter<CPS::Real>("L"))
494 .def_property("C", createAttributeGetter<CPS::Real>("C"),
495 createAttributeSetter<CPS::Real>("C"));
496}
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.
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...
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.
void connect(typename SimNode< Real >::List nodes)