source: experiments/frams/foraminifera/data/scripts/foraminifera.expdef @ 479

Last change on this file since 479 was 479, checked in by oriona, 8 years ago

Parameters calibrated, diversification of initial population added, chamber growth and gametogenesis extended in time.

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