Commit 15edf620 authored by Adam Reichold's avatar Adam Reichold
Browse files

Make the flower patch refill interval a configurable parameter.

parent c334525f
Pipeline #33759 passed with stage
in 6 minutes and 52 seconds
......@@ -73,7 +73,8 @@ impl FlowerPatch {
let flower_patch_params = &params.flower_patches[species.0 as usize];
let flowers = flower_patch_params.flowers(area, rng);
let nectar_production = flower_patch_params.nectar_production(rng);
let nectar_production = flower_patch_params.nectar_production(rng)
/ (Tick::days(1) / params.refill_interval) as f64;
let mut empty_flowers = Bitmap::new(flowers1, flowers as usize);
let contaminated_flowers = Bitmap::new(flowers1, flowers as usize);
......@@ -85,7 +86,8 @@ For the non-depleted flower patches, the discrete representation of available ne
\begin{code}
let nectar = if params.init.empty_flower_patches.sample(rng) {
*refills_at = Some(params.tick * rng.gen_range(1..=Tick::days(1) / params.tick));
*refills_at =
Some(params.tick * rng.gen_range(1..=params.refill_interval / params.tick));
for flower in 0..flowers {
empty_flowers.set(flowers1, flower as usize, true);
......
......@@ -286,7 +286,7 @@ As the scarcity of nectar is primarily used as a driver for the exploration of t
if flower_patch.nectar <= Default::default() {
flower_patch_events.push(FlowerPatchEvent::Refill {
happens_at: tick + Tick::days(1),
happens_at: tick + params.refill_interval,
flower_patch: *index,
});
......
......@@ -26,6 +26,7 @@ The time resolution is given by the discrete time step \inlinecode{tick} whereas
pub struct Params {
pub tick: Tick,
pub length: Length,
pub refill_interval: Tick,
pub flower_patches: Box<[FlowerPatch]>,
pub hoverflies: Box<[Hoverfly]>,
pub solitary_bees: Box<[SolitaryBee]>,
......@@ -291,6 +292,7 @@ The parameters of the random walk used to model insect flight are based on \auto
Self {
tick,
length: Length::kilometers(1.),
refill_interval: Tick::days(1),
flower_patches,
hoverflies: vec![hoverfly].into(),
solitary_bees: vec![solitary_bee].into(),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment