Changeset 493 for experiments/frams
- Timestamp:
- 04/10/16 17:48:18 (9 years ago)
- Location:
- experiments/frams/foraminifera/data/scripts
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
experiments/frams/foraminifera/data/scripts/foraminifera.expdef
r488 r493 25 25 global chambers; 26 26 global colors; 27 global dir_change; 27 global retColors; 28 global curColor; 29 global dir_change_sec; 28 30 global max_chamber_volume; 29 31 global movePerStep; … … 33 35 global changePeriod; 34 36 global phase; 37 global nutrientSqrCm; 35 38 global species_genes; 36 39 … … 80 83 //world 81 84 SignalView.mode = 1; 82 World.wrldwat = 200;83 World.wrldsiz = micronsToFrams( 40000);85 World.wrldwat = 500; 86 World.wrldsiz = micronsToFrams(100000); 84 87 World.wrldbnd = 1; 85 88 ExpProperties.stress = 1; … … 95 98 96 99 //ExpProperties.logging = 1; //uncomment to enable logging simulation parameters to log files 100 ExpProperties.logPref = ""; 97 101 98 102 //reproduction … … 101 105 ExpProperties.mutationprob = 0; 102 106 ExpProperties.repro_time = 720; 103 ExpProperties.gametoPeriod = 43200;107 ExpProperties.gametoPeriod = 21600; 104 108 ExpProperties.divisionCost = 15.6; 105 109 reprocounter = 0; … … 109 113 init_chambers(); 110 114 115 curColor = retColors[0]; 111 116 //morphology 112 dir_change = 30000;117 dir_change_sec = 30000; 113 118 ExpProperties.zone1_range = micronsToFrams(1000); 114 119 ExpProperties.zone2_range = micronsToFrams(3000); … … 137 142 ExpProperties.energy_move = 0.0000005; 138 143 139 ExpProperties.energies0_haplo = energyFromVolume(micronsToFrams(20),1);140 ExpProperties.energies0_diplo = energyFromVolume(micronsToFrams(1.25),1);144 ExpProperties.energies0_haplo = 20; 145 ExpProperties.energies0_diplo = 1.25; 141 146 ExpProperties.feedtrans = 0.001; 142 147 ExpProperties.e_repro_cost_haplo = 0.3; … … 149 154 changePeriod = 0; 150 155 phase = "low"; 151 ExpProperties.foodperiod = 3600; 152 ExpProperties.foodPeriodChange = 0; 156 nutrientSqrCm = 10; 157 ExpProperties.foodperiod = 25920; 158 ExpProperties.foodPeriodChange = 6; 153 159 ExpProperties.nutrientradius = micronsToFrams(10); 154 160 ExpProperties.energy_nut = energyFromVolume(ExpProperties.nutrientradius,1); 155 ExpProperties. feedrate = 1;161 ExpProperties.nutrient_pop = Math.pow(framsToMicrons(World.wrldsiz)*0.0001,2)/nutrientSqrCm; 156 162 ExpProperties.ingestion = 0.25; 157 163 nutrientenergywaiting = 0; … … 159 165 ExpState.nutrient = ""; 160 166 161 addSpecies({"min_repro_energies" : [4,6]});162 addSpecies({"min_repro_energies" : [4,8]});167 //addSpecies({"min_repro_energies" : [4,6]}); 168 //addSpecies({"min_repro_energies" : [4,8]}); 163 169 } 164 170 … … 189 195 function micronsToFrams(micrometers) 190 196 { 191 return micrometers*0.0 25;197 return micrometers*0.01; 192 198 } 193 199 194 200 function framsToMicrons(framsworldunits) 195 201 { 196 return framsworldunits/0.0 25;202 return framsworldunits/0.01; 197 203 } 198 204 … … 215 221 { 216 222 var geno = createForamMorphology(species_genes[species]->morphotype, ploid, chambernum); 223 curColor = retColors[ploid]; 217 224 var cr = Populations[0].add(geno); 218 225 cr.name = "Initial creature" + species + "_" + iter; … … 235 242 ploid = 1; 236 243 } 237 //add new foram with random energy bewtween starting energy and reproduction t reshold244 //add new foram with random energy bewtween starting energy and reproduction threshold 238 245 addForam(species, iter, int(Math.rndUni(0,species_genes[species]->min_repro_energies[ploid])),ploid); 239 246 } … … 242 249 function addSpecies(new_genes) 243 250 { 244 species_genes.add({"min_repro_energies" : [ 4,6], "energies0" : [20, 1.25], "hibernation" : 0, "morphotype" : 0});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}); 245 252 for (var i = 0; i < new_genes.size; i++) 246 253 { … … 358 365 if (ExpProperties.visualize == 1) 359 366 { 360 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");367 var ret = Populations[2].add("//0\np:sh=3,sx=0.01,sy="+getZoneRange(cr,1)+",sz="+getZoneRange(cr,1)+",ry=1.57,vr="+curColor); 361 368 cr.data->reticulopodiacreature = ret; 362 369 } … … 395 402 if ((chamber_num+1) < chambers[cr.data->lifeparams->species].size) 396 403 { 404 curColor = retColors[cr.data->lifeparams->gen]; 397 405 var geno = createForamMorphology(getGene(cr, "morphotype", 0), cr.data->lifeparams->gen, chamber_num+1); 398 406 var cr2 = Populations[0].add(geno); … … 476 484 } 477 485 478 function fence(pos )479 { 480 return Math.min(Math.max(0 ,pos),World.wrldsiz);486 function fence(pos, zone) 487 { 488 return Math.min(Math.max(0+zone,pos),World.wrldsiz-zone); 481 489 } 482 490 … … 486 494 487 495 //adjustment in z axis 488 cr.moveAbs(fence(cr.pos_x ), fence(cr.pos_y), 0);496 cr.moveAbs(fence(cr.pos_x, getZoneRange(cr, 1)), fence(cr.pos_y,getZoneRange(cr, 1)), 0); 489 497 490 498 //are there any nutrients in zone 1 or 2? … … 504 512 } 505 513 //random move 506 else if (Simulator.stepNumber%int(dir_change /ExpProperties.secPerStep) == 0)514 else if (Simulator.stepNumber%int(dir_change_sec/ExpProperties.secPerStep) == 0) 507 515 { 508 516 cr.data->lifeparams->dir = randomDir(); … … 552 560 } 553 561 562 function createLogVector(cr, value) 563 { 564 var vec = Vector.new(); 565 for (var i = 0; i < species_genes.size; i++) 566 { 567 for (var j = 0; j < 2; j++) 568 { 569 vec.add(0); 570 } 571 if (cr.data->lifeparams->species == i) 572 { 573 vec[i*2+cr.data->lifeparams->gen] = value; 574 } 575 } 576 return vec; 577 } 554 578 555 579 function onForamsStep(cr) … … 592 616 if (visualization(cr)) 593 617 { 594 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"));618 cr.data->reticulopodiacreature.moveAbs(cr.center_x-getZoneRange(cr,1), cr.center_y-getZoneRange(cr,1), cr.center_z-getZoneRange(cr,1)); 595 619 } 596 620 597 621 if (deathConditions(cr) == 1) 598 622 { 623 if (ExpProperties.logging == 1) 624 { 625 log(createLogVector(cr, cr.data->lifeparams->max_energy_level),ExpProperties.logPref+"fossil_log.txt"); 626 } 599 627 Populations[0].kill(cr); 600 628 return; … … 712 740 if (nutrientenergywaiting*ExpProperties.secPerStep >= ExpProperties.foodperiod) 713 741 { 714 for (var i = 0; i < ExpProperties. feedrate; i++)742 for (var i = 0; i < ExpProperties.nutrient_pop; i++) 715 743 { 716 744 addNutrient(); … … 719 747 nutrientenergywaiting = 0.0; 720 748 Simulator.checkpoint(); 721 } 749 750 if (ExpProperties.logging == 1) 751 { 752 log([ExpProperties.nutrient_pop],ExpProperties.logPref+"nutrients_log.txt"); 753 } 754 } 755 722 756 } 723 757 … … 808 842 log_energies.add(e_nut); 809 843 810 log(log_numbers, "forams_log.txt");811 log(log_energies, "energies_log.txt");844 log(log_numbers, ExpProperties.logPref+"forams_log.txt"); 845 log(log_energies, ExpProperties.logPref+"energies_log.txt"); 812 846 } 813 847 … … 841 875 name:Stop after the given number of simulation steps 842 876 type:d 0 1000000 0 877 878 property: 879 id:logPref 880 name:Log prefix 881 type:s 843 882 844 883 property: … … 1044 1083 1045 1084 property: 1046 id: feedrate1085 id:nutrient_pop 1047 1086 name:Feeding rate 1048 1087 type:f 0 1000000 … … 1065 1104 id:energy_nut 1066 1105 name:Nutrient energy 1067 type:f 0 100000 1106 type:f 0 10000000 1068 1107 group:Energy 1069 1108 … … 1083 1122 id:nutrientradius 1084 1123 name:Nutrient size 1085 type:f 0. 1 0.9 0.11124 type:f 0.001 0.9 0.1 1086 1125 group:Energy 1087 1126 -
experiments/frams/foraminifera/data/scripts/foraminifera.inc
r488 r493 5 5 { 6 6 colors = ["1.0,1.0,0.0","1.0,0.5,0.0"]; 7 retColors = ["1.0,1.0,1.0", "1.0,0.0,0.0"]; 7 8 chambers = [ ["0.0,0.0,0.0,", //coiled 8 9 "1.08020961284637, -0.0597195439040661, -0.0393781512975693,", … … 108 109 new_genes = [parent.data->genes, parent2.data->genes]; 109 110 gen = 1 - parent.data->lifeparams->gen; 111 112 if (ExpProperties.logging == 1) 113 { 114 log(createLogVector(parent, parent.energy),ExpProperties.logPref+"repro_energies_log.txt"); 115 log(createLogVector(parent2, parent2.energy),ExpProperties.logPref+"repro_energies_log.txt"); 116 log(createLogVector(parent, number),ExpProperties.logPref+"repro_num_log.txt"); 117 } 110 118 } 111 119 … … 122 130 var energy0 =getEnergy0( getGene(parent,"energies0", 0)[0]); 123 131 var number = ((1 - (getProperty(parent.data->lifeparams->gen, "e_repro_cost"))) * parent.energy) / energy0; 132 133 if (ExpProperties.logging == 1) 134 { 135 log(createLogVector(parent, parent.energy),ExpProperties.logPref+"repro_energies_log.txt"); 136 log(createLogVector(parent, number),ExpProperties.logPref+"repro_num_log.txt"); 137 } 124 138 125 139 Simulator.print("diploid number of offspring: " + number+ " energ0: " + energy0); … … 189 203 print_repro_info(parent1); 190 204 print_repro_info(parent2); 191 //Simulator.print("parents "+parent1.uid + " " + parent2.uid + " reproduced: "+Simulator.stepNumber);192 205 pop.kill(parent1); 193 206 pop.kill(parent2); 194 207 parent1 = null; 195 208 parent2 = null; 196 197 209 } 198 210 } … … 280 292 function createOffspring(geno, energy, parent_genes, parent_lifeparams) 281 293 { 294 curColor = retColors[1-parent_lifeparams->gen]; 282 295 var cr = Populations[0].add(geno); 283 296 cr.energy0 = energy; -
experiments/frams/foraminifera/data/scripts/foraminifera.show
r486 r493 23 23 GLDisplay.minfps = 10; 24 24 TrackingCam.cam_h = 15; //more side view 25 Params = { "f eedrate" : [200,100,50], "feedtrans" : [0.05,0.125,0.25],"energy_nut" :[0.5,1.5,3.0], "stress" : [0,1], "visualize" : [0,1]};25 Params = { "foodperiod" : [43200,25920,10800], "feedtrans" : [0.001,0.001,0.001],"energy_nut" :[144.54,544.54,944.54], "stress" : [0,1], "visualize" : [0,1]}; 26 26 ShowProperties.visualize=1; 27 27 } … … 57 57 } 58 58 59 function ShowProperties_f eedrate_set()59 function ShowProperties_foodperiod_set() 60 60 { 61 setShowParam("f eedrate");61 setShowParam("foodperiod"); 62 62 } 63 63 … … 85 85 86 86 property: 87 id:f eedrate88 name:Feeding rate87 id:foodperiod 88 name:Feeding period 89 89 type:d 0 2 1 ~Low~Medium~High 90 90
Note: See TracChangeset
for help on using the changeset viewer.