Commit 33f20bfd authored by Markus Mirz's avatar Markus Mirz
Browse files

relocate villas interface code


Signed-off-by: Markus Mirz's avatarMarkus Mirz <mmirz@eonerc.rwth-aachen.de>
parent 9fa73b38
...@@ -205,6 +205,7 @@ add_subdirectory(docs) ...@@ -205,6 +205,7 @@ add_subdirectory(docs)
if(BUILD_EXAMPLES) if(BUILD_EXAMPLES)
add_subdirectory(Examples) add_subdirectory(Examples)
add_subdirectory(villas-dpsim/examples)
endif(BUILD_EXAMPLES) endif(BUILD_EXAMPLES)
if(WITH_PYBIND) if(WITH_PYBIND)
......
...@@ -89,22 +89,6 @@ if(WITH_RT) ...@@ -89,22 +89,6 @@ if(WITH_RT)
) )
endif() endif()
if(WITH_SHMEM)
list(APPEND LIBRARIES ${VILLASNODE_LIBRARIES})
list(APPEND INCLUDE_DIRS ${VILLASNODE_INCLUDE_DIRS})
set(SHMEM_SOURCES
Shmem/ShmemExample.cpp
Shmem/ShmemDistributedReference.cpp
Shmem/ShmemDistributedDirect.cpp
Shmem/ShmemDistributedVillas.cpp
Shmem/ShmemControllableSource.cpp
Shmem/ShmemControllableFiltSource.cpp
Shmem/Shmem_CIGRE_MV_PowerFlowTest.cpp
Shmem/Shmem_CIGRE_MV_PowerFlowTest_LoadProfiles.cpp
)
endif()
if(WITH_CIM) if(WITH_CIM)
list(APPEND LIBRARIES ${CIMPP_LIBRARIES}) list(APPEND LIBRARIES ${CIMPP_LIBRARIES})
list(APPEND INCLUDE_DIRS ${CIMPP_INCLUDE_DIRS}) list(APPEND INCLUDE_DIRS ${CIMPP_INCLUDE_DIRS})
...@@ -144,14 +128,6 @@ if(WITH_CIM) ...@@ -144,14 +128,6 @@ if(WITH_CIM)
endif() endif()
endif() endif()
if(WITH_CIM AND WITH_SHMEM)
set(CIM_SHMEM_SOURCES
Shmem/Shmem_WSCC-9bus.cpp
Shmem/Shmem_WSCC-9bus_Ctrl.cpp
Shmem/Shmem_WSCC-9bus_CtrlDist.cpp
)
endif()
if(WITH_PYTHON) if(WITH_PYTHON)
#list(APPEND LIBRARIES ${PYTHON_LIBRARIES}) #list(APPEND LIBRARIES ${PYTHON_LIBRARIES})
list(APPEND INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS}) list(APPEND INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
...@@ -162,7 +138,7 @@ if(WITH_OPENMP) ...@@ -162,7 +138,7 @@ if(WITH_OPENMP)
list(APPEND LIBRARIES ${OpenMP_CXX_FLAGS}) list(APPEND LIBRARIES ${OpenMP_CXX_FLAGS})
endif() endif()
foreach(SOURCE ${CIRCUIT_SOURCES} ${SYNCGEN_SOURCES} ${VARFREQ_SOURCES} ${SHMEM_SOURCES} ${RT_SOURCES} ${CIM_SOURCES} ${CIM_SOURCES_POSIX} ${CIM_SHMEM_SOURCES} ${DAE_SOURCES} ${INVERTER_SOURCES}) foreach(SOURCE ${CIRCUIT_SOURCES} ${SYNCGEN_SOURCES} ${VARFREQ_SOURCES} ${RT_SOURCES} ${CIM_SOURCES} ${CIM_SOURCES_POSIX} ${DAE_SOURCES} ${INVERTER_SOURCES})
get_filename_component(TARGET ${SOURCE} NAME_WE) get_filename_component(TARGET ${SOURCE} NAME_WE)
add_executable(${TARGET} ${SOURCE}) add_executable(${TARGET} ${SOURCE})
...@@ -172,12 +148,5 @@ foreach(SOURCE ${CIRCUIT_SOURCES} ${SYNCGEN_SOURCES} ${VARFREQ_SOURCES} ${SHMEM_ ...@@ -172,12 +148,5 @@ foreach(SOURCE ${CIRCUIT_SOURCES} ${SYNCGEN_SOURCES} ${VARFREQ_SOURCES} ${SHMEM_
target_compile_options(${TARGET} PUBLIC ${DPSIM_CXX_FLAGS}) target_compile_options(${TARGET} PUBLIC ${DPSIM_CXX_FLAGS})
endforeach() endforeach()
if(WITH_SHMEM)
add_executable(ShmemRealtimeExample Shmem/ShmemExample.cpp)
target_link_libraries(ShmemRealtimeExample ${LIBRARIES})
target_include_directories(ShmemRealtimeExample PRIVATE ${INCLUDE_DIRS})
target_compile_definitions(ShmemRealtimeExample PUBLIC REALTIME)
endif()
add_subdirectory(cim_graphviz) add_subdirectory(cim_graphviz)
add_subdirectory(signals) add_subdirectory(signals)
\ No newline at end of file
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include <dpsim/Interface.h> #include <dpsim/Interface.h>
#ifdef WITH_SHMEM #ifdef WITH_SHMEM
#include <dpsim/InterfaceShmem.h> #include <villas-dpsim/InterfaceShmem.h>
#endif #endif
namespace DPsim { namespace DPsim {
......
...@@ -44,16 +44,6 @@ if(WITH_PYTHON) ...@@ -44,16 +44,6 @@ if(WITH_PYTHON)
add_subdirectory(Python) add_subdirectory(Python)
endif() endif()
if(WITH_SHMEM)
list(APPEND DPSIM_SOURCES
InterfaceShmem.cpp
PthreadPoolScheduler.cpp
)
list(APPEND DPSIM_LIBRARIES ${VILLASNODE_LIBRARIES} pthread)
list(APPEND DPSIM_INCLUDE_DIRS ${VILLASNODE_INCLUDE_DIRS})
endif()
if(WITH_SPARSE) if(WITH_SPARSE)
list(APPEND DPSIM_SOURCES list(APPEND DPSIM_SOURCES
MNASolverEigenSparse.cpp MNASolverEigenSparse.cpp
...@@ -87,9 +77,19 @@ if(WITH_OPENMP) ...@@ -87,9 +77,19 @@ if(WITH_OPENMP)
list(APPEND DPSIM_LIBRARIES ${OpenMP_CXX_FLAGS}) list(APPEND DPSIM_LIBRARIES ${OpenMP_CXX_FLAGS})
endif() endif()
add_library(dpsim ${DPSIM_SOURCES}) if(WITH_SHMEM)
target_link_libraries(dpsim PUBLIC ${DPSIM_LIBRARIES}) set(DPSIM_VILLAS_SOURCES
target_include_directories(dpsim PUBLIC ${DPSIM_INCLUDE_DIRS} ${CPS_LIBRARIES}) ${CMAKE_SOURCE_DIR}/villas-dpsim/src/InterfaceShmem.cpp
${CMAKE_SOURCE_DIR}/villas-dpsim/src/PthreadPoolScheduler.cpp
)
set(DPSIM_VILLAS_LIBRARIES ${VILLASNODE_LIBRARIES} pthread)
set(DPSIM_VILLAS_INCLUDE_DIRS ${VILLASNODE_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/villas-dpsim/include)
endif()
add_library(dpsim ${DPSIM_SOURCES} ${DPSIM_VILLAS_SOURCES})
target_link_libraries(dpsim PUBLIC ${DPSIM_LIBRARIES} ${DPSIM_VILLAS_LIBRARIES})
target_include_directories(dpsim PUBLIC ${DPSIM_INCLUDE_DIRS} ${DPSIM_VILLAS_INCLUDE_DIRS})
target_compile_options(dpsim PUBLIC ${DPSIM_CXX_FLAGS}) target_compile_options(dpsim PUBLIC ${DPSIM_CXX_FLAGS})
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <dpsim/Config.h> #include <dpsim/Config.h>
#ifdef WITH_SHMEM #ifdef WITH_SHMEM
#include <dpsim/InterfaceShmem.h> #include <villas-dpsim/InterfaceShmem.h>
#include <cps/AttributeList.h> #include <cps/AttributeList.h>
#endif #endif
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#endif #endif
#ifdef WITH_SHMEM #ifdef WITH_SHMEM
#include <dpsim/PthreadPoolScheduler.h> #include <villas-dpsim/PthreadPoolScheduler.h>
#endif #endif
using namespace DPsim; using namespace DPsim;
using namespace CPS; using namespace CPS;
......
...@@ -38,15 +38,15 @@ OPTS="--timestep 1 --duration $((5)) --system-freq 50 --start-at $TIME --solver- ...@@ -38,15 +38,15 @@ OPTS="--timestep 1 --duration $((5)) --system-freq 50 --start-at $TIME --solver-
echo "Simulation params: $OPTS" echo "Simulation params: $OPTS"
CPS_LOG_PREFIX="[Sys ] " \ CPS_LOG_PREFIX="[Sys ] " \
build/Examples/Cxx/Shmem_CIGRE_MV_PowerFlowTest $OPTS & P1=$! build/villas-dpsim/examples/cxx/Shmem_CIGRE_MV_PowerFlowTest $OPTS & P1=$!
CHILDS=$P1 CHILDS=$P1
sleep 2 sleep 2
if false; then if true; then
VILLAS_LOG_PREFIX="[Pipe] " \ VILLAS_LOG_PREFIX="[Pipe] " \
villas-pipe Configs/shmem_CIGRE_MV_PF/Shmem_CIGRE_MV.conf dpsim1 villas-pipe villas-dpsim/examples/config/shmem_CIGRE_MV_PF/Shmem_CIGRE_MV.conf dpsim1
else else
VILLAS_LOG_PREFIX="[Node] " \ VILLAS_LOG_PREFIX="[Node] " \
villas-node Configs/shmem_CIGRE_MV_PF/Shmem_CIGRE_MV.conf & VN=$! villas-node Configs/shmem_CIGRE_MV_PF/Shmem_CIGRE_MV.conf & VN=$!
......
set(LIBRARIES "dpsim")
if (NOT WIN32)
# needed so CIMParser and arabica (which are first compiled into static libs)
# can be included in the .so
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
if(WITH_SHMEM)
list(APPEND LIBRARIES ${VILLASNODE_LIBRARIES})
list(APPEND INCLUDE_DIRS ${VILLASNODE_INCLUDE_DIRS})
set(SHMEM_SOURCES
ShmemExample.cpp
ShmemDistributedReference.cpp
ShmemDistributedDirect.cpp
ShmemDistributedVillas.cpp
ShmemControllableSource.cpp
ShmemControllableFiltSource.cpp
Shmem_CIGRE_MV_PowerFlowTest.cpp
Shmem_CIGRE_MV_PowerFlowTest_LoadProfiles.cpp
)
endif()
if(WITH_CIM AND WITH_SHMEM)
set(CIM_SHMEM_SOURCES
Shmem_WSCC-9bus.cpp
Shmem_WSCC-9bus_Ctrl.cpp
Shmem_WSCC-9bus_CtrlDist.cpp
)
endif()
foreach(SOURCE ${SHMEM_SOURCES} ${CIM_SHMEM_SOURCES})
get_filename_component(TARGET ${SOURCE} NAME_WE)
add_executable(${TARGET} ${SOURCE})
target_link_libraries(${TARGET} ${LIBRARIES})
target_include_directories(${TARGET} PRIVATE ${INCLUDE_DIRS})
target_compile_options(${TARGET} PUBLIC ${DPSIM_CXX_FLAGS})
endforeach()
if(WITH_SHMEM)
add_executable(ShmemRealtimeExample ShmemExample.cpp)
target_link_libraries(ShmemRealtimeExample ${LIBRARIES})
target_include_directories(ShmemRealtimeExample PRIVATE ${INCLUDE_DIRS})
target_compile_definitions(ShmemRealtimeExample PUBLIC REALTIME)
endif()
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
*********************************************************************************/ *********************************************************************************/
#include <DPsim.h> #include <DPsim.h>
#include <dpsim/InterfaceShmem.h> #include <villas-dpsim/InterfaceShmem.h>
using namespace DPsim; using namespace DPsim;
using namespace CPS::Signal; using namespace CPS::Signal;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
*********************************************************************************/ *********************************************************************************/
#include <DPsim.h> #include <DPsim.h>
#include <dpsim/InterfaceShmem.h> #include <villas-dpsim/InterfaceShmem.h>
using namespace DPsim; using namespace DPsim;
using namespace CPS::DP; using namespace CPS::DP;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
*********************************************************************************/ *********************************************************************************/
#include <DPsim.h> #include <DPsim.h>
#include <dpsim/InterfaceShmem.h> #include <villas-dpsim/InterfaceShmem.h>
using namespace DPsim; using namespace DPsim;
using namespace CPS::DP; using namespace CPS::DP;
......
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