Skip to content

Commit

Permalink
Merge pull request #264 from GMLC-TDC/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
phlptp authored Apr 16, 2018
2 parents f65d4ba + 1954085 commit 8cee4c4
Show file tree
Hide file tree
Showing 497 changed files with 19,619 additions and 12,009 deletions.
10 changes: 7 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ install:
script:
- mkdir build && cd build
- export HELICS_DEPENDENCY_FLAGS="-DZeroMQ_INSTALL_PATH=${CI_DEPENDENCY_DIR}/zmq -DBOOST_INSTALL_PATH=${CI_DEPENDENCY_DIR}/boost"
- export HELICS_OPTION_FLAGS="-DBUILD_C_SHARED_LIB=ON -DBUILD_HELICS_EXAMPLES=ON -DBUILD_PYTHON_INTERFACE=ON -DEXAMPLES_WARNINGS_AS_ERROR=ON -DPYTHON_LIBRARY=$(python3-config --prefix)/lib/libpython3.6m.${SHARED_LIB_EXT} -DPYTHON_INCLUDE_DIR=$(python3-config --prefix)/include/python3.6m/"
- export HELICS_OPTION_FLAGS="-DBUILD_C_SHARED_LIB=ON -DBUILD_HELICS_EXAMPLES=ON -DBUILD_PYTHON_INTERFACE=ON -DBUILD_JAVA_INTERFACE=ON -DEXAMPLES_WARNINGS_AS_ERROR=ON -DPYTHON_LIBRARY=$(python3-config --prefix)/lib/libpython3.6m.${SHARED_LIB_EXT} -DPYTHON_INCLUDE_DIR=$(python3-config --prefix)/include/python3.6m/"
- if [[ "$USE_SWIG" == 'false' ]] ; then HELICS_OPTION_FLAGS+=" -DDISABLE_SWIG=ON" ; fi
- if [[ "$USE_MPI" ]]; then HELICS_OPTION_FLAGS+=" -DMPI_ENABLE=ON" ; fi
- if [[ "$CXX_STANDARD" == 17 ]] ; then HELICS_OPTION_FLAGS+=" -DENABLE_CXX_17=ON" ; fi
Expand All @@ -181,8 +181,12 @@ script:
# 7 = helics-apps tests
- ctest --verbose --timeout 120 -I 0,0,0,1
# - ctest --verbose --timeout 120 -I 0,0,0,2
- ctest --verbose --timeout 180 -I 0,0,0,3
- ctest --verbose --timeout 360 -I 0,0,0,6
- ctest --verbose --timeout 240 -I 0,0,0,6
# - ctest --verbose --timeout 240 -I 0,0,0,7
- ctest --verbose --timeout 200 -I 0,0,0,3
- ctest --verbose -L Java
- ctest -L Examples

- export PYTHONPATH="$(pwd)/swig/python"
# - echo "$LD_LIBRARY_PATH"
# - echo "$DYLD_FALLBACK_LIBRARY_PATH"
Expand Down
53 changes: 34 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
##############################################################################
#Copyright © 2017-2018,
#Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC
#All rights reserved. See LICENSE file and DISCLAIMER for more details.
##############################################################################

cmake_minimum_required (VERSION 3.4)
project (HELICS)

Expand All @@ -7,19 +13,22 @@ project (HELICS)
set (HELICS_VERSION_MAJOR 1)
set (HELICS_VERSION_MINOR 0)
set (HELICS_VERSION_PATCH 0)
set (HELICS_VERSION_BUILD beta.2)
set (HELICS_DATE "03-20-18")
set (HELICS_VERSION "${HELICS_VERSION_MAJOR}.${HELICS_VERSION_MINOR}.${HELICS_VERSION_PATCH}-${HELICS_VERSION_BUILD}")
set (HELICS_VERSION_BUILD 0)
set (HELICS_DATE "04-15-18")
set (HELICS_VERSION "${HELICS_VERSION_MAJOR}.${HELICS_VERSION_MINOR}.${HELICS_VERSION_PATCH}")
set (HELICS_VERSION_STRING "${HELICS_VERSION} ${HELICS_DATE}")

