-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #98 from Illuminator-team/dev
New release 3.0.0-beta
- Loading branch information
Showing
45 changed files
with
107,124 additions
and
156 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# Software Architecture | ||
|
||
The Illuminator is modular Python applications to simulate energy systems. In this seciton, we provide an overview of its sotware architecture. The diagram below describes the components of the Illuminator. | ||
|
||
<div align="center"> | ||
<img align="center" src="../_static/img/components.png" width="800"> | ||
</div> | ||
|
||
|
||
## Users | ||
Users of the Illuminator take one of two roles: | ||
|
||
* **Moder Developer**: uses the Illuminator to create energy models that can be used in any simulation | ||
* **Energy Analys**: use sthe Illuminator to define and run simulation scenarios. | ||
|
||
<!-- ## Containers | ||
Containers represent applications that are separately runnable/deployable units of software. Below, we refer to containers as 'applicaitons' --> | ||
|
||
## Components | ||
|
||
### Mosaik Simulation Framework | ||
|
||
A framework that serves as a core platform for executing energy system simulations. [Mosaik](https://mosaik.readthedocs.io/en/latest/index.html) is an external dependency, and as such the Illuminator interacts with it thru its API. | ||
|
||
### Model Builder Application | ||
|
||
A Python applicaiton that model developers use to define/modify energy models for the Illuminator. New models are developed using the **Builder** componente, which provides a custom interface for creating and registering energy models to the **Model Library**. The purpose of the **Builder** componet is ease the defintion of energy models using a jargon that **energy system engineers** are more familiar with. For example, by defining new models in term of *inputs, outputs, states, etc.* | ||
|
||
The **Model Library** component stores energy models that can be use in a simulation, so that they can be accessed by the **Mosaik Simulation Framework** during runtime. | ||
|
||
### Model Builder Application | ||
|
||
A Python application that facilated the development and registration of energy models for the **Model Library**, in wich the **Builder** component provides an interface that can be used to define energy models in terms of *parameters, inputs, output, states, etc*. This applicaiton stores energy models in the **Model Library** and mades them available to the **Mosaik Simulation Framework**. | ||
|
||
Models in the **Model Library** are metadata and business logic containers. No computations are performed by this component. | ||
|
||
### Simulation Engine Application | ||
|
||
A Python application to run simulations via the Mosaik API. This application consists of four compoennts. The **Scenario API** provides a wrapper to prepare and start simulations in the **Mosaik Simulation Framework**. Therefore, simulations, computations and the management of output data are delegated to the **Mosaik Simulation Framework**. | ||
The Senario API uses the **Scenario Schema** to validate simulation definitions writen as YAML files written by the **Energy Analysis**. The **Scenario Schema** defines the format that YAML files must be written on. | ||
|
||
The **Illuminator CLI** is an appliccation implemented using [Typer](https://typer.tiangolo.com/), which provides a command line interface to run simulation locally, and automate the deployment of the Illuminator in a Raspberry Pi cluster. The **Illuminator CLI** uses the **Scernario API** and the **Cluster PI** components for its functionality. | ||
|
||
Finally, the **Cluster Pi** component consists of a set of tools for setting up the Illuminator to tha Raspberry Py cluster that will run scenario simulatios. | ||
|
||
### Dashboard | ||
|
||
An application used by the **Energy Analyst** to visualise the results and logs of simulatiosn in real-time. This is not implemented in the current version. | ||
|
||
----- | ||
## Use Cases | ||
|
||
There are three main use cases for the users of the Illuminator: | ||
|
||
1. Extending the model library: a *Model developer* wants to add a new model to the **Model Library** | ||
2. Creating a simullation scenario: an *Energy Analyst* wants to define a simulation scenario using a YAML file and execute the simulation. | ||
3. Set up a raspberry Pi cluster: a **user** wants to set up the Illuminator in a cluster of Raspberry Pi's to run simulations. | ||
|
||
### Extending the Model Library | ||
|
||
Energy model should be added to the **Model Library** as follows: | ||
|
||
1. Create a Python module with the name of the model. For example, `ExampleModel.py` | ||
1. In the file, create an IlluminatorModel object for the model. This defines which inputs, output, parameters, states, triggers, etc. a particular model has. For example: | ||
|
||
```Python | ||
from illuminator.builder import IlluminatorModel | ||
# Defines a model'a paramters, inputs, outputs... | ||
example_model = IlluminatorModel( | ||
parameters={"param1": "addition"}, | ||
inputs={"in1": 10, "in2": 20}, | ||
outputs={"out1": 0}, | ||
states={"out1": 0}, | ||
time_step_size=1, | ||
time=None | ||
) | ||
``` | ||
|
||
2. Create a class that inherits from `ModelConstructor`, and impement the `step()` method. Name the new class with the same name as the Python module it contains it. The new class will become a *model type* in the Illuminator. Instances of this model type will be created by the **Scenario API** | ||
|
||
For example, | ||
|
||
```python | ||
from illuminator builder import ModelConstructor | ||
|
||
class ExampleModel (ModelConstructor): | ||
|
||
def step(): | ||
"""Computes this in every time step""" | ||
|
||
# The computation logic goes here: | ||
|
||
# return the time for the next time step | ||
return time + self._model.time_step_size | ||
``` | ||
|
||
3. To test the new model is implemented correctly, try: | ||
|
||
```python | ||
# TODO: add example | ||
``` | ||
|
||
### Creating Simulation Scenarios | ||
|
||
TODO | ||
|
||
### Setting Up Cluster Pi | ||
|
||
Refer to [Cluster Pi setup.](../cluster-setup.md) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
@startuml | ||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml | ||
|
||
scale 1.5 | ||
LAYOUT_LANDSCAPE() | ||
title Component Diagram for the Illuminator | ||
|
||
AddElementTag("not implemented", $bgColor="#3c6658") | ||
|
||
Person(modelDeveloper, "Model Developer", "A person who wants to develop new models") | ||
Person(energyAnalyst, "Energy Analyst", "A person who creates simulations of energy systems") | ||
|
||
System_Ext(mosaik, "Mosaik Simulation Framework", "A Smart Grid co-simulation framework. It provides a platform for executing simualtions of energy systems") | ||
|
||
System_Boundary(illuminatorSys, "Illuminator", $descr="A Python package to simulate energy system") { | ||
|
||
Container(dashboard, "Dashboard", "?", "An application for visualizing simulation results and logs in real-time", $tags="not implemented") | ||
|
||
Container_Boundary(builderApp, "Model Builder Application", "Python", $descr="a Python application to develop energy models for the Illuminator") { | ||
Component(modelBuilder, "Builder", "Python", "A custom interface for creating and registering energy system models") | ||
Component(modelLibrary, "Model Libarry", "Python", "A collection of energy system models that can be use in a simulation") | ||
|
||
Rel(modelBuilder, modelLibrary, "registers models to", "Python") | ||
Rel(modelDeveloper, modelBuilder, "defines energy models using", "Python") | ||
|
||
} | ||
Container_Boundary(simulationEngine, "Simulation Engine Application", "Python", $descr="A Python application to simulate energy systems") { | ||
Component(scenarioApi, "Scenario API", "Python", "generates and starts simulation scenarios. It serves as a wrapper for the Mosaik API") | ||
Component(clusterPi, "Cluster Pi", "Python, Bash", "tools for setting up a cluster of Raspberry Pi's for running simulations") | ||
Component(cli, "Illuminator CLI", "Python, Typer", "a commnad line application to run simulation scenarios, and support the set up of a cluster of Raspberry Pi's") | ||
|
||
Component(scenarioSchema, "Scenario Schema", "Python, YAML", "provides a formal schema for defining simulation scenarios using YAML files") | ||
|
||
Rel(cli, scenarioApi, "uses", "Python") | ||
Rel(cli, clusterPi, "uses", "Python") | ||
Rel(scenarioApi, scenarioSchema, "validates scenario simulations using", "Python") | ||
|
||
} | ||
|
||
Rel(scenarioApi, mosaik, "starts simulators in", "Mosaik API") | ||
Rel(mosaik, dashboard, "provides simulation results and logs to", "Collector Model") | ||
|
||
} | ||
|
||
|
||
Rel(mosaik, modelLibrary, "access energy models from", "Python") | ||
|
||
Rel(energyAnalyst, scenarioApi, "defines simulation scenarios for", "YAML") | ||
Rel(energyAnalyst, cli, "runs simulation scenarios using", "Terminal") | ||
|
||
Rel(energyAnalyst,dashboard, "visualizes simulation results and logs in", "GUI") | ||
|
||
|
||
SHOW_LEGEND() | ||
@enduml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
scenario: | ||
name: "SimpleTest" # in mosaik so called world | ||
start_time: '2012-01-01 00:00:00' # ISO 8601 start time of the simulation | ||
end_time: '2012-01-01 01:00:00' # duration in seconds | ||
time_resolution: 900 # time step in seconds (optional). Defaults to 15 minutes (900 s) | ||
|
||
|
||
models: # list of models for the energy network | ||
|
||
- name: CSVB # name for the model (must be unique) | ||
type: CSV # name of the model registered in the Illuminator | ||
parameters: # a CSV model must have a start time and a file as parameters | ||
start: '2012-01-01 00:00:00' # ISO 8601 start time of the simulation | ||
file_path: './examples/solar-sample.csv' # path to the file with the data | ||
delimiter: ',' | ||
date_format: 'YYYY-MM-DD HH:mm:ss' | ||
|
||
- name: PV1 | ||
type: PV # models can reuse the same type | ||
parameters: | ||
m_area: 1.26 | ||
NOCT: 44 | ||
m_efficiency_stc: 0.198 | ||
G_NOCT: 800 | ||
P_STC: 250 | ||
peak_power: 600 | ||
m_tilt: 14 | ||
m_az: 180 | ||
cap: 500 | ||
output_type: 'power' | ||
inputs: | ||
G_Gh: null | ||
G_Dh: null | ||
G_Bn: null | ||
Ta: null | ||
hs: null | ||
FF: null | ||
Az: null | ||
outputs: | ||
pv_gen: 1 | ||
g_aoi: null | ||
|
||
|
||
connections: | ||
- from: CSVB.G_Gh # start model, pattern: model_name.output_name/input_name | ||
to: PV1.G_Gh # end model | ||
- from: CSVB.G_Dh | ||
to: PV1.G_Dh | ||
- from: CSVB.G_Bn | ||
to: PV1.G_Bn | ||
- from: CSVB.Ta | ||
to: PV1.Ta | ||
- from: CSVB.hs | ||
to: PV1.hs | ||
- from: CSVB.FF | ||
to: PV1.FF | ||
- from: CSVB.Az | ||
to: PV1.Az | ||
|
||
|
||
monitor: | ||
file: './out.csv' # optional with default, path to the results file for the scenario. This should be optional # a list of models, its inputs, output and states to be monitored and logged | ||
items: | ||
- CSVB.G_Gh | ||
- PV1.pv_gen |
Binary file not shown.
Oops, something went wrong.