Skip to main content

PyPI version PyPI license pipeline status

AMIRIS-Py

Python tools for the electricity market model AMIRIS.

Installation

pip install amirispy

You may also use pipx. For detailed information please refer to the official pipx documentation.

pipx install amirispy

Further Requirements

In order to execute all commands provided by amirispy, you also require a Java Development Kit (JDK). JDK must be installed and accessible via your console in which you run amirispy.

To test, run java --version which should show your JDK version (required: 11 or above). If java command is not found or relates to a Java Runtime Environment (JRE), please download and install JDK (e.g. from Adoptium)

Usage

Currently, there are three distinct commands available:

  • amiris download: download the latest versions of AMIRIS and examples files
  • amiris run: perform a full workflow by compiling the .pb file from your scenario.yaml, executing AMIRIS, and extracting the results
  • amiris batch: perform multiple runs, each with scenario compilation, AMIRIS execution, and results extraction
  • amiris comparison: compare the results of two different AMIRIS runs to check their equivalence

You may also use the arguments as a list of strings in your script directly, e.g.

from amirispy.scripts import amiris_cli

amiris_cli(["download", "-m", "model"])

amiris download

Downloads and extracts the latest open access AMIRIS instance and accompanying examples.

Option Provides
-u or --url URL to download AMIRIS from (default: latest AMIRIS artifact from https://gitlab.com/dlr-ve/esy/amiris/amiris
-t or --target Folder to download amiris-core_<version>-jar-with-dependencies.jar to (default: ./)
-f or --force Force download which may overwrites existing AMIRIS installation of same version and existing examples (default: False)
-m or --mode Option to download model and examples all (default), only model, or only examples

amiris run

Compile scenario, execute AMIRIS, and extract results.

Option Provides
-s or --scenario Path to a scenario yaml-file
-j or --jar Path to amiris-core_<version>-jar-with-dependencies.jar, defaults to a single "amiris*.jar"-file in current working directory
-o or --output Directory to write output to, defaults to "./result"
-oo or --output-options Optional arguments to override default output conversion arguments of fameio
-co or --core-options Optional pass through of FAME-Core's command-line options, see FAME-Core documentation
-nc or --no-checks Skip checks for Java installation and correct version to increase speed
-n or --number-of-cores The number of parallel processes to start AMIRIS with in multicore mode; requires OpenMPI linked with Java

Bug in argparse

:warning: If you provide but a single flag to --output-options or --core-options, you may get a crash as there is a bug in the argparse library which will not be fixed. We recommend the workaround: Add an equal between the amiris-py option name and its argument, e.g., change -oo "-m" to -oo="-m".

Calling AMIRIS from your own script using amiris_cli

If you happen to run AMIRIS in your own script by importing amiris_cli, this is an example of how to use it.

from amirispy.scripts import amiris_cli

commands = [
    "-l", "critical",
    "run",
    "-j", "amiris-core_3.4.0-jar-with-dependencies.jar",
    "-s", "examples/Germany2019/scenario.yaml",
    "-oo", "-m ",
]

amiris_cli(commands)

:warning: Similar to the command-line call you need to work around the argparse bug when using --output-option with a single flag only. Thus, the extra space in statement "-oo", "-m " is intended - see explanation above.

amiris batch

Perform multiple runs - each with scenario compilation, AMIRIS execution, and results extraction

Option Provides
-s or --scenarios Path to single or list of: scenario yaml-files or their enclosing directories
-j or --jar Path to amiris-core_<version>-jar-with-dependencies.jar, defaults to a single "amiris*.jar"-file in current working directory
-o or --output Directory to write output to "./result"
-r or --recursive Option to recursively search in provided Path for scenario (default: False)
-p or --pattern Optional name pattern that scenario files searched for must match
-oo or --output-options Optional arguments to override default output conversion arguments of fameio
-nc or --no-checks Skip checks for Java installation and correct version to increase speed
-n or --number-of-cores The number of parallel processes to start AMIRIS with in multicore mode; requires OpenMPI linked with Java

See description of amiris run for details on the issues with the -oo option.

amiris compare

Compare if results of two AMIRIS runs and equivalent.

Option Provides
-e or --expected Path to folder with expected result .csv files
-t or --test Path to folder with results files (.csv) to test for equivalence
-i or --ignore Optional list of file names not to be compared

Help

You reach the help menu at any point using -h or --help which gives you a list of all available options, e.g.:

amiris --help

Logging

You may define a logging level or optional log file as first arguments in your workflow using any of the following arguments:

Option Provides
-l or --log logging level, defaults to error; options are debug, info, warning, warn, error, critical.
-lf or --logfile path to log file, defaults to None; if None is provided, all logs get only printed to the console.

Example: amiris --log debug --logfile my/log/file.txt download

Cite AMIRIS-Py

If you use AMIRIS-Py in academic work, please cite 10.21105/joss.05041

@article{Schimeczek2023, 
  title = {{AMIRIS}: Agent-based Market model for the Investigation of Renewable and Integrated energy Systems}, 
  author = {Schimeczek, Christoph and Nienhaus, Kristina and Frey, Ulrich and Sperber, Evelyn and Sarfarazi, Seyedfarzad and Nitsch, Felix and Kochems, Johannes and Ghazi, A. Achraf El}, 
  journal = {Journal of Open Source Software}, 
  year = {2023}, 
  volume = {8}, 
  number = {84}, 
  pages = {5041}, 
  publisher = {The Open Journal}, 
  doi = {10.21105/joss.05041}, 
} 

Contributing

Please see CONTRIBUTING.

Available Support

This is a purely scientific project by (at the moment) one research group. Thus, there is no paid technical support available.

If you experience any trouble with AMIRIS, you may contact the developers at the openMod-Forum or via amiris@dlr.de. Please report bugs and make feature requests by filing issues following the provided templates (see also CONTRIBUTING). For substantial enhancements, we recommend that you contact us via amiris@dlr.de for working together on the code in common projects or towards common publications and thus further develop AMIRIS.

Acknowledgement

Work on AMIRIS-Py was financed by the Helmholtz Association's Energy System Design research programme.

Release files for amirispy 4.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for amirispy 4.0.0
File Size Uploaded
amirispy-4.0.0.tar.gz 33.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for amirispy 4.0.0
File Interpreter ABI Platform
amirispy-4.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 71.3 kB

Release files / amirispy-4.0.0.tar.gz

Download URL amirispy-4.0.0.tar.gz
Size 33.2 kB
Tags Source
SHA-256 checksum
How to use checksums
fc477f85846f2bd30614ab8ada999eb7a0984ff29b6cc2433de48733e49475f3
BLAKE2b-256 checksum
How to use checksums
9f9557ad66d7a1e10a57972554259dbe18f4433bcdc58219e03fb7d5047bf53c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.14.3 Windows/11

Release files / amirispy-4.0.0-py3-none-any.whl

Download URL amirispy-4.0.0-py3-none-any.whl
Size 38.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eba9d6b4a8b7fca5be7560cb29807b7853d5c6536f6918227e6d2f73335eafb8
BLAKE2b-256 checksum
How to use checksums
6278530676bfc4d2fd81f99669f34c3c4dd2b1e770f79d8d9e1a602c81376c37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.14.3 Windows/11

Release history Release notifications | RSS feed

4.0.1

2 release files

This release

4.0.0 This release

2 release files

3.4.0

2 release files

3.3.2

2 release files

3.3.1

2 release files

3.3.0

2 release files

3.2.1

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.3

2 release files

1.2

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page