/* MODEL NUMBER: 0234
MODEL NAME: CTEX20
SHORT DESCRIPTION: N compartments in series with Flow,
each compartment exchanging with a compartment in parallel,
modeling plasma and interstitial fluid regions.
*/
import nsrunit; unit conversion on;
math CTEX20 {
// INDEPENDENT VARIABLES
realDomain t sec ; t.min=0; t.max=30; t.delta=0.01;
realDomain N; N.min=1; N.delta=1; // private N.min, N.delta, N.ct;
real Ntank = 1;
private int iNtank = floor(Ntank); // non-integer values of Ntank -> lower integer
N.max = if(iNtank=1) 2 else iNtank;// N.max needed for the realDomain N
// PARAMETERS
real Fp = 1 ml/(g*min), // Flow per gram tissue
PSg = 1 ml/(g*min), // Permeability-Surface Area product for Clefts for N comps
Gp = 0 ml/(g*min), // plasma consumption rate coeff (Gulosity) for N isf comps
Gisf = 0 ml/(g*min), // isf consumption rate coeff (Gulosity) for N isf comps
Vp = 0.05 ml/g, // Total Volume for N plasma compartments
Visfp = 0.15 ml/g; // Total Volume for N isf compartments
real hVp ml/g, // Volume of each plasma compartment
hVisfp ml/g; // Volume of each isf compartment
hVp = if(Vp>0) Vp/iNtank else (1e-6 ml/g); //protects vs Vp = 0
hVisfp = if(Visfp>0) Visfp/iNtank else (1e-6 ml/g); //protects vs Visf = 0
real hPSg ml/(g*min), // PSg for each tank
hGp ml/(g*min), // Gp for each tank
hGisf ml/(g*min); // Gisf for each tank
hPSg = PSg/iNtank;
hGp = Gp/iNtank;
hGisf = Gisf/iNtank;
// INPUT FUNCTION
real Cinn(t,N) mM;
extern real Cin(t) mM;
// VARIABLES
real Cp(t,N) mM, Cisf(t,N) mM, Cout(t) mM; // Cout is concn at outflow
// INITIAL CONDITIONS
when(t=t.min) {Cp = 0; Cisf =0;}
Cinn = if(N=1) Cin else Cp(t,N-1) ;
// ORDINARY DIFFERENTIAL EQUATIONs (Applies to all tanks.)
hVp*Cp:t = Fp * (Cinn - Cp) + hPSg*(Cisf - Cp) - hGp*Cp; // Capillary plasma
hVisfp*Cisf:t = hPSg*(Cp - Cisf) - hGisf*Cisf; // Extravascular region
Cout = Cp(t,Ntank) ; // Outflow
// NOISY DATA
real Cnoise(t) mM;
Cnoise = Cout+.003*randomg(); // seed was 3756 (Solver Page)
} // END
/*
FIGURE:
Tank 1 Tank 2 Tank N
+---------+ +---------+ +---------+
Fp*Cin -> ->Fp*CP(1)-> -> .....->Fp*Cp(N-1)-> ->Fp*Cp(N)
| Cp(1) | | Cp(2) | | Cp(N) | =
| V/N | | V/N | | V/N | Fp*Cout
| Gp/N | | Gp/N | | Gp/N |
+---------+ +---------+ +---------+
^ ^ ^
| PSg | PSg | PSg
v v v
+---------+ +---------+ +---------+
| Cisf(1) | | Cisf(2) | | Cisf(N) |
| Visfp/N | | Visfp/N | | Visfp/N |
| Gisf/N | | Gisf/N | | Gisf/N |
+---------+ +---------+ +---------+
DETAILED DESCRIPTION:
N well stirred tanks (i.e. compartmental models with flow) representing
the capillary region are connected in series and exchange with N stagnant tanks
in parallel representing the interstitial fluid region.
SHORTCOMINGS/GENERAL COMMENTS: See Notes page for additional info.
KEY WORDS: CTEX20, BTEX20, Compartmental, Stirred Tanks, Tutorial
REFERENCES:
REVISION HISTORY:
Revised: GR Date: 08aug09
JBB 25nov09
BEJ:08jul15: Use corrected value for PSg for each tank, add consumption term (G)
COPYRIGHT AND REQUEST FOR ACKNOWLEDGMENT OF USE:
Copyright (C) 1999-2015 University of Washington. From the National Simulation Resource,
Director J. B. Bassingthwaighte, Department of Bioengineering, University of Washington, Seattle WA 98195-5061.
Academic use is unrestricted. Software may be copied so long as this copyright notice is included.
When citing JSim please use this reference: Butterworth E, Jardine BE, Raymond GM, Neal ML, Bassingthwaighte JB.
JSim, an open-source modeling system for data analysis [v3; ref status: indexed, http://f1000r.es/3n0]
F1000Research 2014, 2:288 (doi: 10.12688/f1000research.2-288.v3)
This software was developed with support from NIH grants HL088516 and HL073598, NIBIB grant BE08417
and the Virtual Physiological Rat program GM094503 (PI: D.A.Beard). Please cite this grant in any
publication for which this software is used and send an email with the citation and, if possible,
a PDF file of the paper to: staff@physiome.org.
*/