- Figure 1 (Concentrations): Run 'default' parameter set
The concentrations of all 6 compartments are
plotted as functions of time.
- Figure 2 (CC2_LOOP): Operators are Commutable:
Run 'default' parameter set with RUN LOOPS.
On 'Loops' page put a check mark under the 'OK' heading for
the first four parameters (VB1, VB2, VC1, VC2) then run loops
The output of the last serial tank is plotted when
the volumes are interchanged, i.e.
Run1 Run2
VB1 0.02 ml/g 0.03 ml/g
VB2 0.03 ml/g 0.07 ml/g
VC1 0.06 ml/g 0.02 ml/g
VC2 0.07 ml/g 0.06 ml/g
A comparison with Figure 1 (Conc plot page) will show different
concentrations in each compartment while the output concentration of last tank
does not change. For this model, swapping volumes for each compartment does not
change the system output.
- Figure 3 (AREAsTBARS): Run 'tbar' parameter set with RUN LOOPS.
On 'Loops' page put a check mark under the 'OK' heading for
the last parameter (AreaTbar). Confirm start value is '1' and
Other value is '@+1 then run 6 loops. Go to Text tab of Plot Page AREAsTBARS to see
tabular listing of values. The AreaTbar specifies where Cout
is taken, for AreaTbar = '1' then Cout is the output of compartment CA1,
'2' corresponds to CB1, etc... This example shows the relationship between
transit time and relative amount of the total substrate that passes through
the system.
/* MODEL NUMBER: 0118
MODEL NAME: Comp6_Recirc
SHORT DESCRIPTION: Six compartment model with flow, exchange, and recirculation.
*/
import nsrunit; unit conversion on;
math Comp6_recirc {
// INDEPENDENT VARIABLE
realDomain t sec; t.min=0; t.max=200; t.delta= 0.1;
// PARAMETERS:
real Fp = 0.01 ml/(g*sec), // Plasma flow per gram of tissue
Vp = 0.02 ml/g, // Plasma volume per gram of tissue
Visfp = 0.02 ml/g, // ISF volume per gram of tissue
PSg = 0.2 ml/(g*min), // Permeability-surface area product
clear = 0.0, // Fractional clearance 0 =< clear <= 1
VB1 = 0.02 ml/g, // Plasma volume per gram of tissue in B1
VB2 = 0.03 ml/g, // Plasma volume per gram of tissue in B2
VC1 = 0.06 ml/g, // Plasma volume per gram of tissue in C1
VC2 = 0.07 ml/g; // Plasma volume per gram of tissue in C2
// VARIABLES
real CA1(t) mM, CA2(t) mM, // Concentration in Vp, Visfp respectively
CB1(t) mM, CB2(t) mM, // Concentration in VB1 and VB2 respectively
CC1(t) mM, CC2(t) mM, // Concentration in VC1 and VC2 respectively
Creturn(t) mM; // Concentration returning to Vp after clearance
extern real Cin(t) mM; // Inflow concentration provided by function
// generator to volume B1 (not Vp!)
// INITIAL CONDITIONS:
when(t=t.min) { CA1 = 0; CA2 = 0;
CB1 = 0; CB2 = 0;
CC1 = 0; CC2 = 0; }
// ORDINARY DIFFERENTIAL EQUATIONS
// FIRST OPERATOR (A)
CA1:t = (Fp/Vp)*(Creturn-CA1) + (PSg/Vp)*(CA2-CA1); // Compartment with flow and
// exchange
CA2:t = (PSg/Visfp)*(CA1-CA2); // Compartment with only
// exchange
// SECOND OPERATOR (B)
CB1:t = (Fp/VB1)*(CA1 + Cin -CB1);
CB2:t = (Fp/VB2)*(CB1 -CB2);
// THIRD OPERATOR (C)
CC1:t = (Fp/VC1)*(CB2 -CC1);
CC2:t = (Fp/VC2)*(CC1 -CC2);
// CLEARANCE WITH REMAINDER TO FIRST OPERATOR
Creturn = (1.0-clear)*CC2;
// Additional Calculations
choice AreaTbar("CA1","CB1","CB2","CC1","CC2","Creturn")=5;
private real stat = AreaTbar;
private real Cout(t);
Cout = if(stat=1) CA1 else
if(stat=2) CB1 else
if(stat=3) CB2 else
if(stat=4) CC1 else
if(stat=5) CC2 else
if(stat=6) Creturn else 0;
// AREA AND TRANSIT TIME OF INFLOW AND OUTFLOW CONCENTRATIONS
private real S2_in(t) mM*sec^2, S2_out(t) mM*sec^2; // First moments
real Area_in(t) mM*sec, Area_out(t) mM*sec, // Areas
Tbar_in(t) sec, Tbar_out(t) sec, Tbar_sys(t) sec; // Transit times
when(t=t.min) {Area_in = 0; S2_in = 0;
Area_out = 0; S2_out = 0; }
Area_in:t = Cin;
Area_out:t = Cout;
S2_in:t = Cin*t;
S2_out:t = Cout*t;
Tbar_in = if(Area_in>0) S2_in /Area_in else 0;
Tbar_out = if(Area_out>0) S2_out/Area_out else 0;
Tbar_sys = if(Tbar_out>Tbar_in) Tbar_out-Tbar_in else 0;
}
/*
DIAGRAM:
CC2*(1-clear)
<----------<---------------------------<---------------<---------------<
Fp| OPERATOR 1 Cin OPERATOR 2 OPERATOR 3 |
| _________________ | ______ _______ _______ _______ ^
v |Vp CA1(t) | CA1 v |VB1 | |VB2 | |VC1 | |VC2 | |
Creturn -->| |--->(+)--->| CB1 |->| CB2 |----->| CC1 |->| CC2 |->|
| PSg | |_____| |_____| |_____| |_____|
| ^ |
--------|-------- FLOW = Fp ml/(g*min) -->
| v |
| |
|Visfp CA2(t) |
-----------------
DETAILED DESCRIPTION:
System is composed of 6 compartments, five of them in series, with one
in parallel. The system is divided into three operators with recirculation
as diagrammed. Exchange is allowed in only the first operator. The second
and third operators are each composed of two stirred tanks operators in series.
The input function, Cin, is positioned between the first and second
operators but could be positioned anywhere. A fractional clearance occurs
between the output of the third operator with the remainder recirculating
to the first operator.
This model can be used to explore the theory of John L.Stephenson,
Bull Math Biophys 10: 117-121, 1948.and Bull Math Biophys 22:1-17, 1960.
KEY WORDS:
compartment, compartmental, flow, first order process, recirculating, tutorial,
transit time, clearance, six compartment
REFERENCES:
John L.Stephenson, Bull Math Biophys 10: 117-121, 1948.
John L.Stephenson, Bull Math Biophys 22:1-17, 1960.
REVISION HISTORY:
Original Author : JBB Date: July/06
Revised by : GR Date: 12/23/09
Revision: 1) Update code and plots
Revised by : BEJ Date: 12/31/09
Revision: 1) Update comments
2) Add notes for plots
COPYRIGHT AND REQUEST FOR ACKNOWLEDGMENT OF USE:
Copyright (C) 1999-2009 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.
This software was developed with support from NIH grant HL073598.
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@bioeng.washington.edu.
*/