Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/animal parameters #41

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion GeoRasterBlueprint/Model/AbstractAnimal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public abstract class AbstractAnimal : IPositionable, IAgent<LandscapeLayer> {
public const double DehydrationRate = 6.0;
public const double StarvationRate = 4.0;
public const int MaxAge = 25;

public void Init(LandscapeLayer layer) {
LandscapeLayer = layer;

Expand Down
32 changes: 25 additions & 7 deletions GeoRasterBlueprint/Model/Bison.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,43 @@ public class Bison : AbstractAnimal {
public override double Longitude { get; set; }

#endregion

#region Constants
private readonly Dictionary<AnimalLifePeriod, double> _satietyIntakeHourly = new()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to starvationRate

{
//food per day (kg) / 16 (hours)
{ AnimalLifePeriod.Calf, 0.56 }, //9kg per day
{ AnimalLifePeriod.Adolescent, 1.81 }, //20-29 kg per day
{ AnimalLifePeriod.Adult, 3.75 } //60 kg per day, 113 liter
//value adjusted to maxSatiety = 100
{ AnimalLifePeriod.Calf, MaxSatiety * DailyFoodAdult / 16 / DailyFoodAdult },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add comment explaining calculation

{ AnimalLifePeriod.Adolescent, MaxSatiety * DailyFoodAdolescent / 16 / DailyFoodAdult },
{ AnimalLifePeriod.Adult, MaxSatiety * DailyFoodAdult / 16 / DailyFoodAdult }
};

private readonly Dictionary<AnimalLifePeriod, double> _dehydrationRate =
new()
{
{ AnimalLifePeriod.Calf, 0.7 }, // daily water consumption 17.0 = 9 / 60 * 113, divided by 24
{ AnimalLifePeriod.Adolescent, 2.29 }, //daily water consumption 55.0 = 29 / 60 * 113, all divided by 24
{ AnimalLifePeriod.Adult, 4.7} //daily water consumption 113, divided by 24
// value adjusted to maxHydration = 100
{ AnimalLifePeriod.Calf, MaxHydration * DailyWaterCalf / 24 / DailyWaterAdult },
{ AnimalLifePeriod.Adolescent, MaxHydration * DailyWaterAdolescent / 24 / DailyWaterAdult},
{ AnimalLifePeriod.Adult, MaxHydration * DailyWaterAdult / 24 / DailyWaterAdult}
};

[PropertyDescription]
public static double DailyFoodAdult { get; set; }
[PropertyDescription]
public static double DailyFoodCalf { get; set; }
[PropertyDescription]
public static double DailyFoodAdolescent { get; set; }

//total need of water per day in liters
[PropertyDescription]
public static double DailyWaterAdult { get; set; }
[PropertyDescription]
public static double DailyWaterCalf { get; set; }
[PropertyDescription]
public static double DailyWaterAdolescent { get; set; }
#endregion

public override void Tick() {

if (!IsAlive) return;
_hoursLived++;
if (_hoursLived == 300)
Expand Down
32 changes: 24 additions & 8 deletions GeoRasterBlueprint/Model/Elk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,40 @@ public class Elk : AbstractAnimal {

#region constants

//TODO use real Elk data
private readonly Dictionary<AnimalLifePeriod, double> _satietyIntakeHourly = new()
{
//food per day (kg) / 16 (hours)
{ AnimalLifePeriod.Calf, 0.56 }, //9kg per day
{ AnimalLifePeriod.Adolescent, 1.81 }, //20-29 kg per day
{ AnimalLifePeriod.Adult, 3.75 } //60 kg per day, 113 liter
//value adjusted to maxSatiety = 100
{ AnimalLifePeriod.Calf, MaxSatiety * DailyFoodAdult / 16 / DailyFoodAdult },
{ AnimalLifePeriod.Adolescent, MaxSatiety * DailyFoodAdolescent / 16 / DailyFoodAdult },
{ AnimalLifePeriod.Adult, MaxSatiety * DailyFoodAdult / 16 / DailyFoodAdult }
};

private readonly Dictionary<AnimalLifePeriod, double> _dehydrationRate =
new()
{
{ AnimalLifePeriod.Calf, 0.7 }, // daily water consumption 17.0 = 9 / 60 * 113, divided by 24
{ AnimalLifePeriod.Adolescent, 2.29 }, //daily water consumption 55.0 = 29 / 60 * 113, all divided by 24
{ AnimalLifePeriod.Adult, 4.7} //daily water consumption 113, divided by 24
// value adjusted to maxHydration = 100
{ AnimalLifePeriod.Calf, MaxHydration * DailyWaterCalf / 24 / DailyWaterAdult },
{ AnimalLifePeriod.Adolescent, MaxHydration * DailyWaterAdolescent / 24 / DailyWaterAdult},
{ AnimalLifePeriod.Adult, MaxHydration * DailyWaterAdult / 24 / DailyWaterAdult}
};

[PropertyDescription]
public static double DailyFoodAdult { get; set; }
[PropertyDescription]
public static double DailyFoodCalf { get; set; }
[PropertyDescription]
public static double DailyFoodAdolescent { get; set; }

//total need of water per day in liters
[PropertyDescription]
public static double DailyWaterAdult { get; set; }
[PropertyDescription]
public static double DailyWaterCalf { get; set; }
[PropertyDescription]
public static double DailyWaterAdolescent { get; set; }
#endregion
public override void Tick() {

if (!IsAlive) return;
_hoursLived++;
if (_hoursLived == 300)
Expand Down
33 changes: 25 additions & 8 deletions GeoRasterBlueprint/Model/Moose.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,41 @@ public class Moose : AbstractAnimal {
#endregion

#region Constants
//TODO use real moose data
private readonly Dictionary<AnimalLifePeriod, double> _satietyIntakeHourly = new()
{
//food per day (kg) / 16 (hours)
{ AnimalLifePeriod.Calf, 0.56 }, //9kg per day
{ AnimalLifePeriod.Adolescent, 1.81 }, //20-29 kg per day
{ AnimalLifePeriod.Adult, 3.75 } //60 kg per day, 113 liter
//value adjusted to maxSatiety = 100
{ AnimalLifePeriod.Calf, MaxSatiety * DailyFoodAdult / 16 / DailyFoodAdult },
{ AnimalLifePeriod.Adolescent, MaxSatiety * DailyFoodAdolescent / 16 / DailyFoodAdult },
{ AnimalLifePeriod.Adult, MaxSatiety * DailyFoodAdult / 16 / DailyFoodAdult }
};

private readonly Dictionary<AnimalLifePeriod, double> _dehydrationRate =
new()
{
{ AnimalLifePeriod.Calf, 0.7 }, // daily water consumption 17.0 = 9 / 60 * 113, divided by 24
{ AnimalLifePeriod.Adolescent, 2.29 }, //daily water consumption 55.0 = 29 / 60 * 113, all divided by 24
{ AnimalLifePeriod.Adult, 4.7} //daily water consumption 113, divided by 24
// value adjusted to maxHydration = 100
{ AnimalLifePeriod.Calf, MaxHydration * DailyWaterCalf / 24 / DailyWaterAdult },
{ AnimalLifePeriod.Adolescent, MaxHydration * DailyWaterAdolescent / 24 / DailyWaterAdult},
{ AnimalLifePeriod.Adult, MaxHydration * DailyWaterAdult / 24 / DailyWaterAdult}
};

//total need of food per day in kilogramms
[PropertyDescription]
public static double DailyFoodAdult { get; set; }
[PropertyDescription]
public static double DailyFoodCalf { get; set; }
[PropertyDescription]
public static double DailyFoodAdolescent { get; set; }

//total need of water per day in liters
[PropertyDescription]
public static double DailyWaterAdult { get; set; }
[PropertyDescription]
public static double DailyWaterCalf { get; set; }
[PropertyDescription]
public static double DailyWaterAdolescent { get; set; }
#endregion
public override void Tick() {

if (!IsAlive) return;
_hoursLived++;
if (_hoursLived == 300)
Expand Down
78 changes: 78 additions & 0 deletions GeoRasterBlueprint/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,98 @@
"agents": [
{
"name": "Bison",
"mapping": [
{
"parameter": "DailyFoodAdult",
"value": 60
},
{
"parameter": "DailyFoodAdolescent",
"value": 29
},
{
"parameter": "DailyFoodCalf",
"value": 9
},
{
"parameter": "DailyWaterAdult",
"value": 113
},
{
"parameter": "DailyWaterAdolescent",
"value": 55
},
{
"parameter": "DailyWaterCalf",
"value": 17
}
],
"file":"Resources/bisons.csv",
"outputs": [
{"kind": "trips"}
]
},
{
"name": "Moose",
"mapping": [
{
"parameter": "DailyFoodAdult",
"value": 27
},
{
"parameter": "DailyFoodAdolescent",
"value": 13
},
{
"parameter": "DailyFoodCalf",
"value": 4
},
{
"parameter": "DailyWaterAdult",
"value": 529
},
{
"parameter": "DailyWaterAdolescent",
"value": 258
},
{
"parameter": "DailyWaterCalf",
"value": 79
}
],
"file":"Resources/moose.csv",
"outputs": [
{"kind": "trips"}
]
},
{
"name": "Elk",
"mapping": [
{
"parameter": "DailyFoodAdult",
"value": 9.1
},
{
"parameter": "DailyFoodAdolescent",
"value": 4.2
},
{
"parameter": "DailyFoodCalf",
"value": 2.0
},
{
"parameter": "DailyWaterAdult",
"value": 60
},
{
"parameter": "DailyWaterAdolescent",
"value": 29
},
{
"parameter": "DailyWaterCalf",
"value": 9
}
],
"file":"Resources/elks.csv",
"outputs": [
{"kind": "trips"}
Expand Down
Loading