/[ascend]/trunk/models/johnpye/lotka.a4c
ViewVC logotype

Contents of /trunk/models/johnpye/lotka.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 855 - (show annotations) (download) (as text)
Wed Sep 20 14:00:41 2006 UTC (14 years ago) by johnpye
File MIME type: text/x-ascend
File size: 1432 byte(s)
Removed some verbage in Integrator output
1 REQUIRE "ivpsystem.a4l";
2 REQUIRE "atoms.a4l";
3
4 (*
5 A simple population model using the Lotka-Volterra model.
6
7 http://www.stolaf.edu/people/mckelvey/envision.dir/lotka-volt.html
8 http://www.ento.vt.edu/~sharov/PopEcol/lec10/lotka.html
9 *)
10 MODEL lotka;
11
12 R IS_A factor; (* rabbits *)
13 F IS_A factor; (* foxes *)
14
15 dR_dt IS_A rate;
16 dF_dt IS_A rate;
17
18 r IS_A rate; (* growth rate of rabbits in absence of foxes *)
19 a IS_A rate; (* efficiency of turning hunted rabbits into new foxes*)
20 b IS_A rate; (* production rate of predators per prey eaten *)
21 m IS_A rate; (* natural fox mortality rate *)
22
23 dR_dt = r*R - a*R*F;
24 dF_dt = b*R*F - m*F;
25
26 t IS_A time;
27 METHODS
28
29 METHOD on_load;
30 RUN default_self;
31 RUN reset; RUN values;
32 RUN set_obs;
33 RUN set_ode;
34 END on_load;
35
36 METHOD default_self;
37 R := 1000;
38 F := 9;
39 dR_dt := 0 {Hz};
40 dF_dt := 0 {Hz};
41 END default_self;
42
43 METHOD specify;
44 FIX r,a,b,m;
45 FIX F,R;
46 END specify;
47
48 METHOD values;
49 r := 0.04 {1/s};
50 a := 0.0005 {1/s};
51 b := 0.1*0.0005 {1/s};
52 m := 0.2 {1/s};
53 t := 0{s};
54 END values;
55
56 METHOD set_obs;
57 R.obs_id :=1;
58 F.obs_id :=2;
59 END set_obs;
60
61 METHOD set_ode; (* this is where the current implementation sux *)
62 R.ode_id := 1; R.ode_type := 1;
63 dR_dt.ode_id := 1; dR_dt.ode_type := 2;
64
65 F.ode_id := 2; F.ode_type := 1;
66 dF_dt.ode_id := 2; dF_dt.ode_type := 2;
67
68 t.ode_type :=-1;
69 END set_ode;
70
71
72 END lotka;

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22