#-----------------------------------------------------------------------------
# set the install path to a local directory
#-----------------------------------------------------------------------------
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
if (WIN32)
if (MSVC)
if (MSYS)
set (CMAKE_INSTALL_PREFIX "/usr/local/helics_${HELICS_VERSION_MAJOR}_${HELICS_VERSION_MINOR}_${HELICS_VERSION_PATCH}/" CACHE PATH "default install path" FORCE )
else(MSYS)
set (CMAKE_INSTALL_PREFIX "C:/local/helics_${HELICS_VERSION_MAJOR}_${HELICS_VERSION_MINOR}_${HELICS_VERSION_PATCH}/" CACHE PATH "default install path" FORCE )
endif(MSVC)
endif(MSYS)

endif(WIN32)
endif()

Expand All @@ -35,7 +44,7 @@ OPTION(BUILD_HELICS_EXAMPLES "Enable the example Executables to be built" ON)

OPTION(BUILD_PYTHON_INTERFACE "Build Python extension" OFF)
OPTION(BUILD_MATLAB_INTERFACE "Build Matlab Extension" OFF)
OPTION(BUILD_OCTAVE_INTERFACE "Build Octave extension" OFF)
OPTION(BUILD_OCTAVE_INTERFACE "Build Octave extension (very experimental)" OFF)
OPTION(BUILD_JAVA_INTERFACE "Build Java extension" OFF)

OPTION(DISABLE_SWIG "Disable the use of swig to generate interface code and use repo code" OFF)
Expand Down Expand Up @@ -105,9 +114,11 @@ IF (USE_BOOST_STATIC_LIBS)
set(Boost_USE_STATIC_LIBS ON)
set(BOOST_STATIC ON)
ENDIF ()

# -------------------------------------------------------------
# add coverage target
# -------------------------------------------------------------
IF(BUILD_HELICS_TESTS)
option (TEST_CODE_COVERAGE "Build a target for testing code coverage" OFF)
if (TEST_CODE_COVERAGE)
include(CodeCoverage)
Expand All @@ -120,6 +131,7 @@ ENDIF ()
)

endif(TEST_CODE_COVERAGE)
endif(BUILD_HELICS_TESTS)


# -------------------------------------------------------------
Expand Down Expand Up @@ -160,7 +172,7 @@ add_library(helics-static STATIC
$<TARGET_OBJECTS:helics_core>
$<TARGET_OBJECTS:helics_common>
)
message(STATUS "setting version option to \"${VERSION_OPTION}\"")
message(STATUS "setting version build options to \"${VERSION_OPTION}\"")
IF (VERSION_OPTION)
IF (MSVC)
target_compile_options(helics-static PUBLIC ${VERSION_OPTION})
Expand Down Expand Up @@ -348,12 +360,18 @@ endif()

add_subdirectory (src)

if (BUILD_PYTHON_INTERFACE)
SET(Python_ADDITIONAL_VERSIONS 3.4 3.5 3.6 3.7 3.8)
find_package(PythonInterp 3)
find_package(PythonLibs 3 REQUIRED )
endif(BUILD_PYTHON_INTERFACE)

#-----------------------------------------------------------------------------
# Setup CTEST environment
#-----------------------------------------------------------------------------
IF (BUILD_HELICS_TESTS)
include (CTest)
add_subdirectory (tests)
IF(BUILD_HELICS_TESTS)
include (CTest)
add_subdirectory (tests)
ENDIF(BUILD_HELICS_TESTS)

if (BUILD_HELICS_EXAMPLES)
Expand All @@ -380,11 +398,12 @@ endif()

add_subdirectory(docs)

set(HELICS_CMAKECONFIG_INSTALL_DIR "cmake/${PROJECT_NAME}" CACHE STRING "install path for HELICSConfig.cmake")
set(HELICS_CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" CACHE STRING "install path for HELICSConfig.cmake")

install (TARGETS helics-static EXPORT helics-targets
DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs)

#install(FILES $<TARGET_PDB_FILE:helics-static> DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libs OPTIONAL)
set(helics_static_file "${CMAKE_STATIC_LIBRARY_PREFIX}helics-static${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(helics_static_file_debug "${CMAKE_STATIC_LIBRARY_PREFIX}helics-static${CMAKE_DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}")
IF(BUILD_CXX_SHARED_LIB)
Expand Down Expand Up @@ -460,8 +479,8 @@ configure_package_config_file(config/${PROJECT_NAME}Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${HELICS_CMAKECONFIG_INSTALL_DIR})
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
VERSION ${HELICS_VERSION_MAJOR}.${HELICS_VERSION_MINOR}.${HELICS_VERSION_PATCH}.${HELICS_VERSION_BUILD}
COMPATIBILITY AnyNewerVersion)
VERSION ${HELICS_VERSION_MAJOR}.${HELICS_VERSION_MINOR}.${HELICS_VERSION_PATCH}-${HELICS_VERSION_BUILD}
COMPATIBILITY SameMajorVersion)

