Changeset 554
- Timestamp:
- 07/31/16 23:26:43 (8 years ago)
- Location:
- experiments/frams/foraminifera/data/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
experiments/frams/foraminifera/data/scripts/foraminifera.expdef
r553 r554 85 85 World.wrldsiz = micronsToFrams(100000); 86 86 World.wrldbnd = 1; 87 ExpProperties.stress = 1; 88 ExpProperties.creath = -0.99; //just above the bottom 89 ExpProperties.autorestart = 0; 90 91 //time 92 ExpProperties.secPerStep = 300; 93 ExpProperties.foramSpeedMmPerMin = 0.05; 87 94 88 movePerStep = getMovePerStep(); 95 89 … … 99 93 ExpProperties.logPref = ""; 100 94 101 //reproduction102 ExpProperties.foramPop = 20;103 ExpProperties.crossprob = 0;104 ExpProperties.mutationprob = 0;105 ExpProperties.repro_time = 720;106 ExpProperties.gametoPeriod = 21600;107 ExpProperties.divisionCost = 20;108 reprocounter = 0;109 110 95 species_genes = []; 111 96 97 //morphology 112 98 init_chambers(); 113 114 99 curColor = retColors[0]; 115 //morphology116 ExpProperties.dir_change_sec = 30000;117 100 ExpProperties.zone1_range = micronsToFrams(1000); 118 101 ExpProperties.zone2_range = micronsToFrams(3000); 119 ExpProperties.chamber_growth_time = 720;120 ExpProperties.chamberCostPerSec = 0.000001;121 102 ExpProperties.chamber_proculus_haplo = micronsToFrams(50); 122 103 ExpProperties.chamber_difference_haplo = 0.0; … … 133 114 } 134 115 135 //energetics136 ExpProperties.min_repro_energ_haplo = 4;137 ExpProperties.min_repro_energ_diplo = 6;138 139 ExpProperties.e_meta = 0.0000005;140 ExpProperties.energy_hib = 0.0000001;141 ExpProperties.energy_move = 0.0000005;142 143 ExpProperties.energies0_haplo = 20;144 ExpProperties.energies0_diplo = 1.25;145 ExpProperties.feedtrans = 0.001;146 ExpProperties.e_repro_cost_haplo = 0.3;147 ExpProperties.e_repro_cost_diplo = 0.2;148 149 ExpProperties.e_death_level_haplo = 0.5;150 ExpProperties.e_death_level_diplo = 0.5;151 152 116 //nutrients 153 changePeriod = 0;154 phase = "low";155 nutrientSqrCm = 10;156 ExpProperties.foodperiod = 14400;157 ExpProperties.foodPeriodChange = 0;158 117 ExpProperties.nutrientradius = micronsToFrams(10); 159 118 ExpProperties.energy_nut = 200 * energyFromVolume(ExpProperties.nutrientradius,1); 119 nutrientSqrCm = 10; 160 120 ExpProperties.nutrient_pop = Math.pow(framsToMicrons(World.wrldsiz)*0.0001,2)/nutrientSqrCm; 161 ExpProperties.ingestion = 0.25; 162 nutrientenergywaiting = 0; 121 163 122 ExpState.totaltestedcr = 0; 164 123 ExpState.nutrient = ""; … … 169 128 170 129 @include "standard_placement.inc" 130 131 function secToSimSteps(value_in_sec){ 132 return value_in_sec/ExpProperties.secPerStep; 133 } 171 134 172 135 function volumeInMicrons(radiusInFrams) … … 226 189 cr.energy0 = energyFromVolume(max_chamber_volume[ploid][chambernum],0); 227 190 cr.energy = cr.energy0; 228 setGenotype({"opt" : 0, "cr" : cr, "species" : species, "energy0" : cr.energy0, "genes" : species_genes[species]});191 setGenotype({"opt" : "birth", "cr" : cr, "gen" : ploid, "species" : species, "energy0" : cr.energy0, "genes" : species_genes[species]}); 229 192 if (ploid == 1) 230 193 { 231 cr.data->lifeparams->gen = 1;232 194 cr.data->genes = [cr.data->genes, cr.data->genes]; //TODO two different genes sets 233 195 } … … 277 239 o = Populations[0][0].getMechPart(0).orient.clone(); 278 240 ExpState.totaltestedcr = 0; 241 242 reprocounter = 0; 243 nutrientenergywaiting = 0; 244 changePeriod = 0; 245 phase = "low"; 279 246 } 280 247 … … 411 378 cr2.energy = cr2.energy0; 412 379 413 setGenotype({"cr" : cr2, "parent_genes" : cr.data->genes, "parent_lifeparams" : cr.data->lifeparams, "opt" : 2, "energy0" : cr.energy0});380 setGenotype({"cr" : cr2, "parent_genes" : cr.data->genes, "parent_lifeparams" : cr.data->lifeparams, "opt" : "growth", "energy0" : cr.energy0}); 414 381 cr2.moveAbs(cr.center_x - cr2.size_x / 2, cr.center_y - cr2.size_y / 2, cr.pos_z); 415 382 setForamMeta(cr2); … … 496 463 497 464 //adjustment in z axis 498 cr.moveAbs(fence(cr.pos_x, getZoneRange(cr, 1)), fence(cr.pos_y,getZoneRange(cr, 1)), 0); 465 var change_direction = 0; 466 var new_x = fence(cr.pos_x, getZoneRange(cr, 1)); 467 var new_y = fence(cr.pos_y,getZoneRange(cr, 1)); 468 469 if ((new_x != cr.pos_x) || (new_y != cr.pos_y) || (cr.data->lifeparams->dir_counter >= int(secToSimSteps(ExpProperties.dir_change_sec)))) 470 { 471 change_direction = 1; 472 } 473 474 cr.moveAbs(new_x, new_y, 0); 499 475 500 476 //are there any nutrients in zone 1 or 2? … … 515 491 } 516 492 //random move 517 else if (c r.data->lifeparams->dir_counter >= int(ExpProperties.dir_change_sec/ExpProperties.secPerStep))493 else if (change_direction == 1) 518 494 { 519 495 cr.data->lifeparams->dir = randomDir(); … … 656 632 if ((cr.data->lifeparams->max_energy_level >= energyFromVolume(max_chamber_volume[cr.data->lifeparams->gen][lastChamberNum(cr)],0))) 657 633 { 658 cr.data->lifeparams->chamber_growth = int( ExpProperties.chamber_growth_time/ExpProperties.secPerStep);634 cr.data->lifeparams->chamber_growth = int(secToSimSteps(ExpProperties.chamberGrowthSec)); 659 635 } 660 636 } … … 716 692 { 717 693 var nutsize = ExpProperties.nutrientradius*10; 718 var nut = Populations[2].add("//0\n m:Vstyle=nutrient_visual\np:sh=2,sx="+nutsize+",sy="+nutsize+",sz="+nutsize+",ry=1.5,vr=0.0,1.0,0.0");694 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"); 719 695 cr.data->reticulopodiacreature = nut; 720 696 nut.moveAbs(cr.pos_x-1.5*nutsize, cr.pos_y-1.5*nutsize, 0.5); … … 735 711 { 736 712 changePeriod += 1; 737 if (phase=="low" && (changePeriod*ExpProperties.secPerStep) >= 23328000) //9 months713 if (phase=="low" && changePeriod >= secToSimSteps(23328000)) //9 months 738 714 { 739 715 ExpProperties.foodperiod = ExpProperties.foodperiod/ExpProperties.foodPeriodChange; … … 742 718 } 743 719 744 else if (phase == "high" && (changePeriod*ExpProperties.secPerStep) >= 7776000) //3 months720 else if (phase == "high" && changePeriod >= secToSimSteps(7776000)) //3 months 745 721 { 746 722 ExpProperties.foodperiod = ExpProperties.foodperiod*ExpProperties.foodPeriodChange; … … 750 726 } 751 727 nutrientenergywaiting = nutrientenergywaiting + 1; 752 if (nutrientenergywaiting *ExpProperties.secPerStep >= ExpProperties.foodperiod)728 if (nutrientenergywaiting >= secToSimSteps(ExpProperties.foodperiod)) 753 729 { 754 730 for (var i = 0; i < ExpProperties.nutrient_pop; i++) … … 783 759 //reproduction -------------------------------------------- 784 760 reprocounter += 1; 785 if (reprocounter *ExpProperties.secPerStep > ExpProperties.repro_time)761 if (reprocounter > secToSimSteps(ExpProperties.reproTimeSec)) 786 762 { 787 763 reprocounter = 0; … … 881 857 name:Show reticulopodia and nutrients 882 858 type:d 0 1 0 883 group: Foraminifera859 group: 884 860 885 861 property: 886 862 id:maxSteps 887 name: Stop after the given number of simulationsteps863 name:Maximum number of steps 888 864 type:d 0 10000000 0 865 group: 866 867 property: 868 id:logging 869 name:Log statistics to file 870 type:d 0 1 0 871 group: 889 872 890 873 property: … … 894 877 895 878 property: 896 id:foramSpeedMmPerMin897 name:Speed of foraminfera in mm/min898 type:f 0.1899 flags: 16900 group:Foraminifera901 902 property:903 id:gametSuccessRate904 name:Ratio of successful gamets905 type:f 0.001906 group:Foraminifera907 908 property:909 id:dir_change_sec910 name:Number of seconds before direction change911 type:d 30000912 group:Foraminifera913 914 property:915 id:gametoPeriod916 name:Time of gametogenesis917 type:f 720918 group:Foraminifera919 920 property:921 id:picoCarbonPerMikro922 name:Picograms of carbon in cubed micrometer923 type:f 0.13924 group:Foraminifera925 926 property:927 879 id:secPerStep 928 880 name:Seconds per simulation step 929 881 help:Number of seconds of foraminifera time per simulation step 930 type:f 60.0 882 type:f 1 480 300 883 flags: 16 884 group: 885 886 property: 887 id:foramSpeedMmPerMin 888 name:Speed of foraminfera in mm/min 889 type:f 0.01 0.1 0.05 931 890 flags: 16 932 891 group:Foraminifera 933 892 934 893 property: 935 id: e_repro_cost_haplo936 name: Cost of reproduction937 type: f 0.1 0.9 0.5894 id:dir_change_sec 895 name:Number of seconds before direction change 896 type:d 300 300000 6000 938 897 group:Foraminifera 898 899 property: 900 id:foramPop 901 name:Initial forams population size 902 type:d 1 1000 20 903 group:Foraminifera 904 905 property: 906 id:gametoPeriodSec 907 name:Time of gametogenesis 908 type:f 300 300000 21600 909 group:Reproduction 910 911 property: 912 id:gametSuccessRate 913 name:Ratio of successful gamets 914 type:f 0.0001 0.01 0.001 915 group:Reproduction 939 916 940 917 property: 941 918 id:divisionCost 942 919 name:Cost of division in pG 943 type:f 944 group:Foraminifera 945 946 property: 947 id:e_repro_cost_diplo 948 name:Cost of reproduction 949 type:f 0.1 0.9 0.3 950 group:Foraminifera 951 952 property: 953 id:chamber_growth_time 920 type:f 15 25 20 921 group:Reproduction 922 923 property: 924 id:min_repro_energ_haplo 925 name:Min reproduction energy of haploid 926 type:f 0 -1 4 927 group:Energy 928 929 property: 930 id:min_repro_energ_diplo 931 name:Min reproduction energy of diploid 932 type:f 0 -1 6 933 group:Energy 934 935 property: 936 id:repro_prob 937 name:Probability of reproduction 938 type:f 0 1 0.8 939 group:Reproduction 940 941 property: 942 id:energies0_haplo 943 name:Energy of offspring from diploid forams 944 type:f 0 -1 20 945 group:Energy 946 947 property: 948 id:energies0_diplo 949 name:Energy of offspring from diploid forams 950 type:f 0 -1 1.25 951 group:Energy 952 953 property: 954 id:crossprob 955 name:Crossover probability 956 type:f 0 1 0 957 group:Reproduction 958 959 property: 960 id:mutationprob 961 name:Mutation probability 962 type:f 0 1 0 963 group:Reproduction 964 965 property: 966 id:reproTimeSec 967 name:Time before reproduction 968 type:d 0 10000 720 969 group:Reproduction 970 971 property: 972 id:chamberGrowthSec 954 973 name:Time of the chamber growth in seconds 955 type:f 956 group:Foraminifera 957 958 property: 959 id:chamberCostPerSec 960 name:Cost of growning chamber per second 961 type:f 974 type:f 360 1440 720 962 975 group:Foraminifera 963 976 … … 977 990 id:chamber_difference_haplo 978 991 name:Difference in size between subsequent chambers 979 type:f 992 type:f 0 -1 0 980 993 group:Foraminifera 981 994 … … 983 996 id:chamber_difference_diplo 984 997 name:Difference in size between subsequent chambers 985 type:f 998 type:f 0 -1 0.08 986 999 group:Foraminifera 987 1000 … … 990 1003 name:Probability of being hunted 991 1004 type:f 0 1 0 992 group:For minifera1005 group:Foraminifera 993 1006 994 1007 property: 995 1008 id:zone1_range 996 1009 name:Zone 1 range 997 type:f 0 200 1010 type:f 0 200 10 998 1011 group:Foraminifera 999 1012 … … 1001 1014 id:zone2_range 1002 1015 name:Zone 2 range 1003 type:f 0 3000 1016 type:f 0 3000 30 1004 1017 group:Foraminifera 1005 1018 1006 1019 property: 1007 id:colors 1008 name:Haploid and diploid colors 1009 type:x 1010 group:Foraminifera 1011 1012 property: 1013 id:min_repro_energ_haplo 1014 name:Min reproduction energy of forams 1015 type:f 1016 group:Foraminifera 1017 1018 property: 1019 id:min_repro_energ_diplo 1020 name:Min reproduction energy of forams 1021 type:f 1022 group:Foraminifera 1023 1024 property: 1025 id:repro_prob 1026 name:Probability of reproduction 1027 type:f 0 1 0.8 1028 group:Foraminifera 1029 1030 property: 1031 id:energies0_haplo 1032 name:Energy of offspring from diploid forams 1033 type:f 1034 group:Foraminifera 1035 1036 property: 1037 id:energies0_diplo 1038 name:Energy of offspring from diploid forams 1039 type:f 1040 group:Foraminifera 1020 id:chamberCostPerSec 1021 name:Cost of growning chamber per second 1022 type:f 0 1 0.000001 1023 group:Energy 1041 1024 1042 1025 property: 1043 1026 id:e_death_level_haplo 1044 1027 name:Minimal level of energy to sustain life of haploid 1045 type:f 0 20 0.21046 group: Foraminifera1028 type:f 0 1 0.5 1029 group:Energy 1047 1030 1048 1031 property: 1049 1032 id:e_death_level_diplo 1050 1033 name:Minimal level of energy to sustain life of diploid 1051 type:f 0 20 0.21052 group: Foraminifera1034 type:f 0 1 0.5 1035 group:Energy 1053 1036 1054 1037 property: 1055 1038 id:energy_hib 1056 1039 name:Energy used for hibernation during one step 1057 type:f 0 1 0.00 11058 group: Foraminifera1040 type:f 0 1 0.0000001 1041 group:Energy 1059 1042 1060 1043 property: 1061 1044 id:energy_move 1062 1045 name:Energy used for movement during one step 1063 type:f 0 20 0.001 1064 group:Foraminifera 1065 1066 property: 1067 id:min_vol 1068 name:Minimal volume for reproduction 1069 type:f 100 900 100 1070 group:Foraminifera 1071 1072 property: 1073 id:max_size 1074 name:Maximal size 1075 type:d 1 10 5 1076 group:Foraminifera 1077 1078 property: 1079 id:foramPop 1080 name:Initial forams population size 1081 type:d 1 1000 100 1082 group:Foraminifera 1083 1084 property: 1085 id:crossprob 1086 name:Crossover probability 1087 type:f 0 1 0 1088 group:Foraminifera 1089 1090 property: 1091 id:mutationprob 1092 name:Mutation probability 1093 type:f 0 1 0 1094 group:Foraminifera 1046 type:f 0 1 0.0000005 1047 group:Energy 1095 1048 1096 1049 property: 1097 1050 id:e_meta 1098 1051 name:Idle metabolism 1099 type:f 0 1 1052 type:f 0 1 0.0000005 1100 1053 group:Energy 1101 1054 help:Each stick consumes this amount of energy in one time step 1102 1103 property:1104 id:nutrient_pop1105 name:Feeding rate1106 type:f 0 10000001107 group:Energy1108 help:How fast energy is created in the world1109 1110 property:1111 id:foodPeriodChange1112 name:Set variable feed rate1113 type:f 01114 group:Energy1115 1055 1116 1056 property: 1117 1057 id:ingestion 1118 1058 name:Ingestion rate 1119 type:f 1120 group:Energy 1059 type:f 0 -1 0.25 1060 group:Energy 1061 1062 property: 1063 id:nutrient_pop 1064 name:Nutrient population 1065 type:f 0 1000000 1066 group:Energy 1067 help:How fast energy is created in the world 1121 1068 1122 1069 property: … … 1127 1074 1128 1075 property: 1129 id:feedtrans1130 name:Energy transfer per second1131 type:f 0 1000001132 group:Energy1133 1134 property:1135 id:foodperiod1136 name:Time between food occurrences1137 type:f 0 10000001138 group:Energy1139 1140 property:1141 1076 id:nutrientradius 1142 1077 name:Nutrient size … … 1145 1080 1146 1081 property: 1082 id:picoCarbonPerMikro 1083 name:Picograms of carbon in cubed micrometer 1084 type:f 0 -1 0.13 1085 group:Energy 1086 1087 property: 1088 id:feedtrans 1089 name:Energy transfer per second 1090 type:f 0 1 0.001 1091 group:Energy 1092 1093 property: 1094 id:foodperiod 1095 name:Time between food occurrences 1096 type:f 0 1000000 14400 1097 group:Energy 1098 1099 property: 1100 id:foodPeriodChange 1101 name:Set variable feed rate 1102 type:f 0 -1 0 1103 group:Energy 1104 1105 property: 1147 1106 id:stress 1148 1107 name:Environmental stress 1149 1108 type:d 0 1 1 1150 group: World1109 group: 1151 1110 1152 1111 property: … … 1154 1113 name:Reproduction trigger 1155 1114 type:d 0 1 1 1156 group:World 1157 1158 property: 1159 id:repro_time 1160 name:Time before reproduction 1161 type:d 0 10000 1115 group:Reproduction 1162 1116 1163 1117 property: 1164 1118 id:creath 1165 1119 name:Creation height 1166 type:f -1 50 1120 type:f -1 50 -0.99 1167 1121 help:~ 1168 1122 Vertical position (above the surface) where new Forams are revived. … … 1172 1126 -1 = just above the bottom~ 1173 1127 1128 property: 1129 id:autorestart 1130 name:Restart after extinction 1131 help:Restart automatically this experiment after the last creature has died? 1132 type:d 0 1 0 1133 1174 1134 state: 1175 1135 id:nutrient … … 1178 1138 type:x 1179 1139 flags:32 1180 1181 property:1182 id:autorestart1183 name:Restart after extinction1184 help:Restart automatically this experiment after the last creature has died?1185 type:d 0 11186 1140 1187 1141 state: … … 1199 1153 type:d 1200 1154 flags:16 1201 1202 property:1203 id:logging1204 name:Log statistics to file1205 type:d 0 1 0 -
experiments/frams/foraminifera/data/scripts/foraminifera.inc
r552 r554 30 30 function createForamMorphology(morphotype, gen, chamber_num) 31 31 { 32 var rad = getProperty(gen, "chamber_proculus");33 32 var geno = "//0\nm:Vstyle=foram\n" + chambers[morphotype][0] + "vr=" + colors[gen]; 34 33 … … 37 36 for (var i = 0; i < chamber_num; i++) 38 37 { 39 //rad = getProperty(gen, "chamber_proculus") + getProperty(gen, "chamber_difference") * (i + 1);40 38 geno += "\n" + chambers[morphotype][i+1] + "vr=" + colors[gen]; 41 39 } … … 46 44 } 47 45 48 //if (morphotype == 0) geno += "\nn:p=0,d=\"S\"";49 46 return geno; 50 47 } … … 52 49 function setGenotype(mode) 53 50 { 54 if (mode->opt == 0) //initial 55 { 56 mode->cr.data->genes = String.deserialize(String.serialize(mode->genes)); 57 mode->cr.data->lifeparams = {"max_energy_level" : mode->energy0, "gen" : 0, "hibernated" : 0, "species" : mode->species, "reproduce" : 0, "dir" : randomDir(), "dir_counter" : Math.random(ExpProperties.dir_change_sec), "chamber_growth" : -1, "division_time" : -1}; 58 } 59 else if (mode->opt == 1) //child 60 { 61 mode->cr.data->lifeparams = {"max_energy_level" : mode->energy0, "gen" : 1 - mode->parent_lifeparams->gen, "hibernated" : 0, "species" : mode->parent_lifeparams->species, "reproduce" : 0, "dir" : randomDir(), "dir_counter" : Math.random(ExpProperties.dir_change_sec), "chamber_growth" : -1, "division_time" : -1}; 62 mode->cr.data->genes = String.deserialize(String.serialize(mode->parent_genes)); 63 } 64 else //grow 51 if (mode->opt == "growth") 65 52 { 66 53 mode->cr.data->genes = mode->parent_genes; 67 54 mode->cr.data->lifeparams = mode->parent_lifeparams; 55 } 56 57 else if (mode->opt == "birth") 58 { 59 mode->cr.data->genes = String.deserialize(String.serialize(mode->genes)); 60 mode->cr.data->lifeparams = {"max_energy_level" : mode->energy0, "gen" : mode->gen, "hibernated" : 0, "species" : mode->species, "reproduce" : 0, "dir" : randomDir(), "dir_counter" : Math.random(int(secToSimSteps(ExpProperties.dir_change_sec))), "chamber_growth" : -1, "division_time" : -1}; 61 68 62 } 69 63 } … … 192 186 if (parent1.data->lifeparams->division_time == -1 && parent2.data->lifeparams->division_time == -1) 193 187 { 194 var time = int( ExpProperties.gametoPeriod/ExpProperties.secPerStep);188 var time = int(secToSimSteps(ExpProperties.gametoPeriodSec)); 195 189 parent1.data->lifeparams->division_time = time; 196 190 parent2.data->lifeparams->division_time = time; … … 298 292 cr.energy0 = energy; 299 293 cr.energy = cr.energy0; 300 setGenotype({" cr" : cr, "parent_genes" : parent_genes, "parent_lifeparams" : parent_lifeparams, "opt" : 1, "energy0" : cr.energy0});294 setGenotype({"opt" : "birth", "cr" : cr, "gen" : 1 - parent_lifeparams->gen, "species" : parent_lifeparams->species, "energy0" : cr.energy0, "genes" : parent_genes}); 301 295 placeRandomlyNotColliding(cr); 302 296 }
Note: See TracChangeset
for help on using the changeset viewer.