10#include <dpsim-models/Base/Base_Governor.h>
11#include <dpsim-models/Base/Base_PSS.h>
12#include <dpsim-models/Base/Base_Turbine.h>
13#include <dpsim-models/CSVReader.h>
14#include <dpsim-models/IdentifiedObject.h>
15#include <dpsim-models/Signal/PSS1A.h>
16#include <dpsim-models/Signal/TurbineGovernorType1.h>
17#include <dpsim/RealTimeSimulation.h>
18#include <dpsim/Simulation.h>
19#include <dpsim/pybind/BaseComponents.h>
20#include <dpsim/pybind/Utils.h>
22namespace py = pybind11;
23using namespace pybind11::literals;
25void addBaseComponents(py::module_ mBase) {
26 py::class_<CPS::Base::Ph1::Switch, std::shared_ptr<CPS::Base::Ph1::Switch>>(
28 py::class_<CPS::Base::Ph3::Switch, std::shared_ptr<CPS::Base::Ph3::Switch>>(
32 std::shared_ptr<CPS::MNASyncGenInterface>>(
33 mBase,
"MNASyncGenInterface", py::multiple_inheritance())
36 .def(
"set_tolerance", &CPS::MNASyncGenInterface::setTolerance,
41 std::shared_ptr<CPS::Base::ReducedOrderSynchronGenerator<CPS::Complex>>,
43 mBase,
"ReducedOrderSynchronGeneratorComplex", py::multiple_inheritance())
44 .def(
"set_base_parameters",
46 CPS::Complex>::setBaseParameters,
47 "nom_power"_a,
"nom_voltage"_a,
"nom_frequency"_a)
48 .def(
"set_initial_values",
50 CPS::Complex>::setInitialValues,
51 "init_complex_electrical_power"_a,
"init_mechanical_power"_a,
52 "init_complex_terminal_voltage"_a)
53 .def(
"scale_inertia_constant",
55 CPS::Complex>::scaleInertiaConstant,
57 .def(
"set_model_as_norton_source",
59 CPS::Complex>::setModelAsNortonSource,
60 "model_as_norton_source"_a)
64 std::shared_ptr<CPS::Base::Exciter> exciter,
65 std::shared_ptr<CPS::Base::ExciterParameters> parameters) {
68 "exciter"_a,
"parameters"_a)
72 std::shared_ptr<CPS::Base::Exciter> exciter) {
79 CPS::Real Ta, CPS::Real Ka, CPS::Real Te, CPS::Real Ke,
80 CPS::Real Tf, CPS::Real Kf,
81 CPS::Real Tr) { self.
addExciter(Ta, Ka, Te, Ke, Tf, Kf, Tr); },
82 "Ta"_a,
"Ka"_a,
"Te"_a,
"Ke"_a,
"Tf"_a,
"Kf"_a,
"Tr"_a)
84 py::overload_cast<std::shared_ptr<CPS::Base::PSS>,
85 std::shared_ptr<CPS::Base::PSSParameters>>(
87 "pss"_a,
"parameters"_a)
89 py::overload_cast<std::shared_ptr<CPS::Base::PSS>>(
95 std::shared_ptr<CPS::Signal::TurbineGovernorType1> governor) {
102 CPS::Real T3, CPS::Real T4, CPS::Real T5, CPS::Real Tc,
103 CPS::Real Ts, CPS::Real R, CPS::Real Pmin, CPS::Real Pmax,
104 CPS::Real OmRef, CPS::Real TmRef) {
105 self.
addGovernor(T3, T4, T5, Tc, Ts, R, Pmin, Pmax, OmRef, TmRef);
107 "T3"_a,
"T4"_a,
"T5"_a,
"Tc"_a,
"Ts"_a,
"R"_a,
"Pmin"_a,
"Pmax"_a,
108 "OmRef"_a,
"TmRef"_a)
110 "add_governor_and_turbine",
112 std::shared_ptr<CPS::Base::Governor> governor,
113 std::shared_ptr<CPS::Base::GovernorParameters> govParams,
114 std::shared_ptr<CPS::Base::Turbine> turbine,
115 std::shared_ptr<CPS::Base::TurbineParameters> turbineParams) {
119 "governor"_a,
"gov_params"_a,
"turbine"_a,
"turbine_params"_a)
121 "add_governor_and_turbine",
123 std::shared_ptr<CPS::Base::Governor> governor,
124 std::shared_ptr<CPS::Base::Turbine> turbine) {
127 "governor"_a,
"turbine"_a);
131 std::shared_ptr<CPS::Base::ReducedOrderSynchronGenerator<CPS::Real>>,
133 py::multiple_inheritance())
134 .def(
"set_base_parameters",
136 CPS::Real>::setBaseParameters,
137 "nom_power"_a,
"nom_voltage"_a,
"nom_frequency"_a)
138 .def(
"set_initial_values",
140 CPS::Real>::setInitialValues,
141 "init_complex_electrical_power"_a,
"init_mechanical_power"_a,
142 "init_complex_terminal_voltage"_a)
143 .def(
"scale_inertia_constant",
145 CPS::Real>::scaleInertiaConstant,
147 .def(
"set_model_as_norton_source",
149 CPS::Real>::setModelAsNortonSource,
150 "model_as_norton_source"_a)
154 std::shared_ptr<CPS::Base::Exciter> exciter,
155 std::shared_ptr<CPS::Base::ExciterParameters> parameters) {
158 "exciter"_a,
"parameters"_a)
162 std::shared_ptr<CPS::Base::Exciter> exciter) {
169 CPS::Real Ta, CPS::Real Ka, CPS::Real Te, CPS::Real Ke,
170 CPS::Real Tf, CPS::Real Kf,
171 CPS::Real Tr) { self.
addExciter(Ta, Ka, Te, Ke, Tf, Kf, Tr); },
172 "Ta"_a,
"Ka"_a,
"Te"_a,
"Ke"_a,
"Tf"_a,
"Kf"_a,
"Tr"_a)
174 py::overload_cast<std::shared_ptr<CPS::Base::PSS>,
175 std::shared_ptr<CPS::Base::PSSParameters>>(
177 "pss"_a,
"parameters"_a)
179 py::overload_cast<std::shared_ptr<CPS::Base::PSS>>(
185 std::shared_ptr<CPS::Signal::TurbineGovernorType1> governor) {
192 CPS::Real T3, CPS::Real T4, CPS::Real T5, CPS::Real Tc,
193 CPS::Real Ts, CPS::Real R, CPS::Real Pmin, CPS::Real Pmax,
194 CPS::Real OmRef, CPS::Real TmRef) {
195 self.
addGovernor(T3, T4, T5, Tc, Ts, R, Pmin, Pmax, OmRef, TmRef);
197 "T3"_a,
"T4"_a,
"T5"_a,
"Tc"_a,
"Ts"_a,
"R"_a,
"Pmin"_a,
"Pmax"_a,
198 "OmRef"_a,
"TmRef"_a)
200 "add_governor_and_turbine",
202 std::shared_ptr<CPS::Base::Governor> governor,
203 std::shared_ptr<CPS::Base::GovernorParameters> govParams,
204 std::shared_ptr<CPS::Base::Turbine> turbine,
205 std::shared_ptr<CPS::Base::TurbineParameters> turbineParams) {
209 "governor"_a,
"gov_params"_a,
"turbine"_a,
"turbine_params"_a)
211 "add_governor_and_turbine",
213 std::shared_ptr<CPS::Base::Governor> governor,
214 std::shared_ptr<CPS::Base::Turbine> turbine) {
217 "governor"_a,
"turbine"_a);
void addGovernorAndTurbine(std::shared_ptr< Base::Governor > governor, std::shared_ptr< Base::GovernorParameters > govParams, std::shared_ptr< Base::Turbine > turbine, std::shared_ptr< Base::TurbineParameters > turbineParams)
Add a modular governor + turbine pair (new API for SteamTurbineGovernor / SteamTurbine)
void addPSS(std::shared_ptr< Base::PSS > pss, std::shared_ptr< Base::PSSParameters > parameters)
Attach a PSS (initialises parameters) to this generator.
void addExciter(std::shared_ptr< Base::Exciter > exciter, std::shared_ptr< Base::ExciterParameters > params)
Add voltage regulator and exciter.
void addGovernor(Real T3, Real T4, Real T5, Real Tc, Real Ts, Real R, Real Pmin, Real Pmax, Real OmRef, Real TmRef)
Add governor and turbine (TurbineGovernorType1 legacy API)
Interface to be used by synchronous generators.
void setMaxIterations(Int maxIterations)
Base class for all components that are transmitting power.