Commit ddbbf541 authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼
Browse files

fix compilation of CIM support

parent 4619844f
......@@ -34,13 +34,12 @@ string(TIMESTAMP YMD "%Y%m%d")
set(DPSIM_RELEASE ${YMD}git${GIT_HASH_SHORT})
set(Python_ADDITIONAL_VERSIONS 3.5 3.6 3.7)
find_package(PythonInterp 3.5)
find_package(PythonLibs 3.5)
set(CIM_DIR 16v29a)
find_package(CIMpp)
find_package(PythonInterp 3.5)
find_package(PythonLibs 3.5)
find_package(Eigen3 3.0 REQUIRED)
find_package(CIMpp)
find_package(VILLASnode)
if(PythonInterp_FOUND AND PythonLibs_FOUND)
......
......@@ -29,7 +29,8 @@ RUN dnf -y install \
RUN dnf -y install \
python3-devel \
eigen3-devel \
villas-node-devel
villas-node-devel \
libcimpp16v29a
# Python Packages
ADD requirements.txt .
......
......@@ -28,7 +28,6 @@
using namespace DPsim;
static int testCIMReader(std::list<String> filenames) {
CIM::Reader reader(50, Logger::Level::INFO);
for (String & filename : filenames) {
......@@ -38,9 +37,9 @@ static int testCIMReader(std::list<String> filenames) {
reader.parseFiles();
Components::Base::List components = reader.getComponents();
Components::Base::List comps = reader.getComponents();
Simulation sim("CIM_Test", components, 2 * PI * 50, 0.001, 0.3);
Simulation sim("CIM", comps, 2 * PI * 50, 0.001, 0.3);
sim.run();
......@@ -48,18 +47,20 @@ static int testCIMReader(std::list<String> filenames) {
}
static void readFixedCIMFiles_LineLoad() {
std::list<String> filenames;
filenames.push_back("..\\..\\Examples\\CIM\\Line_Load\\Line_Load.xml");
std::list<String> filenames = {
"..\\..\\Examples\\CIM\\Line_Load\\Line_Load.xml"
};
testCIMReader(filenames);
}
static void readFixedCIMFiles_IEEE9bus() {
std::list<String> filenames;
filenames.push_back("..\\..\\..\\..\\dpsim\\Examples\\CIM\\IEEE-09_Neplan_RX\\IEEE-09_Neplan_RX_DI.xml");
filenames.push_back("..\\..\\..\\..\\dpsim\\Examples\\CIM\\IEEE-09_Neplan_RX\\IEEE-09_Neplan_RX_EQ.xml");
filenames.push_back("..\\..\\..\\..\\dpsim\\Examples\\CIM\\IEEE-09_Neplan_RX\\IEEE-09_Neplan_RX_SV.xml");
filenames.push_back("..\\..\\..\\..\\dpsim\\Examples\\CIM\\IEEE-09_Neplan_RX\\IEEE-09_Neplan_RX_TP.xml");
std::list<String> filenames = {
"..\\..\\..\\dpsim\\Examples\\CIM\\IEEE-09_Neplan_RX\\IEEE-09_Neplan_RX_DI.xml",
"..\\..\\..\\dpsim\\Examples\\CIM\\IEEE-09_Neplan_RX\\IEEE-09_Neplan_RX_EQ.xml",
"..\\..\\..\\dpsim\\Examples\\CIM\\IEEE-09_Neplan_RX\\IEEE-09_Neplan_RX_SV.xml",
"..\\..\\..\\dpsim\\Examples\\CIM\\IEEE-09_Neplan_RX\\IEEE-09_Neplan_RX_TP.xml"
};
testCIMReader(filenames);
}
......@@ -76,8 +77,12 @@ static void readCIMFilesFromInput(int argc, char *argv[]) {
}
int main(int argc, char *argv[]) {
//readCIMFilesFromInput(argc, argv);
readFixedCIMFiles_IEEE9bus();
if (argc < 2) {
readFixedCIMFiles_IEEE9bus();
}
else {
readCIMFilesFromInput(argc, argv);
}
return 0;
}
......@@ -73,6 +73,7 @@ foreach(SOURCE ${CIRCUIT_SOURCES} ${SYNCGEN_SOURCES} ${VARFREQ_SOURCES})
endforeach()
# CIMpp
set(CIM_DIR 16v29a)
find_package(CIMpp)
if(CIMpp_FOUND)
add_executable(CIM CIM/CIM.cpp)
......@@ -83,7 +84,7 @@ if(CIMpp_FOUND)
endif()
# Linux for shared memory and real-time
if(LINUX)
if(WITH_SHMEM)
foreach(SOURCE ${SHMEM_SOURCES} ${RT_SOURCES})
get_filename_component(TARGET ${SOURCE} NAME_WE)
......
......@@ -25,11 +25,13 @@
#include <map>
#include <vector>
// CIMpp includes
#include <CIMModel.hpp>
#include <IEC61970.hpp>
#include "Definitions.h"
#include "Components/Base.h"
#include "CIMModel.hpp"
#include "IEC61970.hpp"
#include "Logger.h"
#include "Simulation.h"
......
......@@ -63,6 +63,7 @@ if(WITH_RT)
list(APPEND SOURCES RealTimeSimulation.cpp)
endif()
find_package(VILLASnode)
if(WITH_SHMEM)
list(APPEND LIBRARIES ${VILLASNODE_LIBRARIES})
list(APPEND INCLUDE_DIRS ${VILLASNODE_INCLUDE_DIRS})
......@@ -77,6 +78,8 @@ if(WITH_PYTHON)
add_subdirectory(Python)
endif()
set(CIM_DIR 16v29a)
find_package(CIMpp)
if(WITH_CIM)
list(APPEND SOURCES CIM/Reader.cpp)
list(APPEND INCLUDE_DIRS ${CIMPP_INCLUDE_DIRS})
......
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/..)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_path('platlib'), end='')" OUTPUT_VARIABLE PYTHON_PKGPATH)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'), end='')" OUTPUT_VARIABLE PYTHON_EXT_SUFFIX)
......@@ -26,9 +24,24 @@ else(UNIX)
set(INSTALL_RPATH "\$ORIGIN")
endif()
target_sources(dpsim_python PRIVATE ${PYTHON_SOURCES})
target_link_libraries(dpsim_python dpsim ${PYTHON_LIBRARIES})
target_include_directories(dpsim_python PRIVATE ${PYTHON_INCLUDE_DIRS} ${INCLUDE_DIRS})
list(APPEND INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_BINARY_DIR}/..
${PYTHON_INCLUDE_DIRS}
)
list(APPEND LIBRARIES ${PYTHON_LIBRARIES})
find_package(CIMpp)
if (WITH_CIM)
list(APPEND INCLUDE_DIRS ${CIMPP_INCLUDE_DIRS})
list(APPEND LIBRARIES ${CIMPP_LIBRARIES})
endif()
target_link_libraries(dpsim_python dpsim ${LIBRARIES})
target_include_directories(dpsim_python PRIVATE ${INCLUDE_DIRS})
set_target_properties(dpsim_python
PROPERTIES
OUTPUT_NAME "_dpsim"
......
......@@ -81,7 +81,7 @@ PyObject* Python::LoadCim(PyObject* self, PyObject* args)
}
reader->parseFiles();
Components::Base::List comps = reader->getComponents();
DPsim::Components::Base::List comps = reader->getComponents();
list = PyList_New(comps.size());
for (unsigned i = 0; i < comps.size(); i++) {
......
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