Skip to content

Commit

Permalink
Merge branch 'dev' into 'main'
Browse files Browse the repository at this point in the history
1.0.5

See merge request iek-3/shared-code/ethos_penalps!42
  • Loading branch information
julianbelina committed Apr 18, 2024
2 parents 9b87d8e + 0f769a2 commit 174c762
Show file tree
Hide file tree
Showing 80 changed files with 1,024 additions and 391 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run ETHOS.PeNALPS Tests
name: Daily ETHOS.PeNALPS Tests
on:
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -30,7 +30,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest","ubuntu-20.04", "macos-latest","macos-13","macos-12", "macos-11","windows-latest","windows-2019"]
os: ["ubuntu-latest","ubuntu-20.04", "macos-latest","macos-13","macos-12", "windows-latest","windows-2019"]
steps:
- uses: conda-incubator/setup-miniconda@v3
with:
Expand Down Expand Up @@ -83,14 +83,14 @@ jobs:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest","ubuntu-20.04", "macos-latest","macos-13","macos-12", "macos-11","windows-latest","windows-2019"]
os: ["ubuntu-latest","ubuntu-20.04", "macos-latest","macos-13","macos-12", "windows-latest","windows-2019"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: FZJ-IEK3-VSA/ETHOS_PeNALPS
path: './ETHOS_PENALPS'
ref: ${{ github.ref }}
ref: main
- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
Expand Down
80 changes: 80 additions & 0 deletions .github/workflows/push_and_pull_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Run ETHOS.PeNALPS Tests on push or pull
on:
workflow_dispatch:
inputs:
tags:
description: 'Manual run'
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
# Allows to trigger the workflow manually


jobs:
TestPeNALPSDevLocal:
name: Ex1 (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest","ubuntu-20.04", "macos-latest","macos-13","macos-12", "windows-latest","windows-2019"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: FZJ-IEK3-VSA/ETHOS_PeNALPS
path: './ETHOS_PENALPS'
ref: ${{ github.ref }}
- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
channels: conda-forge
activate-environment: test_env
- name: Run tests
shell: pwsh
run: |
ls
echo "LS Done"
cd ETHOS_PENALPS
mamba env create --name penalps_env --yes --file environment.yml
conda run --name penalps_env pip install . --no-deps
echo "Installation done"
conda list --name penalps_env
echo "libaries printed"
echo "start pytest"
conda run --name penalps_env pytest
echo "Pytest done"
echo "run examples"
- name: Run examples
shell: pwsh
run: |
ls
cd ETHOS_PENALPS
cd examples
cd tutorial
conda run --name penalps_env python _1_cooking_example.py
conda run --name penalps_env python _2_cooking_example_more_states.py
conda run --name penalps_env python _3_add_more_cooker_for_parallel_operation.py
conda run --name penalps_env python _4_cooking_and_mixer_exclusive_example.py
cd _5_connect_four_process_steps
conda run --name penalps_env python simulation_starter.py
cd ..
cd ..
cd toffee_production
conda run --name penalps_env python simulation_starter.py
cd ..
cd basic_examples
conda run --name penalps_env python batch_to_batch_1_node_example.py
cd ..
cd b_pillar_manufacturing
conda run --name penalps_env python simulation_starter.py
echo "Running examples terminated"
#"PENALPS_VERSION=$PENALPS_VERSION" >> $GITHUB_OUTPUT
1 change: 1 addition & 0 deletions documentation/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ parts:
- file: ethos_penalps_articles/model_topology.md
- file: ethos_penalps_articles/roadmap.md
- file: ethos_penalps_articles/contribution_guide.md
- file: ethos_penalps_articles/statement_of_need.md

- caption: API
chapters:
Expand Down
14 changes: 7 additions & 7 deletions documentation/ethos_penalps_articles/model_topology.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ Depiction of the possible topology of production systems of ETHOS.PeNALPS models

The production systems consists of:

- Exactly one [Enterprise](../autoapi/ethos_penalps/enterprise/index.rst).
- One or more [NetworkLevel](../autoapi/ethos_penalps/network_level/index.rst).
- Exactly one [Enterprise](../autoapi/ethos_penalps/organizational_agents/enterprise/index.rst).
- One or more [NetworkLevel](../autoapi/ethos_penalps/organizational_agents/network_level/index.rst).
- Exactly one [Source](../autoapi/ethos_penalps/process_nodes/source/index.rst) in the upper NetworkLevel.
- Exactly one [Sink](../autoapi/ethos_penalps/process_nodes/sink/index.rst) in the lower NetworkLevel.
- One [ProcessChainStorage](../autoapi/ethos_penalps/process_nodes/process_chain_storage/index.rst) to
connect two NetworkLevel.
- One or more [ProcessChain](../autoapi/ethos_penalps/process_chain/index.rst) per NetworkLevel
- One or more [ProcessChain](../autoapi/ethos_penalps/organizational_agents/process_chain/index.rst) per NetworkLevel
- One more [Process Step](../autoapi/ethos_penalps/process_nodes/process_step/index.rst) per process chain.
- One [StreamHandler](../autoapi/ethos_penalps/stream_handler/index.rst) per NetworkLevel
- One stream for each connection between multiple process Steps, between source and process step and sink and process step.
Expand All @@ -27,7 +27,7 @@ The production systems consists of:

# Petri Net

Additionally each of the process step requires a Petri-Net. There are two generic versions of petri nets which can be implemented which are shown in {numref}`petri-net-combined-input-output-topology` and {numref}`petri-net-separate-input-output-topology`. Each of node in the petri net is a [ProcessState](../autoapi/ethos_penalps/process_state/index.rst). To model a transition which is indicated by the arrows a [ProcessStateSwitchSelector](../autoapi/ethos_penalps/process_state_switch_selector/index.rst) which contains at least one [ProcessStateSwitch](../autoapi/ethos_penalps/process_state_switch/index.rst) is required.
Additionally each of the process step requires a Petri-Net. There are two generic versions of petri nets which can be implemented which are shown in {numref}`petri-net-combined-input-output-topology` and {numref}`petri-net-separate-input-output-topology`. Each of node in the petri net is a [ProcessState](../autoapi/ethos_penalps/petri_net/process_state/index.rst). To model a transition which is indicated by the arrows a [ProcessStateSwitchSelector](../autoapi/ethos_penalps/petri_net/process_state_switch_selector/index.rst) which contains at least one [ProcessStateSwitch](../autoapi/ethos_penalps/petri_net/process_state_switch/index.rst) is required.



Expand All @@ -46,9 +46,9 @@ Generic depiction of a process state petri net with separate input and output st

The Petri-Net ist stored in the following structure for each process step:

- Exactly one [ProcessStateHandler](../autoapi/ethos_penalps/process_state_handler/index.rst) (Container for the Process Petri Net) per process step.
- Exactly one [ProcessStateSwitchSelectorHandler](../autoapi/ethos_penalps/process_state_switch_selector/index.rst) process state handler. it stores all [ProcessStateSwitchSelectors](../autoapi/ethos_penalps/process_state_switch_selector/index.rst).
- Exactly one [ProcessStateSwitchHandler](../autoapi/ethos_penalps/process_state_switch/index.rst) per process state switch selector handler. It stores all [ProcessStateSwitches](../autoapi/ethos_penalps/process_state_switch/index.rst)
- Exactly one [ProcessStateHandler](../autoapi/ethos_penalps/petri_net/process_state_handler/index.rst) (Container for the Process Petri Net) per process step.
- Exactly one [ProcessStateSwitchSelectorHandler](../autoapi/ethos_penalps/petri_net/process_state_switch_selector/index.rst) process state handler. it stores all [ProcessStateSwitchSelectors](../autoapi/ethos_penalps/petri_net/process_state_switch_selector/index.rst).
- Exactly one [ProcessStateSwitchHandler](../autoapi/ethos_penalps/petri_net/process_state_switch/index.rst) per process state switch selector handler. It stores all [ProcessStateSwitches](../autoapi/ethos_penalps/petri_net/process_state_switch/index.rst)



Expand Down
12 changes: 12 additions & 0 deletions documentation/ethos_penalps_articles/statement_of_need.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Statement of Need

Energy system models are tools that provide guidance on future energy systems, which are currently undergoing significant changes to due global efforts to reduce dependence on fossil fuels {cite}`Prina.2020` p. 1. However, building long-term models with high spatial and temporal resolution and transparent input data remains a challenge {cite}`Prina.2020` p. 12. For instance, historical load profiles for the German industrial sector in 2015 are available {cite}`Priesmann.2021` pp. 5–6, while load profiles for other regions are not currently available. Furthermore, decarbonization efforts will cause changes in the industrial sector, creating a need for load profiles of future scenarios. To address the lack of sectoral load profiles for the industry, Boßmann and Stafell {cite}`Bomann.2015` p. 1321 demonstrated the use of a bottom-up approach. Therefore, it is necessary to obtain load profiles of the industrial processes that are part of the industrial sector. However, these profiles are often unavailable for open research due to:

- Companies’ efforts to protect commercial secrets;
- Missing measurements;
- Unstructured collection of energy data in companies;
- Novelty of the industrial processes and their current lack of implementation.

ETHOS.PeNALPS can support the creation of an energy system model by providing load profiles for industrial processes. While many industrial processes and their load profiles have been previously simulated, most have not published load profiles and simulation implementations under an open-source license. This creates a research gap, despite similar work having already been done.

ETHOS.PeNALPS provides modeling capabilities to simulate load profiles of individual production equipment and the logistics between them in a network. Fluctuations of individual production equipment are modeled using a deterministic Petri net of states. The level of detail and temporal resolution of the load profile model depends on the production process features, the level of detail in the process description, and the available input data. To ensure the suitability of a simulated load profile for each energy system model, it is necessary to evaluate its temporal resolution. At lower temporal resolutions, effects may occur that cannot be modeled using a deterministic Petri net of machine states and average energy consumption per state. Furthermore, the temporal resolution of energy system models is constantly evolving. According to {cite}`Prina.2020` p. 10, a temporal resolution of one hour is considered high for long-term energy system models. Currently, studies may require load profiles with a resolution as low as one minute {cite}`Omoyele.2024` pp. 12–13.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Simple Cooker Example

This section shows how to setup a minimal simulation of a production system which consists of a single cooker. A depiction of the ETHOS.PeNALPS Model is shown in {numref}`cooking-example-single`. The energy, time and mass data is used from an experiment by Korzeniowska-Ginter et al. {cite}`Korzeniowska_Ginter_2019`. They conducted a series of experiments to determine cooking length and energy demand that are required to cook potatoes using household appliances. For this case the data from the electric stove with a metal plate is used.
This section shows how to setup a minimal simulation of a production system which consists of a single cooker. A depiction of the ETHOS.PeNALPS Model is shown in {numref}`cooking-example-single`. The energy, time and mass data is used from an experiment by Korzeniowska-Ginter et al. {cite}`KorzeniowskaGinter.2019`. They conducted a series of experiments to determine cooking length and energy demand that are required to cook potatoes using household appliances. For this case the data from the electric stove with a metal plate is used.

:::{figure-md} cooking-example-single
<img src="./figures/1_tutorial/single_cooker_process_chain_example.png" width=300>
Expand Down Expand Up @@ -33,7 +33,7 @@ output_commodity = Commodity(name="Cooked Goods")
input_commodity = Commodity(name="Raw Goods")
```
## Create Product Orders
As a third step the orders to be produced during the simulation must be created. The mass is passed as metric tones. The order consists of the commodity of the product, the deadline and the number of orders. The simulation attempts to fulfill the order just in time. If it is not possible due to capacity constraints, the production start is shifted to an earlier time. The order size is based on the mass that was used in a single experiment which consists of 200 gram potatoes and 450 ml of water. {cite}`Korzeniowska_Ginter_2019` p.3
As a third step the orders to be produced during the simulation must be created. The mass is passed as metric tones. The order consists of the commodity of the product, the deadline and the number of orders. The simulation attempts to fulfill the order just in time. If it is not possible due to capacity constraints, the production start is shifted to an earlier time. The order size is based on the mass that was used in a single experiment which consists of 200 gram potatoes and 450 ml of water. {cite}`KorzeniowskaGinter.2019` p.3

```
# Create all order for the simulation
Expand Down Expand Up @@ -160,7 +160,7 @@ The transitions connect the newly created nodes. The transitions are called proc
3. process_state_switch_at_output_stream --> output_state
4. create_process_state_switch_delay --> intermediate_state

Additionally, selectors are implemented to determine which transition are evaluated when multiple transitions could occur in the same state. In this example each state only has a single transition. Thus, the process state switch is passed to a so called single choice selector. The cooking time is assumed to be 24 minutes in total. {cite}`Korzeniowska_Ginter_2019` p.5
Additionally, selectors are implemented to determine which transition are evaluated when multiple transitions could occur in the same state. In this example each state only has a single transition. Thus, the process state switch is passed to a so called single choice selector. The cooking time is assumed to be 24 minutes in total. {cite}`KorzeniowskaGinter.2019` p.5

```
activate_not_cooking = process_step.process_state_handler.process_state_switch_selector_handler.process_state_switch_handler.create_process_state_switch_at_next_discrete_event(
Expand Down Expand Up @@ -201,7 +201,7 @@ process_step.process_state_handler.process_state_switch_selector_handler.create_
```
## Initialize Energy Data

Finally the energy data must be initialized. Therefore, the energy load type must be initialized, which is electricity in this example. It can either be addressed to a specific state or to the activity of a stream. Here the complete energy is consumed during the cooking state. The specific energy demand is provided in the units MJ/t. An energy demand of 830.76 MJ/t for the cooking process. It is based on the energy demand of 0.15 kWh/650 gram from Korzeniowska-Ginter et al. {cite}`Korzeniowska_Ginter_2019` p.5. The input stream of the corresponding process step must be passed to the energy data to determine the mass that is processed in the state.
Finally the energy data must be initialized. Therefore, the energy load type must be initialized, which is electricity in this example. It can either be addressed to a specific state or to the activity of a stream. Here the complete energy is consumed during the cooking state. The specific energy demand is provided in the units MJ/t. An energy demand of 830.76 MJ/t for the cooking process. It is based on the energy demand of 0.15 kWh/650 gram from Korzeniowska-Ginter et al. {cite}`KorzeniowskaGinter.2019` p.5. The input stream of the corresponding process step must be passed to the energy data to determine the mass that is processed in the state.

```
electricity_load = LoadType(name="Electricity")
Expand Down
Loading

0 comments on commit 174c762

Please sign in to comment.