-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
--------- Co-authored-by: mhunter02 <[email protected]> Co-authored-by: Mihail <[email protected]> Co-authored-by: Wen <[email protected]> Co-authored-by: chuuuun <[email protected]> Co-authored-by: hackerman <[email protected]> Co-authored-by: kareem <[email protected]> Co-authored-by: jing-yaoo <[email protected]>
- Loading branch information
1 parent
8b81c91
commit 4d335ef
Showing
33 changed files
with
5,338 additions
and
1 deletion.
There are no files selected for viewing
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,60 @@ | ||
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | ||
|
||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
name: Java CI with Maven | ||
|
||
on: | ||
push: | ||
branches: [ "**" ] | ||
pull_request: | ||
branches: [ "**" ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: [ubuntu-latest] | ||
|
||
strategy: | ||
matrix: | ||
java_version: [17] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK ${{ matrix.java_version }} | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: maven | ||
|
||
- name: Download and Unpack Scylla | ||
run: | | ||
# Define variables for URLs and target directory | ||
SCYLLA_URL="https://github.com/bptlab/scylla/releases/download/0.0.1-SNAPSHOT/scylla.zip" | ||
TARGET_DIR="${{ github.workspace }}/lib" | ||
# Create the target directory if it doesn't exist | ||
mkdir -p $TARGET_DIR | ||
# Download the zip file | ||
wget $SCYLLA_URL -O scylla.zip | ||
# Unpack the zip file | ||
unzip scylla.zip | ||
# Move the JAR files to the target directory | ||
mv scylla.jar $TARGET_DIR | ||
mv scylla-tests.jar $TARGET_DIR | ||
- name: Setup dependencies | ||
run: mvn -B clean --file pom.xml | ||
|
||
- name: Build with Maven | ||
uses: coactions/setup-xvfb@v1 | ||
with: | ||
run: mvn -B package --file pom.xml |
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,126 @@ | ||
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created | ||
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path | ||
|
||
name: Maven Package | ||
|
||
on: | ||
release: | ||
types: [ created ] | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
pat: | ||
name: Test PAT | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v3 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Install dependencies | ||
run: yarn install | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TOKEN }} | ||
|
||
triage: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
steps: | ||
- uses: actions/labeler@v4 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
Release: | ||
if: github.repository == 'INSM-TUM-Teaching/Simulator-Extension-SOPA' # Only main repo has permissions to publish this | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml | ||
settings-path: ${{ github.workspace }} # location for the settings.xml file | ||
cache: maven | ||
|
||
- name: Download and Unpack Scylla | ||
run: | | ||
# Define variables for URLs and target directory | ||
SCYLLA_URL="https://github.com/bptlab/scylla/releases/download/0.0.1-SNAPSHOT/scylla.zip" | ||
TARGET_DIR="${{ github.workspace }}/lib" | ||
# Create the target directory if it doesn't exist | ||
mkdir -p $TARGET_DIR | ||
# Download the zip file | ||
wget $SCYLLA_URL -O scylla.zip | ||
# Unpack the zip file | ||
unzip scylla.zip | ||
# Move the JAR files to the target directory | ||
mv scylla.jar $TARGET_DIR | ||
mv scylla-tests.jar $TARGET_DIR | ||
- name: Setup dependencies | ||
run: mvn -B clean --file pom.xml | ||
|
||
- name: Build with Maven | ||
uses: coactions/setup-xvfb@v1 | ||
with: | ||
run: mvn -B package --file pom.xml | ||
|
||
- name: Create .zip | ||
run: | | ||
cd ./target/ | ||
mv ./*.jar ./cost_driver.jar | ||
zip -r ../cost_driver.zip ./*.jar | ||
cd .. | ||
echo "RELEASE_VERSION=$(cat pom.xml | grep '<version>' | head -1 | sed 's/<version>//' | sed 's/<\/version>//')" >> $GITHUB_ENV | ||
- name: Upload Zip | ||
uses: ncipollo/[email protected] | ||
with: | ||
artifacts: "cost_driver.zip" | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{env.RELEASE_VERSION}} | ||
commit: 'main' | ||
allowUpdates: true | ||
|
||
Deploy: | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && github.repository == 'INSM-TUM-Teaching/cost_driver' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml | ||
settings-path: ${{ github.workspace }} # location for the settings.xml file | ||
cache: maven | ||
|
||
- name: Publish as Maven package to GitHub Packages Apache Maven | ||
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml -DskipTests | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
|
||
- name: Set Release version env variable | ||
run: | | ||
echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV |
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,25 @@ | ||
/target/ | ||
|
||
# Ignore output of scylla | ||
*_resourceutilization.txt | ||
*.xes | ||
*.*_batchactivitystats.txt | ||
*.xml | ||
|
||
# Compiled class file | ||
*.class | ||
|
||
# Package Files # | ||
*.war | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
**/output_*/* | ||
/.idea/* | ||
/target/ | ||
/samples/*.html | ||
/.settings/ | ||
/.project | ||
**/*.iml |
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 |
---|---|---|
@@ -1 +1,136 @@ | ||
# Scylla-Plugin--SOPA | ||
# BearCrow | ||
Simulate models with sustainability info, and process and visualize the simulation results. | ||
|
||
## ℹ️ About | ||
The plugin works by extending Scylla, a business process simulator, by processing sustainability information | ||
of a business process, passing it through the Scylla simulation, and outputs data insights. | ||
### Why is sustainability information important? | ||
Provides insights into the environmental impact of business processes/activities. | ||
### What is Cost Driver(CD)? | ||
Cost Driver is the term used to describe the cost of an activity. Here we abbreviate them into CD. Abstract cost driver (ACD) is a category consuming resource and causes environmental impact. Concrete cost driver (CCD) is the concreteized case of ACD. Take Delivery packages in our life, delivery can be considered as an ACD while delivery by a lorry or bicycle can be its CCD. | ||
### What is the Cost Variant? | ||
Cost variants govern what specific combinations of concretizations can occur during individual process instances based on the environmental cost driver hierarchy. In other words, what sets of concrete environmental cost drivers can, during process execution, take the place of the abstract environmental cost drivers during activity execution? | ||
### What are LCA Scores? | ||
A quantified score of environmental impacts associated with the life cycle of a commercial product. | ||
## 🎯Objective | ||
Whilst the concern for the world’s ecosystem seems to grow, industries need to measure how much their business processes impact the environment. Thus, considering the environmental impacts of business processes has become an important factor that needs to be considered. | ||
Business process model and notation (BPMN) has been introduced to organizations to allow them to construct models of their business processes. Within this business process exist activities that contain further information about the activity itself. | ||
Scylla is a BPMN simulator being used in the case, the plugin is an extension of Scylla by dealing with the additional sustainability info. | ||
|
||
More information can be found in our [report](https://github.com/INSM-TUM-Teaching/cost_driver/blob/main/Final_Report_scylla_sustainability.pdf). | ||
### 🛠️ How to run it? | ||
### [For Developers] | ||
1. git clone our repository | ||
2. [Download](https://github.com/bptlab/scylla/releases) and add Scylla.jar and scylla-tests.jar into libs | ||
3. Navigate to src/main/java/cost_driver/Main and run. | ||
4. Select the desired configuration files in the samples UI and check "cost_driver" as a plugin. | ||
<img width="1822" alt="Screenshot 2024-01-17 at 23 10 06" src="https://github.com/mhunter02/BearCrow-private/assets/85895529/83200e2f-5fce-4098-8c8e-0b2224d9d91e"> | ||
5. The logged data files will be found in a folder with the format: "output_yy_mm_dd...." | ||
|
||
#### NOTE | ||
*1. Please remember to put the latest scylla.jar & scylla-tests.jar files in the ./lib folder</br> | ||
*2. Another way of managing the plugin is by replacing the current Scylla dependencies, with the following. Please ensure you are using the [latest](https://github.com/orgs/bptlab/packages?repo_name=scylla) Scylla package | ||
``` | ||
<dependency> | ||
<groupId>de.hpi.bpt</groupId> | ||
<artifactId>scylla</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<type>test-jar</type> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>de.hpi.bpt</groupId> | ||
<artifactId>scylla</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
``` | ||
|
||
### [For users] | ||
1. Download the latest version of [scylla.zip](https://github.com/bptlab/scylla/releases) | ||
2. Download our plugin package [cost_driver.zip](https://github.com/INSM-TUM-Teaching/cost_driver/releases/tag/0.0.1-SNAPSHOT) | ||
3. Unzip them | ||
4. Create a directory "samples" under Scylla and put desired samples in | ||
5. Double click scylla.jar and obtain the UI as step 4 above | ||
|
||
A demo video can be found [here](https://youtu.be/ag2_OvQh5vY). | ||
|
||
## 🧱 Components | ||
Three Plugins are cooperating to achieve this. | ||
|
||
### Global Configuration Parser Plugin | ||
Parses the global config file which describes the abstract CDs and their children, concreteCDs with details that it consists of: | ||
```ruby | ||
<bsim:costDriver> | ||
<bsim:abstractCostDriver id="[Abstract Cost Driver ID]"> | ||
<bsim:concreteCostDeiver id="[Concrete Cost Driver ID]" cost="[LCA Score]"/> | ||
<bsim:concreteCostDeiver id="[Concrete Cost Driver ID]" cost="[LCA Score]"/> | ||
... | ||
</bsim:abstractCostDriver> | ||
... | ||
|
||
``` | ||
### Simulation Configuration Parser Plugin | ||
Parses the simulation config file which describes the cost variant by ID, frequency of occurrence, and cost: | ||
```ruby | ||
<bsim:costVariantConfig> | ||
<bsim:variant id="[Cost Variant ID]" frequency="[double]"> | ||
<bsim:driver id="[Abstract Cost Driver ID]" cost="[Cost]"/> | ||
</bsim:variant> | ||
``` | ||
### Logger Plugin | ||
Logs the extended simulation data as an XES and XML file. | ||
|
||
## Results | ||
The results will be shown in two files, *.xes and *_statistic.xml. | ||
### Event log (enclosed with .xes) | ||
The event log is composed of a sequence of activity instances. We put the activity cost, process cost reference Abstract Cost Driver, and Concrete Cost Driver inside so that the utilization of resources used is clear. | ||
```ruby | ||
<trace> | ||
<string key="concept:name" value="cost[Process_Instance_ID]"/> | ||
<string key="cost:Process_Instance" value="[Total Cost]"/> | ||
<string key="cost:variant" value=[Cost Variant A]/> | ||
<event> | ||
<string key="cost:driver" value=[Abstract Cost Driver(Concrete Cost Driver): [cost]]/> | ||
<string key="cost:driver" value=[Abstract Cost Driver(Concrete Cost Driver): [cost]]/> | ||
<string key="concept:name" value=[Activity]]/> | ||
<string key="lifecycle:transition" value="[state]"/> | ||
<date key="time:timestamp" value="2023-12-25T09:00:00+01:00"/> | ||
<string key="cost:activity" value=[activity cost]/> | ||
</event> | ||
... | ||
</trace> | ||
``` | ||
### Aggregated sustainability information (enclosed with _statistic.xml) | ||
The outputted file shows a complete detailed breakdown of sustainability info. | ||
Explanation of nodes moving downwards: | ||
```ruby | ||
<Sustainability_Info> | ||
<Average_Cost_Variant_Cost id="[id]">[cost]</Average_Cost_Variant_Cost> | ||
... | ||
<Average_Process_Instance_Cost>[cost]</Average_Process_Instance_Cost> | ||
<Activity_Cost> | ||
<Activity id="[id]"> | ||
<Activity_Average_Cost_Variant_Cost id="[id]">[cost]</Activity_Average_Cost_Variant_Cost> | ||
... | ||
<Activity_Average_Cost>[cost]</Activity_Average_Cost> | ||
</Activity> | ||
... | ||
</Activity_Cost> | ||
|
||
<Activity_Instance_Cost> | ||
<Activity id="[id]"> | ||
<Cost_Variant id="[id]"> | ||
<activity_instance_cost ProcessInstance_IDs="[IDs]" count="[counts]">[cost]</activity_instance_cost> | ||
</Cost_Variant> | ||
... | ||
</Activity> | ||
... | ||
</Activity_Instance_Cost> | ||
</Sustainability_Info> | ||
``` | ||
|
||
## References: <br> | ||
Pufahl, L., & Weske, M. (January 2018). Design of an Extensible BPMN Process Simulator. Retrieved from https://www.researchgate.net/publication/322524759_Design_of_an_Extensible_BPMN_Process_Simulator?enrichId=rgreq-55dc4561329b473ce8f8871f05e56dba-XXX&enrichSource=Y292ZXJQYWdlOzMyMjUyNDc1OTtBUzo1OTU2ODQ2MDQ1MjY1OTJAMTUxOTAzMzY4NTAwNg%3D%3D&el=1_x_3&_esc=publicationCoverPdf <br> | ||
Ng, K. Y. (1996). An Algorithm for Acyclic State Machines. *Acta Informatica*, 33(4), 223–228. https://doi.org/10.1007/BF02986351 | ||
|
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,44 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<bsim:globalConfiguration xmlns:bsim="http://bsim.hpi.uni-potsdam.de/scylla/simModel" targetNamespace="http://www.hpi.de" id="logistics_global"> | ||
<bsim:zoneOffset>+01:00</bsim:zoneOffset> | ||
<bsim:timetables> | ||
<bsim:timetable id="Standard"> | ||
<bsim:timetableItem from="MONDAY" to="MONDAY" beginTime="09:00" endTime="17:00" /> | ||
<bsim:timetableItem from="TUESDAY" to="TUESDAY" beginTime="09:00" endTime="17:00" /> | ||
<bsim:timetableItem from="WEDNESDAY" to="WEDNESDAY" beginTime="09:00" endTime="17:00" /> | ||
<bsim:timetableItem from="THURSDAY" to="THURSDAY" beginTime="09:00" endTime="17:00" /> | ||
<bsim:timetableItem from="FRIDAY" to="FRIDAY" beginTime="09:00" endTime="17:00" /> | ||
</bsim:timetable> | ||
</bsim:timetables> | ||
<bsim:resourceData> | ||
<bsim:dynamicResource id="courier" defaultQuantity="4" defaultCost="10.0" defaultTimetableId="Standard" defaultTimeUnit="HOURS" /> | ||
</bsim:resourceData> | ||
<bsim:costDriver> | ||
<bsim:abstractCostDriver id="Delivery"> | ||
<bsim:concreteCostDeiver id="Delivery_B_Small_Lorry" cost="0.00005524"/> | ||
<bsim:concreteCostDeiver id="Delivery_A_Small_Lorry" cost="0.00003683"/> | ||
<bsim:concreteCostDeiver id="Delivery_A_Lorry" cost="0.00002843"/> | ||
<bsim:concreteCostDeiver id="Delivery_B_Lorry" cost="0.00004265"/> | ||
</bsim:abstractCostDriver> | ||
<bsim:abstractCostDriver id="Filling Material"> | ||
<bsim:concreteCostDeiver id="Filling_A" cost="0.00001468"/> | ||
</bsim:abstractCostDriver> | ||
<bsim:abstractCostDriver id="Packaging Material"> | ||
<bsim:concreteCostDeiver id="Packaging_Material_A" cost="0.00007611"/> | ||
<bsim:concreteCostDeiver id="Packaging_Material_B" cost="0.00003806"/> | ||
</bsim:abstractCostDriver> | ||
<bsim:abstractCostDriver id="Re-Routing"> | ||
<bsim:concreteCostDeiver id="Re-Routing_A_Lorry" cost="0.000008529"/> | ||
<bsim:concreteCostDeiver id="Re-Routing_A_Small_Lorry" cost="0.00001105"/> | ||
</bsim:abstractCostDriver> | ||
<bsim:abstractCostDriver id="Receipt"> | ||
<bsim:concreteCostDeiver id="Receipt" cost="0.00001153"/> | ||
</bsim:abstractCostDriver> | ||
<bsim:abstractCostDriver id="Shipment"> | ||
<bsim:concreteCostDeiver id="Shipment_A_Lorry" cost="0.00007839"/> | ||
<bsim:concreteCostDeiver id="Shipment_A_Rail_Electric" cost="0.0000000253"/> | ||
<bsim:concreteCostDeiver id="Shipment_B_Lorry" cost="0.0001568"/> | ||
<bsim:concreteCostDeiver id="Shipment_B_Rail_Electric" cost="0.0000000506"/> | ||
</bsim:abstractCostDriver> | ||
</bsim:costDriver> | ||
</bsim:globalConfiguration> |
Oops, something went wrong.