simulationengine
Repository for the Generic Recursive Simulation of Socio-technical Systems for Service Provision (GR4SP).
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 4 committers (25.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.1%) to scientific vocabulary
Keywords
Repository
Repository for the Generic Recursive Simulation of Socio-technical Systems for Service Provision (GR4SP).
Basic Info
Statistics
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 11
- Releases: 0
Topics
Metadata Files
README.md
gr4sp
This repository holds the source code of the Generic Recursive Simulation of Socio-technical Systems for Service Provision (GR4SP) model. The simulation model uses data for the Victorian electricity system in Australia. But GR4SP's structure can guide the development of similar simulations in other contexts.
In addition to the source code of the main simulation engine, an Agent-based model in Java, this repository holds several Jupyter notebooks for analysing and visualising sets of experimental results.
Set up Gr4sp
Clone repo:
git clone https://github.com/angelara/gr4sp.git
go to the root folder gr4sp and run
mkdir logs
mkdir csv
mkdir plots
To run the model, you need to install JAVA JRE and JDK.
JAVA
Ubuntu
sudo apt update
sudo apt install default-jre
sudo apt install default-jdk
See this guide more details on how to setup JAVA in ubuntu
Windows
follow these instructions
Python
Install JPype, Pandas, ipyparallel, SALib, numpy, scipy, matplotlib:
pip install JPype1 pandas ipyparallel SALib numpy scipy matplotlib
compile java files
You can use InteliJ. Once installed, open the project clicking on the gr4sp.iml file. You can compile/build and run from InteliJ.
Alternatively, run this command from the root of the repo to make the bash script executable:
javac -d classes -cp src/:/mnt/data/gr4sp/experiments/../libraries/bsh-2.0b4.jar:/mnt/data/gr4sp/experiments/../libraries/itext-1.2.jar:/mnt/data/gr4sp/experiments/../libraries/j3dcore.jar:/mnt/data/gr4sp/experiments/../libraries/j3dutils.jar:/mnt/data/gr4sp/experiments/../libraries/jcommon-1.0.21.jar:/mnt/data/gr4sp/experiments/../libraries/jfreechart-1.0.17.jar:/mnt/data/gr4sp/experiments/../libraries/jmf.jar:/mnt/data/gr4sp/experiments/../libraries/mason.19.jar:/mnt/data/gr4sp/experiments/../libraries/portfolio.jar:/mnt/data/gr4sp/experiments/../libraries/vecmath.jar:/mnt/data/gr4sp/experiments/../libraries/postgresql-42.2.6.jar:/mnt/data/gr4sp/experiments/../libraries/opencsv-4.6.jar:/mnt/data/gr4sp/experiments/../libraries/yamlbeans-1.13.jar $(find src -name *.java)
Set simulation YAML file
The settings for the simulation are specified in YAML format. Which is a human readable file that can be edited to change the simulation settings.
To run the simulation settings stored in the YAML file, the folderOutput variable in the YAML file should point to the main folder containing gr4sp (root folder where the code was cloned).
Run the following command:
[src\core\settings\BAUVIC.yaml](src\core\settings\BAUVIC.yaml)
This command should have printed the full location path. Make sure the folderOutput variable at the beginning of the YAML file is set to the correct full path printed by pwd.
For example, if you clone the repo in windows in this folder c:\\Users\\MyUserName\\Documents\\GitHub\\gr4sp, then set the first variable in the yaml file simulationSettings/BAUVIC.yaml as
folderOutput: "C:\\Users\\MyUserName\\Documents\\GitHub\\gr4sp"
```
Install PostGres and load database
Install postgres
sudo apt install postgresql postgresql-contrib
To create postgres username and database
``` sudo -u postgres -i
dropdb postgres createdb postgres sudo -u postgres psql \q ```
To load data into the database in linux run
sudo -u postgres pg_restore -U postgres -d postgres < backupDB/databaseName.sql
If you are using windows run instead
pg_restore.exe -U postgres -d postgres -l backupDB/databaseName.sql
:warning: If you already loaded the database and you need to recreate it again using a new different backup file run:
sudo -u postgres dropdb postgres
sudo -u postgres createdb postgres
sudo -u postgres pg_restore -U postgres -d postgres < backupDB/databaseName.sql
Edit file pghba.conf. In ubuntu it can be found at `/etc/postgresql/XX/main/pghba.conf` where XX is the PostgreSQL version:
sudo nano /etc/postgresql/XX/main/pg_hba.conf
See this guide about how to edit files with nano. Scroll down to the end of the file and make sure that all the lines below finish with the word trust. The file should be edited so it looks as shown below:
```local all postgres trust
"local" is for Unix domain socket connections only
local all all trust # IPv4 local connections:
host all all 127.0.0.1/32 trust # IPv6 local connections:
host all all ::1/128 trust
```
and then run
sudo service postgresql restart
These changes make sure that gr4sp access the postgres database without any issues (e.g. username, passwords).
You can run from InteliJ.
Otherwise, make sure you added executable rights to run_gr4sp.sh by running
chmod +x *.sh
and then simply run:
./runGr4sp.sh
It will run the simulation using the default simulationSettings simulationSettings/BAUVIC.yaml. Once the simulation is over, the results should appear in the csv and plots folders.
if you want to run it with the Graphical interface to see the progress of the simulation with the live plots, then run
``` ./runGr4spUI.sh
```
alternatively, the command being used is as follows:
```
java -classpath classes/production/gr4sp:libraries/bsh-2.0b4.jar:libraries/itext-1.2.jar:libraries/j3dcore.jar:libraries/j3dutils.jar:libraries/jcommon-1.0.21.jar:libraries/jfreechart-1.0.17.jar:libraries/jmf.jar:libraries/mason.19.jar:libraries/portfolio.jar:libraries/vecmath.jar:libraries/postgresql-42.2.6.jar:libraries/opencsv-4.6.jar:libraries/yamlbeans-1.13.jar core.Gr4spSim
```
Run Experiments with EMA Workbench
install python3 and pip3 following this instructions
Python dependencies
install PIP python package manager:
sudo apt update
sudo apt install python3-pip
Install JPype, Pandas, ipyparallel, SALib, numpy, scipy, matplotlib:
pip3 install JPype1 pandas ipyparallel SALib numpy scipy matplotlib
Set JVM library
open experiments/settingsExperiments.json file, and edit the file setting the variable jvmPath accordingly to jvmPathWindows or jvmPathUbuntu , making sure that the folders contain the jvm.dll or libjvm.so library.
Run EET or Variance-based SA
go to experiments folder, edit the experiment you want to run in experiments/runExperiments.py:26 and execute:
python3 runExperiments.py
Analyze results
see notebooks in experiments/notebookGr4sp
GitHub Events
Total
Last Year
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| angelara | 3****a | 333 |
| angelara | a****a@s****u | 21 |
| angelara | a****s@g****m | 5 |
| Ubuntu | u****u@g****l | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: over 2 years ago
All Time
- Total issues: 28
- Total pull requests: 0
- Average time to close issues: over 2 years
- Average time to close pull requests: N/A
- Total issue authors: 1
- Total pull request authors: 0
- Average comments per issue: 0.21
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- angelara (28)