Commit 2b6e97a9 authored by Markus Mirz's avatar Markus Mirz
Browse files

Merge branch 'merge-harm-parallel' into 'development'

Merge harm parallel

See merge request acs/public/simulation/dpsim!74
parents e259662b 79c5bc8e
......@@ -6,6 +6,8 @@ dist/
_dpsim.pyd
_dpsim.pdb
.pytest_cache/
logs/
*.csv
# Folders
Libraries/
......
......@@ -70,6 +70,10 @@ 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)
......
logging = {
level = 3
}
stats = 5
nodes = {
opal = {
type = "socket",
layer = "udp",
format = "villas.binary",
in = {
address = "134.130.169.82:12000",
signals = {
count = 18
type = "float"
},
hooks = (
{ type = "ts"},
{ type = "print" }
)
},
out = {
address = "134.130.169.80:12000"
}
},
broker1 = {
type = "mqtt"
format = "villas.binary",
username = "guest",
password = "guest",
host = "acs-os-villas",
port = 1883,
out = {
publish = "opal-villas"
},
in = {
subscribe = "villas-opal"
signals = {
count = 4
type = "float"
}
hooks = (
{ type = "stats" }
)
}
}
}
paths = (
# Simulation -> VILLASweb
{
enabled = true,
in = "opal",
out = "broker1"
hooks = (
{ type = "limit_rate", rate = 50 }
)
},
# VILLASweb -> Simulation
{
in = "broker1.data[0-3]",
out = "opal",
hooks = (
{ type = "print" }
)
}
)
logging = {
level = 3
}
stats = 5
nodes = {
v2g_bus_68 = {
type = "mqtt",
format = "json.reserve",
builtin = false,
host = "acs-os-villas",
publish = "reserve_esb_lv",
subscribe = "reserve_esb_lv/Q_Set",
out = {
signals = (
{ name = "V", unit = "Volts" }
)
},
in = {
signals = (
{ name = "Q", unit = "Var" }
)
}
},
v2g_bus_81 = {
type = "mqtt",
format = "json.reserve",
builtin = false,
host = "acs-os-villas",
publish = "reserve_esb_lv",
subscribe = "reserve_esb_lv/Q_Set",
out = {
signals = (
{ name = "V", unit = "Volts" }
)
},
in = {
signals = (
{ name = "Q", unit = "Var" }
)
}
},
v2g_bus_27 = {
type = "mqtt",
format = "json.reserve",
builtin = false,
host = "acs-os-villas",
publish = "reserve_esb_lv",
subscribe = "reserve_esb_lv/Q_Set",
out = {
signals = (
{ name = "V", unit = "Volts" }
)
},
in = {
signals = (
{ name = "Q", unit = "Var" }
)
}
},
v2g_bus_35 = {
type = "mqtt",
format = "json.reserve",
builtin = false,
host = "acs-os-villas",
publish = "reserve_esb_lv",
subscribe = "reserve_esb_lv/Q_Set",
out = {
signals = (
{ name = "V", unit = "Volts" }
)
},
in = {
signals = (
{ name = "Q", unit = "Var" }
)
}
},
v2g_bus_85 = {
type = "mqtt",
format = "json.reserve",
builtin = false,
host = "acs-os-villas",
publish = "reserve_esb_lv",
subscribe = "reserve_esb_lv/Q_Set",
out = {
signals = (
{ name = "V", unit = "Volts" }
)
},
in = {
signals = (
{ name = "Q", unit = "Var" }
)
}
},
v2g_bus_19 = {
type = "mqtt",
format = "json.reserve",
builtin = false,
host = "acs-os-villas",
publish = "reserve_esb_lv",
subscribe = "reserve_esb_lv/Q_Set",
out = {
signals = (
{ name = "V", unit = "Volts" }
)
},
in = {
signals = (
{ name = "Q", unit = "Var" }
)
}
},
v2g_bus_63 = {
type = "mqtt",
format = "json.reserve",
builtin = false,
host = "acs-os-villas",
publish = "reserve_esb_lv",
subscribe = "reserve_esb_lv/Q_Set",
out = {
signals = (
{ name = "V", unit = "Volts" }
)
},
in = {
signals = (
{ name = "Q", unit = "Var" }
)
}
},
v2g_bus_76 = {
type = "mqtt",
format = "json.reserve",
builtin = false,
host = "acs-os-villas",
publish = "reserve_esb_lv",
subscribe = "reserve_esb_lv/Q_Set",
out = {
signals = (
{ name = "V", unit = "Volts" }
)
},
in = {
signals = (
{ name = "Q", unit = "Var" }
)
}
},
v2g_bus_78 = {
type = "mqtt",
format = "json.reserve",
builtin = false,
host = "acs-os-villas",
publish = "reserve_esb_lv",
subscribe = "reserve_esb_lv/Q_Set",
out = {
signals = (
{ name = "V", unit = "Volts" }
)
},
in = {
signals = (
{ name = "Q", unit = "Var" }
)
}
},
signal = {
type = "signal",
signal = "sine",
offset = 230,
amplitude = 0.5,
frequency = 0.1,
rate = 20,
values = 1
},
opal = {
type = "socket",
layer = "udp",
format = "villas.binary",
local = "134.130.169.82:12000",
remote = "134.130.169.80:12000"
},
broker1 = {
type = "mqtt"
format = "protobuf",
username = "guest",
password = "guest",
host = "acs-os-villas",
port = 1883,
publish = "opal-villas",
subscribe = "villas-opal",
hooks = (
{ type = "stats" }
)
}
}
paths = (
# Simulation -> VILLASweb
{
enabled = true,
in = "opal",
out = "broker1"
hooks = (
{ type = "limit_rate", rate = 50 }
)
},
# VILLASweb -> Simulation
{
in = "broker1.data[0-3]",
out = "opal",
hooks = (
{ type = "print" }
)
},
# Simulation -> AVM
{
enabled = false,
in = "signal.data[0]",
out = [ "v2g_bus_68","v2g_bus_81","v2g_bus_27","v2g_bus_35","v2g_bus_85","v2g_bus_19","v2g_bus_63","v2g_bus_76","v2g_bus_78" ],
hooks = (
{ type = "print" }
)
},
# AVM -> Simulation
{
enabled = false,
mode = "any",
in = [ "v2g_bus_68.data[0]","v2g_bus_81.data[0]","v2g_bus_27.data[0]","v2g_bus_35.data[0]","v2g_bus_85.data[0]","v2g_bus_19.data[0]","v2g_bus_63.data[0]","v2g_bus_76.data[0]","v2g_bus_78.data[0]" ],
hooks = (
{ type = "print" }
)
}
)
#!/bin/bash
function join_by { local IFS="$1"; shift; echo "$*"; }
V2G_BUSSES="68 81 27 35 85 19 63 76 78"
IN=""
OUT=""
for BUS in ${V2G_BUSSES}; do
IN="${IN} \"v2g_bus_${BUS}.data[0]\""
OUT="${OUT} \"v2g_bus_${BUS}\""
done
INPUTS=$(join_by , ${IN})
OUTPUTS=$(join_by , ${OUT})
cat << EOF
logging = {
level = 3
}
stats = 5
nodes = {
EOF
for BUS in ${V2G_BUSSES}; do
cat << EOF
v2g_bus_${BUS} = {
type = "mqtt",
format = "json.reserve",
builtin = false,
host = "acs-os-villas",
out = {
publish = "reserve_esb_lv",
signals = (
{ name = "V", unit = "Volts", type = "float" }
)
},
in = {
subscribe = "reserve_esb_lv/Q_Set",
signals = (
{ name = "Q", unit = "Var", type = "float" }
)
}
},
EOF
done
cat << EOF
signal = {
type = "signal",
signal = "sine",
offset = 230,
amplitude = 0.5,
frequency = 0.1,
rate = 20,
values = 1
},
opal = {
type = "socket",
layer = "udp",
format = "villas.binary",
in = {
address = "134.130.169.82:12000",
signals = {
count = 18
type = "float"
}
},
out = {
address = "134.130.169.80:12000"
}
},
broker1 = {
type = "mqtt"
format = "villas.binary",
username = "guest",
password = "guest",
host = "acs-os-villas",
port = 1883,
out = {
publish = "opal-villas"
},
in = {
subscribe = "villas-opal"
signals = {
count = 4
type = "float"
}
hooks = (
{ type = "stats" }
)
}
}
}
paths = (
# Simulation -> VILLASweb
{
enabled = true,
in = "opal",
out = "broker1"
hooks = (
{ type = "limit_rate", rate = 50 }
)
},
# VILLASweb -> Simulation
{
in = "broker1.data[0-3]",
out = "opal",
hooks = (
{ type = "print" }
)
},
# Simulation -> AVM
{
enabled = false,
in = "signal.data[0]",
out = [ ${OUTPUTS} ],
hooks = (
{ type = "print" }
)
},
# AVM -> Simulation
{
enabled = false,
mode = "any",
in = [ ${INPUTS} ],
hooks = (
{ type = "print" }
)
}
)
EOF
Subproject commit af108124639d9dd93f5e31070d730a226eeb259b
Subproject commit 8a1627e86892b5d77b26f8242022aad8261675fb
......@@ -24,7 +24,7 @@
#include <DPsim.h>
using namespace DPsim;
using namespace CPS;
using namespace CPS::DP;
int main(int argc, char *argv[]) {
#ifdef _WIN32
......@@ -41,12 +41,27 @@ int main(int argc, char *argv[]) {
};
String simName = "WSCC-9bus";
Logger::setLogDir("logs/"+simName);
CIM::Reader reader(simName, Logger::Level::DEBUG, Logger::Level::NONE);
CPS::CIM::Reader reader(simName, Logger::Level::DEBUG, Logger::Level::NONE);
SystemTopology sys = reader.loadCIM(60, filenames);
// Logging
auto logger = DataLogger::make(simName);
logger->addAttribute("v1", sys.node<Node>("BUS1")->attribute("v"));
logger->addAttribute("v2", sys.node<Node>("BUS2")->attribute("v"));
logger->addAttribute("v3", sys.node<Node>("BUS3")->attribute("v"));
logger->addAttribute("v4", sys.node<Node>("BUS4")->attribute("v"));
logger->addAttribute("v5", sys.node<Node>("BUS5")->attribute("v"));
logger->addAttribute("v6", sys.node<Node>("BUS6")->attribute("v"));
logger->addAttribute("v7", sys.node<Node>("BUS7")->attribute("v"));
logger->addAttribute("v8", sys.node<Node>("BUS8")->attribute("v"));
logger->addAttribute("v9", sys.node<Node>("BUS9")->attribute("v"));
Simulation sim(simName, sys, 0.0001, 0.1,
Domain::DP, Solver::Type::MNA, Logger::Level::DEBUG, true);
Domain::DP, Solver::Type::MNA, Logger::Level::INFO, true);
sim.addLogger(logger);
sim.run();
return 0;
......
......@@ -24,7 +24,7 @@
#include <DPsim.h>
using namespace DPsim;
using namespace CPS;
using namespace CPS::DP;
int main(int argc, char *argv[]) {
#ifdef _WIN32
......@@ -41,12 +41,30 @@ int main(int argc, char *argv[]) {
};
String simName = "WSCC-9bus_dyn";
Logger::setLogDir("logs/"+simName);
CIM::Reader reader(simName, Logger::Level::DEBUG, Logger::Level::DEBUG);
CPS::CIM::Reader reader(simName, Logger::Level::DEBUG, Logger::Level::DEBUG);
SystemTopology sys = reader.loadCIM(60, filenames);
Simulation sim(simName, sys, 0.0001, 0.1,
Domain::DP, Solver::Type::MNA, Logger::Level::DEBUG, true);
// Logging
auto logger = DataLogger::make(simName);
logger->addAttribute("v1", sys.node<Node>("BUS1")->attribute("v"));
logger->addAttribute("v2", sys.node<Node>("BUS2")->attribute("v"));
logger->addAttribute("v3", sys.node<Node>("BUS3")->attribute("v"));
logger->addAttribute("v4", sys.node<Node>("BUS4")->attribute("v"));
logger->addAttribute("v5", sys.node<Node>("BUS5")->attribute("v"));
logger->addAttribute("v6", sys.node<Node>("BUS6")->attribute("v"));
logger->addAttribute("v7", sys.node<Node>("BUS7")->attribute("v"));
logger->addAttribute("v8", sys.node<Node>("BUS8")->attribute("v"));
logger->addAttribute("v9", sys.node<Node>("BUS9")->attribute("v"));
logger->addAttribute("wr_1", sys.component<Ph1::SynchronGeneratorTrStab>("GEN1")->attribute("w_r"));
logger->addAttribute("wr_2", sys.component<Ph1::SynchronGeneratorTrStab>("GEN2")->attribute("w_r"));
logger->addAttribute("wr_3", sys.component<Ph1::SynchronGeneratorTrStab>("GEN3")->attribute("w_r"));
Simulation sim(simName, sys, 0.0001, 2,
Domain::DP, Solver::Type::MNA, Logger::Level::INFO, true);
sim.addLogger(logger);
sim.run();