Skip to content

Commit

Permalink
add user guide
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle committed Nov 26, 2024
1 parent 217cc72 commit 3e7a6ee
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 4 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ Antares Craft python library is currently under construction. When completed it
antares studies.

This project only supports antares studies with a version v8.8 or higher.

**Table of Contents**

- [usage](docs/usage.md)
- [development](docs/development.md)
- [Changelog](docs/CHANGELOG.md)
43 changes: 43 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Introduction

With antares-craft you can interact with studies using AntaresWeb API or in local mode.
To interact with AntaresWeb you need a token.

## AntaresWeb

### How to create a study

```
api_config = APIconf(api_host=antares_web.url, token=your_token, verify=False)
study = create_study_api("antares-craft-test", "880", api_config)
```

### How to point to an existing study

Not handled yet

## LOCAL

### How to create a study

study = create_study_local("your_name", 880, {"local_path": "your_path", "study_name": "your_name"})

### How to point to an existing study

`study = read_study_local(study_path)`

## Apart from that every operation is the same no matter the environment you're targetting.

### How to create an area with given properties:

```
area_properties = AreaProperties()
area_properties.energy_cost_unsupplied = 10
study.create_area("fr", area_properties)
```

### How to access study areas

```
area_list = study.read_areas()
```
5 changes: 1 addition & 4 deletions tests/integration/test_web_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from antares.model.st_storage import STStorageGroup, STStorageMatrixName, STStorageProperties
from antares.model.study import create_study_api
from antares.model.thermal import ThermalClusterGroup, ThermalClusterProperties
from antares.service.api_services.area_api import AreaApiService

from tests.integration.antares_web_desktop import AntaresWebDesktop

Expand All @@ -52,8 +51,6 @@ def test_creation_lifecycle(self, antares_web: AntaresWebDesktop):

study = create_study_api("antares-craft-test", "880", api_config)

area_api = AreaApiService(api_config, study.service.study_id)

# tests area creation with default values
area_name = "FR"
area_fr = study.create_area(area_name)
Expand Down Expand Up @@ -196,7 +193,7 @@ def test_creation_lifecycle(self, antares_web: AntaresWebDesktop):
assert properties.group == STStorageGroup.BATTERY

# test reading list of areas
area_list = area_api.read_areas()
area_list = study.read_areas()
assert len(area_list) == 3
# asserts areas are sorted by id
assert area_list[0].id == area_be.id
Expand Down

0 comments on commit 3e7a6ee

Please sign in to comment.