Skip to content

dynawo/dynawo-algorithms

Repository files navigation

Dynaωo-algorithms

Build Status Quality Gate Status Coverage MPL-2.0 License

Dynaωo-algorithms is a wrapper around Dynaωo that provides utility algorithms to calculate complex key values of a power system.

It can be used with any tool of the Dynaωo toolsuite (DynaFlow, DynaWaltz, DynaSwing, DySym, DynaWave).

It provides the following possibilities:

  • Unitary simulations: simulations of one or several power systems test cases described in a .jobs file (see Dynaωo documentation);
  • Systematic analysis: simulations of a same base power system test case subject to different events to assess the global stability;
  • Margin calculation: simulations of a same base power system test case with a load variation and subject to different events to compute the maximum load increase in a specific region before the voltage collapses;
  • Load increase: simulation of a single load variation.

Get involved!

Dynaωo-algorithms is an open-source project and as such, questions, discussions, feedbacks and more generally any form of contribution are very welcome and greatly appreciated!

For further informations about contributing guidelines, please refers to the contributing documentation.

Dynaωo algorithms Distribution

You can download a pre-built Dynaωo-algorithms release to start testing it. Pre-built releases are available for Linux and Windows:

Linux Requirements for Distribution

  • Binary utilities: curl and unzip
$> apt install -y unzip curl
$> dnf install -y unzip curl

Windows Requirements for Distribution

> msmpisetup

Using a distribution

Linux

You can launch the following commands to download and test the latest distribution:

