DPsim
Loading...
Searching...
No Matches
BaseComponents.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/BaseComponents.h>
15#include <dpsim/pybind/Utils.h>
16
17namespace py = pybind11;
18using namespace pybind11::literals;
19
20void addBaseComponents(py::module_ mBase) {
21 py::class_<CPS::Base::Ph1::Switch, std::shared_ptr<CPS::Base::Ph1::Switch>>(
22 mBase, "Switch");
23 py::class_<CPS::Base::Ph3::Switch, std::shared_ptr<CPS::Base::Ph3::Switch>>(
24 mBase, "SwitchPh3");
25
26 py::class_<CPS::MNASyncGenInterface,
27 std::shared_ptr<CPS::MNASyncGenInterface>>(
28 mBase, "MNASyncGenInterface", py::multiple_inheritance())
29 .def("set_max_iterations", &CPS::MNASyncGenInterface::setMaxIterations,
30 "max_iter"_a)
31 .def("set_tolerance", &CPS::MNASyncGenInterface::setTolerance,
32 "tolerance"_a);
33
34 py::class_<
36 std::shared_ptr<CPS::Base::ReducedOrderSynchronGenerator<CPS::Complex>>,
38 mBase, "ReducedOrderSynchronGeneratorComplex", py::multiple_inheritance())
39 .def("set_base_parameters",
41 CPS::Complex>::setBaseParameters,
42 "nom_power"_a, "nom_voltage"_a, "nom_frequency"_a)
43 .def("set_initial_values",
45 CPS::Complex>::setInitialValues,
46 "init_complex_electrical_power"_a, "init_mechanical_power"_a,
47 "init_complex_terminal_voltage"_a)
48 .def("scale_inertia_constant",
50 CPS::Complex>::scaleInertiaConstant,
51 "scaling_factor"_a)
52 .def("set_model_as_norton_source",
54 CPS::Complex>::setModelAsNortonSource,
55 "model_as_norton_source"_a);
56
57 py::class_<
59 std::shared_ptr<CPS::Base::ReducedOrderSynchronGenerator<CPS::Real>>,
60 CPS::SimPowerComp<CPS::Real>>(mBase, "ReducedOrderSynchronGeneratorReal",
61 py::multiple_inheritance())
62 .def("set_base_parameters",
64 CPS::Real>::setBaseParameters,
65 "nom_power"_a, "nom_voltage"_a, "nom_frequency"_a)
66 .def("set_initial_values",
68 CPS::Real>::setInitialValues,
69 "init_complex_electrical_power"_a, "init_mechanical_power"_a,
70 "init_complex_terminal_voltage"_a)
71 .def("scale_inertia_constant",
73 CPS::Real>::scaleInertiaConstant,
74 "scaling_factor"_a)
75 .def("set_model_as_norton_source",
77 CPS::Real>::setModelAsNortonSource,
78 "model_as_norton_source"_a);
79}
Interface to be used by synchronous generators.
void setMaxIterations(Int maxIterations)
Base class for all components that are transmitting power.