Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:Illuminator-team/Illuminator into do…
Browse files Browse the repository at this point in the history
…cumentation/DocStrings
  • Loading branch information
jgrguric96 committed Aug 30, 2024
2 parents 4f6db3b + 1f4dcba commit c4993a8
Show file tree
Hide file tree
Showing 15 changed files with 662 additions and 493 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: deploy-docs

on: [push, pull_request, workflow_dispatch]

permissions:
contents: write

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install dependencies
run: |
pip install -r docs/requirements.txt
- name: Sphinx build
run: |
sphinx-build docs _build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _build/
force_orphan: true
114 changes: 114 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Contributing guidelines

Any kind of contribution to **The Illuminator** is welcome, from a simple comment or a question, to a full fledged [pull request](https://help.github.com/articles/about-pull-requests/).

A contribution can be associated with the following cases:

- You have a question.
- You think you may have found a bug, including unexpected behavior.
- You want to make changes to the code base to fix a bug, make improvements, add a new functionality, or to update the documentation.
- You want to improve the Illuminator's documentation

The sections below outlines the steps to make your contribution to the software for each of the aforementioned cases.

## A. You have a question

1. Use the search functionality [here](link-to-issues) to see if someone already filed the same issue.
1. If your issue search did not yield any relevant results, open a new issue.
1. Apply the "Question" label. Additionally, apply other labels when relevant.

## B. You think you may have found a bug

1. Use the search functionality [here](link-to-issues) to see if someone already filed the same issue.
1. If your issue search did not yield any relevant results, open a new issue and provide enough information to understand the cause and the context of the problem. Depending on the issue, you may also want to include:
- the [SHA hashcode](https://help.github.com/articles/autolinked-references-and-urls/#commit-shas) of the commit that is causing your problem
- some identifying information (name and version number) for dependencies you're using
- information about the operating system

## C. You want to make changes to the code base


### Announce your plan

1. (**important**) Announce your plan to the rest of the community *before you start working*. This announcement should be in the form of a (new) issue on the Github repository.
2. (**important**) Wait until a consensus is reached about your idea being a good idea.


### Set up a local development environment to work on your changes

If you are a part of the Illuminator team and have write access to the Illuminator GitHub repository, skip to the next subsection [Develop your contribution](CONTRIBUTING.md#develop-your-contribution). If you are a first-time contributor, follow the below steps:

1. Go to the [Illuminator GitHub repository](url-repository) and click on 'Fork'. This will create a copy of the Illuminator repository in your GitHub account.

1. Clone the project to your local computer:

```bash
git clone https://github.com/your-username/Illuminator.git
```

1. Change the directory

```bash
cd Illuminator
```

1. Add the upstream repository

```bash
git remote add upstream https://github.com/<illuminator-path>.git
```

1. Now, `git remote -v` will show two remote repositories named:

* `upstream`, which refers to the Illumator repository
* `origin`, which refers to your personal fork

### Develop your contribution

> TODO: update this section after refactoring

1. Create a branch of the latest commit on the `main` branch to work on your feature.

```bash
git checkout -b my-feature
```

2. If you are contributing via a fork, make sure to pull in changes from the 'upstream' repository to stay up to date with the `main` branch while working on your feature branch. Follow the instructions [here](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/configuring-a-remote-repository-for-a-fork) and [here](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork).

3. Set up a development environment on your computer by installing the Illuminator in development mode with the following command: (Consider using a virtual environment for this purpose.)

```bash
# TODO: this part needs to be updated after refactoring
```

4. Set up your code editor to follow [PEP 8](https://peps.python.org/pep-0008/) (remove trailing white space, no tabs, etc.). Check code with [flake8](https://flake8.pycqa.org/en/latest/).

5. Make sure the existing tests pass by running `pytest` from the root of the repository.

6. Write tests for any new lines of code you add.

7. Include in-code documentation in form of comments and docstrings. Use the [numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html#docstring-standard) documentation style.

8. Update the user/developer documentation if relevant. Undocumented contributions might not be merged.


### Submitting your contribution

1. Push your feature branch to (your fork of) the Illuminator GitHub repository.

1. Create a pull request, for an example, following the instructions [here](https://help.github.com/articles/creating-a-pull-request/).


## D. You want to improve the Illuminator's documentation

We use Sphinx and Markdown to write documentation for the Illuminator. The root of the documentation is the `docs/` directory.

1. [Announce your plan.](#announce-your-plan)
1. Follow the same steps to set up a development environment for [making changes to the code base](#set-up-a-local-development-environment-to-work-on-your-changes).
1. Install the dependencies in `docs/requirements.txt` using `pip install -r docs/requirments.txt` (Sphnix will also be installed).
1. Update the documentation using Markdown. If familiar with writing Markdown for MyST consult their [guides and documentation](https://myst-parser.readthedocs.io/en/latest/syntax/optional.html)
1. Make sure your contributions are built without errors. Go to the `docs` directory in the terminal with `cd docs/`. Then, build the documentation using `make html`.
1. [Submit your contribution](#submitting-your-contribution) for review.


In case you feel you've made a valuable contribution, but you don't know how to write or run tests for it, or how to generate the documentation; don't let this discourage you from making the pull request. We can help you! Just go ahead and submit the pull request. But keep in mind that you might be asked to append additional commits to your pull request.
50 changes: 0 additions & 50 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]

Preamble

The licenses for most software are designed to take away your
Expand Down Expand Up @@ -456,49 +452,3 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.

END OF TERMS AND CONDITIONS

How to Apply These Terms to Your New Libraries

If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).

To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.

The Illuminator, a Energy System Integration Development kit
Copyright (C) 2024 Illuminator Team

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA

Also add information on how to contact you by electronic and paper mail.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:

Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random
Hacker.

<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice

That's all there is to it!
2 changes: 1 addition & 1 deletion Models/Controller/controller_mosaik.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Models.Controller.controller_model as controller_model
#import Battery.model as batterymodel
import sys
sys.path.insert(1,'/home/illuminator/Desktop/Final_illuminator')
sys.path.insert(1, '/home/illuminator/Desktop/Final_illuminator')

try:
import Models.Battery.battery_model as batterymodel
Expand Down
15 changes: 13 additions & 2 deletions Models/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,22 @@ def step(self, time, inputs, max_advance):
wandb.log({key: value[0],
"custom_step":time/900})

if self.results_show['write2csv']==True:
if self.results_show['write2csv'] == True:
if time == 0:
# Overwrite the CSV file at the first time step
df.to_csv(self.output_file, mode='w', header=True)
else:
df.to_csv(self.output_file, mode='a', header=False)
if os.path.exists(self.output_file):
# Read existing CSV
existing_df = pd.read_csv(self.output_file, index_col='date', parse_dates=True)

# Align the columns
combined_df = pd.concat([existing_df, df])
else:
combined_df = df

# Write the merged data to CSV
combined_df.to_csv(self.output_file, mode='w', header=True)


if self.results_show['database']==True:
Expand Down
6 changes: 6 additions & 0 deletions WAIVER
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Technische Universiteit Delft hereby disclaims all copyright interest in the
program “Illuminator”, an easy-to-use Energy System Integration Development Kit
to demystify energy system operation, illustrate challenges that arise due to
the energy transition and test state-of-the-art energy management concepts,
written by the Author(s).
[Name Dean], Dean of Faculty Electrical Engineering, Mathematics and Computer Science
7 changes: 6 additions & 1 deletion configuration/buildmodelset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

# [Manuel] FROM Balassis thesis:
# The buildmodelset.py file holds the parameters for each simulator. It is imported into the Main file and used to
# instantiate the models with the appropriate setup. This file allows for the specification of various parameters related
# to physical energy assets, like the initial SoC of batteries or the rated power of wind turbines. Additionally, economic
# parameters, such as the marginal cost or benefit of each asset in agents’ portfolios, can also be defined among the
# available parameters.

resolution=15
Battery_initialset = {'initial_soc': 20}
Expand Down
22 changes: 22 additions & 0 deletions configuration/interpreter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
"""
The Illuminator, a Energy System Integration Development kit
Copyright (C) 2024 Illuminator Team
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
For questions and support, please contact us at illuminator@tudelft.nl
"""

import shutil

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
'sphinx_rtd_theme',
'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'sphinx-copybutton',
'sphinx_copybutton',
]

templates_path = ['_templates']
Expand Down
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ and the simulation engine is based on [Mosaik](https://mosaik.offis.de/).
:caption: User's Documentation:

user/start
user/user-guide
user/models

.. toctree::
:maxdepth: 2
Expand Down
Loading

0 comments on commit c4993a8

Please sign in to comment.