source: experiments/frams/foraminifera/data/scripts/foraminifera.show @ 446

Last change on this file since 446 was 446, checked in by Maciej Komosinski, 8 years ago

Added comments and displaying reference to real-world units: size and clock speed

File size: 3.0 KB
Line 
1show:
2name:Reproduction of benthic foraminifera
3info:~
4There are two species of Foraminiera: longitudal and coiled. The first chamber of the longitudal species has orange marks. Haploid and diploid generations alternate in both species. All chambers of the haploid generation have the same size. In the diploid generation, subsequent chambers are bigger than their predecessors.
5
6Nutrients are shown as tiny green cylinders. Foraminifers move towards nearest nutrients and this way they can accumulate enough energy to reproduce.
7
8When the "Enhance visualization" option is enabled, reticulopodia are shown as large disks and positions of nutrients are indicated by cuboids. 
9
10More information at www.framsticks.com/foraminifera
11~
12expdef:foraminifera
13code:~
14
15global Params; //to easily transfer changes in identical properties from this show to expdef
16global lasttimescale; //to display time scale when it changes significantly
17
18function onLoad()
19{
20        Simulator.init();
21        lasttimescale=0;
22        GLDisplay.desiredsimspeed = 50;
23        GLDisplay.minfps = 10;
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]};
26        ShowParams.visualize=1;
27}
28
29function timeScale()
30{
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
34        var foramSpeedMmPerSec=foramSpeedMmPerMin/60;
35        var localDriveMmPerStep=localDriveMicronsPerStep/1000;
36        var localDriveMmPerSec=localDriveMmPerStep*Simulator.simspeed;
37        return localDriveMmPerSec/foramSpeedMmPerSec;
38}
39
40function updateBanner(timescale)
41{
42        GLDisplay.banner="World size is %g mm." % (framsToMicrons(World.wrldsiz)/1000);
43        GLDisplay.banner+="\nShowing real-time x %g." % timescale;
44}
45
46function onShowStep()
47{
48        var timescale=timeScale();
49        if (timescale<lasttimescale*0.9 || timescale>lasttimescale*1.1) //significant change
50        {
51                updateBanner(timescale);
52                lasttimescale=timescale;
53        }
54}
55
56function setShowParam(param_id)
57{
58        ExpParams.[param_id] = Params[param_id][ShowParams.[param_id]];
59}
60
61function ShowParams_feedrate_set()
62{
63        setShowParam("feedrate");
64}
65
66function ShowParams_feedtrans_set()
67{
68        setShowParam("feedtrans");
69}
70
71function ShowParams_energy_nut_set()
72{
73        setShowParam("energy_nut");
74}
75
76function ShowParams_stress_set()
77{
78        setShowParam("stress");
79}
80
81function ShowParams_visualize_set()
82{
83        setShowParam("visualize");
84}
85
86~
87
88prop:
89id:feedrate
90name:Feeding rate
91type:d 0 2 1 ~Low~Medium~High
92
93prop:
94id:feedtrans
95name:Energy transfer
96type:d 0 2 1 ~0.01~0.05~0.1
97
98prop:
99id:energy_nut
100name:Nutrient energy
101type:d 0 2 1 ~0.5~1.5~3
102
103prop:
104id:stress
105name:Stress
106type:d 0 1 1
107
108prop:
109id:visualize
110name:Enhance visualization
111type:d 0 1 0
Note: See TracBrowser for help on using the repository browser.