Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
Power System Simulation and Optimization
DPsim
DPsim
Commits
ddbbf541
Commit
ddbbf541
authored
Jan 11, 2018
by
Steffen Vogel
🎅🏼
Browse files
fix compilation of CIM support
parent
4619844f
Changes
8
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
ddbbf541
...
...
@@ -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
)
...
...
Dockerfile
View file @
ddbbf541
...
...
@@ -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 .
...
...
Examples/Cxx/CIM/CIM.cpp
View file @
ddbbf541
...
...
@@ -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
comp
onent
s
=
reader
.
getComponents
();
Components
::
Base
::
List
comps
=
reader
.
getComponents
();
Simulation
sim
(
"CIM
_Test
"
,
comp
onent
s
,
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
;
}
Examples/Cxx/CMakeLists.txt
View file @
ddbbf541
...
...
@@ -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
)
...
...
Source/CIM/Reader.h
View file @
ddbbf541
...
...
@@ -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"
...
...
Source/CMakeLists.txt
View file @
ddbbf541
...
...
@@ -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
}
)
...
...
Source/Python/CMakeLists.txt
View file @
ddbbf541
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"
...
...
Source/Python/LoadCim.cpp
View file @
ddbbf541
...
...
@@ -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
++
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment