[380] | 1 | expdef:
|
---|
[406] | 2 | name:Reproduction of benthic foraminifera
|
---|
[380] | 3 | info:~
|
---|
[434] | 4 | Basic information about this simulation:
|
---|
| 5 | www.framsticks.com/foraminifera
|
---|
| 6 |
|
---|
| 7 | Technical information:
|
---|
[476] | 8 | Genes and parameter values which control reproduction are stored in data->genes and data->lifeparams fields.
|
---|
[380] | 9 |
|
---|
[476] | 10 | genes:
|
---|
[402] | 11 | genes which are not encoded in Ff genotype:
|
---|
[422] | 12 | min_repro_energy - Minimum energy necessary for reproduction
|
---|
| 13 | hibernation - Defines foram behavior in the case of no nutrients
|
---|
[380] | 14 |
|
---|
[476] | 15 | lifeparams:
|
---|
[380] | 16 | Physiological parameters of foraminifera:
|
---|
[422] | 17 | max_energy_level - maximum energy level reached so far
|
---|
[380] | 18 | gen - generation: 0 haploid, 1 diploid
|
---|
[432] | 19 | species - species: 0 not hibernating 1 hibernating
|
---|
| 20 | hibernated - 0/1 foram is/isn't hibernated
|
---|
[422] | 21 | reproduce - 0/1 foram isn't/is ready for reproduction
|
---|
[380] | 22 | ~
|
---|
| 23 | code:~
|
---|
| 24 |
|
---|
[479] | 25 | global chambers;
|
---|
[422] | 26 | global colors;
|
---|
[493] | 27 | global retColors;
|
---|
| 28 | global curColor;
|
---|
| 29 | global dir_change_sec;
|
---|
[479] | 30 | global max_chamber_volume;
|
---|
[474] | 31 | global movePerStep;
|
---|
[479] | 32 | global nutrientenergywaiting;
|
---|
| 33 | global o;
|
---|
| 34 | global reprocounter;
|
---|
[481] | 35 | global changePeriod;
|
---|
| 36 | global phase;
|
---|
[493] | 37 | global nutrientSqrCm;
|
---|
[487] | 38 | global species_genes;
|
---|
[380] | 39 |
|
---|
[406] | 40 | @include "foraminifera.inc"
|
---|
[401] | 41 |
|
---|
[380] | 42 | // -------------------------------- experiment begin --------------------------------
|
---|
| 43 |
|
---|
| 44 | function onExpDefLoad()
|
---|
| 45 | {
|
---|
| 46 | // define genotype and creature groups
|
---|
| 47 | GenePools.clear();
|
---|
| 48 | Populations.clear();
|
---|
| 49 | GenePools[0].name = "Unused";
|
---|
| 50 |
|
---|
| 51 | var pop = Populations[0];
|
---|
[421] | 52 | pop.name = "Forams";
|
---|
[380] | 53 | pop.en_assim = 0;
|
---|
[404] | 54 | pop.nnsim = 0;
|
---|
[380] | 55 | pop.enableperf = 1;
|
---|
| 56 | pop.death = 1;
|
---|
| 57 | pop.energy = 1;
|
---|
[487] | 58 | pop.selfmask = 0;
|
---|
| 59 | pop.othermask = 0;
|
---|
[401] | 60 | //pop.selfmask = 0x20002; pop.othermask = 0x10002;
|
---|
[422] | 61 | pop.perfperiod = 25;
|
---|
[487] | 62 | pop.bodysim = 0;
|
---|
[380] | 63 |
|
---|
[421] | 64 | pop = Populations.addGroup("Nutrients");
|
---|
[380] | 65 | pop.nnsim = 0;
|
---|
| 66 | pop.enableperf = 0;
|
---|
| 67 | pop.death = 1;
|
---|
| 68 | pop.energy = 1;
|
---|
[487] | 69 | pop.selfmask = 0;
|
---|
| 70 | pop.othermask = 0;
|
---|
[422] | 71 | //pop.othermask = 0x10002;
|
---|
[487] | 72 | pop.bodysim = 0;
|
---|
[380] | 73 |
|
---|
[444] | 74 | pop = Populations.addGroup("ReticulopodiaNutrients");
|
---|
[430] | 75 | pop.nnsim = 0;
|
---|
| 76 | pop.enableperf = 0;
|
---|
| 77 | pop.death = 0;
|
---|
| 78 | pop.energy = 0;
|
---|
[487] | 79 | pop.selfmask = 0;
|
---|
| 80 | pop.othermask = 0;
|
---|
| 81 | pop.bodysim = 0;
|
---|
[444] | 82 |
|
---|
[422] | 83 | //world
|
---|
| 84 | SignalView.mode = 1;
|
---|
[496] | 85 | World.wrldwat = 200;
|
---|
[493] | 86 | World.wrldsiz = micronsToFrams(100000);
|
---|
[422] | 87 | World.wrldbnd = 1;
|
---|
[486] | 88 | ExpProperties.stress = 1;
|
---|
| 89 | ExpProperties.creath = -0.99; //just above the bottom
|
---|
| 90 | ExpProperties.autorestart = 0;
|
---|
[422] | 91 |
|
---|
[474] | 92 | //time
|
---|
[486] | 93 | ExpProperties.secPerStep = 480;
|
---|
| 94 | ExpProperties.foramSpeedMmPerMin = 0.05;
|
---|
[474] | 95 | movePerStep = getMovePerStep();
|
---|
| 96 |
|
---|
[486] | 97 | //ExpProperties.visualize = 1; //uncomment to visualize reticulopodia and indicate nutrients positions
|
---|
[444] | 98 |
|
---|
[487] | 99 | //ExpProperties.logging = 1; //uncomment to enable logging simulation parameters to log files
|
---|
[493] | 100 | ExpProperties.logPref = "";
|
---|
[401] | 101 |
|
---|
[422] | 102 | //reproduction
|
---|
[486] | 103 | ExpProperties.foramPop = 20;
|
---|
| 104 | ExpProperties.crossprob = 0;
|
---|
| 105 | ExpProperties.mutationprob = 0;
|
---|
| 106 | ExpProperties.repro_time = 720;
|
---|
[493] | 107 | ExpProperties.gametoPeriod = 21600;
|
---|
[486] | 108 | ExpProperties.divisionCost = 15.6;
|
---|
[422] | 109 | reprocounter = 0;
|
---|
[380] | 110 |
|
---|
[487] | 111 | species_genes = [];
|
---|
| 112 |
|
---|
[479] | 113 | init_chambers();
|
---|
| 114 |
|
---|
[493] | 115 | curColor = retColors[0];
|
---|
[422] | 116 | //morphology
|
---|
[493] | 117 | dir_change_sec = 30000;
|
---|
[486] | 118 | ExpProperties.zone1_range = micronsToFrams(1000);
|
---|
| 119 | ExpProperties.zone2_range = micronsToFrams(3000);
|
---|
| 120 | ExpProperties.chamber_growth_time = 720;
|
---|
| 121 | ExpProperties.chamberCostPerSec = 0.000001;
|
---|
| 122 | ExpProperties.chamber_proculus_haplo = micronsToFrams(50);
|
---|
| 123 | ExpProperties.chamber_difference_haplo = 0.0;
|
---|
| 124 | ExpProperties.chamber_proculus_diplo = micronsToFrams(20);
|
---|
| 125 | ExpProperties.chamber_difference_diplo = micronsToFrams(8);
|
---|
[479] | 126 |
|
---|
| 127 | max_chamber_volume = [Vector.new(), Vector.new()];
|
---|
[422] | 128 | for (var j = 0; j < 2; j++)
|
---|
| 129 | {
|
---|
| 130 | for (var i = 0; i < chambers[0].size; i++)
|
---|
| 131 | {
|
---|
[479] | 132 | max_chamber_volume[j].add(((volumeInMicrons(getProperty(j, "chamber_proculus")) + volumeInMicrons(getProperty(j, "chamber_proculus") + (i) * getProperty(j, "chamber_difference")))*(i+1))/2);
|
---|
[422] | 133 | }
|
---|
| 134 | }
|
---|
| 135 |
|
---|
| 136 | //energetics
|
---|
[486] | 137 | ExpProperties.min_repro_energ_haplo = 4;
|
---|
| 138 | ExpProperties.min_repro_energ_diplo = 6;
|
---|
[430] | 139 |
|
---|
[486] | 140 | ExpProperties.e_meta = 0.0000005;
|
---|
| 141 | ExpProperties.energy_hib = 0.0000001;
|
---|
| 142 | ExpProperties.energy_move = 0.0000005;
|
---|
[430] | 143 |
|
---|
[493] | 144 | ExpProperties.energies0_haplo = 20;
|
---|
| 145 | ExpProperties.energies0_diplo = 1.25;
|
---|
[486] | 146 | ExpProperties.feedtrans = 0.001;
|
---|
| 147 | ExpProperties.e_repro_cost_haplo = 0.3;
|
---|
| 148 | ExpProperties.e_repro_cost_diplo = 0.2;
|
---|
[422] | 149 |
|
---|
[486] | 150 | ExpProperties.e_death_level_haplo = 0.5;
|
---|
| 151 | ExpProperties.e_death_level_diplo = 0.5;
|
---|
[479] | 152 |
|
---|
[422] | 153 | //nutrients
|
---|
[481] | 154 | changePeriod = 0;
|
---|
[488] | 155 | phase = "low";
|
---|
[493] | 156 | nutrientSqrCm = 10;
|
---|
[502] | 157 | ExpProperties.foodperiod = 19200;
|
---|
| 158 | ExpProperties.foodPeriodChange = 0;
|
---|
[486] | 159 | ExpProperties.nutrientradius = micronsToFrams(10);
|
---|
[502] | 160 | ExpProperties.energy_nut = 150 * energyFromVolume(ExpProperties.nutrientradius,1);
|
---|
[493] | 161 | ExpProperties.nutrient_pop = Math.pow(framsToMicrons(World.wrldsiz)*0.0001,2)/nutrientSqrCm;
|
---|
[486] | 162 | ExpProperties.ingestion = 0.25;
|
---|
[474] | 163 | nutrientenergywaiting = 0;
|
---|
[380] | 164 | ExpState.totaltestedcr = 0;
|
---|
[421] | 165 | ExpState.nutrient = "";
|
---|
[488] | 166 |
|
---|
[493] | 167 | //addSpecies({"min_repro_energies" : [4,6]});
|
---|
| 168 | //addSpecies({"min_repro_energies" : [4,8]});
|
---|
[380] | 169 | }
|
---|
| 170 |
|
---|
| 171 | @include "standard_placement.inc"
|
---|
| 172 |
|
---|
[479] | 173 | function volumeInMicrons(radiusInFrams)
|
---|
[475] | 174 | {
|
---|
[479] | 175 | return 4.0/3.0*Math.pi*Math.pow(framsToMicrons(radiusInFrams),3);
|
---|
[475] | 176 | }
|
---|
| 177 |
|
---|
[479] | 178 | function energyFromVolume(base, isRadiusInFrams)
|
---|
| 179 | {
|
---|
| 180 | if (isRadiusInFrams == 1) //radius in frams
|
---|
| 181 | {
|
---|
[486] | 182 | return ExpProperties.picoCarbonPerMikro*volumeInMicrons(base);
|
---|
[479] | 183 | }
|
---|
| 184 | else //volume in microns
|
---|
| 185 | {
|
---|
[486] | 186 | return ExpProperties.picoCarbonPerMikro * base;
|
---|
[479] | 187 | }
|
---|
| 188 | }
|
---|
| 189 |
|
---|
[474] | 190 | function getMovePerStep()
|
---|
| 191 | {
|
---|
[486] | 192 | return micronsToFrams((ExpProperties.foramSpeedMmPerMin/60)*1000)*ExpProperties.secPerStep;
|
---|
[474] | 193 | }
|
---|
| 194 |
|
---|
[447] | 195 | function micronsToFrams(micrometers)
|
---|
[422] | 196 | {
|
---|
[493] | 197 | return micrometers*0.01;
|
---|
[422] | 198 | }
|
---|
| 199 |
|
---|
[447] | 200 | function framsToMicrons(framsworldunits)
|
---|
[445] | 201 | {
|
---|
[493] | 202 | return framsworldunits/0.01;
|
---|
[445] | 203 | }
|
---|
| 204 |
|
---|
[422] | 205 | function getProperty(gen, prop_id)
|
---|
| 206 | {
|
---|
| 207 | var ploid = "haplo";
|
---|
| 208 | if (gen == 1) ploid = "diplo";
|
---|
[486] | 209 | return ExpProperties.[prop_id + "_" + ploid];
|
---|
[422] | 210 | }
|
---|
| 211 |
|
---|
[487] | 212 | function getGene(cr, gen_id, gen_set)
|
---|
| 213 | {
|
---|
| 214 | if (cr.data->lifeparams->gen == 0)
|
---|
| 215 | return cr.data->genes[gen_id];
|
---|
| 216 | else
|
---|
| 217 | return cr.data->genes[gen_set][gen_id];
|
---|
| 218 | }
|
---|
| 219 |
|
---|
[479] | 220 | function addForam(species, iter, chambernum, ploid)
|
---|
[422] | 221 | {
|
---|
[496] | 222 | var geno = createForamMorphology(ploid, ploid, chambernum);
|
---|
[493] | 223 | curColor = retColors[ploid];
|
---|
[422] | 224 | var cr = Populations[0].add(geno);
|
---|
[479] | 225 | cr.name = "Initial creature" + species + "_" + iter;
|
---|
[422] | 226 | placeCreatureRandomly(cr, 0, 0);
|
---|
[479] | 227 | cr.energy0 = energyFromVolume(max_chamber_volume[ploid][chambernum],0);
|
---|
[422] | 228 | cr.energy = cr.energy0;
|
---|
[487] | 229 | setGenotype({"opt" : 0, "cr" : cr, "species" : species, "energy0" : cr.energy0, "genes" : species_genes[species]});
|
---|
[479] | 230 | if (ploid == 1)
|
---|
| 231 | {
|
---|
| 232 | cr.data->lifeparams->gen = 1;
|
---|
| 233 | cr.data->genes = [cr.data->genes, cr.data->genes]; //TODO two different genes sets
|
---|
| 234 | }
|
---|
[422] | 235 | }
|
---|
| 236 |
|
---|
[479] | 237 | function addInitialForam(species, iter)
|
---|
| 238 | {
|
---|
| 239 | var ploid = 0;
|
---|
| 240 | if (Math.rnd01 > 0.5)
|
---|
| 241 | {
|
---|
| 242 | ploid = 1;
|
---|
| 243 | }
|
---|
[493] | 244 | //add new foram with random energy bewtween starting energy and reproduction threshold
|
---|
[488] | 245 | addForam(species, iter, int(Math.rndUni(0,species_genes[species]->min_repro_energies[ploid])),ploid);
|
---|
[479] | 246 | }
|
---|
| 247 |
|
---|
[487] | 248 | //new species can be added as a dictionary with parameter values that are different than default values
|
---|
| 249 | function addSpecies(new_genes)
|
---|
| 250 | {
|
---|
[493] | 251 | species_genes.add({"min_repro_energies" : [ExpProperties.min_repro_energ_haplo,ExpProperties.min_repro_energ_diplo], "energies0" : [ExpProperties.energies0_haplo, ExpProperties.energies0_diplo], "hibernation" : 0, "morphotype" : 0});
|
---|
[487] | 252 | for (var i = 0; i < new_genes.size; i++)
|
---|
| 253 | {
|
---|
| 254 | var key = new_genes.getKey(i);
|
---|
| 255 | species_genes[species_genes.size-1][key] = new_genes[key];
|
---|
| 256 | }
|
---|
| 257 | }
|
---|
| 258 |
|
---|
[380] | 259 | function onExpInit()
|
---|
| 260 | {
|
---|
| 261 | Populations[0].clear();
|
---|
| 262 | Populations[1].clear();
|
---|
[444] | 263 | Populations[2].clear(); //reticulopodia and nutrients
|
---|
[380] | 264 |
|
---|
[487] | 265 | if (species_genes.size == 0)
|
---|
[380] | 266 | {
|
---|
[487] | 267 | addSpecies({}); //default
|
---|
[380] | 268 | }
|
---|
[487] | 269 |
|
---|
| 270 | for (var spec = 0; spec < species_genes.size; spec++)
|
---|
| 271 | {
|
---|
| 272 | for (var i = 0; i < ExpProperties.foramPop; i++)
|
---|
| 273 | {
|
---|
| 274 | addInitialForam(spec, i);
|
---|
| 275 | }
|
---|
| 276 | }
|
---|
[422] | 277 | o = Populations[0][0].getMechPart(0).orient.clone();
|
---|
[380] | 278 | ExpState.totaltestedcr = 0;
|
---|
| 279 | }
|
---|
| 280 |
|
---|
| 281 | function onExpLoad()
|
---|
| 282 | {
|
---|
| 283 | for (var pop in Populations)
|
---|
| 284 | pop.clear();
|
---|
| 285 |
|
---|
| 286 | Loader.addClass(sim_params.*);
|
---|
| 287 | Loader.setBreakLabel(Loader.BeforeUnknown, "onExpLoad_Unknown");
|
---|
| 288 | Loader.run();
|
---|
| 289 |
|
---|
[421] | 290 | Simulator.print("Loaded " + Populations[0].size + " Forams and " + Populations[1].size + " nutrient objects");
|
---|
[380] | 291 | }
|
---|
| 292 |
|
---|
| 293 | function onExpLoad_Unknown()
|
---|
| 294 | {
|
---|
| 295 | if (Loader.objectName == "org") // saved by the old expdef
|
---|
| 296 | {
|
---|
| 297 | var g = Genotype.newFromString("");
|
---|
| 298 | Loader.currentObject = g;
|
---|
| 299 | Interface.makeFrom(g).setAllDefault();
|
---|
| 300 | Loader.loadObject();
|
---|
| 301 | var cr = Populations[0].add(g);
|
---|
| 302 | if (cr != null)
|
---|
| 303 | {
|
---|
[401] | 304 | //cr.rotate(0,0,Math.rnd01*Math.twopi);
|
---|
[476] | 305 | if ((typeof(g.data->genes) == "Vector") && (g.data->genes.size >= 3))
|
---|
[401] | 306 | {
|
---|
| 307 | // [x,y,energy]
|
---|
[476] | 308 | cr.move(g.data->genes[0] - cr.center_x, g.data->genes[1] - cr.center_y, 0);
|
---|
| 309 | cr.energy = g.data->genes[2];
|
---|
[380] | 310 | }
|
---|
| 311 | else
|
---|
| 312 | {
|
---|
[401] | 313 | cr.move(Math.rnd01 * World.wrldsiz - cr.center_x, Math.rnd01 * World.wrldsiz - cr.center_y, 0);
|
---|
[380] | 314 | }
|
---|
| 315 | }
|
---|
| 316 | }
|
---|
| 317 | else if (Loader.objectName == "Creature")
|
---|
| 318 | {
|
---|
| 319 | Loader.currentObject = CreatureSnapshot.new();
|
---|
| 320 | Loader.loadObject();
|
---|
| 321 | Populations[0].add(Loader.currentObject);
|
---|
| 322 | }
|
---|
| 323 | }
|
---|
| 324 |
|
---|
| 325 | function onExpSave()
|
---|
| 326 | {
|
---|
| 327 | File.writeComment("saved by '%s.expdef'" % Simulator.expdef);
|
---|
| 328 |
|
---|
[401] | 329 | var tmpvec = [], i;
|
---|
[380] | 330 |
|
---|
[401] | 331 | for(var cr in Populations[1])
|
---|
[380] | 332 | tmpvec.add([cr.center_x, cr.center_y, cr.energy]);
|
---|
| 333 |
|
---|
[421] | 334 | ExpState.nutrient = tmpvec;
|
---|
[380] | 335 | File.writeObject(sim_params.*);
|
---|
[432] | 336 | ExpState.nutrient = null; //vectors are only created for saving and then discarded
|
---|
[380] | 337 |
|
---|
| 338 | for (var cr in Populations[0])
|
---|
| 339 | File.writeObject(cr);
|
---|
| 340 | }
|
---|
| 341 |
|
---|
| 342 | // -------------------------------- experiment end --------------------------------
|
---|
| 343 |
|
---|
[421] | 344 | // -------------------------------- foram begin -----------------------------------
|
---|
[380] | 345 |
|
---|
[479] | 346 | function setForamMeta(cr)
|
---|
[430] | 347 | {
|
---|
[479] | 348 | //percent of current energy
|
---|
[486] | 349 | cr.idleen = (ExpProperties.e_meta * cr.energy)*ExpProperties.secPerStep;
|
---|
[430] | 350 | }
|
---|
| 351 |
|
---|
| 352 | function lastChamberNum(cr)
|
---|
| 353 | {
|
---|
| 354 | return cr.numparts-1;
|
---|
| 355 | }
|
---|
| 356 |
|
---|
[479] | 357 | function getZoneRange(cr, zone_num)
|
---|
| 358 | {
|
---|
[486] | 359 | return ExpProperties.["zone"+zone_num+"_range"];
|
---|
[479] | 360 | }
|
---|
| 361 |
|
---|
[421] | 362 | function onForamsBorn(cr)
|
---|
| 363 | {
|
---|
[479] | 364 | setForamMeta(cr);
|
---|
[486] | 365 | if (ExpProperties.visualize == 1)
|
---|
[430] | 366 | {
|
---|
[502] | 367 | var ret = Populations[2].add("//0\np:sh=1,sx=0.001,sy=0.001,sz=0.001\np:sh=3,sx=0.01,sy="+getZoneRange(cr,1)+",sz="+getZoneRange(cr,1)+",ry=1.57079633,vr="+curColor+"\nj:0, 1, sh=1");
|
---|
[476] | 368 | cr.data->reticulopodiacreature = ret;
|
---|
[502] | 369 | ret.getMechPart(0).orient.set(o);
|
---|
[496] | 370 | ret.moveAbs(cr.center_x-getZoneRange(cr,1), cr.center_y-getZoneRange(cr,1), cr.center_z-getZoneRange(cr,1));
|
---|
[430] | 371 | }
|
---|
[380] | 372 | }
|
---|
| 373 |
|
---|
[401] | 374 | function placeRandomlyNotColliding(cr)
|
---|
| 375 | {
|
---|
| 376 | var retry = 100; //try 100 times
|
---|
| 377 | while (retry--)
|
---|
| 378 | {
|
---|
| 379 | placeCreatureRandomly(cr, 0, 0);
|
---|
| 380 | if (!cr.boundingBoxCollisions(0))
|
---|
| 381 | return cr;
|
---|
| 382 | }
|
---|
| 383 |
|
---|
| 384 | Populations[0].delete(cr);
|
---|
| 385 | }
|
---|
| 386 |
|
---|
[444] | 387 | function visualization(cr)
|
---|
| 388 | {
|
---|
| 389 | var has_ret = 0;
|
---|
| 390 |
|
---|
[476] | 391 | if (cr.data->reticulopodiacreature != null)
|
---|
[444] | 392 | {
|
---|
[476] | 393 | if (Populations[2].findUID(cr.data->reticulopodiacreature.uid) != null)
|
---|
[444] | 394 | {
|
---|
| 395 | has_ret = 1;
|
---|
| 396 | }
|
---|
| 397 | }
|
---|
| 398 |
|
---|
| 399 | return has_ret;
|
---|
| 400 | }
|
---|
| 401 |
|
---|
[422] | 402 | function foramGrow(cr, chamber_num)
|
---|
[380] | 403 | {
|
---|
[476] | 404 | if ((chamber_num+1) < chambers[cr.data->lifeparams->species].size)
|
---|
[474] | 405 | {
|
---|
[493] | 406 | curColor = retColors[cr.data->lifeparams->gen];
|
---|
[496] | 407 | var geno = createForamMorphology(cr.data->lifeparams->gen, cr.data->lifeparams->gen, chamber_num+1);
|
---|
[474] | 408 | var cr2 = Populations[0].add(geno);
|
---|
[422] | 409 |
|
---|
[474] | 410 | cr2.energy0 = cr.energy;
|
---|
| 411 | cr2.energy = cr2.energy0;
|
---|
[422] | 412 |
|
---|
[487] | 413 | setGenotype({"cr" : cr2, "parent_genes" : cr.data->genes, "parent_lifeparams" : cr.data->lifeparams, "opt" : 2, "energy0" : cr.energy0});
|
---|
[474] | 414 | cr2.moveAbs(cr.center_x - cr2.size_x / 2, cr.center_y - cr2.size_y / 2, cr.pos_z);
|
---|
[479] | 415 | setForamMeta(cr2);
|
---|
[422] | 416 |
|
---|
[474] | 417 | if (visualization(cr))
|
---|
| 418 | {
|
---|
[476] | 419 | Populations[2].delete(cr.data->reticulopodiacreature);
|
---|
[474] | 420 | }
|
---|
| 421 | Populations[0].delete(cr);
|
---|
[430] | 422 | }
|
---|
[380] | 423 | }
|
---|
| 424 |
|
---|
[435] | 425 | function stepToNearest(cr)
|
---|
[380] | 426 | {
|
---|
| 427 | var p = cr.getMechPart(0);
|
---|
[479] | 428 | var n = cr.signals.receiveSet("nutrient", getZoneRange(cr,2));
|
---|
[380] | 429 |
|
---|
[401] | 430 | //if signals are received find the source of the nearest
|
---|
[380] | 431 | if (n.size > 0)
|
---|
| 432 | {
|
---|
| 433 | var i;
|
---|
| 434 | var mp;
|
---|
| 435 | var distvec = XYZ.new(0, 0, 0);
|
---|
| 436 | var dist;
|
---|
[470] | 437 | var mindist = 100000000000.0;
|
---|
[380] | 438 | var mindistvec = null;
|
---|
[430] | 439 | var eating = 0;
|
---|
[380] | 440 |
|
---|
[401] | 441 | for (i = 0; i < n.size; i++)
|
---|
[380] | 442 | {
|
---|
[430] | 443 | mp = n[i].value.getMechPart(0);
|
---|
[401] | 444 | distvec.set(mp.pos);
|
---|
| 445 | distvec.sub(p.pos);
|
---|
| 446 | dist = distvec.length;
|
---|
[479] | 447 | if (dist < getZoneRange(cr,1))
|
---|
[380] | 448 | {
|
---|
[430] | 449 | if (n[i].value != null)
|
---|
| 450 | {
|
---|
| 451 | energyTransfer(cr, n[i].value);
|
---|
| 452 | eating = 1;
|
---|
| 453 | }
|
---|
| 454 | }
|
---|
[476] | 455 | else if (eating == 0 && cr.data->lifeparams->hibernated == 0 && dist < mindist)
|
---|
[430] | 456 | {
|
---|
[401] | 457 | mindist = dist;
|
---|
| 458 | mindistvec = distvec.clone();
|
---|
[380] | 459 | }
|
---|
| 460 | }
|
---|
| 461 |
|
---|
[476] | 462 | if (!eating && cr.data->lifeparams->hibernated == 0)
|
---|
[430] | 463 | {
|
---|
| 464 | mindistvec.normalize();
|
---|
[474] | 465 | mindistvec.scale(-1*movePerStep);
|
---|
[430] | 466 | cr.localDrive = mindistvec;
|
---|
| 467 | moveEnergyDec(cr);
|
---|
| 468 | }
|
---|
| 469 |
|
---|
[422] | 470 | return 1;
|
---|
[380] | 471 | }
|
---|
[422] | 472 |
|
---|
| 473 | else
|
---|
[474] | 474 | {
|
---|
[422] | 475 | return 0;
|
---|
[474] | 476 | }
|
---|
[422] | 477 | }
|
---|
[401] | 478 |
|
---|
[422] | 479 | function moveEnergyDec(cr)
|
---|
| 480 | {
|
---|
[476] | 481 | if (cr.data->lifeparams->hibernated == 0)
|
---|
[422] | 482 | {
|
---|
[479] | 483 | //percent of maximal energy
|
---|
[504] | 484 | cr.energy -= (ExpProperties.energy_move * cr.data->lifeparams->max_energy_level)*ExpProperties.secPerStep;
|
---|
[422] | 485 | }
|
---|
[421] | 486 | }
|
---|
[380] | 487 |
|
---|
[493] | 488 | function fence(pos, zone)
|
---|
[487] | 489 | {
|
---|
[496] | 490 | return Math.min(Math.max(0,pos),World.wrldsiz);
|
---|
[487] | 491 | }
|
---|
| 492 |
|
---|
[422] | 493 | function foramMove(cr)
|
---|
[421] | 494 | {
|
---|
[422] | 495 | //TODO moving inside sediment?
|
---|
[421] | 496 |
|
---|
[422] | 497 | //adjustment in z axis
|
---|
[493] | 498 | cr.moveAbs(fence(cr.pos_x, getZoneRange(cr, 1)), fence(cr.pos_y,getZoneRange(cr, 1)), 0);
|
---|
[421] | 499 |
|
---|
[430] | 500 | //are there any nutrients in zone 1 or 2?
|
---|
[401] | 501 | {
|
---|
[435] | 502 | var moved = stepToNearest(cr); //TODO weighted sum of distance and energy
|
---|
[422] | 503 | if (moved==1)
|
---|
[430] | 504 | {
|
---|
[502] | 505 | moveReticulopodia(cr);
|
---|
[422] | 506 | return;
|
---|
| 507 | }
|
---|
[401] | 508 | }
|
---|
| 509 |
|
---|
[422] | 510 | //no nutrients in zone 2
|
---|
[487] | 511 | if (getGene(cr, "hibernation",0) == 1)
|
---|
[401] | 512 | {
|
---|
[430] | 513 | reverseHib(cr);
|
---|
[422] | 514 | cr.localDrive = XYZ.new(0,0,0);
|
---|
[380] | 515 | }
|
---|
[422] | 516 | //random move
|
---|
[493] | 517 | else if (Simulator.stepNumber%int(dir_change_sec/ExpProperties.secPerStep) == 0)
|
---|
[380] | 518 | {
|
---|
[476] | 519 | cr.data->lifeparams->dir = randomDir();
|
---|
| 520 | cr.localDrive = cr.data->lifeparams->dir;
|
---|
[422] | 521 | moveEnergyDec(cr);
|
---|
| 522 | }
|
---|
[474] | 523 | else
|
---|
| 524 | {
|
---|
[476] | 525 | cr.localDrive = cr.data->lifeparams->dir;
|
---|
[474] | 526 | }
|
---|
[502] | 527 | moveReticulopodia(cr);
|
---|
[422] | 528 | }
|
---|
[401] | 529 |
|
---|
[502] | 530 | function moveReticulopodia(cr)
|
---|
| 531 | {
|
---|
| 532 | if (visualization(cr))
|
---|
| 533 | {
|
---|
| 534 | cr.data->reticulopodiacreature.moveAbs(cr.center_x-getZoneRange(cr,1), cr.center_y-getZoneRange(cr,1), cr.center_z-getZoneRange(cr,1));
|
---|
| 535 | cr.data->reticulopodiacreature.localDrive = cr.localDrive;
|
---|
| 536 | }
|
---|
| 537 | }
|
---|
| 538 |
|
---|
[474] | 539 | function randomDir()
|
---|
| 540 | {
|
---|
[486] | 541 | var dir = (Math.rndUni(-ExpProperties.zone2_range, ExpProperties.zone2_range), Math.rndUni(-ExpProperties.zone2_range, ExpProperties.zone2_range), 0);
|
---|
[474] | 542 | dir.normalize();
|
---|
| 543 | dir.scale(-1*movePerStep);
|
---|
| 544 | return dir;
|
---|
| 545 | }
|
---|
| 546 |
|
---|
[430] | 547 | function energyTransfer(cr1, cr2)
|
---|
[422] | 548 | {
|
---|
[430] | 549 | cr1.localDrive = XYZ.new(0,0,0);
|
---|
[502] | 550 | var e = ExpProperties.feedtrans*cr1.energy; //TODO efficiency dependent on age
|
---|
| 551 | e = Math.min(cr2.energy, e*ExpProperties.secPerStep);
|
---|
| 552 | //Simulator.print("transferring "+e +"("+e*ExpProperties.ingestion+")"+" to "+cr1.name +" ("+ cr1.energy+") " +" from "+cr2.uid+" ("+cr2.energy+") "+ e/ExpProperties.secPerStep+ " per sec");
|
---|
| 553 | cr2.energy -= (e + 0.0000001);
|
---|
[504] | 554 | cr1.energy += e*ExpProperties.ingestion;
|
---|
[476] | 555 | if (cr1.data->lifeparams->hibernated == 1)
|
---|
[422] | 556 | {
|
---|
[430] | 557 | reverseHib(cr1);
|
---|
[422] | 558 | }
|
---|
| 559 | }
|
---|
[401] | 560 |
|
---|
[430] | 561 | function reverseHib(cr)
|
---|
| 562 | {
|
---|
[476] | 563 | if (cr.data->lifeparams->hibernated == 1)
|
---|
[430] | 564 | {
|
---|
[479] | 565 | setForamMeta(cr); //unhibernate
|
---|
[430] | 566 | }
|
---|
| 567 | else
|
---|
| 568 | {
|
---|
[486] | 569 | cr.idleen = (ExpProperties.energy_hib * cr.energy)*ExpProperties.secPerStep; //hibernate
|
---|
[430] | 570 | }
|
---|
[476] | 571 | cr.data->lifeparams->hibernated = 1 - cr.data->lifeparams->hibernated;
|
---|
[430] | 572 | }
|
---|
| 573 |
|
---|
[493] | 574 | function createLogVector(cr, value)
|
---|
| 575 | {
|
---|
| 576 | var vec = Vector.new();
|
---|
| 577 | for (var i = 0; i < species_genes.size; i++)
|
---|
| 578 | {
|
---|
| 579 | for (var j = 0; j < 2; j++)
|
---|
| 580 | {
|
---|
| 581 | vec.add(0);
|
---|
| 582 | }
|
---|
| 583 | if (cr.data->lifeparams->species == i)
|
---|
| 584 | {
|
---|
| 585 | vec[i*2+cr.data->lifeparams->gen] = value;
|
---|
| 586 | }
|
---|
| 587 | }
|
---|
| 588 | return vec;
|
---|
| 589 | }
|
---|
[479] | 590 |
|
---|
[422] | 591 | function onForamsStep(cr)
|
---|
| 592 | {
|
---|
[479] | 593 | //checking for gametogenesis process
|
---|
| 594 | if (cr.data->lifeparams->division_time > 0)
|
---|
[444] | 595 | {
|
---|
[479] | 596 | cr.data->lifeparams->division_time = Math.max(cr.data->lifeparams->division_time-1,0);
|
---|
[444] | 597 | }
|
---|
[479] | 598 | //checking for end of gametogenesis
|
---|
| 599 | else if (cr.data->lifeparams->division_time == 0)
|
---|
[422] | 600 | {
|
---|
[479] | 601 | //waiting for gamets fusion
|
---|
[422] | 602 | }
|
---|
[479] | 603 | //checking for chamber growth process
|
---|
| 604 | else if (cr.data->lifeparams->chamber_growth > 0)
|
---|
| 605 | {
|
---|
| 606 | cr.data->lifeparams->chamber_growth = Math.max(cr.data->lifeparams->chamber_growth-1,0);
|
---|
[486] | 607 | //Simulator.print("chamber growing, time left = " + cr.data->lifeparams->chamber_growth*ExpProperties.secPerStep);
|
---|
[504] | 608 | cr.energy -= ExpProperties.chamberCostPerSec * cr.energy * ExpProperties.secPerStep;
|
---|
[422] | 609 |
|
---|
[479] | 610 | //Simulator.print("energy " + cr2.energy + " subtracting " + growth_cost);
|
---|
| 611 | }
|
---|
| 612 | //checking for end of chamber growth process
|
---|
| 613 | else if (cr.data->lifeparams->chamber_growth == 0)
|
---|
[430] | 614 | {
|
---|
[479] | 615 | foramGrow(cr, lastChamberNum(cr));
|
---|
| 616 | cr.data->lifeparams->chamber_growth = -1;
|
---|
| 617 | //Simulator.print("chamber "+ (lastChamberNum(cr) + 1) +" complete");
|
---|
[430] | 618 | }
|
---|
[479] | 619 | else
|
---|
[422] | 620 | {
|
---|
[479] | 621 | //update of metabolism rate
|
---|
| 622 | if (cr.data->lifeparams->hibernated == 0)
|
---|
[401] | 623 | {
|
---|
[479] | 624 | setForamMeta(cr);
|
---|
| 625 | }
|
---|
| 626 |
|
---|
| 627 | cr.getMechPart(0).orient.set(o);
|
---|
| 628 |
|
---|
| 629 | if (deathConditions(cr) == 1)
|
---|
| 630 | {
|
---|
[493] | 631 | if (ExpProperties.logging == 1)
|
---|
| 632 | {
|
---|
| 633 | log(createLogVector(cr, cr.data->lifeparams->max_energy_level),ExpProperties.logPref+"fossil_log.txt");
|
---|
| 634 | }
|
---|
[479] | 635 | Populations[0].kill(cr);
|
---|
| 636 | return;
|
---|
| 637 | }
|
---|
| 638 |
|
---|
| 639 | foramMove(cr);
|
---|
| 640 |
|
---|
| 641 | var repro = foramReproduce(cr);
|
---|
| 642 | if (repro == 1)
|
---|
| 643 | {
|
---|
| 644 | return;
|
---|
| 645 | }
|
---|
| 646 |
|
---|
| 647 | cr.data->lifeparams->max_energy_level = Math.max(cr.energy, cr.data->lifeparams->max_energy_level);
|
---|
| 648 |
|
---|
| 649 | //cheking conditions of chamber growth process start
|
---|
| 650 | if (lastChamberNum(cr) != chambers[0].size-1)
|
---|
| 651 | {
|
---|
| 652 | if ((cr.data->lifeparams->max_energy_level >= energyFromVolume(max_chamber_volume[cr.data->lifeparams->gen][lastChamberNum(cr)],0)))
|
---|
| 653 | {
|
---|
[486] | 654 | cr.data->lifeparams->chamber_growth = int(ExpProperties.chamber_growth_time/ExpProperties.secPerStep);
|
---|
[479] | 655 | }
|
---|
| 656 | }
|
---|
[430] | 657 | }
|
---|
[380] | 658 | }
|
---|
| 659 |
|
---|
[422] | 660 | function deathConditions(cr)
|
---|
| 661 | {
|
---|
[486] | 662 | if ((cr.energy <= getProperty(cr.data->lifeparams->gen,"e_death_level")*cr.data->lifeparams->max_energy_level) || (Math.rnd01 < ExpProperties.hunted_prob))
|
---|
[479] | 663 | {
|
---|
[422] | 664 | return 1;
|
---|
[479] | 665 | }
|
---|
[422] | 666 | else
|
---|
| 667 | return 0;
|
---|
| 668 | }
|
---|
| 669 |
|
---|
[421] | 670 | function onForamsDied(cr)
|
---|
[380] | 671 | {
|
---|
[444] | 672 | if (visualization(cr))
|
---|
[430] | 673 | {
|
---|
[476] | 674 | Populations[2].delete(cr.data->reticulopodiacreature);
|
---|
[430] | 675 | }
|
---|
[380] | 676 | //fossilization
|
---|
| 677 | var geno = GenePools[0].add(cr.genotype);
|
---|
[476] | 678 | geno.data->genes = cr.data->genes;
|
---|
| 679 | geno.data->lifeparams = cr.data->lifeparams;
|
---|
[486] | 680 | if (ExpProperties.logging == 1) Simulator.print("\"" + cr.name + "\" died...");
|
---|
[380] | 681 | ExpState.totaltestedcr++;
|
---|
| 682 | }
|
---|
| 683 |
|
---|
[421] | 684 | // --------------------------------foram end -------------------------------------
|
---|
[380] | 685 |
|
---|
[421] | 686 | // -------------------------------- nutrient begin --------------------------------
|
---|
[380] | 687 |
|
---|
[479] | 688 | function createNutrientGenotype(nutrientradius)
|
---|
[422] | 689 | {
|
---|
[502] | 690 | return "//0\np:sh=3,sx="+nutrientradius+",sy="+nutrientradius+",sz="+nutrientradius+",ry=1.57,vr=0.0,1.0,0.0";
|
---|
[422] | 691 | }
|
---|
| 692 |
|
---|
[421] | 693 | function onNutrientsStep(cr)
|
---|
[380] | 694 | {
|
---|
[444] | 695 | cr.moveAbs(cr.pos_x % World.wrldsiz, cr.pos_y % World.wrldsiz, 0.5);
|
---|
[380] | 696 | }
|
---|
| 697 |
|
---|
[421] | 698 | function addNutrient()
|
---|
[380] | 699 | {
|
---|
[486] | 700 | var cr = Populations[1].add(createNutrientGenotype(ExpProperties.nutrientradius));
|
---|
[380] | 701 |
|
---|
[421] | 702 | cr.name = "Nutrients";
|
---|
[380] | 703 | cr.idleen = 0;
|
---|
[486] | 704 | cr.energy0 = ExpProperties.energy_nut;
|
---|
[416] | 705 | cr.energy = cr.energy0;
|
---|
[421] | 706 | cr.signals.add("nutrient");
|
---|
[380] | 707 |
|
---|
[430] | 708 | cr.signals[0].value = cr;
|
---|
[380] | 709 |
|
---|
[422] | 710 | placeCreatureRandomly(cr, 0, 0);
|
---|
[486] | 711 | if (ExpProperties.visualize == 1)
|
---|
[444] | 712 | {
|
---|
[486] | 713 | var nutsize = ExpProperties.nutrientradius*10;
|
---|
[444] | 714 | var nut = Populations[2].add("//0\np:sh=2,sx="+nutsize+",sy="+nutsize+",sz="+nutsize+",ry=1.5,vr=0.0,1.0,0.0");
|
---|
[476] | 715 | cr.data->reticulopodiacreature = nut;
|
---|
[444] | 716 | nut.moveAbs(cr.pos_x-1.5*nutsize, cr.pos_y-1.5*nutsize, 0.5);
|
---|
| 717 | }
|
---|
[380] | 718 | }
|
---|
| 719 |
|
---|
[444] | 720 | function onNutrientsDied(cr)
|
---|
| 721 | {
|
---|
| 722 | if (visualization(cr))
|
---|
| 723 | {
|
---|
[476] | 724 | Populations[2].delete(cr.data->reticulopodiacreature);
|
---|
[444] | 725 | }
|
---|
| 726 | }
|
---|
| 727 |
|
---|
[422] | 728 | function nutrientGrowth()
|
---|
[380] | 729 | {
|
---|
[486] | 730 | if (ExpProperties.foodPeriodChange > 0)
|
---|
[481] | 731 | {
|
---|
| 732 | changePeriod += 1;
|
---|
[486] | 733 | if (phase=="low" && (changePeriod*ExpProperties.secPerStep) >= 23328000) //9 months
|
---|
[481] | 734 | {
|
---|
[486] | 735 | ExpProperties.foodperiod = ExpProperties.foodperiod/ExpProperties.foodPeriodChange;
|
---|
[481] | 736 | phase = "high";
|
---|
| 737 | changePeriod = 0;
|
---|
| 738 | }
|
---|
| 739 |
|
---|
[486] | 740 | else if (phase == "high" && (changePeriod*ExpProperties.secPerStep) >= 7776000) //3 months
|
---|
[481] | 741 | {
|
---|
[486] | 742 | ExpProperties.foodperiod = ExpProperties.foodperiod*ExpProperties.foodPeriodChange;
|
---|
[481] | 743 | phase = "low";
|
---|
| 744 | changePeriod = 0;
|
---|
| 745 | }
|
---|
| 746 | }
|
---|
[474] | 747 | nutrientenergywaiting = nutrientenergywaiting + 1;
|
---|
[486] | 748 | if (nutrientenergywaiting*ExpProperties.secPerStep >= ExpProperties.foodperiod)
|
---|
[380] | 749 | {
|
---|
[493] | 750 | for (var i = 0; i < ExpProperties.nutrient_pop; i++)
|
---|
[432] | 751 | {
|
---|
[422] | 752 | addNutrient();
|
---|
| 753 | }
|
---|
| 754 |
|
---|
| 755 | nutrientenergywaiting = 0.0;
|
---|
| 756 | Simulator.checkpoint();
|
---|
[493] | 757 |
|
---|
| 758 | if (ExpProperties.logging == 1)
|
---|
| 759 | {
|
---|
| 760 | log([ExpProperties.nutrient_pop],ExpProperties.logPref+"nutrients_log.txt");
|
---|
| 761 | }
|
---|
[380] | 762 | }
|
---|
[493] | 763 |
|
---|
[380] | 764 | }
|
---|
| 765 |
|
---|
[421] | 766 | // -------------------------------- nutrient end --------------------------------
|
---|
[380] | 767 |
|
---|
[422] | 768 | // -------------------------------- step begin --------------------------------
|
---|
[380] | 769 |
|
---|
[422] | 770 | function onStep()
|
---|
| 771 | {
|
---|
[432] | 772 |
|
---|
| 773 | nutrientGrowth();
|
---|
[486] | 774 | if (ExpProperties.logging == 1)
|
---|
[422] | 775 | {
|
---|
| 776 | createStatistics();
|
---|
| 777 | }
|
---|
| 778 |
|
---|
| 779 | //reproduction --------------------------------------------
|
---|
| 780 | reprocounter += 1;
|
---|
[486] | 781 | if (reprocounter*ExpProperties.secPerStep > ExpProperties.repro_time)
|
---|
[422] | 782 | {
|
---|
| 783 | reprocounter = 0;
|
---|
| 784 | reproduce_parents(0);
|
---|
| 785 | reproduce_parents(1);
|
---|
| 786 | }
|
---|
| 787 |
|
---|
| 788 | //check for extinction -----------------------------------------------
|
---|
| 789 | if (Populations[0].size == 0)
|
---|
| 790 | {
|
---|
[486] | 791 | if (ExpProperties.autorestart)
|
---|
[422] | 792 | {
|
---|
| 793 | Simulator.print("no more creatures, restarting...");
|
---|
| 794 | onExpInit();
|
---|
| 795 | }
|
---|
| 796 | else
|
---|
| 797 | {
|
---|
| 798 | Simulator.print("no more creatures, stopped.");
|
---|
| 799 | Simulator.stop();
|
---|
| 800 | }
|
---|
| 801 | }
|
---|
[486] | 802 | if (ExpProperties.maxSteps > 0)
|
---|
[432] | 803 | {
|
---|
[486] | 804 | if (Simulator.stepNumber >= ExpProperties.maxSteps)
|
---|
[432] | 805 | Simulator.stop();
|
---|
| 806 | }
|
---|
[422] | 807 | }
|
---|
| 808 |
|
---|
| 809 | function createStatistics()
|
---|
| 810 | {
|
---|
[487] | 811 | var number = [];
|
---|
| 812 | var e_inc = [];
|
---|
[422] | 813 | var e_nut = 0.0;
|
---|
| 814 |
|
---|
[487] | 815 | for (var s = 0; s < species_genes.size; s++)
|
---|
| 816 | {
|
---|
| 817 | number.add([0,0]);// [haplo][diplo]
|
---|
| 818 | e_inc.add([0,0]);
|
---|
| 819 | }
|
---|
| 820 |
|
---|
[422] | 821 | for (var i = 0; i < Populations[0].size; i++)
|
---|
| 822 | {
|
---|
| 823 | var cr = Populations[0].get(i);
|
---|
[476] | 824 | var gen = cr.data->lifeparams->gen;
|
---|
| 825 | var species = cr.data->lifeparams->species;
|
---|
[430] | 826 |
|
---|
| 827 | number[species][gen] = number[species][gen] + 1;
|
---|
| 828 | e_inc[species][gen] = e_inc[species][gen] + cr.energy;
|
---|
[422] | 829 | }
|
---|
| 830 |
|
---|
| 831 | for (var i = 0; i < Populations[1].size; i++)
|
---|
| 832 | {
|
---|
| 833 | var cr = Populations[1].get(i);
|
---|
| 834 | e_nut += cr.energy;
|
---|
| 835 | }
|
---|
| 836 |
|
---|
[487] | 837 | var log_numbers = [];
|
---|
| 838 | var log_energies = [];
|
---|
[422] | 839 |
|
---|
[487] | 840 | for (var s = 0; s < species_genes.size; s++)
|
---|
| 841 | {
|
---|
| 842 | for (var p = 0; p < 2; p++)
|
---|
| 843 | {
|
---|
| 844 | log_numbers.add(number[s][p]);
|
---|
| 845 | log_energies.add(e_inc[s][p]);
|
---|
| 846 | }
|
---|
| 847 | }
|
---|
| 848 |
|
---|
| 849 | log_numbers.add(Populations[1].size);
|
---|
| 850 | log_energies.add(e_nut);
|
---|
| 851 |
|
---|
[493] | 852 | log(log_numbers, ExpProperties.logPref+"forams_log.txt");
|
---|
| 853 | log(log_energies, ExpProperties.logPref+"energies_log.txt");
|
---|
[422] | 854 | }
|
---|
| 855 |
|
---|
[380] | 856 | function log(tolog, fname)
|
---|
| 857 | {
|
---|
[430] | 858 | var f = File.appendDirect(fname, "forams data");
|
---|
[380] | 859 | f.writeString("" + Simulator.stepNumber);
|
---|
[401] | 860 | for (var i = 0; i < tolog.size; i++)
|
---|
[380] | 861 | {
|
---|
| 862 | f.writeString(";" + tolog[i]);
|
---|
| 863 | }
|
---|
| 864 | f.writeString("\n");
|
---|
| 865 | f.close();
|
---|
| 866 | }
|
---|
| 867 |
|
---|
[422] | 868 | // -------------------------------- step end --------------------------------
|
---|
[479] | 869 | //TODO default params values in frams instead of microns/seconds
|
---|
[380] | 870 |
|
---|
[401] | 871 | @include "standard_events.inc"
|
---|
[380] | 872 |
|
---|
[401] | 873 | ~
|
---|
[380] | 874 |
|
---|
[486] | 875 | property:
|
---|
[444] | 876 | id:visualize
|
---|
| 877 | name:Show reticulopodia and nutrients
|
---|
[430] | 878 | type:d 0 1 0
|
---|
| 879 | group:Foraminifera
|
---|
| 880 |
|
---|
[486] | 881 | property:
|
---|
[434] | 882 | id:maxSteps
|
---|
[432] | 883 | name:Stop after the given number of simulation steps
|
---|
[434] | 884 | type:d 0 1000000 0
|
---|
[432] | 885 |
|
---|
[486] | 886 | property:
|
---|
[493] | 887 | id:logPref
|
---|
| 888 | name:Log prefix
|
---|
| 889 | type:s
|
---|
| 890 |
|
---|
| 891 | property:
|
---|
[474] | 892 | id:foramSpeedMmPerMin
|
---|
| 893 | name:Speed of foraminfera in mm/min
|
---|
| 894 | type:f 0.1
|
---|
| 895 | flags: 16
|
---|
| 896 | group:Foraminifera
|
---|
| 897 |
|
---|
[486] | 898 | property:
|
---|
[479] | 899 | id:gametSuccessRate
|
---|
| 900 | name:Ratio of successful gamets
|
---|
| 901 | type:f 0.001
|
---|
| 902 | group:Foraminifera
|
---|
| 903 |
|
---|
[486] | 904 | property:
|
---|
[479] | 905 | id:gametoPeriod
|
---|
| 906 | name:Time of gametogenesis
|
---|
| 907 | type:f 720
|
---|
| 908 | group:Foraminifera
|
---|
| 909 |
|
---|
[486] | 910 | property:
|
---|
[479] | 911 | id:picoCarbonPerMikro
|
---|
| 912 | name:Picograms of carbon in cubed micrometer
|
---|
| 913 | type:f 0.13
|
---|
| 914 | group:Foraminifera
|
---|
| 915 |
|
---|
[486] | 916 | property:
|
---|
[474] | 917 | id:secPerStep
|
---|
| 918 | name:Seconds per simulation step
|
---|
| 919 | type:f 60.0
|
---|
| 920 | flags: 16
|
---|
| 921 | group:Foraminifera
|
---|
| 922 |
|
---|
[486] | 923 | property:
|
---|
[422] | 924 | id:e_repro_cost_haplo
|
---|
[423] | 925 | name:Cost of reproduction
|
---|
[422] | 926 | type:f 0.1 0.9 0.5
|
---|
[421] | 927 | group:Foraminifera
|
---|
[380] | 928 |
|
---|
[486] | 929 | property:
|
---|
[479] | 930 | id:divisionCost
|
---|
| 931 | name:Cost of division in pG
|
---|
| 932 | type:f
|
---|
| 933 | group:Foraminifera
|
---|
| 934 |
|
---|
[486] | 935 | property:
|
---|
[422] | 936 | id:e_repro_cost_diplo
|
---|
[423] | 937 | name:Cost of reproduction
|
---|
[422] | 938 | type:f 0.1 0.9 0.3
|
---|
| 939 | group:Foraminifera
|
---|
[380] | 940 |
|
---|
[486] | 941 | property:
|
---|
[479] | 942 | id:chamber_growth_time
|
---|
| 943 | name:Time of the chamber growth in seconds
|
---|
| 944 | type:f
|
---|
| 945 | group:Foraminifera
|
---|
| 946 |
|
---|
[486] | 947 | property:
|
---|
[479] | 948 | id:chamberCostPerSec
|
---|
| 949 | name:Cost of growning chamber per second
|
---|
| 950 | type:f
|
---|
| 951 | group:Foraminifera
|
---|
| 952 |
|
---|
[486] | 953 | property:
|
---|
[422] | 954 | id:chamber_proculus_haplo
|
---|
[423] | 955 | name:Size of proculus
|
---|
[422] | 956 | type:f
|
---|
[421] | 957 | group:Foraminifera
|
---|
[380] | 958 |
|
---|
[486] | 959 | property:
|
---|
[422] | 960 | id:chamber_proculus_diplo
|
---|
[423] | 961 | name:Size of proculus
|
---|
[422] | 962 | type:f
|
---|
[380] | 963 | group:Foraminifera
|
---|
| 964 |
|
---|
[486] | 965 | property:
|
---|
[422] | 966 | id:chamber_difference_haplo
|
---|
[423] | 967 | name:Difference in size between subsequent chambers
|
---|
[422] | 968 | type:f
|
---|
[380] | 969 | group:Foraminifera
|
---|
| 970 |
|
---|
[486] | 971 | property:
|
---|
[422] | 972 | id:chamber_difference_diplo
|
---|
[423] | 973 | name:Difference in size between subsequent chambers
|
---|
[422] | 974 | type:f
|
---|
[380] | 975 | group:Foraminifera
|
---|
| 976 |
|
---|
[486] | 977 | property:
|
---|
[422] | 978 | id:hunted_prob
|
---|
| 979 | name:Probability of being hunted
|
---|
| 980 | type:f 0 1 0
|
---|
| 981 | group:Forminifera
|
---|
[380] | 982 |
|
---|
[486] | 983 | property:
|
---|
[422] | 984 | id:zone1_range
|
---|
| 985 | name:Zone 1 range
|
---|
| 986 | type:f 0 200
|
---|
| 987 | group:Foraminifera
|
---|
[380] | 988 |
|
---|
[486] | 989 | property:
|
---|
[422] | 990 | id:zone2_range
|
---|
| 991 | name:Zone 2 range
|
---|
| 992 | type:f 0 3000
|
---|
[421] | 993 | group:Foraminifera
|
---|
[380] | 994 |
|
---|
[486] | 995 | property:
|
---|
[422] | 996 | id:colors
|
---|
| 997 | name:Haploid and diploid colors
|
---|
| 998 | type:x
|
---|
[380] | 999 | group:Foraminifera
|
---|
| 1000 |
|
---|
[486] | 1001 | property:
|
---|
[422] | 1002 | id:min_repro_energ_haplo
|
---|
| 1003 | name:Min reproduction energy of forams
|
---|
| 1004 | type:f
|
---|
[380] | 1005 | group:Foraminifera
|
---|
| 1006 |
|
---|
[486] | 1007 | property:
|
---|
[422] | 1008 | id:min_repro_energ_diplo
|
---|
| 1009 | name:Min reproduction energy of forams
|
---|
| 1010 | type:f
|
---|
| 1011 | group:Foraminifera
|
---|
| 1012 |
|
---|
[486] | 1013 | property:
|
---|
[380] | 1014 | id:repro_prob
|
---|
[401] | 1015 | name:Probability of reproduction
|
---|
[422] | 1016 | type:f 0 1 0.8
|
---|
[421] | 1017 | group:Foraminifera
|
---|
[380] | 1018 |
|
---|
[486] | 1019 | property:
|
---|
[422] | 1020 | id:energies0_haplo
|
---|
| 1021 | name:Energy of offspring from diploid forams
|
---|
| 1022 | type:f
|
---|
| 1023 | group:Foraminifera
|
---|
| 1024 |
|
---|
[486] | 1025 | property:
|
---|
[422] | 1026 | id:energies0_diplo
|
---|
| 1027 | name:Energy of offspring from diploid forams
|
---|
| 1028 | type:f
|
---|
| 1029 | group:Foraminifera
|
---|
| 1030 |
|
---|
[486] | 1031 | property:
|
---|
[475] | 1032 | id:e_death_level_haplo
|
---|
| 1033 | name:Minimal level of energy to sustain life of haploid
|
---|
[479] | 1034 | type:f 0 20 0.2
|
---|
[475] | 1035 | group:Foraminifera
|
---|
| 1036 |
|
---|
[486] | 1037 | property:
|
---|
[475] | 1038 | id:e_death_level_diplo
|
---|
| 1039 | name:Minimal level of energy to sustain life of diploid
|
---|
[479] | 1040 | type:f 0 20 0.2
|
---|
[475] | 1041 | group:Foraminifera
|
---|
| 1042 |
|
---|
[486] | 1043 | property:
|
---|
[422] | 1044 | id:energy_hib
|
---|
| 1045 | name:Energy used for hibernation during one step
|
---|
| 1046 | type:f 0 1 0.001
|
---|
| 1047 | group:Foraminifera
|
---|
| 1048 |
|
---|
[486] | 1049 | property:
|
---|
[422] | 1050 | id:energy_move
|
---|
| 1051 | name:Energy used for movement during one step
|
---|
| 1052 | type:f 0 20 0.001
|
---|
| 1053 | group:Foraminifera
|
---|
| 1054 |
|
---|
[486] | 1055 | property:
|
---|
[422] | 1056 | id:min_vol
|
---|
| 1057 | name:Minimal volume for reproduction
|
---|
| 1058 | type:f 100 900 100
|
---|
| 1059 | group:Foraminifera
|
---|
| 1060 |
|
---|
[486] | 1061 | property:
|
---|
[422] | 1062 | id:max_size
|
---|
| 1063 | name:Maximal size
|
---|
| 1064 | type:d 1 10 5
|
---|
| 1065 | group:Foraminifera
|
---|
| 1066 |
|
---|
[486] | 1067 | property:
|
---|
[422] | 1068 | id:foramPop
|
---|
| 1069 | name:Initial forams population size
|
---|
| 1070 | type:d 1 1000 100
|
---|
| 1071 | group:Foraminifera
|
---|
| 1072 |
|
---|
[486] | 1073 | property:
|
---|
[380] | 1074 | id:crossprob
|
---|
[401] | 1075 | name:Crossover probability
|
---|
| 1076 | type:f 0 1 0
|
---|
[421] | 1077 | group:Foraminifera
|
---|
[380] | 1078 |
|
---|
[486] | 1079 | property:
|
---|
[401] | 1080 | id:mutationprob
|
---|
| 1081 | name:Mutation probability
|
---|
| 1082 | type:f 0 1 0
|
---|
[421] | 1083 | group:Foraminifera
|
---|
[401] | 1084 |
|
---|
[486] | 1085 | property:
|
---|
[380] | 1086 | id:e_meta
|
---|
| 1087 | name:Idle metabolism
|
---|
| 1088 | type:f 0 1
|
---|
| 1089 | group:Energy
|
---|
| 1090 | help:Each stick consumes this amount of energy in one time step
|
---|
| 1091 |
|
---|
[486] | 1092 | property:
|
---|
[493] | 1093 | id:nutrient_pop
|
---|
[380] | 1094 | name:Feeding rate
|
---|
[474] | 1095 | type:f 0 1000000
|
---|
[380] | 1096 | group:Energy
|
---|
| 1097 | help:How fast energy is created in the world
|
---|
| 1098 |
|
---|
[486] | 1099 | property:
|
---|
[481] | 1100 | id:foodPeriodChange
|
---|
| 1101 | name:Set variable feed rate
|
---|
| 1102 | type:f 0
|
---|
| 1103 | group:Energy
|
---|
| 1104 |
|
---|
[486] | 1105 | property:
|
---|
[479] | 1106 | id:ingestion
|
---|
| 1107 | name:Ingestion rate
|
---|
| 1108 | type:f
|
---|
| 1109 | group:Energy
|
---|
| 1110 |
|
---|
[486] | 1111 | property:
|
---|
[422] | 1112 | id:energy_nut
|
---|
[428] | 1113 | name:Nutrient energy
|
---|
[493] | 1114 | type:f 0 10000000
|
---|
[380] | 1115 | group:Energy
|
---|
| 1116 |
|
---|
[486] | 1117 | property:
|
---|
[380] | 1118 | id:feedtrans
|
---|
[479] | 1119 | name:Energy transfer per second
|
---|
| 1120 | type:f 0 100000
|
---|
[380] | 1121 | group:Energy
|
---|
[422] | 1122 |
|
---|
[486] | 1123 | property:
|
---|
[479] | 1124 | id:foodperiod
|
---|
| 1125 | name:Time between food occurrences
|
---|
[481] | 1126 | type:f 0 1000000
|
---|
[422] | 1127 | group:Energy
|
---|
| 1128 |
|
---|
[486] | 1129 | property:
|
---|
[479] | 1130 | id:nutrientradius
|
---|
| 1131 | name:Nutrient size
|
---|
[493] | 1132 | type:f 0.001 0.9 0.1
|
---|
[421] | 1133 | group:Energy
|
---|
| 1134 |
|
---|
[486] | 1135 | property:
|
---|
[422] | 1136 | id:stress
|
---|
| 1137 | name:Environmental stress
|
---|
| 1138 | type:d 0 1 1
|
---|
| 1139 | group:World
|
---|
| 1140 |
|
---|
[486] | 1141 | property:
|
---|
[422] | 1142 | id:repro_trigger
|
---|
| 1143 | name:Reproduction trigger
|
---|
| 1144 | type:d 0 1 1
|
---|
| 1145 | group:World
|
---|
| 1146 |
|
---|
[486] | 1147 | property:
|
---|
[422] | 1148 | id:repro_time
|
---|
| 1149 | name:Time before reproduction
|
---|
[474] | 1150 | type:d 0 10000
|
---|
[422] | 1151 |
|
---|
[486] | 1152 | property:
|
---|
[422] | 1153 | id:creath
|
---|
| 1154 | name:Creation height
|
---|
| 1155 | type:f -1 50
|
---|
| 1156 | help:~
|
---|
| 1157 | Vertical position (above the surface) where new Forams are revived.
|
---|
| 1158 | Negative values are only used in the water area:
|
---|
| 1159 | 0 = at the surface
|
---|
| 1160 | -0.5 = half depth
|
---|
| 1161 | -1 = just above the bottom~
|
---|
| 1162 |
|
---|
[421] | 1163 | state:
|
---|
| 1164 | id:nutrient
|
---|
[428] | 1165 | name:Nutrient locations
|
---|
[421] | 1166 | help:vector of vectors [x,y,energy]
|
---|
| 1167 | type:x
|
---|
| 1168 | flags:32
|
---|
| 1169 |
|
---|
[486] | 1170 | property:
|
---|
[380] | 1171 | id:autorestart
|
---|
| 1172 | name:Restart after extinction
|
---|
| 1173 | help:Restart automatically this experiment after the last creature has died?
|
---|
| 1174 | type:d 0 1
|
---|
| 1175 |
|
---|
| 1176 | state:
|
---|
| 1177 | id:notes
|
---|
| 1178 | name:Notes
|
---|
| 1179 | type:s 1
|
---|
| 1180 | help:~
|
---|
| 1181 | You can write anything here
|
---|
| 1182 | (it will be saved to the experiment file)~
|
---|
| 1183 |
|
---|
| 1184 | state:
|
---|
| 1185 | id:totaltestedcr
|
---|
[421] | 1186 | name:Evaluated Forams
|
---|
| 1187 | help:Total number of the Forams evaluated in the experiment
|
---|
[380] | 1188 | type:d
|
---|
| 1189 | flags:16
|
---|
| 1190 |
|
---|
[486] | 1191 | property:
|
---|
[421] | 1192 | id:logging
|
---|
| 1193 | name:Log statistics to file
|
---|
| 1194 | type:d 0 1 0
|
---|