configure_file(config/${PROJECT_NAME}Import.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Import.cmake" @ONLY)
Expand Down Expand Up @@ -514,9 +533,9 @@ set(CPACK_COMPONENT_APPLICATIONS_DISPLAY_NAME "Application")
set(CPACK_COMPONENT_GROUP_INTERFACES_DESCRIPTION "additional language interfaces for HELICS")

set(CPACK_COMPONENT_LIBS_DEPENDS headers)
SET(CPACK_COMPONENT_RUNTIME_REQUIRED ON)
set(CPACK_COMPONENT_RUNTIME_REQUIRED ON)

set(CPACK_PACKAGE_EXECUTABLES "helics_broker" "Helics Broker")
set(CPACK_PACKAGE_EXECUTABLES "helics_broker" "Helics Broker" "helics_app" "Helics app executable")
if (WIN32)
set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}\\\\docs\\\\img\\\\HELICS.ico")
set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/docs/img/HELICS.ico")
Expand All @@ -532,10 +551,6 @@ else (WIN32)
endif(WIN32)






set(CPACK_SOURCE_IGNORE_FILES "/Build*/;/build*/;/.git/")
#THIS LINE MUST BE LAST
include(CPack)
49 changes: 42 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
<img src="docs/img/HELICS_Logo.png" width="400">
</p>

