R/Bass_ind_equations.R

#' Seabass bioenergetic individual model differential equations
#'
#' @param Param vector containing all metabolic parameters
#' @param Temp water temperature forcing at time t
#' @param G food entering the cage at time t
#' @param Food food characterization (Proteins, Lipids, Carbohydrates)
#' @param weight individual weight at time t
#'
#' @return model output at time t
#'
#' @import matrixStats plotrix rstudioapi
#'

Bass_ind_equations <- function(Param, Temp, G, Food, weight){

  # Parameters definition
  ingmax=Param[1]        # [g/d] Maximum ingestion rate
  alpha=Param[2]         # [-] Feeding catabolism coefficient
  betaprot=Param[3]      # [-] Assimilation coefficient for protein
  betalip=Param[4]       # [-] Assimilation coefficient for lipid
  betacarb=Param[5]      # [-] Assimilation coefficient for carbohydrates
  epsprot=Param[6]       # [J/gprot] Energy content of protein
  epslip=Param[7]        # [J/glip] Energy content of lipid
  epscarb=Param[8]       # [J/gcarb] Energy content of carbohydrate
  epsO2=Param[9]         # [J/gO2] Energy consumed by the respiration of 1g of oxygen
  pk=Param[10]           # [1/day] Temperature coefficient for the fasting catabolism
  k0=Param[11]           # [1/Celsius degree]  Fasting catabolism at 0 Celsius degree
  m=Param[12]            # [-] Weight exponent for the anabolism
  n=Param[13]            # [-] Weight exponent for the catabolism
  betac=Param[14]        # [-]  Shape coefficient for the H(Tw) function
  Tma=Param[15]          # [Celsius degree] Maximum lethal temperature for Dicentrarchus labrax
  Toa=Param[16]          # [Celsius degree] Optimal temperature for Dicentrarchus labrax
  Taa=Param[17]          # [Celsius degree] Lowest feeding temperature for Dicentrarchus labrax
  omega=Param[18]        # [gO2/g] Oxygen consumption - weight loss ratio
  a=Param[19]            # [J/gtissue] Energy content of fish tissue
  k=Param[20]            # [-] Weight exponent for energy content
  eff=Param[21]          # [-] Food ingestion efficiency

  # Food composition definition
  Pcont=Food[1]       # [-] Percentage of proteins in the food
  Lcont=Food[2]       # [-] Percentage of lipids in the food
  Ccont=Food[3]       # [-] Percentage of carbohydrates in the food

  # EQUATIONS

  # Forcing temperature
  fgT=((Tma-Temp)/(Tma-Toa))^(betac*(Tma-Toa))*exp(betac*(Temp-Toa)) # Optimum Temperature dependance for ingestion
  frT= exp(pk*Temp)                                                  # Exponential Temperature dependance for catabolism
  Tfun=cbind(fgT, frT)                                               # Output with temperature limitation functions

  # Ingested mass
  ing=ingmax*(weight^m)*fgT   # [g/d] Potential ingestion rate
  G=G*eff                     # [g/d] Ingested food (a part of the available food falls through the net)

  # Lowest feeding temperature threshold
  if (Temp<Taa) {
    ing=0
  }

  # Available food limitation
  if (ing>G) {
    ingvero=G         # [g/d] Actual ingestion rate
  }  else {
    ingvero=ing     # [g/d] Actual ingestion rate
  }

  # Energy content of somatic tissue [J/g] Source: Lupatsch et al. (2003)
  epstiss=a*weight^k

  # Ingested energy
  diet=Pcont*epsprot*betaprot+Lcont*epslip*betalip+Ccont*epscarb*betacarb # [J/g] Energy content of the ingested food
  assE=ingvero*diet # [J/d] Ingested energy

  # Compute excretion
  Pexc=(1-betaprot)*Pcont*ingvero  # Excreted proteins [g/d]
  Lexc=(1-betalip)*Lcont*ingvero   # Excreted lipids [g/d]
  Cexc=(1-betacarb)*Ccont*ingvero  # Excreted carbohydrates [g/d]
  exc=cbind(Pexc,Lexc,Cexc)        # Output with excretion values

  # Compute waste
  Pwst=((G/eff)-ingvero)*Pcont     # Proteines to waste [g/d]
  Lwst=((G/eff)-ingvero)*Lcont     # Lipids to waste [g/d]
  Cwst=((G/eff)-ingvero)*Ccont     # Carbohydrates to waste [g/d]
  wst=cbind(Pwst,Cwst,Lwst)        # Output with waste values

  # Metabolism terms
  anab=assE*(1-alpha)                    # Net anabolism [J/d]
  catab=epsO2*k0*frT*(weight^n)*omega    # Fasting catabolism [J/d]
  metab=cbind(anab,catab)                # Output with metabolic rates

  # O2 and NH4 produced
  O2=catab/epsO2          # O2 consumed [g02/d]
  NH4=O2*0.06             # NH4 produced [gN/d]

  # Mass balance
  dw = (anab-catab)/epstiss # weight increment [g/d]

  # Function outputs
  output=list(dw,exc,wst,ing,ingvero,Tfun,metab, O2, NH4)
  return(output) # Bass_ind_equations output
}

Try the RAC package in your browser

Any scripts or data that you put into this service are public.

RAC documentation built on May 2, 2019, 3:26 a.m.