Skip to content

Commit

Permalink
Add support for adding custom resources/parameters (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlange-42 authored May 16, 2024
1 parent 829613b commit 9ece010
Show file tree
Hide file tree
Showing 19 changed files with 676 additions and 371 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,11 @@ jobs:
sudo apt-get update -y
sudo apt-get install -y libgl1-mesa-dev xorg-dev xvfb
go get ./...
- name: Run examples
- name: Run examples 1
run: |
xvfb-run go run . -s 120 -d _examples/base -x params.Termination.MaxTicks=365
xvfb-run --auto-servernum --server-num=1 go run . -s 120 -d _examples/base -x params.Termination.MaxTicks=365
go run . -r 5 -d _examples/base -e experiment.json -x params.Termination.MaxTicks=365
xvfb-run go run . -s 120 -d _examples/patches -x params.Termination.MaxTicks=365
xvfb-run go run . -s 120 -d _examples/weather_file -x params.Termination.MaxTicks=730
xvfb-run go run . -s 120 -d _examples/weather_builtin -x params.Termination.MaxTicks=730
xvfb-run --auto-servernum --server-num=1 go run . -s 120 -d _examples/patches -x params.Termination.MaxTicks=365
xvfb-run --auto-servernum --server-num=1 go run . -s 120 -d _examples/weather_file -x params.Termination.MaxTicks=730
xvfb-run --auto-servernum --server-num=1 go run . -s 120 -d _examples/weather_builtin -x params.Termination.MaxTicks=730
xvfb-run --auto-servernum --server-num=1 go run . -s 120 -d _examples/systems --systems systems.json -x params.Termination.MaxTicks=730
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Adds sub-command `init` to create input file templates (#22)
- Adds support for seasonal and "scripted" patch dynamics (#23)
- Adds support for weather/foraging period files (#24)
- Adds support for adding custom resources/parameters as well as systems (#25)

### Other

Expand Down
20 changes: 11 additions & 9 deletions _examples/base/parameters.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"Termination": {
"MaxTicks": 3650
},
"InitialPopulation": {
"Count": 25000
},
"Foragers": {
"FlightVelocity": 6.0,
"MaxKmPerDay": 25.0
"Params": {
"Termination": {
"MaxTicks": 3650
},
"InitialPopulation": {
"Count": 25000
},
"Foragers": {
"FlightVelocity": 6.0,
"MaxKmPerDay": 25.0
}
}
}
14 changes: 8 additions & 6 deletions _examples/patches/parameters.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"Termination": {
"MaxTicks": 3650
},
"InitialPatches": {
"File": "patches.json",
"Patches": []
"Params": {
"Termination": {
"MaxTicks": 3650
},
"InitialPatches": {
"File": "patches.json",
"Patches": []
}
}
}
25 changes: 25 additions & 0 deletions _examples/systems/observers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"TimeSeriesPlots": [
{
"Observer": "obs.WorkerCohorts",
"Params": {
"Cumulative": true
},
"DrawInterval": 5,
"MaxRows": 730,
"Labels": {"Title": "WorkerCohorts", "X": "Time [d]", "Y": "Count"},
"Bounds": {"X": 1, "Y": 30, "W": 600, "H": 400}
},
{
"Observer": "obs.Stores",
"Params": {
"PollenFactor": 20
},
"Columns": ["Honey", "Pollen x20"],
"DrawInterval": 5,
"MaxRows": 730,
"Labels": {"Title": "Stores", "X": "Time [d]", "Y": "Amount [kg]"},
"Bounds": {"X": 1, "Y": 470, "W": 600, "H": 400}
}
]
}
7 changes: 7 additions & 0 deletions _examples/systems/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Params": {
"Termination": {
"MaxTicks": 3650
}
}
}
24 changes: 24 additions & 0 deletions _examples/systems/systems.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[
"sys.InitStore",
"sys.InitCohorts",
"sys.InitPopulation",
"sys.InitPatchesList",

"sys.CalcAff",
"sys.CalcForagingPeriod",
"sys.ReplenishPatches",
"sys.BroodCare",
"sys.AgeCohorts",
"sys.TransitionForagers",
"sys.EggLaying",

"sys.MortalityCohorts",
"sys.MortalityForagers",

"sys.Foraging",
"sys.HoneyConsumption",
"sys.PollenConsumption",

"sys.CountPopulation",
"sys.FixedTermination"
]
32 changes: 17 additions & 15 deletions _examples/weather_builtin/parameters.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
{
"Termination": {
"MaxTicks": 3650
},
"ForagingPeriod": {
"Files": [
"data/foraging-period/berlin2000.txt",
"data/foraging-period/berlin2001.txt",
"data/foraging-period/berlin2002.txt",
"data/foraging-period/berlin2003.txt",
"data/foraging-period/berlin2004.txt",
"data/foraging-period/berlin2005.txt",
"data/foraging-period/berlin2006.txt"
],
"Builtin": true,
"RandomYears": true
"Params": {
"Termination": {
"MaxTicks": 3650
},
"ForagingPeriod": {
"Files": [
"data/foraging-period/berlin2000.txt",
"data/foraging-period/berlin2001.txt",
"data/foraging-period/berlin2002.txt",
"data/foraging-period/berlin2003.txt",
"data/foraging-period/berlin2004.txt",
"data/foraging-period/berlin2005.txt",
"data/foraging-period/berlin2006.txt"
],
"Builtin": true,
"RandomYears": true
}
}
}
16 changes: 9 additions & 7 deletions _examples/weather_file/parameters.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"Termination": {
"MaxTicks": 3650
},
"ForagingPeriod": {
"Files": ["weather.txt"],
"Builtin": false,
"RandomYears": false
"Params": {
"Termination": {
"MaxTicks": 3650
},
"ForagingPeriod": {
"Files": ["weather.txt"],
"Builtin": false,
"RandomYears": false
}
}
}
Loading

0 comments on commit 9ece010

Please sign in to comment.