# From 'Local glutamate-glutamine cycling underlies presynaptic ATP homeostasis'
# implementation of the plain model of Table 3 (Equations 1 and 2), except for
# parameter kappa2, which has been multiplied by four, after which the model was 
# recalibrated accordingly (see text in section 3.3).
# Implementation by Reinoud Maex, University of Hertfordshire, UK,
# to be run with XPP (Bard Ermentrout).
#
# N.B. This code reproduces the red traces of Figure 4.
# 
# the static variables Pi and ADP
orthoP = 0.2 * (9 - ATP)
ADP = orthoP
#
# the stimulus (rectangular modulation of the workload w)
rect_pulse(t,from,to,amp) = amp * (heav (t-from) - heav (t-to))
w = 1 + rect_pulse(t,20,120,1.0)
#
# the differential equations, parameters kappa1 and kappa3 are now taken from Eqs. 6
PAG = w * k21/k22 / 0.6 * orthoP^2 * Gln
Krebs = 25 * (1.5 * k21/k22 + 1) * Pyr * Glu * orthoP * ADP / ATP
Glu' = PAG - k21/k22 * Glu * ATP
ATP' = Krebs - 0.5 * k21/k22 * Glu * ATP - w * ATP - PAG
#
# auxiliary variables for plotting: 
# workload, rate of ATP production, rate of ATPconsumption for Glu packaging, rate of Glu formation 
aux auxw = w
aux ATPprod = Krebs
aux ATPves = 0.5 * k21/k22 * Glu * ATP
aux Gluprod = PAG
#
# if needed, total ATP produced
ATPtot' = Krebs / 1000.0
# the constants (see Table 1)
param Pyr=0.04,Gln=0.4
# 
# the free parameter kappa2 (see Table 1 or Eqs. 8), here multiplied by 4
par k21=4,k22=30.5
# 
# the initial conditions
init Glu=1,ATP=1.5
#
@ total=220,dt=.01,xhi=10,maxstor=5000000
@ xp=t,yp=ATP,xlo=0,xhi=220,ylo=0,yhi=4
done