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)
if(BUILD_EXAMPLES)
add_subdirectory(Examples)
add_subdirectory(villas-dpsim/examples)
endif(BUILD_EXAMPLES)
if(WITH_PYBIND)
......
......@@ -89,22 +89,6 @@ if(WITH_RT)
)
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)
list(APPEND LIBRARIES ${CIMPP_LIBRARIES})
list(APPEND INCLUDE_DIRS ${CIMPP_INCLUDE_DIRS})
......@@ -144,14 +128,6 @@ if(WITH_CIM)
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)
#list(APPEND LIBRARIES ${PYTHON_LIBRARIES})
list(APPEND INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
......@@ -162,7 +138,7 @@ if(WITH_OPENMP)
list(APPEND LIBRARIES ${OpenMP_CXX_FLAGS})
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)
add_executable(${TARGET} ${SOURCE})
......@@ -172,12 +148,5 @@ foreach(SOURCE ${CIRCUIT_SOURCES} ${SYNCGEN_SOURCES} ${VARFREQ_SOURCES} ${SHMEM_
target_compile_options(${TARGET} PUBLIC ${DPSIM_CXX_FLAGS})
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(signals)
\ No newline at end of file
......@@ -33,7 +33,7 @@
#include <dpsim/Interface.h>
#ifdef WITH_SHMEM
#include <dpsim/InterfaceShmem.h>
#include <villas-dpsim/InterfaceShmem.h>
#endif
namespace DPsim {
......
......@@ -44,16 +44,6 @@ if(WITH_PYTHON)
add_subdirectory(Python)
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)
list(APPEND DPSIM_SOURCES
MNASolverEigenSparse.cpp
......@@ -87,9 +77,19 @@ if(WITH_OPENMP)
list(APPEND DPSIM_LIBRARIES ${OpenMP_CXX_FLAGS})
endif()
add_library(dpsim ${DPSIM_SOURCES})
target_link_libraries(dpsim PUBLIC ${DPSIM_LIBRARIES})
target_include_directories(dpsim PUBLIC ${DPSIM_INCLUDE_DIRS} ${CPS_LIBRARIES})
if(WITH_SHMEM)
set(DPSIM_VILLAS_SOURCES
${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})
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
......
......@@ -17,7 +17,7 @@
#include <dpsim/Config.h>
#ifdef WITH_SHMEM
#include <dpsim/InterfaceShmem.h>
#include <villas-dpsim/InterfaceShmem.h>
#include <cps/AttributeList.h>
#endif
......
......@@ -35,7 +35,7 @@
#endif
#ifdef WITH_SHMEM
#include <dpsim/PthreadPoolScheduler.h>
#include <villas-dpsim/PthreadPoolScheduler.h>
#endif
using namespace DPsim;
using namespace CPS;
......
......@@ -38,15 +38,15 @@ OPTS="--timestep 1 --duration $((5)) --system-freq 50 --start-at $TIME --solver-
echo "Simulation params: $OPTS"
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
sleep 2
if false; then
if true; then
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
VILLAS_LOG_PREFIX="[Node] " \
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 @@
*********************************************************************************/
#include <DPsim.h>
#include <dpsim/InterfaceShmem.h>
#include <villas-dpsim/InterfaceShmem.h>
using namespace DPsim;
using namespace CPS::Signal;
......
......@@ -15,7 +15,7 @@
*********************************************************************************/
#include <DPsim.h>
#include <dpsim/InterfaceShmem.h>
#include <villas-dpsim/InterfaceShmem.h>
using namespace DPsim;
using namespace CPS::DP;
......
......@@ -15,7 +15,7 @@
*********************************************************************************/
#include <DPsim.h>
#include <dpsim/InterfaceShmem.h>
#include <villas-dpsim/InterfaceShmem.h>
using namespace DPsim;
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