Commit 21aa7d4e authored by Markus Mirz's avatar Markus Mirz
Browse files

python: add shmem intf


Signed-off-by: Markus Mirz's avatarMarkus Mirz <mmirz@eonerc.rwth-aachen.de>
parent bc290134
...@@ -31,8 +31,7 @@ ...@@ -31,8 +31,7 @@
namespace DPsim { namespace DPsim {
/// Shmem interface used in combination with VILLAS /// Shmem interface used in combination with VILLAS
class InterfaceShmem : class InterfaceShmem :
public Interface, public Interface {
public SharedFactory<InterfaceShmem> {
public: public:
typedef std::shared_ptr<InterfaceShmem> Ptr; typedef std::shared_ptr<InterfaceShmem> Ptr;
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <cps/CIM/Reader.h> #include <cps/CIM/Reader.h>
#include <DPsim.h> #include <DPsim.h>
#include <dpsim/InterfaceShmem.h>
#include <cps/CSVReader.h> #include <cps/CSVReader.h>
namespace py = pybind11; namespace py = pybind11;
...@@ -44,7 +46,8 @@ PYBIND11_MODULE(dpsimpy, m) { ...@@ -44,7 +46,8 @@ PYBIND11_MODULE(dpsimpy, m) {
.def("set_attribute", static_cast<void (DPsim::Simulation::*)(const std::string&, const std::string&, CPS::Real)>(&DPsim::Simulation::setAttribute)) .def("set_attribute", static_cast<void (DPsim::Simulation::*)(const std::string&, const std::string&, CPS::Real)>(&DPsim::Simulation::setAttribute))
.def("set_attribute", static_cast<void (DPsim::Simulation::*)(const std::string&, const std::string&, CPS::Complex)>(&DPsim::Simulation::setAttribute)) .def("set_attribute", static_cast<void (DPsim::Simulation::*)(const std::string&, const std::string&, CPS::Complex)>(&DPsim::Simulation::setAttribute))
.def("get_real_attribute", &DPsim::Simulation::getRealAttribute) .def("get_real_attribute", &DPsim::Simulation::getRealAttribute)
.def("get_complex_attribute", &DPsim::Simulation::getComplexAttribute); .def("get_complex_attribute", &DPsim::Simulation::getComplexAttribute)
.def("add_interface", &DPsim::Simulation::addInterface, py::arg("interface"), py::arg("syncStart") = true);
py::class_<DPsim::RealTimeSimulation>(m, "RealTimeSimulation") py::class_<DPsim::RealTimeSimulation>(m, "RealTimeSimulation")
.def(py::init<std::string>()) .def(py::init<std::string>())
...@@ -65,6 +68,11 @@ PYBIND11_MODULE(dpsimpy, m) { ...@@ -65,6 +68,11 @@ PYBIND11_MODULE(dpsimpy, m) {
.def("render_to_file", &DPsim::SystemTopology::renderToFile) .def("render_to_file", &DPsim::SystemTopology::renderToFile)
.def_readwrite("nodes", &DPsim::SystemTopology::mNodes); .def_readwrite("nodes", &DPsim::SystemTopology::mNodes);
py::class_<DPsim::Interface>(m, "Interface");
py::class_<DPsim::InterfaceShmem, DPsim::Interface>(m, "InterfaceShmem")
.def(py::init<const CPS::String &, const CPS::String &>());
py::class_<DPsim::DataLogger, std::shared_ptr<DPsim::DataLogger>>(m, "Logger") py::class_<DPsim::DataLogger, std::shared_ptr<DPsim::DataLogger>>(m, "Logger")
.def(py::init<std::string>()) .def(py::init<std::string>())
.def("log_attribute", (void (DPsim::DataLogger::*)(const CPS::String &, const CPS::String &, CPS::IdentifiedObject::Ptr)) &DPsim::DataLogger::addAttribute); .def("log_attribute", (void (DPsim::DataLogger::*)(const CPS::String &, const CPS::String &, CPS::IdentifiedObject::Ptr)) &DPsim::DataLogger::addAttribute);
...@@ -151,7 +159,6 @@ PYBIND11_MODULE(dpsimpy, m) { ...@@ -151,7 +159,6 @@ PYBIND11_MODULE(dpsimpy, m) {
.def("connect", &CPS::DP::Ph1::Inductor::connect); .def("connect", &CPS::DP::Ph1::Inductor::connect);
#ifdef VERSION_INFO #ifdef VERSION_INFO
m.attr("__version__") = VERSION_INFO; m.attr("__version__") = VERSION_INFO;
#else #else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment