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

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