Skip to main content

Python library to read, edit and launch antares-simulator studies

Project description

Antares Craft

CI Quality Gate Status Coverage License PyPI Latest Release

What is it ?

Antares Craft is a python library to read and edit antares-simulator studies, stored either on you local filesystem or on an antares-web server. It also allows you to trigger simulations and retrieve the corresponding result.

Main features

  • Read and edit antares-simulator studies programmatically
  • Work seamlessly on filesystem or antares-web studies
  • Support for variant studies on antares-web
  • Launch simulations, be it on you computer or on antares-web server
  • Retrieve and inspect simulation outputs
  • Generate availability timeseries, be it on you computer or on antares-web server

Installation

Antares Craft can simply be installed from PyPI repository, typically using pip:

pip install antares_craft

Documentation

You may find further information and documentation on readthedocs.

Example

Below as an example, a code snippet where we create a small study with only one area where 100 MW of load are fed with a cluster of 5 power plants of 30 MW each. We then run the simulation and print some results.

For more information and examples please refer to the documentation.

conf = APIconf(api_host="https://antares-web.mydomain",
               token="my-token")

# create a study named "my-study" on the antares-web server
study = create_study_api(study_name="my-study", version="8.8", api_config=conf)

# create an area with 100 MW of load for every hour of the year, and 3000 euros/h for unsupplied energy cost
area = study.create_area(area_name="my-country", properties=AreaProperties(energy_cost_unsupplied=3000))
area.set_load(pd.DataFrame(data=100 * np.ones((8760, 1))))

# create a cluster with 5 nuclear units of 30 MW each, and a generation cost of 30 MW/h
cluster = area.create_thermal_cluster("nuclear",
                                      ThermalClusterProperties(unit_count=5,
                                                               nominal_capacity=30,
                                                               marginal_cost=10,
                                                               market_bid_cost=10,
                                                               group=ThermalClusterGroup.NUCLEAR))
cluster.set_series(pd.DataFrame(data=150 * np.ones((8760, 1))))

# launch a simulation on the server and wait for the result
job = study.run_antares_simulation()
study.wait_job_completion(job)
output = study.get_output(job.output_id)

# read some output data as a pandas dataframe:
res = output.aggregate_mc_all_areas(data_type="details", frequency="hourly")
print(res)

should print the following output, which shows that at every hour the created cluster has generated 100 MW as expected to feed the load, and had to start 4 units (NODU column).

            area  cluster  timeId  production  NP Cost  NODU  Profit - Euro
0     my-country  nuclear       1       100.0      0.0   4.0            0.0
1     my-country  nuclear       2       100.0      0.0   4.0            0.0
2     my-country  nuclear       3       100.0      0.0   4.0            0.0
3     my-country  nuclear       4       100.0      0.0   4.0            0.0
4     my-country  nuclear       5       100.0      0.0   4.0            0.0
...          ...      ...     ...         ...      ...   ...            ...
8731  my-country  nuclear    8732       100.0      0.0   4.0            0.0
8732  my-country  nuclear    8733       100.0      0.0   4.0            0.0
8733  my-country  nuclear    8734       100.0      0.0   4.0            0.0
8734  my-country  nuclear    8735       100.0      0.0   4.0            0.0
8735  my-country  nuclear    8736       100.0      0.0   4.0            0.0

[8736 rows x 7 columns]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

antares_craft-0.9.5.tar.gz (144.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

antares_craft-0.9.5-py3-none-any.whl (219.3 kB view details)

Uploaded Python 3

File details

Details for the file antares_craft-0.9.5.tar.gz.

File metadata

  • Download URL: antares_craft-0.9.5.tar.gz
  • Upload date:
  • Size: 144.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for antares_craft-0.9.5.tar.gz
Algorithm Hash digest
SHA256 d80f6b8768820d0bb66ccbe0b1e076cb8d21c5bd420e02379d570f1766e8a7bb
MD5 46424b804be712e8c9a4e728116c8cbd
BLAKE2b-256 00ac80a95d09d5808919d96f3a9f1230e7fcb02b13f06dc9ce75f1b6cc010369

See more details on using hashes here.

File details

Details for the file antares_craft-0.9.5-py3-none-any.whl.

File metadata

  • Download URL: antares_craft-0.9.5-py3-none-any.whl
  • Upload date:
  • Size: 219.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for antares_craft-0.9.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b9dda322f8d5917720d9bf3690abb41645d5522cff29a06d8e28950ddf7ef8df
MD5 04b9c388c8d973fb36f362782b3de993
BLAKE2b-256 2e1593d6bf32a5572da0a15d73bcbaca36665510ca2e9fca34f60dd7e606451e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page