3 #include <pybind11/complex.h>
4 #include <pybind11/pybind11.h>
5 #include <pybind11/stl.h>
7 #include <dpsim-villas/InterfaceVillas.h>
11 namespace py = pybind11;
12 using namespace py::literals;
13 using namespace villas;
21 CPS::UInt sampleLength,
const CPS::String &name,
22 CPS::UInt downsampling)
24 (py::str)py::module_::import(
"json").attr(
"dumps")(
26 "indent"_a = py::none()),
27 queueLength, sampleLength, name, downsampling) {}
30 PYBIND11_MODULE(dpsimpyvillas, m) {
31 py::object
interface =
32 (py::object)py::module_::import("dpsimpy").attr("Interface");
34 py::class_<PyInterfaceVillas, std::shared_ptr<PyInterfaceVillas>>(
35 m, "InterfaceVillas", interface)
36 .def(py::init<const CPS::String &, CPS::UInt, CPS::UInt,
37 const CPS::String &, CPS::UInt>(),
38 "config"_a, "queue_length"_a = 512, "sample_length"_a = 64,
39 "name"_a = "", "downsampling"_a = 1)
40 .def(py::init<py::dict, CPS::UInt, CPS::UInt, const CPS::String &,
42 "config"_a, "queue_length"_a = 512, "sample_length"_a = 64,
43 "name"_a = "", "downsampling"_a = 1)
44 .def("import_attribute", &PyInterfaceVillas::importAttribute, "attr"_a,
46 "idx"_a, "block_on_read"_a = false, "sync_on_start"_a = true,
47 "name"_a = "", "unit"_a = "")
48 .def("export_attribute", &PyInterfaceVillas::exportAttribute, "attr"_a,
50 "idx"_a, "wait_for_on_write"_a = true, "name"_a = "", "unit"_a = "");
Interface type that can be used to import and export simulation attributes over any node type support...
InterfaceVillas(const String &nodeConfig, UInt queueLength=512, UInt sampleLength=64, const String &name="", UInt downsampling=1)
create a new InterfaceVillas instance