Skip to content

Commit

Permalink
Merge pull request #568 from rl-institut/Release/v0.4.1
Browse files Browse the repository at this point in the history
Release/v0.4.1
  • Loading branch information
smartie2076 authored Sep 21, 2020
2 parents 2cb5572 + 38494f8 commit 243b30b
Show file tree
Hide file tree
Showing 40 changed files with 985 additions and 555 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,4 @@ mvs_csv_config.json
/UVTgv_input_files/
/inputs/

/validation_tests/
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,39 @@ Here is a template for new release sections
-
```

## [0.4.1] - 2020-09-21

### Added
- Evaluation of excess energy for each of the energy carriers and for the whole system. The excess per sector and their energy equivalent may currently be faulty (comp. issue #559) (#555)
- Debug messages for pytests: `C0`, `D2` (#555, #560)
- Labels on capacity barplot bars (#567)

### Changed
- `C1.total_demand_each_sector()` to `C1.total_demand_and_excess_each_sector()`, now also evaluating the excess energy flows (#555)
- `energyBusses` now is defined by: `LABEL, ASSET_LIST, ENERGY_VECTOR`, all functions using `energyBusses` now follow this nomenclature (#555)
- Energy excess sinks now also have parameter `ENERGY_VECTOR` (#555)
- `C0.define_sink` now always defines a sink that is capacity-optimized (#555)
- `D1.sink_dispatchable()`, renamed to `D1.sink_dispatchable_optimize()` now adds a capacity-optimized, dispatchable sink. (#555)
- Simulation data `tests/inputs`: Oemof-solph results are not stored (#555)
- Change logging level of some messages from `logging.info` to `logging.debug` (#555)
- Move and rename json input files for D0 and D1 tests (`test_data_for_D0.json` to `tests/test_data/inputs_for_D0/mvs_config.json`, `test_data_for_D1.json` to `tests/test_data/inputs_for_D1/mvs_config.json`), add required parameters (#555)
- Change requirements/test.txt: `black==19.10b0`, as otherwise there are incompatabilities (#555)
- `D2.prepare_constraint_minimal_renewable_share`, including logging messages and pytest (#560)
- Change the import path of the modules for automatic docstrings import in `docs/Code.rst` (#564)
- Fix the docstrings with math expressions (need to add `r` before the `"""` of the docstring
) (#564)
- Rename the function in F1 module `plot_flows` to `plot_instant_power` (#567)
- Change flow to power in the instanteous power figures (#567)
- `F1.plot_piecharts_of_costs()` now cites costs with currect currency and avoids decimal numbers (#561)

### Fixed
- `C1.check_feedin_tariff()` now also accepts `isinstance(diff, int)` (#552)
- Feed-in sinks of the DSOs now are capacity-optimized and can actually be used (#555)
- Incorrectly applied minimal renewable share criterion (#560)
- Pdf report generation (#566)
- Update fresh install instructions for developers (#565)
- Graphs of the report now use appropriate currency (#561)

## [0.4.0] - 2020-09-01

### Added
Expand Down
32 changes: 22 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

- [Git](https://git-scm.com/)


- Install the dev requirements with
```bash
pip install -e .[test,dev]
```
### Philosophy

Development of a feature for this repository should follow the workflow described
Expand Down Expand Up @@ -46,21 +49,16 @@ If your branch does not exist on the remote server yet, git will provide you wit

#### Step 3: Run tests locally

To install all packages required for the integration tests locally:
To install all packages required for the integration tests locally (if not done yet):
```bash
pip install -r tests/test_requirements.txt
pip install -r requirements/test.txt
```

**!!! Important !!!**: You also need to install the mvs package locally in develop mode:
```bash
python setup.py develop
```
Otherwise your changes will not be perceived by the tests unless you run `python setup.py install` each time.

```bash
pip install -e .
```
should work as well.
Otherwise your changes will not be perceived by the tests.

Please run the tests locally before pushing your feature to the developer branch. You do that by running:
```bash
Expand Down Expand Up @@ -180,11 +178,25 @@ Finally, [create a release](https://help.github.com/en/github/administering-a-re

## Contributing to Readthedocs

You need to first install the required packages

```bash
pip install -r requirements/docs.txt
```

Readthedocs of the MVS is compiled with the content of folder "docs". After editing, execute

cd docs

and then

make html

To update the html pages of readthedocs. Then you can commit, push and pull it like normal code.
To update the html pages of readthedocs. You will find the html files them under `docs/_build/html`
and can open them in your favorite browser. After you are done editing, you can commit, push and
pull it like normal code.

Note: the compilation of certain docstrings requires latex amsmath package, if it is not
available on your local computer, the math expression will not render nicely.

An introduction to creating the readthedocs with Sphinx is given here: https://docs.readthedocs.io/en/stable/intro/getting-started-with-sphinx.html.
34 changes: 17 additions & 17 deletions docs/Code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,89 +5,89 @@ Code documentation
Initialization
--------------

.. automodule:: src.constants
.. automodule:: mvs_eland.utils.constants
:members:
:undoc-members:

.. automodule:: mvs_eland.utils.constants_json_strings
:members:
:undoc-members:

.. automodule:: src.A0_initialization
.. automodule:: mvs_eland.A0_initialization
:members:
:undoc-members:

.. automodule:: src.A1_csv_to_json
.. automodule:: mvs_eland.A1_csv_to_json
:members:
:undoc-members:

Data input
----------

.. automodule:: src.B0_data_input_json
.. automodule:: mvs_eland.B0_data_input_json
:members:
:undoc-members:

Data processing
---------------

.. automodule:: src.C0_data_processing
.. automodule:: mvs_eland.C0_data_processing
:members:
:undoc-members:

.. automodule:: src.C1_verification
.. automodule:: mvs_eland.C1_verification
:members:
:undoc-members:

.. automodule:: src.C2_economic_functions
.. automodule:: mvs_eland.C2_economic_functions
:members:
:undoc-members:

Modelling
---------

.. automodule:: src.D0_modelling_and_optimization
.. automodule:: mvs_eland.D0_modelling_and_optimization
:members:
:undoc-members:

.. automodule:: src.D1_model_components
.. automodule:: mvs_eland.D1_model_components
:members:
:undoc-members:

.. automodule:: src.D2_model_constraints
.. automodule:: mvs_eland.D2_model_constraints
:members:
:undoc-members:

Evaluation
----------

.. automodule:: src.E0_evaluation
.. automodule:: mvs_eland.E0_evaluation
:members:
:undoc-members:

.. automodule:: src.E1_process_results
.. automodule:: mvs_eland.E1_process_results
:members:
:undoc-members:

.. automodule:: src.E2_economics
.. automodule:: mvs_eland.E2_economics
:members:
:undoc-members:

.. automodule:: src.E3_indicator_calculation
.. automodule:: mvs_eland.E3_indicator_calculation
:members:
:undoc-members:

.. automodule:: src.E4_verification_of_constraints
.. automodule:: mvs_eland.E4_verification_of_constraints
:members:
:undoc-members:

Output
------

.. automodule:: src.F0_output
.. automodule:: mvs_eland.F0_output
:members:
:undoc-members:

.. automodule:: src.F1_plotting
.. automodule:: mvs_eland.F1_plotting
:members:
:undoc-members:
2 changes: 1 addition & 1 deletion docs/files_to_be_displayed/example_docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def example_function(arg1, argN):
Returns
-------
:pandas:`pandas.DataFrame<frame>`
:class:`pandas.DataFrame<frame>`
here comes the description
(In case of no return, you can write what the function changes, e.g. updates
`variable_x` with `y`.)
Expand Down
2 changes: 1 addition & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pytest>=5.3.1
black>=19.10b0
black==19.10b0
coverage>=4.5
python-coveralls>=2.9.3
mock>=3.0.5
57 changes: 34 additions & 23 deletions src/mvs_eland/A0_initialization.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
r"""
Module A0_initialization defines functions to parse user inputs to the MVS simulation.
- Display welcome message with current version number
- Parse command line arguments and set default values for MVS parameters if not provided
Expand All @@ -8,27 +8,37 @@
Usage from root of repository:
python mvs_tool.py [-h] [-i [PATH_INPUT_FOLDER]] [-ext [{json,csv}]]
[-o [PATH_OUTPUT_FOLDER]]
[-log [{debug,info,error,warning}]] [-f [OVERWRITE]]
[-pdf [PDF_REPORT]] [-png [SAVE_PNG]]
.. code-block:: bash
python mvs_tool.py [-h] [-i [PATH_INPUT_FOLDER]] [-ext [{json,csv}]] [-o [PATH_OUTPUT_FOLDER]]
[-log [{debug,info,error,warning}]] [-f [OVERWRITE]] [-pdf [PDF_REPORT]] [-png [SAVE_PNG]]
Process MVS arguments
optional arguments:
-h, --help show this help message and exit
-i [PATH_INPUT_FOLDER]
path to the input folder
-ext [{json,csv}] type (json or csv) of the input files (default: 'json'
-o [PATH_OUTPUT_FOLDER]
path to the output folder for the simulation's results
-log [{debug,info,error,warning}]
level of logging in the console
-f [OVERWRITE] overwrite the output folder if True (default: False)
-pdf [PDF_REPORT] generate a pdf report of the simulation if True
(default: False)
-png [SAVE_PNG] generate png figures of the simulation in the
output_folder if True (default: False)
-h, --help
show this help message and exit
-i [PATH_INPUT_FOLDER]
path to the input folder
-ext [{json,csv}]
type (json or csv) of the input files (default: 'json')
-o [PATH_OUTPUT_FOLDER]
path to the output folder for the simulation's results
-log [{debug,info,error,warning}]
level of logging in the console
-f [OVERWRITE]
overwrite the output folder if True (default: False)
-pdf [PDF_REPORT]
generate a pdf report of the simulation if True (default: False)
-png [SAVE_PNG]
generate png figures of the simulation in the output_folder if True (default: False)
"""

Expand Down Expand Up @@ -270,14 +280,15 @@ def process_user_arguments(
(Optional) Can force tool to replace existing output folder (command line "-f")
:param pdf_report:
(Optional) Can generate an automatic pdf report of the simulation's results (Command line "-pdf")
:param: save_png:
:param save_png:
(Optional) Can generate png figures with the simulation's results (Command line "-png")
:param display_output:
(Optional) Determines which messages are used for terminal output (command line "-log")
"debug": All logging messages
"info": All informative messages and warnings (default)
"warning": All warnings
"error": Only errors
Allowed values are
"debug": All logging messages,
"info": All informative messages and warnings (default),
"warning": All warnings,
"error": Only errors,
:param lp_file_output:
Save linear equation system generated as lp file
:param welcome_text:
Expand Down
7 changes: 3 additions & 4 deletions src/mvs_eland/A1_csv_to_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ class WrongStorageColumn(ValueError):


def create_input_json(
input_directory,
pass_back=True,
input_directory, pass_back=True,
):
"""Convert csv files to json file as input for the simulation.
Expand Down Expand Up @@ -462,7 +461,7 @@ def create_json_from_csv(
)
single_dict[column].update(storage_dict)

logging.info(
logging.debug(
"From file %s following assets are added to the energy system: %s",
filename,
asset_name_string[:-2],
Expand Down Expand Up @@ -505,7 +504,7 @@ def check_for_official_extra_parameters(
Returns
-------
Updated parameters list and updated dataframe and updated :pandas:`pandas.DataFrame<frame>`
Updated parameters list and updated dataframe and updated :class:`pandas.DataFrame<frame>`
The function through a warning if a new parameter is not defined in the csv but exists inf
the official_extra_parameters. The parameter will then be set to it's default value.
"""
Expand Down
3 changes: 1 addition & 2 deletions src/mvs_eland/B0_data_input_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ def load_json(
os.replace(
path_input_file,
os.path.join(
dict_values[SIMULATION_SETTINGS][PATH_OUTPUT_FOLDER_INPUTS],
CSV_FNAME,
dict_values[SIMULATION_SETTINGS][PATH_OUTPUT_FOLDER_INPUTS], CSV_FNAME,
),
)

Expand Down
Loading

0 comments on commit 243b30b

Please sign in to comment.