DPsim
Loading...
Searching...
No Matches
Utils.h
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#pragma once
9
10#include <DPsim.h>
11#include <iomanip>
12#include <pybind11/eigen.h>
13#include <pybind11/functional.h>
14#include <pybind11/pybind11.h>
15#include <pybind11/stl.h>
16
17namespace py = pybind11;
18
19template <typename T>
20py::cpp_function createAttributeSetter(const std::string name) {
21 return [name](CPS::IdentifiedObject &object, T &value) {
22 object.attributeTyped<T>(name)->set(value);
23 };
24}
25
26template <typename T>
27py::cpp_function createAttributeGetter(const std::string name) {
28 return [name](CPS::IdentifiedObject &object) {
29 return object.attributeTyped<T>(name)->get();
30 };
31}
32
33CPS::Matrix zeroMatrix(int dim);
34
35std::string getAttributeList(CPS::IdentifiedObject &obj);
36void printAttributes(CPS::IdentifiedObject &obj);
37void printAttribute(CPS::IdentifiedObject &obj, std::string attr);