Changeset 474
- Timestamp:
- 03/12/16 00:13:49 (9 years ago)
- Location:
- experiments/frams/foraminifera/data/scripts
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
experiments/frams/foraminifera/data/scripts/foraminifera.expdef
r470 r474 31 31 global max_chamber_energ; 32 32 global dir_change; 33 global movePerStep; 33 34 34 35 @include "foraminifera.inc" … … 81 82 ExpParams.autorestart = 0; 82 83 84 //time 85 ExpParams.secPerStep = 60; 86 ExpParams.foramSpeedMmPerMin = 0.1; 87 movePerStep = getMovePerStep(); 88 83 89 //ExpParams.visualize = 1; //uncomment to visualize reticulopodia and indicate nutrients positions 84 90 … … 87 93 //reproduction 88 94 ExpParams.foramPop = 10; 89 ExpParams.crossprob = 0 .4;90 ExpParams.mutationprob = 0 .2;95 ExpParams.crossprob = 0; 96 ExpParams.mutationprob = 0; 91 97 ExpParams.repro_time = 20; 92 98 reprocounter = 0; 93 99 94 100 //morphology 95 dir_change = 500;101 dir_change = 30000; 96 102 ExpParams.zone1_range = micronsToFrams(3000); 97 103 ExpParams.zone2_range = micronsToFrams(6000); … … 114 120 ExpParams.min_repro_energ_diplo = 6; 115 121 116 ExpParams.e_meta = 0.000 2;117 ExpParams.energy_hib = 0.000 1;118 ExpParams.energy_move = 0.000 25;122 ExpParams.e_meta = 0.00005; 123 ExpParams.energy_hib = 0.000025; 124 ExpParams.energy_move = 0.00005; 119 125 120 126 ExpParams.energies0_haplo = max_chamber_energ[0][0] - 0.001*max_chamber_energ[0][0]; 121 127 ExpParams.energies0_diplo = max_chamber_energ[1][0] - 0.001*max_chamber_energ[1][0]; 122 ExpParams.feedtrans = 0. 5;128 ExpParams.feedtrans = 0.125; 123 129 ExpParams.e_repro_cost_haplo = 0.7; 124 130 ExpParams.e_repro_cost_diplo = 0.3; … … 128 134 ExpParams.energy_nut = 100 * Math.pow(ExpParams.nutrientsize, 3); 129 135 ExpParams.nutrientPop = 1; 130 ExpParams.feedrate = 0.1;131 nutrientenergywaiting = ExpParams.energy_nut;136 ExpParams.feedrate = 100; 137 nutrientenergywaiting = 0; 132 138 ExpState.totaltestedcr = 0; 133 139 ExpState.nutrient = ""; … … 135 141 136 142 @include "standard_placement.inc" 143 144 function getMovePerStep() 145 { 146 return micronsToFrams((ExpParams.foramSpeedMmPerMin/60)*1000)*ExpParams.secPerStep; 147 } 137 148 138 149 function micronsToFrams(micrometers) … … 247 258 function setForamMeta(cr, gen) 248 259 { 249 cr.idleen = ExpParams.e_meta * max_chamber_energ[gen][Math.min(lastChamberNum(cr), max_chamber_energ[gen].size-1)];260 cr.idleen = (ExpParams.e_meta * max_chamber_energ[gen][Math.min(lastChamberNum(cr), max_chamber_energ[gen].size-1)])*ExpParams.secPerStep; 250 261 } 251 262 … … 295 306 function foramGrow(cr, chamber_num) 296 307 { 297 var geno = createForamGenotype(cr.user2["gen"], cr.user2["species"], chamber_num+1); 298 var cr2 = Populations[0].add(geno); 299 300 cr2.energy0 = cr.energy; 301 cr2.energy = cr2.energy0; 302 303 setGenotype({"cr" : cr2, "parent_user1" : cr.user1, "parent_user2" : cr.user2, "opt" : 2}); 304 cr2.moveAbs(cr.center_x - cr2.size_x / 2, cr.center_y - cr2.size_y / 2, cr.pos_z); 305 setForamMeta(cr2, cr2.user2["gen"]); 306 307 if (visualization(cr)) 308 { 309 Populations[2].delete(cr.user3); 310 } 311 Populations[0].delete(cr); 308 if ((chamber_num+1) < chambers[cr.user2["species"]].size) 309 { 310 var geno = createForamGenotype(cr.user2["gen"], cr.user2["species"], chamber_num+1); 311 var cr2 = Populations[0].add(geno); 312 313 cr2.energy0 = cr.energy; 314 cr2.energy = cr2.energy0; 315 316 setGenotype({"cr" : cr2, "parent_user1" : cr.user1, "parent_user2" : cr.user2, "opt" : 2}); 317 cr2.moveAbs(cr.center_x - cr2.size_x / 2, cr.center_y - cr2.size_y / 2, cr.pos_z); 318 setForamMeta(cr2, cr2.user2["gen"]); 319 320 if (visualization(cr)) 321 { 322 Populations[2].delete(cr.user3); 323 } 324 Populations[0].delete(cr); 325 } 312 326 } 313 327 … … 352 366 { 353 367 mindistvec.normalize(); 354 mindistvec.scale(- 0.08);368 mindistvec.scale(-1*movePerStep); 355 369 cr.localDrive = mindistvec; 356 370 moveEnergyDec(cr); … … 361 375 362 376 else 377 { 363 378 return 0; 379 } 364 380 } 365 381 … … 368 384 if (cr.user2["hibernated"] == 0) 369 385 { 370 cr.energy_m += ExpParams.energy_move * max_chamber_energ[cr.user2["gen"]][Math.min(lastChamberNum(cr), (max_chamber_energ[cr.user2["gen"]].size)-1)];386 cr.energy_m += (ExpParams.energy_move * max_chamber_energ[cr.user2["gen"]][Math.min(lastChamberNum(cr), (max_chamber_energ[cr.user2["gen"]].size)-1)])*ExpParams.secPerStep; 371 387 } 372 388 } … … 399 415 } 400 416 //random move 401 else if (cr.lifespan%dir_change == 0) 402 { 403 var dir = (Math.rndUni(-ExpParams.zone2_range, ExpParams.zone2_range), Math.rndUni(-ExpParams.zone2_range, ExpParams.zone2_range), 0); 404 dir.normalize(); 405 dir.scale(-0.08); 406 cr.localDrive = dir; 417 else if (cr.lifespan%(dir_change/ExpParams.secPerStep) == 0) 418 { 419 cr.user2["dir"] = randomDir(); 420 cr.localDrive = cr.user2["dir"]; 407 421 moveEnergyDec(cr); 408 422 } 423 else 424 { 425 cr.localDrive = cr.user2["dir"]; 426 } 427 } 428 429 function randomDir() 430 { 431 var dir = (Math.rndUni(-ExpParams.zone2_range, ExpParams.zone2_range), Math.rndUni(-ExpParams.zone2_range, ExpParams.zone2_range), 0); 432 dir.normalize(); 433 dir.scale(-1*movePerStep); 434 return dir; 409 435 } 410 436 … … 412 438 { 413 439 cr1.localDrive = XYZ.new(0,0,0); 414 var e = cr2.getPart(0).ing * ExpParams.feedtrans; //TODO efficiency dependent on age440 var e = ExpParams.feedtrans*ExpParams.secPerStep; //TODO efficiency dependent on age 415 441 e = Math.min(cr2.energy, e) + 0.0000001; 416 442 //Simulator.print("transferring "+e+" to "+cr1.name+" from "+cr2.name+" ("+cr2.energy+")"); … … 431 457 else 432 458 { 433 cr.idleen = ExpParams.energy_hib * max_chamber_energ[cr.user2["gen"]][Math.min(lastChamberNum(cr), (max_chamber_energ[cr.user2["gen"]].size)-1)]; //hibernate459 cr.idleen = (ExpParams.energy_hib * max_chamber_energ[cr.user2["gen"]][Math.min(lastChamberNum(cr), (max_chamber_energ[cr.user2["gen"]].size)-1)])*ExpParams.secPerStep; //hibernate 434 460 } 435 461 cr.user2["hibernated"] = 1 - cr.user2["hibernated"]; … … 536 562 function nutrientGrowth() 537 563 { 538 nutrientenergywaiting = nutrientenergywaiting + ExpParams.feedrate;539 if (nutrientenergywaiting > ExpParams. energy_nut)564 nutrientenergywaiting = nutrientenergywaiting + 1; 565 if (nutrientenergywaiting > ExpParams.feedrate/ExpParams.secPerStep) 540 566 { 541 567 for (var i = 0; i < ExpParams.nutrientPop; i++) … … 564 590 //reproduction -------------------------------------------- 565 591 reprocounter += 1; 566 if (reprocounter > ExpParams.repro_time)592 if (reprocounter*ExpParams.secPerStep > ExpParams.repro_time) 567 593 { 568 594 reprocounter = 0; … … 618 644 619 645 log(log_numbers, "forams_log.txt"); 620 646 log(log_energies, "energies_log.txt"); 621 647 } 622 648 … … 649 675 name:Stop after the given number of simulation steps 650 676 type:d 0 1000000 0 677 678 prop: 679 id:foramSpeedMmPerMin 680 name:Speed of foraminfera in mm/min 681 type:f 0.1 682 flags: 16 683 group:Foraminifera 684 685 prop: 686 id:secPerStep 687 name:Seconds per simulation step 688 type:f 60.0 689 flags: 16 690 group:Foraminifera 651 691 652 692 prop: … … 798 838 id:feedrate 799 839 name:Feeding rate 800 type:f 0 100 840 type:f 0 1000000 801 841 group:Energy 802 842 help:How fast energy is created in the world … … 841 881 id:repro_time 842 882 name:Time before reproduction 843 type:d 0 1000 883 type:d 0 10000 844 884 845 885 prop: -
experiments/frams/foraminifera/data/scripts/foraminifera.inc
r432 r474 56 56 { 57 57 mode["cr"].user1 = {"min_repro_energies" : [max_chamber_energ[0][getProperty(0, "min_repro_energ")], max_chamber_energ[1][getProperty(1, "min_repro_energ")]], "hibernation" : mode["species"]}; 58 mode["cr"].user2 = {"max_energy_level" : getProperty(0,"energies0"), "gen" : 0, "hibernated" : 0, "species" : mode["species"], "reproduce" : 0 };58 mode["cr"].user2 = {"max_energy_level" : getProperty(0,"energies0"), "gen" : 0, "hibernated" : 0, "species" : mode["species"], "reproduce" : 0, "dir" : randomDir()}; 59 59 } 60 60 else if (mode["opt"] == 1) //child 61 61 { 62 mode["cr"].user2 = {"max_energy_level" : getProperty(1 - mode["parent_user2"]["gen"],"energies0"), "gen" : 1 - mode["parent_user2"]["gen"], "hibernated" : 0, "species" : mode["parent_user2"]["species"], "reproduce" : 0 };62 mode["cr"].user2 = {"max_energy_level" : getProperty(1 - mode["parent_user2"]["gen"],"energies0"), "gen" : 1 - mode["parent_user2"]["gen"], "hibernated" : 0, "species" : mode["parent_user2"]["species"], "reproduce" : 0, "dir" : randomDir()}; 63 63 mode["cr"].user1 = mode["parent_user1"]; 64 64 } -
experiments/frams/foraminifera/data/scripts/foraminifera.show
r454 r474 23 23 GLDisplay.minfps = 10; 24 24 TrackingCam.cam_h = 15; //more side view 25 Params = { "feedrate" : [ 0.05,0.1,0.2], "feedtrans" : [0.01,0.05,0.1],"energy_nut" :[0.5,1.5,3.0], "stress" : [0,1], "visualize" : [0,1]};25 Params = { "feedrate" : [200,100,50], "feedtrans" : [0.05,0.125,0.25],"energy_nut" :[0.5,1.5,3.0], "stress" : [0,1], "visualize" : [0,1]}; 26 26 ShowParams.visualize=1; 27 27 } … … 30 30 { 31 31 //just a draft, this function and all constants in expdef need serious review 32 var foramSpeedMmPerMin=0.1; //0.1 mm/minute based on http://drs.nio.org/drs/bitstream/handle/2264/418/ONGC_Bull_37%281%29_53.pdf 33 var localDriveMicronsPerStep=framsToMicrons(0.08); //0.08 is used in expdef as distance (in frams units) per simulation step. TODO Use a variable/constant/function from expdef instead of copying this value here 34 var foramSpeedMmPerSec=foramSpeedMmPerMin/60; 32 var localDriveMicronsPerStep=framsToMicrons(getMovePerStep()); 33 var foramSpeedMmPerSec=ExpParams.foramSpeedMmPerMin/60; 35 34 var localDriveMmPerStep=localDriveMicronsPerStep/1000; 36 35 var localDriveMmPerSec=localDriveMmPerStep*Simulator.simspeed; … … 93 92 id:feedtrans 94 93 name:Energy transfer 95 type:d 0 2 1 ~0.0 1~0.05~0.194 type:d 0 2 1 ~0.05~0.125~0.25 96 95 97 96 prop:
Note: See TracChangeset
for help on using the changeset viewer.