$> curl -L $(curl -s -L -X GET https://api.github.com/repos/dynawo/dynawo-algorithms/releases/latest | grep "DynawoAlgorithms_Linux_v" | grep url | cut -d '"' -f 4) -o DynawoAlgorithms_Linux_latest.zip
$> unzip DynawoAlgorithms_Linux_latest.zip
$> cd dynawo-algorithms
$> ./dynawo-algorithms.sh --help
$> ./dynawo-algorithms.sh CS --input examples/CS/IEEE14.jobs
$> ./dynawo-algorithms.sh SA --input fic_MULTIPLE.xml --output testSA.zip --directory examples/SA
$> ./dynawo-algorithms.sh MC --input fic_MULTIPLE.xml --output testMC.zip --directory examples/MC

Windows

Download the zip of the distribution and unzip it somewhere. Then open either Command Prompt or x64 Native Tools Command Prompt for VS2019 and use cd to go into the directory you previously unzipped. You should see a dynawo-algorithms.cmd file at the top of the folder. You can then launch:

> dynawo-algorithms help
> dynawo-algorithms CS --input examples/CS/IEEE14.jobs
> dynawo-algorithms SA --input fic_MULTIPLE.xml --output testSA.zip --directory examples/SA
> dynawo-algorithms MC --input fic_MULTIPLE.xml --output testMC.zip --directory examples/MC

Build Dynaωo-algorithms on Linux

Optional requirements

You can install the following 3rd parties with system packages for Ubuntu 20.04:

$> apt install -y libgoogle-perftools-dev mpich

For other Linux distributions similar packages should exist. If not they will be downloaded and installed during the next steps.

Configure

You can either choose to build Dynaωo-algorithms with a pre-built nightly version of Dynaωo or by building Dynaωo from scratch. Choose one of the two options below.

With pre-build dynawo nightly

$> cd dynawo-algorithms
$> curl -LO https://github.com/dynawo/dynawo/releases/download/nightly/Dynawo_headers_v1.6.0.zip
$> unzip Dynawo_headers_v1.6.0.zip
PATH_TO_DYNAWO_DEPLOY=$(pwd)/dynawo

By building dynawo

To build Dynaωo and deploy, you can do:

$> ./myEnvDynawo.sh build-all
$> ./myEnvDynawo.sh deploy

This command creates a deploy folder in ${DYNAWO_HOME}. The path to dynawo deploy is then the path to the subdirectory dynawo in the deploy folder. It is generally similar to:

PATH_TO_DYNAWO_DEPLOY=${DYNAWO_HOME}/deploy/gcc8/shared/dynawo/

Environment creation

To build Dynaωo-algorithms you need to clone the repository and launch the following commands in the source code directory. it will create a myEnvDynawoAlgorithms.sh script file that will be your personal entrypoint to launch algorithms and configure some options.

$> echo '#!/bin/bash
export DYNAWO_ALGORITHMS_HOME=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
export DYNAWO_HOME=PATH_TO_DYNAWO_DEPLOY

export DYNAWO_LOCALE=en_GB
export DYNAWO_RESULTS_SHOW=true
export DYNAWO_BROWSER=firefox

export DYNAWO_NB_PROCESSORS_USED=1

export DYNAWO_BUILD_TYPE=Release

$DYNAWO_ALGORITHMS_HOME/util/envDynawoAlgorithms.sh $@' > myEnvDynawoAlgorithms.sh
$> chmod +x myEnvDynawoAlgorithms.sh

Then update the path "PATH_TO_DYNAWO_DEPLOY" in the file to your deployed installation of Dynaωo

Build

launch the following command:

$> ./myEnvDynawoAlgorithms.sh build

All commands described in the rest of this README are accessible throught this script. To access all options of the script myEnvDynawoAlgorithms.sh, type:

$> ./myEnvDynawoAlgorithms.sh help

To deploy Dynaωo-algorithms, launch the following command after build:

$> ./myEnvDynawoAlgorithms.sh deploy

Build and use Dynaωo-algorithms on Windows

Requirements

> msmpisdk.msi

Build

Open x64 Native Tools Command Prompt for VS2019 and run the following commands (don't forget to adjust the path to the Dynaωo deploy folder in the DYNAWO_HOME define):

> git config --global core.eol lf
> git config --global core.autocrlf input
> md dynawo-project
> cd dynawo-project
> git clone https://github.com/dynawo/dynawo-algorithms.git
> cd dynawo-algorithms
> cmake -S . -B b -DUSE_MPI=YES -DCMAKE_INSTALL_PREFIX=../da-i -DDYNAWO_ALGORITHMS_HOME=. -DDYNAWO_HOME=../dynawo/deploy/dynawo -DDYNAWO_ALGORITHMS_THIRD_PARTY_DIR=. -G "NMake Makefiles"
> cmake --build b --target install

Warning We try to limit as far as possible the name of the build and install folders (for example da-i instead of dynawo-algorithms-install) because of Windows limitation of length of path for folders. We know it causes problems and the only solution is to install Dynaωo-algorithms in a shorter length directory path.

Warning Only the build directory (b) can be located in the dynawo-algorithms folder, the install (da-i) folder should be located outside to avoid problems with CMake.

Command utility

A command file dynawo-algorithms.cmd (similar to myEnvDynawoAlgorithms.sh or dynawo-algorithms.sh) is available:

  • from build environment: use util\windows\dynawo-algorithms
  • from installation or deploy or distribution folder: use dynawo-algorithms
usage: dynawo-algorithms [VERBOSE] [DEBUG] [HELP | <command>]

HELP command displays this message.
Add VERBOSE option to echo environment variables used.
All commands are run in Release mode by default. Add DEBUG option to turn in Debug mode.

These are commands used by end-user:
  CS|SA|MC [<simulation_options>] Launch dynawoAlgorithms simulation (see simulation_options below)
  [SHOW] nrt                      Launch dynawoAlgorithms Non Regressions Tests (option SHOW uses DYNAWO_BROWSER to show results)
  version                         Print dynawoAlgorithms version

where <simulation_options> are:
  --simulationType arg  Set the simulation type to launch : MC (Margin
                        calculation),  SA (systematic analysis) or CS (compute
                        simulation)
  --input arg           Set the input file of the simulation (*.zip or *.xml)
  --output arg          Set the output file of the simulation (*.zip or *.xml)
  --directory arg       Set the working directory of the simulation
  --variation arg       Specify a specific load increase variation to launch

These are commands used by developer only:
  build [<install_dir>]           Build dynawoAlgorithms
  [SHOW] tests [<unit_test>]      Build and run unit tests or a specific unit test (option SHOW lists available unit tests)
  clean                           Clean build directory
  deploy [<deploy_dir>]           Deploy the current version of dynawoAlgorithms binaries/libraries/includes
                                  to be used as a release by an another project
  distrib [<distrib_dir>]         Create distribution of dynawoAlgorithms
  distrib-headers [<distrib_dir>] Create distribution of dynawoAlgorithms with headers
  distrib-omc [<distrib_dir>]     Create distribution of dynawoAlgorithms with OpenModelica

Not all options are available depending on whether the utility is run from the build environment or the installation/deployment/distribution folder.

The utility tries to guess some environment variables from context and set other to default values (please set it to another value if not correct):

  DYNAWO_HOME=<found_in_distribution_or_in_a_known_place_for_deployment>
  DYNAWO_ALGORITHMS_HOME=<found_in_a_known_place_for_building_environment>
  DYNAWO_ALGORITHMS_LOCALE=en
  DYNAWO_USE_XSD_VALIDATION=false
  DYNAWO_PYTHON_COMMAND=python
  DYNAWO_BROWSER=<read_from_registry_with_default_to_iexplore>
  DYNAWO_NB_PROCESSORS_USED=2

Then the utility automatically sets all other environment variables based on the commandline, above variables and context.

Tests

To launch Dynaωo-algorithms unit tests, launch the following command:

$> ./myEnvDynawoAlgorithms.sh build-tests

To launch Dynaωo-algorithms nrt, launch the following command after build:

$> ./myEnvDynawoAlgorithms.sh nrt

Launching a simulation

For more details on the fic_MULTIPLE.xml and aggregatedResults.xml formats please refer to the documentation.

$> ./myEnvDynawoAlgorithms.sh CS --input PATH_TO_JOBS

Launching a systematic analysis

$> ./myEnvDynawoAlgorithms.sh SA --directory PATH_TO_SA_FOLDER --input fic_MULTIPLE.xml --output aggregatedResults.xml --nbThreads NB_THREADS_TO_USE

fic_MULTIPLE.xml can be replaced by an archive file containing all the required input files

Launching a margin calculation

$> ./myEnvDynawoAlgorithms.sh MC --directory PATH_TO_MC_FOLDER --input fic_MULTIPLE.xml --output aggregatedResults.xml --nbThreads NB_THREADS_TO_USE

fic_MULTIPLE.xml can be replaced by an archive file containing all the required input files

Creating the distribution

$> ./myEnvDynawoAlgorithms.sh distrib

Dynaωo-algorithms Documentation

You can download Dynaωo-algorithms documentation here.

Quoting Dynaωo

If you use Dynaωo or Dynaωo-algorithms in your work or research, it is not mandatory but we kindly ask you to quote the following paper in your publications or presentations:

A. Guironnet, M. Saugier, S. Petitrenaud, F. Xavier, and P. Panciatici, “Towards an Open-Source Solution using Modelica for Time-Domain Simulation of Power Systems,” 2018 IEEE PES Innovative Smart Grid Technologies Conference Europe (ISGT-Europe), Oct. 2018.

License

Dynaωo-algorithms is licensed under the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, you can obtain one at http://mozilla.org/MPL/2.0. You can also see the LICENSE file for more information.

Dynaωo-algorithms is using some external libraries to run simulations:

  • on Linux:
    • gperftools, a collection of a high-performance multi-threaded malloc implementations distributed under the BSD license. Dynaωo-algorithms is currently using the version 2.6.1.
    • MPICH, an implementation of the Message Passing Interface (MPI) standard distributed under a BSD-like license. Dynaωo-algorithms currently using the version 3.4.2.
  • on Windows:
    • MSMPI, a Microsoft implementation of the Message Passing Interface standard distributed under a MIT license. Dynaωo-algorithms currently using the version 10.1.2.

Maintainers

Dynaωo-algorithms is currently maintained by the following people in RTE:

In case of questions or issues, you can also send an e-mail to [email protected].

Links

For more information about Dynaωo and Dynaωo-algorithms: