chemostat              package:simecol              R Documentation

_C_h_e_m_o_s_t_a_t _M_o_d_e_l

_D_e_s_c_r_i_p_t_i_o_n:

     'simecol' example: Model of continuos culture of microorganisms
     (chemostat).

_U_s_a_g_e:

     data(chemostat)

_F_o_r_m_a_t:

     An S4 object according to the 'odeModel' specification. The object
     contains the following slots:


     '_m_a_i_n' the differential equations for substrate ('S') and cells
          ('X').

     '_p_a_r_m_s' a vector with the named parameters of the model:

          '_v_m' maximum growth rate of the cells,

          '_k_m' half saturation constant,

          '_Y' yield coefficient (conversion factor of substrate into
               cells).

          '_D' dilution rate,

          '_S_0' substrate concentration in the inflow.          


     '_t_i_m_e_s' simulation time and integration interval.

     '_i_n_i_t' vector with start values for substrate ('S') and cells
          ('X').


_S_e_e _A_l_s_o:

     'simecol-package', 'sim', 'parms', 'init', 'times'.

_E_x_a_m_p_l_e_s:

     ##============================================
     ## Basic Usage:
     ##   work with the example
     ##============================================
     data(chemostat)
     plot(sim(chemostat))

     parms(chemostat)["D"] <- 0.9 
     plot(sim(chemostat))


     ##============================================
     ## Implementation:
     ##   The code of the chemostat model
     ##============================================
     chemostat <- new("odeModel",
       main = function(time, init, parms, inputs=NULL) {
         vm  <- parms["vm"] # max growth rate 
         km  <- parms["km"] # half saturation constant
         D   <- parms["D"]  # dilution rate
         S0  <- parms["S0"] # substrate in inflow
         Y   <- parms["Y"]  # yield coefficient for substrate
         X   <- init[1]     # cells (e.g. algae)
         S   <- init[2]     # substrate (e.g. phosphorus)

         mu  <- vm * S/(km + S)              # Monod equation
         dx1 <- mu * X - D * X               # cells 
         dx2 <-  D *(S0 - S) - 1/Y * mu * X  # substrate
         list(c(dx1, dx2))
       },
       parms = c(
         vm = 1.0,           # 1/d
         km = 2.0,           # mumol Substrate/l
         Y  = 100,           # cells /mumol Substrate
         D  = 0.5,           # 1/d
         S0 = 10             #  mumol Substrate/l
       ),
       times = c(from=0, to=40, by=.5),
       init  = c(X=10, S=10), # cells/l; umol Substrate/l                     
       solver = "lsoda"
     )

