Commit 1e1f51da authored by Markus Mirz's avatar Markus Mirz
Browse files

Merge branch 'development' into 'master'

Development

See merge request acs/public/simulation/dpsim!79

Former-commit-id: 43efe2be
parents bfbc8316 4a76ac23
......@@ -3,9 +3,12 @@ build/
build_*/
build-*/
dist/
outputs/
_dpsim.pyd
_dpsim.pdb
.pytest_cache/
logs/
*.csv
# Folders
Libraries/
......
......@@ -17,7 +17,6 @@ stages:
- generate
- deploy
#- post-all
- trigger
docker:
stage: prepare
......@@ -28,6 +27,7 @@ docker:
--tag ${DOCKER_IMAGE_DEV}:latest .
tags:
- shell
- linux
build:linux:
stage: build
......@@ -52,7 +52,14 @@ test:pytest:
variables:
PYTHONPATH: "build/Source/Python:Source/Python"
script:
- pytest -v
- pytest -v Examples/CIM/test_CIM.yml
- pytest -v Examples/Cxx/test_Circuits.yml
- pytest -v Examples/Cxx/test_RealTime.yml
#- pytest -v Examples/Cxx/test_Shmem.yml
- pytest -v Examples/Python/Base
- pytest -v Examples/Python/Circuits
- pytest -v Examples/Python/RealTime
#- pytest -v Examples/Python/Shmem
image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
dependencies:
- build:linux
......@@ -104,23 +111,24 @@ build:docker:
--tag ${DOCKER_IMAGE}:latest .
tags:
- shell
- linux
only:
- tags
test:jupyter:
stage: test
variables:
PYTHONPATH: "build/Source/Python:Source/Python"
script:
- cd build
- cmake ..
- make -j32 notebooks
image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
- pytest -v Examples/Notebooks
image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
dependencies:
- build:linux
artifacts:
paths:
- build/Examples/Notebooks/
tags:
- docker
artifacts:
paths:
- outputs/Examples/Notebooks/
deploy:docker:
stage: deploy
......@@ -133,6 +141,7 @@ deploy:docker:
- build:docker
tags:
- shell
- linux
only:
- tags
......@@ -150,8 +159,8 @@ deploy:docs:
- development
tags:
- fein-deploy
tags:
- shell
- linux
deploy:packages:
stage: deploy
......@@ -165,8 +174,8 @@ deploy:packages:
- tags
tags:
- fein-deploy
tags:
- shell
- linux
# We run the windows build at last as it takes ages to finish
#build:windows:
......@@ -179,13 +188,3 @@ deploy:packages:
# - cmake --build .
# tags:
# - windows
trigger:jupyter:
stage: trigger
only:
- tags
script:
- curl -X POST
-F token=e9751bbb33e68c8206046d0062b5ff
-F ref=kubernetes
https://git.rwth-aachen.de/api/v4/projects/13613/trigger/pipeline
\ No newline at end of file
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_VENDOR ${PROJECT_AUTHOR})
set(CPACK_PACKAGE_CONTACT "Steffen Vogel <stvogel@eonerc.rwth-aachen.de")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Dynamic Phasor simulation library in C++")
set(CPACK_PACKAGE_VERSION ${DPSIM_SHORT_VERSION})
set(CPACK_PACKAGE_VERSION_MAJOR ${DPSIM_MAJOR_VERSION})
......
......@@ -8,7 +8,11 @@ else()
endif()
# Enable C++11 support
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 11)
if(CMAKE_CXX_COMPILER_ID STREQUAL Intel)
# needed by icc, but for some reason not added by CMake
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
add_definitions(-D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake;${PROJECT_SOURCE_DIR}/Dependencies/libcps/CMake")
......@@ -46,7 +50,17 @@ add_subdirectory(Dependencies/libcps)
find_package(PythonInterp 3.6)
find_package(PythonLibs 3.6)
find_package(Sundials)
find_package(VILLASnode)
if (NOT WIN32)
find_package(OpenMP)
endif()
find_package(GSL)
option(WITH_VILLAS "Build with VILLAS Interface" OFF)
if (WITH_VILLAS)
find_package(VILLASnode)
endif()
if(PythonInterp_FOUND AND PythonLibs_FOUND)
set(Python_FOUND ON)
......@@ -56,16 +70,22 @@ if("${CMAKE_SYSTEM}" MATCHES "Linux")
set(Linux_FOUND ON)
endif()
if(WIN32)
set(OPENMP_FOUND OFF)
endif()
# Options
option(BUILD_SHARED_LIBS "Build shared library" OFF)
option(BUILD_EXAMPLES "Build C++ examples" ON)
option(COMPARE_REFERENCE "Download reference results and compare" OFF)
option(WITH_GSL "Enable GSL" ${GSL_FOUND})
option(WITH_SUNDIALS "Enable sundials solver suite" ${Sundials_FOUND})
option(WITH_SHMEM "Enable shared memory interface" ${VILLASnode_FOUND})
option(WITH_RT "Enable real-time features" ${Linux_FOUND})
option(WITH_PYTHON "Enable Python support" ${Python_FOUND})
option(WITH_CIM "Enable support for parsing CIM files" ${CIMpp_FOUND})
option(WITH_OPENMP "Enable OpenMP-based parallelisation" ${OPENMP_FOUND})
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/Include/dpsim/Config.h.in
......@@ -105,6 +125,7 @@ if(TOPLEVEL_PROJECT)
add_feature_info(Python WITH_PYTHON "Use DPsim as a Python module")
add_feature_info(Shmem WITH_SHMEM "Interface DPsim solvers via shared-memory interfaces")
add_feature_info(RT WITH_RT "Extended real-time features")
add_feature_info(GSL WITH_GSL "Use GNU Scientific library")
feature_summary(WHAT ALL VAR enabledFeaturesText)
message(STATUS "Building ${CMAKE_PROJECT_NAME}:")
......
stats = 1;
logging = {
level = "info";
}
nodes = {
broker1 = {
type = "mqtt",
format = "json",
username = "villas",
password = "s3c0sim4!",
host = "137.226.248.91",
out = {
publish = "dpsim-powerflow"
}
},
dpsim1 = {
type = "shmem",
in = {
name = "/dpsim1-villas", # Name of shared memory segment for sending side
hooks = (
{ type = "stats" }
),
signals = {
count = 30,
type = "float"
}
},
out = {
name = "/villas-dpsim1" # Name of shared memory segment for receiving side
},
queuelen = 1024, # Length of the queues
polling = true, # We can busy-wait or use pthread condition variables for synchronizations
},
# profile = {
# type = "file",
# format = "csv",
# uri = "/projects/reserve/Load_profile_sum.csv",
# in = {
# rate = 1,
# eof = "rewind"
# }
# },
# oscilloscope = {
# type = "socket",
# layer = "udp",
# format = "protobuf",
# in = {
# address = "*:12000"
# }
# out = {
# address = "134.130.169.31:12000"
# }
# },
# lo = {
# type = "loopback"
# },
# web = {
# type = "websocket"
# }
}
paths = (
{
in = "dpsim1",
out = [ "broker1" ],
hooks = (
{
type = "limit_rate",
rate = 50
}
)
},
# {
# in = [
# "broker1.data[0]",
# "profile.data[0]"
# ],
# out = "dpsim1",
# hooks = (
# {
# type = "limit_rate",
# rate = 50
# }
# )
# },
# {
# in = [ "lo.data[8]", "lo.data[10]" ],
# out = "oscilloscope",
# hooks = (
# { type = "scale", scale = 0.0008, offset = -180 },
# { type = "print" }
# )
# }
)
# helper script to prepare dpsim-dev container to work with local dataprocessing package
# assumes dpsim and data-processing to be mounted in /dpsim-dev
pip3 uninstall villas-dataprocessing
cd /dpsim-dev/data-processing
pip3 install -e .
cd /dpsim-dev/dpsim/build
export PYTHONPATH=$(pwd)/Source/Python:$(pwd)/../Source/Python
\ No newline at end of file
This diff is collapsed.
stats = 1;
logging = {
level = "info";
}
nodes = {
broker1 = {
type = "mqtt",
format = "json",
username = "villas",
password = "s3c0sim4!",
host = "137.226.248.91",
in = {
subscribe = "villas-dpsim1",
hooks = (
{ type = "stats" }
)
},
out = {
publish = "dpsim1-villas"
}
},
dpsim1 = {
type = "shmem",
in = {
name = "/dpsim1-villas", # Name of shared memory segment for sending side
hooks = (
{ type = "stats" }
),
signals = {
count = 64,
type = "float"
}
},
out = {
name = "/villas-dpsim1" # Name of shared memory segment for receiving side
},
queuelen = 1024, # Length of the queues
polling = true, # We can busy-wait or use pthread condition variables for synchronizations
},
# profile = {
# type = "file",
# format = "csv",
# uri = "/projects/reserve/Load_profile_sum.csv",
# in = {
# rate = 1,
# eof = "rewind"
# }
# },
# oscilloscope = {
# type = "socket",
# layer = "udp",
# format = "protobuf",
# in = {
# address = "*:12000"
# }
# out = {
# address = "134.130.169.31:12000"
# }
# },
# lo = {
# type = "loopback"
# },
# web = {
# type = "websocket"
# }
}
paths = (
{
in = "dpsim1",
out = [ "broker1" ],
hooks = (
{
type = "limit_rate",
rate = 50
}
)
},
# {
# in = [
# "broker1.data[0]",
# "profile.data[0]"
# ],
# out = "dpsim1",
# hooks = (
# {
# type = "limit_rate",
# rate = 50
# }
# )
# },
# {
# in = [ "lo.data[8]", "lo.data[10]" ],
# out = "oscilloscope",
# hooks = (
# { type = "scale", scale = 0.0008, offset = -180 },
# { type = "print" }
# )
# }
)
stats = 1;
logging = {
level = 4;
}
nodes = {
broker1 = {
type = "mqtt"
format = "protobuf",
username = "guest",
password = "guest",
host = "acs-os-villas",
port = 1883,
publish = "dpsim1-villas",
subscribe = "villas-dpsim1",
hooks = (
{ type = "stats" }
)
},
dpsim1 = {
type = "shmem"
in_name = "/dpsim1-villas", # Name of shared memory segment for receiving side
out_name = "/villas-dpsim1", # Name of shared memory segment for sending side
queuelen = 1024, # Length of the queues
polling = true, # We can busy-wait or use pthread condition variables for synchronizations
hooks = (
{ type = "stats" }
)
},
broker2 = {
type = "mqtt"
format = "protobuf",
username = "guest",
password = "guest",
host = "acs-os-villas",
port = 1883,
publish = "dpsim2-villas",
subscribe = "villas-dpsim2",
hooks = (
{ type = "stats" }
)
},
dpsim2 = {
type = "shmem"
in_name = "/dpsim2-villas", # Name of shared memory segment for receiving side
out_name = "/villas-dpsim2", # Name of shared memory segment for sending side
queuelen = 1024, # Length of the queues
polling = true, # We can busy-wait or use pthread condition variables for synchronizations
hooks = (
{ type = "stats" }
)
},
profile = {
type = "file",
format = "csv",
uri = "/projects/reserve/Load_profile_sum.csv"
rate = 1,
eof = "rewind"
},
oscilloscope = {
type = "socket",
layer = "udp"
format = "protobuf",
local = "*:12000"
remote = "134.130.169.31:12000"
},
lo = {
type = "loopback"
}
}
paths = (
{
in = "broker1",
out = "dpsim1",
hooks = (
{
type = "limit_rate",
rate = 50
}
)
},
{
in = "dpsim1",
out = [ "broker1", "lo"],
hooks = (
{
type = "limit_rate",
rate = 50
}
)
},
{
in = "broker2",
out = "dpsim2",
hooks = (
{
type = "limit_rate",
rate = 50
}
)
},
{
in = "dpsim2",
out = "broker2",
hooks = (
{
type = "limit_rate",
rate = 50
}
)
},
{
in = [ "lo.data[8]", "lo.data[10]" ],
out = "oscilloscope",
hooks = (
{ type = "scale", scale = 0.0008, offset = -180 },
{ type = "print" }
)
}
)
#!/bin/bash
set -x
_stop() {
echo "Caught SIGTSTP signal!"
kill -TSTP ${CHILDS} 2>/dev/null
}
_cont() {
echo "Caught SIGCONT signal!"
kill -CONT ${CHILDS} 2>/dev/null
}
_term() {
echo "Caught SIGTERM signal!"
kill -TERM ${VN} ${CHILDS} 2>/dev/null
}
_kill() {
echo "Caught SIGKILL signal!"
kill -KILL ${VN} ${CHILDS} 2>/dev/null
}
trap _stop SIGTSTP
trap _cont SIGCONT
trap _term SIGTERM
trap _kill SIGKILL
CHILDS=""
# Start time
TIME=$(date -d "+10 seconds" +%Y%m%dT%H%M%S) #-Iseconds
echo "Start simulation at: $TIME"
# Simulation params
OPTS="--timestep 0.001 --duration $((60)) --system-freq 60 --start-at $TIME"
echo "Simulation params: $OPTS"
CPS_LOG_PREFIX="[Sys ] " \
build/Examples/Cxx/Shmem_WSCC-9bus_Ctrl $OPTS & P1=$!
CHILDS=$P1
sleep 2
if true; then
VILLAS_LOG_PREFIX="[Pipe] " \
#villas-pipe Configs/Shmem_WSCC-9bus_Ctrl.conf dpsim1
villas-node Configs/Shmem_WSCC-9bus_Ctrl.conf
else
VILLAS_LOG_PREFIX="[Node] " \
villas-node /projects/reserve/Shmem_WSCC-9bus_Ctrl.conf & VN=$!
fi
# Wait until all child processed finished
while (( $(ps --no-headers -o pid --ppid=$$ | wc -w) > 1 )); do
wait
done
#!/bin/bash
set -x
# Start time
......@@ -25,7 +27,7 @@ if false; then
villas-pipe Configs/villas-shmem.conf shmem
else
VILLAS_LOG_PREFIX="[Node] " \
villas-node /projects/reserve/node2.conf
villas-node /projects/reserve/Shmem_WSCC-9bus_CtrlDist.conf
fi
for job in $P1 $P2; do
......
#!/bin/bash
set -x
_stop() {
echo "Caught SIGTSTP signal!"
kill -TSTP ${CHILDS} 2>/dev/null
}
_cont() {
echo "Caught SIGCONT signal!"
kill -CONT ${CHILDS} 2>/dev/null
}