fameio 2.0.0__tar.gz → 2.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fameio-2.0.0 → fameio-2.1.1}/CHANGELOG.md +45 -22
- {fameio-2.0.0 → fameio-2.1.1}/PKG-INFO +43 -31
- {fameio-2.0.0 → fameio-2.1.1}/README.md +41 -29
- {fameio-2.0.0 → fameio-2.1.1}/pyproject.toml +2 -2
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/scripts/convert_results.py +9 -9
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/scripts/make_config.py +3 -3
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/cli/convert_results.py +11 -2
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/cli/make_config.py +2 -2
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/cli/options.py +0 -1
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/cli/parser.py +3 -3
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/loader.py +10 -10
- fameio-2.1.1/src/fameio/source/logs.py +114 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/results/conversion.py +4 -4
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/results/csv_writer.py +4 -4
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/results/data_transformer.py +3 -20
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/results/input_dao.py +3 -3
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/results/output_dao.py +4 -1
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/results/reader.py +8 -8
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/results/yaml_writer.py +2 -2
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/scenario/contract.py +2 -2
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/scenario/exception.py +2 -2
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/scenario/generalproperties.py +2 -2
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/schema/agenttype.py +5 -5
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/schema/attribute.py +4 -4
- fameio-2.1.1/src/fameio/source/schema/java_packages.py +69 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/schema/schema.py +23 -7
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/series.py +5 -3
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/validator.py +5 -5
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/writer.py +23 -12
- fameio-2.0.0/src/fameio/source/logs.py +0 -83
- {fameio-2.0.0 → fameio-2.1.1}/LICENSE.txt +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/LICENSES/Apache-2.0.txt +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/LICENSES/CC-BY-4.0.txt +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/LICENSES/CC0-1.0.txt +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/__init__.py +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/scripts/__init__.py +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/scripts/__init__.py.license +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/scripts/convert_results.py.license +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/scripts/make_config.py.license +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/__init__.py +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/cli/__init__.py +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/path_resolver.py +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/results/__init__.py +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/results/agent_type.py +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/scenario/__init__.py +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/scenario/agent.py +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/scenario/attribute.py +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/scenario/fameiofactory.py +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/scenario/scenario.py +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/schema/__init__.py +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/schema/exception.py +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/time.py +0 -0
- {fameio-2.0.0 → fameio-2.1.1}/src/fameio/source/tools.py +0 -0
@@ -1,10 +1,33 @@
|
|
1
|
-
<!-- SPDX-FileCopyrightText:
|
1
|
+
<!-- SPDX-FileCopyrightText: 2024 German Aerospace Center <fame@dlr.de>
|
2
2
|
|
3
3
|
SPDX-License-Identifier: CC0-1.0 -->
|
4
4
|
|
5
5
|
# Changelog
|
6
|
+
## [2.1.1](https://gitlab.com/fame-framework/fame-io/-/tags/v2.1.1) - 2024-05-28
|
7
|
+
### Fixed
|
8
|
+
- ConvertFameResults: Fix crash on complex column conversion if Agent has no simple columns #204 (@dlr_fn @dlr-cjs)
|
9
|
+
|
10
|
+
## [2.1.0](https://gitlab.com/fame-framework/fame-io/-/tags/v2.1.0) - 2024-05-11
|
11
|
+
### Changed
|
12
|
+
- Changed format of auto-created timeseries from constant values #196 (@dlr-cjs)
|
13
|
+
- Changed default log level to "WARNING" #191 (@dlr_fn @dlr-cjs)
|
14
|
+
- Adapted link-formatting in Changelog !155 (@dlr-cjs)
|
15
|
+
|
16
|
+
### Added
|
17
|
+
- Read java package names from Schema and write to input.pb #198 (@dlr-cjs)
|
18
|
+
|
19
|
+
### Fixed
|
20
|
+
- Fix docstrings in CLI `handle_args()` #190 (@dlr-cjs @dlr_fn)
|
21
|
+
- Fix potential duplicates in logging #191 (@dlr_fn @dlr-cjs)
|
22
|
+
|
23
|
+
## [2.0.1](https://gitlab.com/fame-framework/fame-io/-/tags/v2.0.1) - 2024-04-05
|
24
|
+
### Fix
|
25
|
+
- Fix potential missing columns when memory-saving-mode `-m` is enabled #194 (@dlr_fn @dlr-cjs)
|
26
|
+
|
27
|
+
### Remove
|
28
|
+
- Remove convert results option `-cc MERGE` #194 (@dlr_fn @dlr-cjs)
|
6
29
|
|
7
|
-
## [2.0.0
|
30
|
+
## [2.0.0](https://gitlab.com/fame-framework/fame-io/-/tags/v2.0.0) - 2024-04-03
|
8
31
|
### Changed
|
9
32
|
- **Breaking**: Removed support for `python==3.8` #163 (@dlr-cjs @dlr_fn)
|
10
33
|
- **Breaking**: Signature of `run` functions in `make_config.py` and `convert_results.py` changed: the input file is now read from the configuration dictionary #163 (@dlr-cjs @dlr_fn)
|
@@ -45,11 +68,11 @@ SPDX-License-Identifier: CC0-1.0 -->
|
|
45
68
|
- Fix breaking tests in Pytest 8.0 #176 (@dlr-cjs)
|
46
69
|
- Fix PyTests for Python 3.12 #182 (@dlr_fn)
|
47
70
|
|
48
|
-
## [1.8.1
|
71
|
+
## [1.8.1](https://gitlab.com/fame-framework/fame-io/-/tags/v1.8.1) - 2023-05-04
|
49
72
|
### Fixed
|
50
73
|
- Fix fail of `ConvertFameResults` when `merge-times` was not specified
|
51
74
|
|
52
|
-
## [1.8.0
|
75
|
+
## [1.8.0](https://gitlab.com/fame-framework/fame-io/-/tags/v1.8) - 2023-04-14
|
53
76
|
### Changed
|
54
77
|
- Update repository to be compliant to `REUSE` standard
|
55
78
|
- Accept custom `date_format` (default: `"%Y-%m-%d_%H:%M:%S"`) for `FameTime.convert_fame_time_step_to_datetime()`
|
@@ -61,7 +84,7 @@ SPDX-License-Identifier: CC0-1.0 -->
|
|
61
84
|
- Add option to merge time steps in results with `convertFameResults`
|
62
85
|
- Add pre-commit hooks enforcing high coding standards and reducing CI runner minutes during development
|
63
86
|
|
64
|
-
## [1.7.0
|
87
|
+
## [1.7.0](https://gitlab.com/fame-framework/fame-io/-/tags/v1.7) - 2023-02-20
|
65
88
|
### Added
|
66
89
|
- Support dictionaries in Schema for field `Products` in elements of `AgentTypes`
|
67
90
|
- Support dictionaries in Schema for field `Values` in elements of `Attributes`
|
@@ -73,15 +96,15 @@ SPDX-License-Identifier: CC0-1.0 -->
|
|
73
96
|
### Remove
|
74
97
|
- **Breaking**: `Products` in Schema no longer support single non-list values
|
75
98
|
|
76
|
-
## [1.6.3
|
99
|
+
## [1.6.3](https://gitlab.com/fame-framework/fame-io/-/tags/v1.6.3) - 2022-11-04
|
77
100
|
### Added
|
78
101
|
- Allow parsing `Help` for `Attributes` in `schema`
|
79
102
|
|
80
|
-
## [1.6.1
|
103
|
+
## [1.6.1](https://gitlab.com/fame-framework/fame-io/-/tags/v1.6.1) - 2022-11-02
|
81
104
|
### Changed
|
82
105
|
- Use existing logger if already set up to avoid duplicates when `fameio` is used as dependency in third party workflows
|
83
106
|
|
84
|
-
## [1.6.0
|
107
|
+
## [1.6.0](https://gitlab.com/fame-framework/fame-io/-/tags/v1.6) - 2022-07-08
|
85
108
|
### Added
|
86
109
|
- Add option to enable memory saving mode using the flag `-m` or `--memory-saving`
|
87
110
|
- Add options to deal with complex indexed output columns using the flag `-cc` or `--complex-column` with
|
@@ -94,23 +117,23 @@ SPDX-License-Identifier: CC0-1.0 -->
|
|
94
117
|
- Reduce memory profile for `convertFameResults`
|
95
118
|
- Extract `source` scripts relevant for `convertFameResults` to be hosted in subpackage `results`
|
96
119
|
|
97
|
-
## [1.5.4
|
120
|
+
## [1.5.4](https://gitlab.com/fame-framework/fame-io/-/tags/v1.5.4) - 2022-06-01
|
98
121
|
### Changed
|
99
122
|
- Limit `protobuf` dependency to `>=3.19,<4.0`
|
100
123
|
|
101
|
-
## [1.5.3
|
124
|
+
## [1.5.3](https://gitlab.com/fame-framework/fame-io/-/tags/v1.5.3) - 2022-03-18
|
102
125
|
### Changed
|
103
126
|
- Harmonize interface with `famegui`
|
104
127
|
- Return `None` on failure of `resolve_series_file_path` instead of raising a `FileNotFoundError`
|
105
128
|
|
106
|
-
## [1.5.2
|
129
|
+
## [1.5.2](https://gitlab.com/fame-framework/fame-io/-/tags/v1.5.2) - 2022-03-10
|
107
130
|
### Changed
|
108
131
|
- Allow interfacing of `famegui` with `scenario` (e.g. serialization, error handling)
|
109
132
|
- Move `scenario` validation to `validator.py`
|
110
133
|
- Extract `path_resolver.py`
|
111
134
|
- Increase test coverage by incorporating [AMIRIS examples](https://gitlab.com/dlr-ve/esy/amiris/examples)
|
112
135
|
|
113
|
-
## [1.5.1
|
136
|
+
## [1.5.1](https://gitlab.com/fame-framework/fame-io/-/tags/v1.5.1) - 2022-01-10
|
114
137
|
### Added
|
115
138
|
- Provide documentation on installation using `pipx`
|
116
139
|
- Add optional argument `-se`/`--singleexport` for exporting individual files for each agent
|
@@ -120,7 +143,7 @@ SPDX-License-Identifier: CC0-1.0 -->
|
|
120
143
|
- Refactor `scenario.py`
|
121
144
|
- Ensure code formatting using `black`
|
122
145
|
|
123
|
-
## [1.5.0
|
146
|
+
## [1.5.0](https://gitlab.com/fame-framework/fame-io/-/tags/v1.5) - 2021-06-30
|
124
147
|
### Added
|
125
148
|
- Support specifying an output folder in command line interface of `convert_results.py`
|
126
149
|
|
@@ -128,7 +151,7 @@ SPDX-License-Identifier: CC0-1.0 -->
|
|
128
151
|
- Update to latest protobuf package
|
129
152
|
- Refactor code
|
130
153
|
|
131
|
-
## [1.4.0
|
154
|
+
## [1.4.0](https://gitlab.com/fame-framework/fame-io/-/tags/v1.4) - 2021-06-10
|
132
155
|
### Added
|
133
156
|
- Enable "Default" values for Attributes - these are used in case a mandatory attribute is not specified in the Scenario
|
134
157
|
- Allow "List" Attributes with multiple values
|
@@ -145,7 +168,7 @@ SPDX-License-Identifier: CC0-1.0 -->
|
|
145
168
|
### Fixed
|
146
169
|
- Fixed minor bugs
|
147
170
|
|
148
|
-
## [1.3.0
|
171
|
+
## [1.3.0](https://gitlab.com/fame-framework/fame-io/-/tags/v1.3) - 2021-04-13
|
149
172
|
### Added
|
150
173
|
- Enable `Attributes` in agents (formerly known as `Fields`) to be structured in complex tree-like data dictionaries
|
151
174
|
- Allow contracts to support `Attributes` of type `int`, `float`, `enum` or `dict`
|
@@ -160,26 +183,26 @@ SPDX-License-Identifier: CC0-1.0 -->
|
|
160
183
|
- Raise critical error when trying to convert empty protobuf output file
|
161
184
|
- Check if `product` in `contract` is valid according to `schema.yaml`
|
162
185
|
|
163
|
-
## [1.2.4
|
186
|
+
## [1.2.4](https://gitlab.com/fame-framework/fame-io/-/tags/v1.2.4) - 2021-02-26
|
164
187
|
### Changed
|
165
188
|
- Move `is_compatible` function to class `AttributeType`
|
166
189
|
|
167
|
-
## [1.2.3
|
190
|
+
## [1.2.3](https://gitlab.com/fame-framework/fame-io/-/tags/v1.2.3) - 2021-02-24
|
168
191
|
### Fixed
|
169
192
|
- Fix file prefix `IGNORE_` (used when loading a set of contract files with the !include argument) is now working consistently
|
170
193
|
|
171
|
-
## [1.2.2
|
194
|
+
## [1.2.2](https://gitlab.com/fame-framework/fame-io/-/tags/v1.2.2) - 2021-02-18
|
172
195
|
### Changed
|
173
196
|
- **Breaking**: Rename `fieldtype` to `attributetype` in `schema.yaml`
|
174
197
|
- Derive protobuf imports from `fameprotobuf` package
|
175
198
|
- Improve handling of cases for keys in `scenario.yaml`
|
176
199
|
- Improve handling of time stamp strings
|
177
200
|
|
178
|
-
## [1.2.1
|
201
|
+
## [1.2.1](https://gitlab.com/fame-framework/fame-io/-/tags/v1.2.1) - 2021-02-10
|
179
202
|
### Changed
|
180
203
|
- Improve key handling for contracts which are now case-insensitive
|
181
204
|
|
182
|
-
## [1.2.0
|
205
|
+
## [1.2.0](https://gitlab.com/fame-framework/fame-io/-/tags/v1.2) - 2021-02-04
|
183
206
|
### Added
|
184
207
|
- Add `!include` command to yaml loading to allow integrating additional yaml files
|
185
208
|
|
@@ -192,7 +215,7 @@ SPDX-License-Identifier: CC0-1.0 -->
|
|
192
215
|
### Fixed
|
193
216
|
- Fix bugs
|
194
217
|
|
195
|
-
## [1.1.0
|
218
|
+
## [1.1.0](https://gitlab.com/fame-framework/fame-io/-/tags/v1.1) - 2020-12-09
|
196
219
|
### Added
|
197
220
|
- Package to PyPI
|
198
221
|
- Provide executables for calling `makeFameRunConfig` and `convertFameResults`
|
@@ -200,5 +223,5 @@ SPDX-License-Identifier: CC0-1.0 -->
|
|
200
223
|
### Changed
|
201
224
|
- Improve documentation
|
202
225
|
|
203
|
-
## [1.0.0
|
226
|
+
## [1.0.0](https://gitlab.com/fame-framework/fame-io/-/tags/v1.0) - 2020-11-17
|
204
227
|
_Initial release of `famepy`_
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fameio
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.1.1
|
4
4
|
Summary: Python scripts for operation of FAME models
|
5
5
|
Home-page: https://gitlab.com/fame-framework/wiki/-/wikis/home
|
6
6
|
License: Apache-2.0
|
@@ -21,13 +21,13 @@ Classifier: Programming Language :: Python :: 3.10
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.11
|
22
22
|
Classifier: Programming Language :: Python :: 3.12
|
23
23
|
Classifier: Topic :: Scientific/Engineering
|
24
|
-
Requires-Dist: fameprotobuf (>=1.
|
24
|
+
Requires-Dist: fameprotobuf (>=1.5.0,<2.0.0)
|
25
25
|
Requires-Dist: pandas (>=1.0,<3.0)
|
26
26
|
Requires-Dist: pyyaml (>=6.0,<7.0)
|
27
27
|
Project-URL: Repository, https://gitlab.com/fame-framework/fame-io/
|
28
28
|
Description-Content-Type: text/markdown
|
29
29
|
|
30
|
-
<!-- SPDX-FileCopyrightText:
|
30
|
+
<!-- SPDX-FileCopyrightText: 2024 German Aerospace Center <fame@dlr.de>
|
31
31
|
|
32
32
|
SPDX-License-Identifier: Apache-2.0 -->
|
33
33
|
[](https://badge.fury.io/py/fameio)
|
@@ -129,33 +129,45 @@ The "scenario.yaml" file contains all configuration options for a FAME-based sim
|
|
129
129
|
It consists of the sections `Schema`, `GeneralProperties`, `Agents` and `Contracts`, all of them described below.
|
130
130
|
|
131
131
|
#### Schema
|
132
|
-
The Schema
|
133
|
-
|
132
|
+
The Schema describes a model's components such as its types of agents, their inputs, what data they exchange, etc.
|
133
|
+
It is also used to validate the model inputs provided in the `scenario.yaml`.
|
134
|
+
Since the Schema is valid until the model itself is changed, it is recommended to defined it in a separate file and include the file here.
|
134
135
|
|
135
136
|
Currently, the schema specifies:
|
136
137
|
* which type of Agents can be created
|
137
138
|
* what type of input attributes an Agent uses
|
138
|
-
* what type of Products an Agent can send in Contracts
|
139
|
+
* what type of Products an Agent can send in Contracts, and
|
140
|
+
* the names of the Java packages for the classes corresponding to Agents, DataItems and Portables.
|
139
141
|
|
140
|
-
The Schema consists of the sections `
|
142
|
+
The Schema consists of the sections `JavaPackages` and `AgentTypes`.
|
141
143
|
|
142
|
-
#####
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
144
|
+
##### JavaPackages
|
145
|
+
This section defines the name of the Java packages in which the model code is located.
|
146
|
+
A similar data set was formerly specified in the `fameSetup.yaml`, but is now specified in the schema.
|
147
|
+
Each of the three sections `Agents`, `DataItems`, and `Portables` contain a list of fully qualified java package names of your model's classes.
|
148
|
+
Package names can occur in multiple lists and may overlap.
|
149
|
+
It is not necessary (but possible) to specify the nearest enclosing package for each Agent, DataItem or Portable.
|
150
|
+
Specifying any super-package will also work.
|
151
|
+
Also, package names occur on multiple lists for Agent, DataItem or Portable.
|
152
|
+
|
153
|
+
For example, for a project with all its
|
154
|
+
* Agent-derived java classes located in packages below the package named "agents",
|
155
|
+
* DataItem implementation classes in a subpackage named "msg",
|
156
|
+
* Portable implementation classes in a subpackages named "portableItems" and "otherPortables",
|
157
|
+
|
158
|
+
the corresponding section in the schema would look like this:
|
147
159
|
|
148
160
|
```yaml
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
161
|
+
JavaPackages:
|
162
|
+
Agents:
|
163
|
+
- "agents"
|
164
|
+
DataItems:
|
165
|
+
- "msg"
|
166
|
+
Portables:
|
167
|
+
- "portableItems"
|
168
|
+
- "otherPortables"
|
153
169
|
```
|
154
170
|
|
155
|
-
* `Project` name of your project / FAME-based application
|
156
|
-
* `RepoUrl` URL of your project
|
157
|
-
* `CommitHash` hash of the commit / version of your project
|
158
|
-
|
159
171
|
##### AgentTypes
|
160
172
|
Here, each type of agent that can be created in your FAME-based application is listed, its attributes and its available Products for Contracts.
|
161
173
|
The structure of this section
|
@@ -585,17 +597,17 @@ Call structure:
|
|
585
597
|
|
586
598
|
You may also specify any of the following arguments:
|
587
599
|
|
588
|
-
| Command | Action
|
589
|
-
|
590
|
-
| `-l` or `--log` <option> | Sets the logging level. Default is `
|
591
|
-
| `-lf` or `--logfile` <file> | Sets the logging file. Default is `None`. If `None` is provided, all logs get only printed to the console.
|
592
|
-
| `-a` or `--agents` <list-of-agents> | If specified, only a subset of agents is extracted from the protobuf file. Default is to extract all agents.
|
593
|
-
| `-o` or `--output` | Sets the path to where the generated output files are written to. If not specified, the folder's name is derived from the input file's name. Folder will be created if it does not exist.
|
594
|
-
| `-se` or `--single-export` | Enables export of individual agents to individual files, when present. If not present (the default) one file per `AgentType` is created.
|
595
|
-
| `-m` or `--memory-saving` | When specified, reduces memory usage profile at the cost of runtime. Use only when necessary.
|
596
|
-
| `-cc` or `--complex-column` <option> | Defines how to deal with complex indexed output columns (if any). `IGNORE` ignores complex columns. `
|
597
|
-
| `-t` or `--time` <option> | Option to define conversion of time steps to given format (default=`UTC`) by `-t/--time {UTC, INT, FAME}`
|
598
|
-
| `--input-recovery` or `--no-input-recovery` | If True, all input data are recovered as well as the outputs (default=False).
|
600
|
+
| Command | Action |
|
601
|
+
|---------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
602
|
+
| `-l` or `--log` <option> | Sets the logging level. Default is `WARNING`. Options are `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`. |
|
603
|
+
| `-lf` or `--logfile` <file> | Sets the logging file. Default is `None`. If `None` is provided, all logs get only printed to the console. |
|
604
|
+
| `-a` or `--agents` <list-of-agents> | If specified, only a subset of agents is extracted from the protobuf file. Default is to extract all agents. |
|
605
|
+
| `-o` or `--output` | Sets the path to where the generated output files are written to. If not specified, the folder's name is derived from the input file's name. Folder will be created if it does not exist. |
|
606
|
+
| `-se` or `--single-export` | Enables export of individual agents to individual files, when present. If not present (the default) one file per `AgentType` is created. |
|
607
|
+
| `-m` or `--memory-saving` | When specified, reduces memory usage profile at the cost of runtime. Use only when necessary. |
|
608
|
+
| `-cc` or `--complex-column` <option> | Defines how to deal with complex indexed output columns (if any). `IGNORE` ignores complex columns. `SPLIT` creates a separate file for each complex indexed output column. |
|
609
|
+
| `-t` or `--time` <option> | Option to define conversion of time steps to given format (default=`UTC`) by `-t/--time {UTC, INT, FAME}` |
|
610
|
+
| `--input-recovery` or `--no-input-recovery` | If True, all input data are recovered as well as the outputs (default=False). |
|
599
611
|
|
600
612
|
Additionally, you may merge TimeSteps of a certain range of steps in the output files to
|
601
613
|
i) associate multiple time steps with a common logical time in your simulation
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<!-- SPDX-FileCopyrightText:
|
1
|
+
<!-- SPDX-FileCopyrightText: 2024 German Aerospace Center <fame@dlr.de>
|
2
2
|
|
3
3
|
SPDX-License-Identifier: Apache-2.0 -->
|
4
4
|
[](https://badge.fury.io/py/fameio)
|
@@ -100,33 +100,45 @@ The "scenario.yaml" file contains all configuration options for a FAME-based sim
|
|
100
100
|
It consists of the sections `Schema`, `GeneralProperties`, `Agents` and `Contracts`, all of them described below.
|
101
101
|
|
102
102
|
#### Schema
|
103
|
-
The Schema
|
104
|
-
|
103
|
+
The Schema describes a model's components such as its types of agents, their inputs, what data they exchange, etc.
|
104
|
+
It is also used to validate the model inputs provided in the `scenario.yaml`.
|
105
|
+
Since the Schema is valid until the model itself is changed, it is recommended to defined it in a separate file and include the file here.
|
105
106
|
|
106
107
|
Currently, the schema specifies:
|
107
108
|
* which type of Agents can be created
|
108
109
|
* what type of input attributes an Agent uses
|
109
|
-
* what type of Products an Agent can send in Contracts
|
110
|
+
* what type of Products an Agent can send in Contracts, and
|
111
|
+
* the names of the Java packages for the classes corresponding to Agents, DataItems and Portables.
|
110
112
|
|
111
|
-
The Schema consists of the sections `
|
113
|
+
The Schema consists of the sections `JavaPackages` and `AgentTypes`.
|
112
114
|
|
113
|
-
#####
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
115
|
+
##### JavaPackages
|
116
|
+
This section defines the name of the Java packages in which the model code is located.
|
117
|
+
A similar data set was formerly specified in the `fameSetup.yaml`, but is now specified in the schema.
|
118
|
+
Each of the three sections `Agents`, `DataItems`, and `Portables` contain a list of fully qualified java package names of your model's classes.
|
119
|
+
Package names can occur in multiple lists and may overlap.
|
120
|
+
It is not necessary (but possible) to specify the nearest enclosing package for each Agent, DataItem or Portable.
|
121
|
+
Specifying any super-package will also work.
|
122
|
+
Also, package names occur on multiple lists for Agent, DataItem or Portable.
|
123
|
+
|
124
|
+
For example, for a project with all its
|
125
|
+
* Agent-derived java classes located in packages below the package named "agents",
|
126
|
+
* DataItem implementation classes in a subpackage named "msg",
|
127
|
+
* Portable implementation classes in a subpackages named "portableItems" and "otherPortables",
|
128
|
+
|
129
|
+
the corresponding section in the schema would look like this:
|
118
130
|
|
119
131
|
```yaml
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
132
|
+
JavaPackages:
|
133
|
+
Agents:
|
134
|
+
- "agents"
|
135
|
+
DataItems:
|
136
|
+
- "msg"
|
137
|
+
Portables:
|
138
|
+
- "portableItems"
|
139
|
+
- "otherPortables"
|
124
140
|
```
|
125
141
|
|
126
|
-
* `Project` name of your project / FAME-based application
|
127
|
-
* `RepoUrl` URL of your project
|
128
|
-
* `CommitHash` hash of the commit / version of your project
|
129
|
-
|
130
142
|
##### AgentTypes
|
131
143
|
Here, each type of agent that can be created in your FAME-based application is listed, its attributes and its available Products for Contracts.
|
132
144
|
The structure of this section
|
@@ -556,17 +568,17 @@ Call structure:
|
|
556
568
|
|
557
569
|
You may also specify any of the following arguments:
|
558
570
|
|
559
|
-
| Command | Action
|
560
|
-
|
561
|
-
| `-l` or `--log` <option> | Sets the logging level. Default is `
|
562
|
-
| `-lf` or `--logfile` <file> | Sets the logging file. Default is `None`. If `None` is provided, all logs get only printed to the console.
|
563
|
-
| `-a` or `--agents` <list-of-agents> | If specified, only a subset of agents is extracted from the protobuf file. Default is to extract all agents.
|
564
|
-
| `-o` or `--output` | Sets the path to where the generated output files are written to. If not specified, the folder's name is derived from the input file's name. Folder will be created if it does not exist.
|
565
|
-
| `-se` or `--single-export` | Enables export of individual agents to individual files, when present. If not present (the default) one file per `AgentType` is created.
|
566
|
-
| `-m` or `--memory-saving` | When specified, reduces memory usage profile at the cost of runtime. Use only when necessary.
|
567
|
-
| `-cc` or `--complex-column` <option> | Defines how to deal with complex indexed output columns (if any). `IGNORE` ignores complex columns. `
|
568
|
-
| `-t` or `--time` <option> | Option to define conversion of time steps to given format (default=`UTC`) by `-t/--time {UTC, INT, FAME}`
|
569
|
-
| `--input-recovery` or `--no-input-recovery` | If True, all input data are recovered as well as the outputs (default=False).
|
571
|
+
| Command | Action |
|
572
|
+
|---------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
573
|
+
| `-l` or `--log` <option> | Sets the logging level. Default is `WARNING`. Options are `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`. |
|
574
|
+
| `-lf` or `--logfile` <file> | Sets the logging file. Default is `None`. If `None` is provided, all logs get only printed to the console. |
|
575
|
+
| `-a` or `--agents` <list-of-agents> | If specified, only a subset of agents is extracted from the protobuf file. Default is to extract all agents. |
|
576
|
+
| `-o` or `--output` | Sets the path to where the generated output files are written to. If not specified, the folder's name is derived from the input file's name. Folder will be created if it does not exist. |
|
577
|
+
| `-se` or `--single-export` | Enables export of individual agents to individual files, when present. If not present (the default) one file per `AgentType` is created. |
|
578
|
+
| `-m` or `--memory-saving` | When specified, reduces memory usage profile at the cost of runtime. Use only when necessary. |
|
579
|
+
| `-cc` or `--complex-column` <option> | Defines how to deal with complex indexed output columns (if any). `IGNORE` ignores complex columns. `SPLIT` creates a separate file for each complex indexed output column. |
|
580
|
+
| `-t` or `--time` <option> | Option to define conversion of time steps to given format (default=`UTC`) by `-t/--time {UTC, INT, FAME}` |
|
581
|
+
| `--input-recovery` or `--no-input-recovery` | If True, all input data are recovered as well as the outputs (default=False). |
|
570
582
|
|
571
583
|
Additionally, you may merge TimeSteps of a certain range of steps in the output files to
|
572
584
|
i) associate multiple time steps with a common logical time in your simulation
|
@@ -7,7 +7,7 @@ build-backend = "poetry.core.masonry.api"
|
|
7
7
|
|
8
8
|
[tool.poetry]
|
9
9
|
name = "fameio"
|
10
|
-
version = "2.
|
10
|
+
version = "2.1.1"
|
11
11
|
description = "Python scripts for operation of FAME models"
|
12
12
|
license = "Apache-2.0"
|
13
13
|
authors = [
|
@@ -35,7 +35,7 @@ include = ["CHANGELOG.md"]
|
|
35
35
|
|
36
36
|
[tool.poetry.dependencies]
|
37
37
|
python = "^3.9"
|
38
|
-
fameprotobuf = "^1.
|
38
|
+
fameprotobuf = "^1.5.0"
|
39
39
|
pandas = ">= 1.0, <3.0"
|
40
40
|
pyyaml = "^6.0"
|
41
41
|
|
@@ -6,7 +6,7 @@ from pathlib import Path
|
|
6
6
|
from fameio.source.cli.convert_results import handle_args, CLI_DEFAULTS as DEFAULT_CONFIG
|
7
7
|
from fameio.source.cli.options import Options
|
8
8
|
from fameio.source.cli.parser import update_default_config
|
9
|
-
from fameio.source.logs import log_and_raise_critical,
|
9
|
+
from fameio.source.logs import log_and_raise_critical, fameio_logger, log
|
10
10
|
from fameio.source.results.agent_type import AgentTypeLog
|
11
11
|
from fameio.source.results.conversion import apply_time_option, apply_time_merging
|
12
12
|
from fameio.source.results.csv_writer import CsvWriter
|
@@ -23,16 +23,16 @@ ERR_MEMORY_SEVERE = "Out of memory despite memory-saving mode. Reduce output int
|
|
23
23
|
def run(config: dict = None) -> None:
|
24
24
|
"""Reads file in protobuf format for configures FILE and extracts its content to .csv file(s)"""
|
25
25
|
config = update_default_config(config, DEFAULT_CONFIG)
|
26
|
-
|
26
|
+
fameio_logger(log_level_name=config[Options.LOG_LEVEL], file_name=config[Options.LOG_FILE])
|
27
27
|
|
28
28
|
file_path = config[Options.FILE]
|
29
29
|
output_writer = CsvWriter(config[Options.OUTPUT], Path(file_path), config[Options.SINGLE_AGENT_EXPORT])
|
30
30
|
file_stream = open(Path(file_path), "rb")
|
31
31
|
|
32
32
|
if config[Options.MEMORY_SAVING]:
|
33
|
-
|
33
|
+
log().info("Memory saving mode enabled: Disable on conversion of small files for performance improvements.")
|
34
34
|
|
35
|
-
|
35
|
+
log().info("Reading and extracting data...")
|
36
36
|
reader = Reader.get_reader(file=file_stream, read_single=config[Options.MEMORY_SAVING])
|
37
37
|
agent_type_log = AgentTypeLog(requested_agents=config[Options.AGENT_LIST])
|
38
38
|
data_transformer = DataTransformer.build(config[Options.RESOLVE_COMPLEX_FIELD])
|
@@ -43,27 +43,27 @@ def run(config: dict = None) -> None:
|
|
43
43
|
input_dao.store_inputs(data_storages)
|
44
44
|
output = OutputDAO(data_storages, agent_type_log)
|
45
45
|
for agent_name in output.get_sorted_agents_to_extract():
|
46
|
-
|
46
|
+
log().debug(f"Extracting data for {agent_name}...")
|
47
47
|
data_frames = output.get_agent_data(agent_name, data_transformer)
|
48
48
|
apply_time_merging(data_frames, config[Options.TIME_MERGING])
|
49
49
|
apply_time_option(data_frames, config[Options.TIME])
|
50
|
-
|
50
|
+
log().debug(f"Writing data for {agent_name}...")
|
51
51
|
output_writer.write_to_files(agent_name, data_frames)
|
52
52
|
|
53
53
|
if config[Options.INPUT_RECOVERY]:
|
54
|
-
|
54
|
+
log().info("Recovering inputs...")
|
55
55
|
timeseries, scenario = input_dao.recover_inputs()
|
56
56
|
series_writer = CsvWriter(Path(config[Options.OUTPUT], "./recovered"), Path("./"), False)
|
57
57
|
series_writer.write_time_series_to_disk(timeseries)
|
58
58
|
data_to_yaml_file(scenario.to_dict(), Path(config[Options.OUTPUT], "./recovered/scenario.yaml"))
|
59
59
|
|
60
|
-
|
60
|
+
log().info("Data conversion completed.")
|
61
61
|
except MemoryError:
|
62
62
|
log_and_raise_critical(ERR_MEMORY_SEVERE if Options.MEMORY_SAVING else ERR_MEMORY_ERROR)
|
63
63
|
|
64
64
|
file_stream.close()
|
65
65
|
if not agent_type_log.has_any_agent_type():
|
66
|
-
|
66
|
+
log().error("Provided file did not contain any output data.")
|
67
67
|
|
68
68
|
|
69
69
|
if __name__ == "__main__":
|
@@ -6,7 +6,7 @@ from fameio.source.cli.make_config import handle_args, CLI_DEFAULTS as DEFAULT_C
|
|
6
6
|
from fameio.source.cli.options import Options
|
7
7
|
from fameio.source.cli.parser import update_default_config
|
8
8
|
from fameio.source.loader import load_yaml, check_for_yaml_file_type
|
9
|
-
from fameio.source.logs import
|
9
|
+
from fameio.source.logs import fameio_logger, log
|
10
10
|
from fameio.source.scenario import Scenario
|
11
11
|
from fameio.source.validator import SchemaValidator
|
12
12
|
from fameio.source.writer import ProtoWriter
|
@@ -15,7 +15,7 @@ from fameio.source.writer import ProtoWriter
|
|
15
15
|
def run(config: dict = None) -> None:
|
16
16
|
"""Executes the main workflow for the building of a FAME configuration file"""
|
17
17
|
config = update_default_config(config, DEFAULT_CONFIG)
|
18
|
-
|
18
|
+
fameio_logger(log_level_name=config[Options.LOG_LEVEL], file_name=config[Options.LOG_FILE])
|
19
19
|
|
20
20
|
file = config[Options.FILE]
|
21
21
|
check_for_yaml_file_type(Path(file))
|
@@ -26,7 +26,7 @@ def run(config: dict = None) -> None:
|
|
26
26
|
writer = ProtoWriter(config[Options.OUTPUT], timeseries_manager)
|
27
27
|
writer.write_validated_scenario(scenario)
|
28
28
|
|
29
|
-
|
29
|
+
log().info("Configuration completed.")
|
30
30
|
|
31
31
|
|
32
32
|
if __name__ == "__main__":
|
@@ -22,7 +22,7 @@ from fameio.source.cli.parser import (
|
|
22
22
|
|
23
23
|
CLI_DEFAULTS = {
|
24
24
|
Options.FILE: None,
|
25
|
-
Options.LOG_LEVEL: "
|
25
|
+
Options.LOG_LEVEL: "WARN",
|
26
26
|
Options.LOG_FILE: None,
|
27
27
|
Options.AGENT_LIST: None,
|
28
28
|
Options.OUTPUT: None,
|
@@ -39,7 +39,16 @@ _OUTFILE_PATH_HELP = "Provide path to folder to store output .csv files"
|
|
39
39
|
|
40
40
|
|
41
41
|
def handle_args(args: List[str], defaults: Optional[Dict[Options, Any]] = None) -> Dict[Options, Any]:
|
42
|
-
"""
|
42
|
+
"""
|
43
|
+
Handles command line arguments and returns `run_config` for convert_results script
|
44
|
+
|
45
|
+
Args:
|
46
|
+
args: list of (command line) arguments, e.g., ['-f', 'my_file']; arg values take precedence over defaults
|
47
|
+
defaults: optional default values used for unspecified parameters; missing defaults are replaced by CLI defaults
|
48
|
+
|
49
|
+
Returns:
|
50
|
+
final configuration compiled from (given) `defaults` and given `args`
|
51
|
+
"""
|
43
52
|
parser = _prepare_parser(defaults)
|
44
53
|
parsed = parser.parse_args(args)
|
45
54
|
return map_namespace_to_options_dict(parsed)
|
@@ -16,7 +16,7 @@ from fameio.source.cli.parser import (
|
|
16
16
|
|
17
17
|
CLI_DEFAULTS = {
|
18
18
|
Options.FILE: None,
|
19
|
-
Options.LOG_LEVEL: "
|
19
|
+
Options.LOG_LEVEL: "WARN",
|
20
20
|
Options.LOG_FILE: None,
|
21
21
|
Options.OUTPUT: Path("config.pb"),
|
22
22
|
}
|
@@ -34,7 +34,7 @@ def handle_args(args: List[str], defaults: Optional[Dict[Options, Any]] = None)
|
|
34
34
|
defaults: optional default values used for unspecified parameters; missing defaults are replaced by CLI defaults
|
35
35
|
|
36
36
|
Returns:
|
37
|
-
final configuration compiled from (given) defaults and
|
37
|
+
final configuration compiled from (given) `defaults` and given `args`
|
38
38
|
"""
|
39
39
|
parser = _prepare_parser(defaults)
|
40
40
|
parsed = parser.parse_args(args)
|
@@ -8,7 +8,7 @@ from pathlib import Path
|
|
8
8
|
from typing import Optional, Dict, Any, List, Union
|
9
9
|
|
10
10
|
from fameio.source.cli.options import MergingOptions, TimeOptions, ResolveOptions, Options
|
11
|
-
from fameio.source.logs import
|
11
|
+
from fameio.source.logs import LogLevel
|
12
12
|
|
13
13
|
_ERR_NEGATIVE_INT = "Given value `{}` is not a non-negative int."
|
14
14
|
|
@@ -74,8 +74,8 @@ def add_log_level_argument(parser: ArgumentParser, default_value: str) -> None:
|
|
74
74
|
"-l",
|
75
75
|
"--log",
|
76
76
|
default=default_value,
|
77
|
-
choices=
|
78
|
-
type=str.
|
77
|
+
choices=[level.name for level in LogLevel if level not in [LogLevel.PRINT, LogLevel.WARN]],
|
78
|
+
type=str.upper,
|
79
79
|
help=help_text,
|
80
80
|
)
|
81
81
|
|