Welcome to the repository for the Hierarchical Engine for Large-scale Infrastructure Co-Simulation (HELICS). HELICS is a Grid Modernization Laboratory Consortium ([GMLC](https://gridmod.labworks.org/)) project supported by the U.S. Department of Energy's Offices of Electricity Delivery and Energy Reliability ([OE](https://www.energy.gov/oe/office-electricity-delivery-and-energy-reliability)) and Energy Efficiency and Renewable Energy ([EERE](https://www.energy.gov/eere/office-energy-efficiency-renewable-energy)).
Welcome to the repository for the Hierarchical Engine for Large-scale Infrastructure Co-Simulation (HELICS). HELICS provides a general-purpose, modular, highly-scalable co-simulation framework that runs cross-platform (Linux, Windows, and Mac OSX). It provides users a high-performance way to have multiple individual simulation model "federates" from various domains interact during execution to create a larger co-simulation "federation" able to capture rich interactions. Written in modern C++ (C++ 2014), HELICS provides includes a rich set of APIs for other languages including Python, C, Java, and MATLAB, and has native support within a growing number of energy simulation tools.

Energy systems and their associated information and communication technology systems are becoming increasingly intertwined. As a result, effectively designing, analyzing, and implementing modern energy systems increasingly relies on advanced modeling that simultaneously captures both the cyber and physical domains in combined simulations. HELICS is a layered, high-performance, co-simulation framework that builds on the collective experience of multiple national labs. It is designed to increase scalability and portability in modeling advanced features of highly integrated power system and cyber-physical energy systems.
**Brief History:** HELICS began as the core software development of the Grid Modernization Laboratory Consortium ([GMLC](https://gridmod.labworks.org/)) project on integrated Transmission-Distribution-Communication simulation (TDC, GMLC project 1.4.15) supported by the U.S. Department of Energy's Offices of Electricity Delivery and Energy Reliability ([OE](https://www.energy.gov/oe/office-electricity-delivery-and-energy-reliability)) and Energy Efficiency and Renewable Energy ([EERE](https://www.energy.gov/eere/office-energy-efficiency-renewable-energy)). As such, it's first use cases center around modern electric power system, though it can be used for co-simulation in other domains. HELICS's layered, high-performance, co-simulation framework builds on the collective experience of multiple national labs.

**Motivation:** Energy systems and their associated information and communication technology systems are becoming increasingly intertwined. As a result, effectively designing, analyzing, and implementing modern energy systems increasingly relies on advanced modeling that simultaneously captures both the cyber and physical domains in combined simulations. It is designed to increase scalability and portability in modeling advanced features of highly integrated power system and cyber-physical energy systems.

# Install Instructions

Expand All @@ -21,22 +23,55 @@ Energy systems and their associated information and communication technology sys
[Linux](https://gmlc-tdc.github.io/HELICS-src/installation/linux.html)

# Getting Started
We've created a series of roughly 10-minute mini-tutorial videos that discuss various design topics, concepts, and interfaces, including how to use the tool. They can be found on our YouTube channel [here](https://github.com/GMLC-TDC/HELICS-Tutorial).

Tutorial models can also be found on the [repository](https://github.com/GMLC-TDC/HELICS-Tutorial).
We've created a series of roughly 10-minute mini-tutorial videos that discuss various design topics, concepts, and interfaces, including how to use the tool. They can be found on our [YouTube channel](https://github.com/GMLC-TDC/HELICS-Tutorial).

The [Introduction to the HELICS documentation](https://gmlc-tdc.github.io/HELICS-src/introduction/index.html) steps through a series of examples that step through the basic usage and concepts of HELICS.

The [HELICS-Tutorial repository](https://github.com/GMLC-TDC/HELICS-Tutorial) provides a series of tutorials using HELICS to build a co-simulation using domain-specific external modeling tools that is built around an electric power system use case with integrated transmission-distribution-market-communication quasi-steady-state-timeseries (QSTS) simulation.

The [HELICS-Use-Cases repository](https://github.com/GMLC-TDC/HELICS-Use-Cases) includes examples for a growing range of research use cases for inspiration.

# Documentation

TODO (docs).
Our GitHub pages provides a rich set of [documentation](https://gmlc-tdc.github.io/HELICS-src/index.html) including a set of introductory [examples](https://gmlc-tdc.github.io/HELICS-src/introduction/index.html), a [developers guide](https://gmlc-tdc.github.io/HELICS-src/developer-guide/index.html), complete doxygen-auto-produced [API documentation](https://gmlc-tdc.github.io/HELICS-src/doxygen/), and more.

Additionally, our initial requirements document can be found [here](https://github.com/GMLC-TDC/specification-doc/blob/master/src/specification.md), which describes a number of our early design considerations.

# Tools with HELICS support

As a co-simulation framework, HELICS is designed to bring together domain-specific modeling tools so they interact during run time. It effectively tries to build on the sholders of giants by not reinventing trusted simulation tools, but instead, mearly acting as a mediator to coordinate such interactions. HELICS's full power is only apparent when you use it to combine these domain-specific tools.

Thankfully the HELICS API is designed to be minimally invasive and make it straightforward to connect most any tool that provides either a scripting interface or access to source code. As listed below, a growing set of energy domain tools have HELICS support either natively or through an external interface. We also provide a set of helper apps for various utility and testing purposes.

We are always looking for help adding support for more tools, so please contact us if you have any additions.

#### Power systems Tools

Additionally, our initial requirements document can be found [here](https://github.com/GMLC-TDC/specification-doc/blob/master/src/specification.md), which describes a number of our design considerations.
* [GridLAB-D](https://www.gridlabd.org/), an open-source tool for distribution power-flow, DER models, basic house thermal and end-use load models, and more. HELICS support currently (4/14/2018) provided in the [`feature/1024` branch](https://github.com/gridlab-d/gridlab-d/tree/feature/1024) which you have to build yourself as described [here](https://github.com/GMLC-TDC/HELICS-Tutorial/tree/master/setup).
* [Griddyn](https://github.com/LLNL/GridDyn), an open-source transmission power flow and dynamics simulator. HELICS support currently (4/14/2018) provided through the [`cmake_updates` branch](https://github.com/LLNL/GridDyn/tree/cmake_update).
* [PSST](https://github.com/kdheepak/psst), an open-source python-based unit-commitment and dispatch market simulator. HELICS examples are included in the [HELICS-Tutorial](https://github.com/GMLC-TDC/HELICS-Tutorial)
* [MATPOWER](http://www.pserc.cornell.edu/matpower/), an open-source Matlab based power flow and optimal power flow tool. HELICS support currently (4/14/2018) under development.
* [InterPSS](http://www.interpss.org/), a Java-based power systems simulator. HELICS support currently (4/14/2018) under development.

#### Communication Tools

* [ns-3](https://www.nsnam.org/), a discrete-event communication network simulator. Supported via the [HELICS fork of ns-3](https://github.com/GMLC-TDC/ns-3-dev-git)
* HELICS also includes built-in support for simple communications manipulations such as delays, lossy channels, etc. through its built-in filters.

#### HELICS helper Apps

* [HELICS runner](https://github.com/GMLC-TDC/helics-runner) provides a simple way to automate configuring, starting, and stopping HELICS co-simulations.
* [Player](https://gmlc-tdc.github.io/HELICS-src/apps/Player.html), which acts as a simple send-only federate that simply publishes a stream of timed HELICS messages from a user-defined file. HELICS Player is included in the HELICS distribution.
* [Recorder](https://gmlc-tdc.github.io/HELICS-src/apps/Recorder.html), which acts as a simple received-only federate that prints out or saves messages from one or more subscribed streams. HELICS Recorder is included in the HELICS distribution.

# Publications

TODO.
#### General HELICS

[1] B. Palmintier, D. Krishnamurthy, P. Top, S. Smith, J. Daily, and J. Fuller, “Design of the HELICS High-Performance Transmission-Distribution-Communication-Market Co-Simulation Framework,” in *Proc. of the 2017 Workshop on Modeling and Simulation of Cyber-Physical Energy Systems*, Pittsburgh, PA, 2017. [pre-print](https://www.nrel.gov/docs/fy17osti/67928.pdf) [published](https://ieeexplore.ieee.org/document/8064542/)





Expand Down
12 changes: 6 additions & 6 deletions ThirdParty/cereal/archives/binary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ namespace cereal
~BinaryOutputArchive() CEREAL_NOEXCEPT = default;

//! Writes size bytes of data to the output stream
void saveBinary( const void * data, std::size_t size )
void saveBinary( const void * data, std::streamsize size )
{
auto const writtenSize = static_cast<std::size_t>( itsStream.rdbuf()->sputn( reinterpret_cast<const char*>( data ), size ) );
auto const writtenSize = itsStream.rdbuf()->sputn( reinterpret_cast<const char*>( data ), size );

if(writtenSize != size)
throw Exception("Failed to write " + std::to_string(size) + " bytes to output stream! Wrote " + std::to_string(writtenSize));
Expand Down Expand Up @@ -97,9 +97,9 @@ namespace cereal
~BinaryInputArchive() CEREAL_NOEXCEPT = default;

//! Reads size bytes of data from the input stream
void loadBinary( void * const data, std::size_t size )
void loadBinary( void * const data, std::streamsize size )
{
auto const readSize = static_cast<std::size_t>( itsStream.rdbuf()->sgetn( reinterpret_cast<char*>( data ), size ) );
auto const readSize = itsStream.rdbuf()->sgetn( reinterpret_cast<char*>( data ), size );

if(readSize != size)
throw Exception("Failed to read " + std::to_string(size) + " bytes from input stream! Read " + std::to_string(readSize));
Expand Down Expand Up @@ -148,14 +148,14 @@ namespace cereal
template <class T> inline
void CEREAL_SAVE_FUNCTION_NAME(BinaryOutputArchive & ar, BinaryData<T> const & bd)
{
ar.saveBinary( bd.data, static_cast<std::size_t>( bd.size ) );
ar.saveBinary( bd.data, static_cast<std::streamsize>( bd.size ) );
}

//! Loading binary data
template <class T> inline
void CEREAL_LOAD_FUNCTION_NAME(BinaryInputArchive & ar, BinaryData<T> & bd)
{
ar.loadBinary(bd.data, static_cast<std::size_t>(bd.size));
ar.loadBinary(bd.data, static_cast<std::streamsize>( bd.size ) );
}
} // namespace cereal

Expand Down
Loading

0 comments on commit 8cee4c4

Please sign in to comment.