# Author: John Harrold <john.m.harrold@gmail.com>
#
# One compartment model with absorption compartment (At). The central
# compartment (Cp) had a volume (Vp). The model is parameterized in terms of
# micro constants (kel). 
#
# While the the default dosing is a 1 mg IV dose into the central compartment,
# the model is written to accept dosing into an absorption compartment and
# through continuous IV infusion.
#
#       _________ 
#      |         |
#      |   At    |
#      |         |
#      |_________|
#           |
#           | ka, fb
#           |
#           V
#       _________ 
#      |         |                   
#      |   Cp    |                  
#      |   Vp    |                  
#      |_________|                  
#           |
#           | kel 
#           |
#           V  
#
# System Units:
#                
#   mass          [=] mg 
#   volume        [=] ml
#   concentration [=] mg/ml
#   time          [=] hours


# #-------------#
# | Parameters  |
# #-------------#
#
# System parameters
#    name              value     lower      upper   units editable    grouping
#                                bound      bound

<P>  Vp                  1.0       eps        Inf   ml/hr      yes     System
<P>  kel                 1.0       eps        Inf   1/hr       yes     System
<P>  ka                  1.0       eps        Inf    1/hr      yes     System
<P>  fb                  1.0       eps        Inf   --         yes     System


# #-------------------#
# |Input Information |
# #-------------------#
#
# Bolus Events
# ------------
# # times/events state   values        scale      units
<B:times>;               [  0  ];      1;         hours
<B:events>;      Cp;     [1.0  ];      1/Vp;      mg     
<B:events>;      At;     [0.0  ];      1;         mg     

# Infusion Rate 
# ------------
# #  name     time/levels  values  scale    units
<R:Dinf>;     times;       [0];     1;    hours
<R:Dinf>;     levels;      [0];     1;    mg/hour

# #-----------------------------#
# | ODEs, and State Information |
# #-----------------------------#

<ODE:At> -ka*At           
<ODE:Cp>  ka*At*fb/Vp - kel*Cp + Dinf/Vp


# #---------#
# | Outputs |
# #---------#
 
<O> Cp_mg_ml    = Cp

# #---------#
# | Options #
# #---------#
# specify different time scales
<TS:hours> 1.0
<TS:days>  1.0/24
