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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 854 by johnpye, Wed Sep 20 13:36:40 2006 UTC revision 855 by johnpye, Wed Sep 20 14:00:41 2006 UTC
# Line 4  REQUIRE "atoms.a4l"; Line 4  REQUIRE "atoms.a4l";
4  (*  (*
5      A simple population model using the Lotka-Volterra model.      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      http://www.ento.vt.edu/~sharov/PopEcol/lec10/lotka.html
9  *)  *)
10  MODEL lotka;  MODEL lotka;
11    
12      H IS_A factor; (* prey *)      R IS_A factor; (* rabbits *)
13      P IS_A factor; (* predators *)      F IS_A factor; (* foxes *)
14            
15      dH_dt IS_A rate;      dR_dt IS_A rate;
16      dP_dt IS_A rate;      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      dH_dt = r*H - a*H*P;      dR_dt = r*R - a*R*F;
24      dP_dt = b*H*P - m*P;      dF_dt = b*R*F - m*F;
25            
     r IS_A factor; (* intrinsic rate of prey population increase *)  
     a IS_A factor; (* predation rate coefficient *)  
     b IS_A factor; (* production rate of predators per prey eaten *)  
     m IS_A factor; (* predator mortality rate *)  
   
26      t IS_A time;          t IS_A time;    
27  METHODS  METHODS
28    
# Line 33  METHOD on_load; Line 34  METHOD on_load;
34  END on_load;  END on_load;
35    
36  METHOD default_self;  METHOD default_self;
37      H := 1000;      R := 1000;
38      P := 9;      F := 9;
39      dH_dt := 0 {Hz};      dR_dt := 0 {Hz};
40      dP_dt := 0 {Hz};      dF_dt := 0 {Hz};
41  END default_self;  END default_self;
42    
43  METHOD specify;  METHOD specify;
44      FIX r,a,b,m;      FIX r,a,b,m;
45      FIX P,H;      FIX F,R;
46  END specify;  END specify;
47    
48  METHOD values;  METHOD values;
49      r   := 0.2;      r   := 0.04 {1/s};
50      a   := 0.01;      a   := 0.0005 {1/s};
51      b   := 0.0005;      b   := 0.1*0.0005 {1/s};
52      m   := 0.04;      m   := 0.2 {1/s};
53        t := 0{s};
54  END values;  END values;
55    
56  METHOD set_obs;  METHOD set_obs;
57      H.obs_id :=1;      R.obs_id :=1;
58      P.obs_id :=2;      F.obs_id :=2;
59  END set_obs;  END set_obs;
60    
61  METHOD set_ode; (* this is where the current implementation sux *)  METHOD set_ode; (* this is where the current implementation sux *)
62      H.ode_id := 1;   H.ode_type := 1;      R.ode_id := 1;   R.ode_type := 1;
63      dH_dt.ode_id := 1; dH_dt.ode_type := 2;      dR_dt.ode_id := 1; dR_dt.ode_type := 2;
64            
65      P.ode_id := 2; P.ode_type := 1;      F.ode_id := 2; F.ode_type := 1;
66      dP_dt.ode_id := 2; dP_dt.ode_type := 2;      dF_dt.ode_id := 2; dF_dt.ode_type := 2;
67    
68      t.ode_type :=-1;      t.ode_type :=-1;
69  END set_ode;  END set_ode;

Legend:
Removed from v.854  
changed lines
  Added in v.855

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