Skip to content

Commit

Permalink
models: add new models to pybind
Browse files Browse the repository at this point in the history
Signed-off-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
  • Loading branch information
n-eiling committed Nov 11, 2024
1 parent f07c5af commit c82b154
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
7 changes: 4 additions & 3 deletions dpsim-models/include/dpsim-models/Components.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,14 @@
#include <dpsim-models/EMT/EMT_Ph3_AvVoltSourceInverterStateSpace.h>
#include <dpsim-models/EMT/EMT_Ph3_AvVoltageSourceInverterDQ.h>
#include <dpsim-models/EMT/EMT_Ph3_Capacitor.h>
#include <dpsim-models/EMT/EMT_Ph3_ControlledVoltageSource.h>
#include <dpsim-models/EMT/EMT_Ph3_CurrentSource.h>
#include <dpsim-models/EMT/EMT_Ph3_Inductor.h>
#include <dpsim-models/EMT/EMT_Ph3_ReducedOrderSynchronGeneratorVBR.h>
#include <dpsim-models/EMT/EMT_Ph3_Resistor.h>
#include <dpsim-models/EMT/EMT_Ph3_SSN_Capacitor.h>
#include <dpsim-models/EMT/EMT_Ph3_SSN_Full_Serial_RLC.h>
#include <dpsim-models/EMT/EMT_Ph3_SSN_Inductor.h>
#include <dpsim-models/EMT/EMT_Ph3_SeriesResistor.h>
#include <dpsim-models/EMT/EMT_Ph3_SeriesSwitch.h>
#include <dpsim-models/EMT/EMT_Ph3_SynchronGenerator3OrderVBR.h>
Expand All @@ -108,9 +112,6 @@
#include <dpsim-models/EMT/EMT_Ph3_SynchronGeneratorDQTrapez.h>
#include <dpsim-models/EMT/EMT_Ph3_VoltageSource.h>
#include <dpsim-models/EMT/EMT_Ph3_VoltageSourceNorton.h>
#include <dpsim-models/EMT/EMT_Ph3_SSN_Capacitor.h>
#include <dpsim-models/EMT/EMT_Ph3_SSN_Inductor.h>
#include <dpsim-models/EMT/EMT_Ph3_SSN_Full_Serial_RLC.h>
#ifdef WITH_SUNDIALS
#include <dpsim-models/EMT/EMT_Ph3_SynchronGeneratorDQODE.h>
#endif
Expand Down
24 changes: 17 additions & 7 deletions dpsim/src/pybind/EMTComponents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,20 @@ void addEMTPh3Components(py::module_ mEMTPh3) {
.def_property("f_src", createAttributeGetter<CPS::Real>("f_src"),
createAttributeSetter<CPS::Real>("f_src"));

py::class_<CPS::EMT::Ph3::ControlledVoltageSource,
std::shared_ptr<CPS::EMT::Ph3::ControlledVoltageSource>,
CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "ControlledVoltageSource",
py::multiple_inheritance())
.def(py::init<std::string>())
.def(py::init<std::string, CPS::Logger::Level>())
.def("set_parameters",
py::overload_cast<CPS::MatrixComp, CPS::Real>(
&CPS::EMT::Ph3::VoltageSource::setParameters),
"V_ref"_a)
.def("connect", &CPS::EMT::Ph3::VoltageSource::connect)
.def_property("V_ref", createAttributeGetter<CPS::MatrixComp>("V_ref"),
createAttributeSetter<CPS::MatrixComp>("V_ref"));

py::class_<CPS::EMT::Ph3::CurrentSource,
std::shared_ptr<CPS::EMT::Ph3::CurrentSource>,
CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "CurrentSource",
Expand Down Expand Up @@ -197,13 +211,9 @@ void addEMTPh3Components(py::module_ mEMTPh3) {
"parallel_conductance"_a = zeroMatrix(3))
.def("connect", &CPS::EMT::Ph3::PiLine::connect);

py::class_<CPS::EMT::Ph3::RXLoad, std::shared_ptr<CPS::EMT::Ph3::RXLoad>,
CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "RXLoad",
py::multiple_inheritance())
.def(py::init<std::string, CPS::Logger::Level>(), "name"_a,
"loglevel"_a = CPS::Logger::Level::off)
.def("set_parameters", &CPS::EMT::Ph3::RXLoad::setParameters,
"active_power"_a, "reactive_power"_a, "volt"_a)
py::class_<CPS::EMT::Ph3::RXLoad, std::shared_ptr<CPS::EMT::Ph3::RXLoad>, CPS::SimPowerComp<CPS::Real>>(mEMTPh3, "RXLoad", py::multiple_inheritance())
.def(py::init<std::string, CPS::Logger::Level>(), "name"_a, "loglevel"_a = CPS::Logger::Level::off)
.def("set_parameters", &CPS::EMT::Ph3::RXLoad::setParameters, "active_power"_a, "reactive_power"_a, "volt"_a, "reactance_in_series"_a)
.def("connect", &CPS::EMT::Ph3::RXLoad::connect);

py::class_<CPS::EMT::Ph3::Switch, std::shared_ptr<CPS::EMT::Ph3::Switch>,
Expand Down

0 comments on commit c82b154

Please sign in to comment.