Figure 1: Concentrations: Default parameter set
This is a plot of the inflow concentration (black line),
outflow concentration (red line), and the concentration in
the interstitial fluid space (ISF) (blue line) as a function
of time.
Question 1. What event coincides with the peak of the curve
of the ISF concentration.
Figure 2: Quantity: Default parameter set
Quantity of material in the two compartments as a function
of time is calculated by two different methods:
Q(t) = Vp*Cp(t) + Visf*Cisf(t), and
/ t
Qintegral(t) = | Fp*(Cin(t')-Cout(t')) dt'
/ 0
and give the same result.
Figure 3: Areas: Fig_3 parameter set
PSc was set to zero and t.max to 60. The integrated inflow
(black) and outflow (red) concentrations are plotted as
functions of time. The difference is plotted in blue and
is equal to the Quantity of material in the system divided
by Fp.
Run loops to see how a positive value of PSc makes a large
change in the Area-out. It rises much more slowly.
Figure 4: Transit Times: Fig_4 parameter set
PSc was set to zero and t.max was set to 60 seconds. The
transit time of the inflow concentration is 5 seconds,
outflow concentration 8 seconds, and system transit time
is 3 seconds = Vp/Fp (expressed in seconds).
Set PSc to 1, t.max to 300, and run again. What happened to
the output transit time, Tbar_out?
Set PSc to 0.001 and run again. Explain what has happened.
Explain the difference between the estimated Tbar_sys (dashed
green line) and the apparent value of Tbar_sys (green solid
line.) Look at the area plots in Figure 3 on a log scale.
Although Area_out at 300 seconds is 99.9% of Area_in, not
enough time has elapsed to make the calculation based on
integrating concentration curves accurate.
Set t.delta = 10, and t.max = 100,000 and run again. This
should help explain the values of the previous run with
Psc=0.001 and t.max=300.
Figure 5: Optimization: Fig_5 parameter set
Figure 5 illlustrates fitting a model to noisy data.
The data was generated by
Cnoise=Cout*(1+.4*randomg()), using seed 2929,
with F=2.3 ml/(g*min), PSc=4 ml/(g*min), t.delta = 1 sec;
and the input function being the Gaussian probability density
function in the function generator with area=1, tMean=5, and
RD=0.3. The data was stored in data_1.
Assume the flow, Fp, and the exchange rate, PSc, are
unknown and optimize on both. Could both flow and the
exchange rate be calculated from this experiment? Note
that the RMS error is 0.0126. (The RMS error is in the
Optimization Report--use button in Optimization GUI.)
Now fix Fp to 2.3 ml/(g*min) (Uncheck the box for this
parameter after you have changed it.) Optimize on
PSc. The fit appears better even though the RMS error is
slightly higher, 0.0131.
Now optimize on both parameters again from this starting
point. The fit is substantially worse, but the RMS error
is the lowest so far.
What is necessary is to weight the data so that the
smallest values are as significant as the largest values.
In the Pwgt (point weight) box, replace the 1 with
if(Cout>0) 1/Cout else 0
This weighting effectively fits the data in the logarithm
space.
Answer (1): When the plasma concentration equals the
ISF concentration, the ISF concentration is at its maximum.
/*MODEL NUMBER: 0247
MODEL NAME: Comp2FlowExchange
SHORT DESCRIPTION: Two compartments, plasma and interstitial
fluid (ISF), with flow and exchange using physiological
names and units for parameters and variables. The model is
optimized to fit a data set.
*/
import nsrunit; unit conversion on;
math Comp2FlowExchange {
// INDEPENDENT VARIABLE
realDomain t sec; t.min=0; t.max=30; t.delta=0.1;
// PARAMETERS
real Fp = 1 ml/(g*min), // Plasma flow per gram of tissue
Vp = 0.05 ml/g, // Plasma volume per gram of tissue
Visf = 0.15 ml/g, // ISF volume per gram of tissue
PSc = 1 ml/(g*min), // Capillary wall permeability
// surface area product. The "c" in
// "PSc" stands stands for cleft, the
// gap between endothelial cells
Cp0 = 0 mM, // Initial concentration in plasma space
Cisf0 = 0 mM; // Initial concentration in ISF space
extern real Cin(t) mM; // Inflowing concentration in plasma
// VARIABLES
real Cp(t) mM, // Concentration in plasma space
Cisf(t) mM, // Concentration in ISF space
Cout(t) mM; // Outflow concentration, Cout = Cp.
// INITIAL CONDITIONS
when(t=t.min) {Cp = Cp0; Cisf = Cisf0; }
// ORDINARY DIFFERENTIAL EQUATIONS
Cp:t = (Fp/Vp)*(Cin-Cp) + (PSc/Vp)*(Cisf-Cp);
Cisf:t = (PSc/Visf)*(Cp-Cisf);
Cout = Cp;
//Additional Calculations
real Q(t) nmol/g,
Qintegral(t) nmol/g;
when (t=t.min) {Qintegral=Vp*Cp0+Visf*Cisf0;}
Q=Vp*Cp+Visf*Cisf;
Qintegral:t=Fp*(Cin-Cout);
// 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 = Tbar_out-Tbar_in;
// GENERATE NOISY DATA (noise is Gaussian)
real Cnoise(t) mM;
Cnoise=Cout*(1+.4*randomg());
}
/*
DIAGRAM:
F(flow) _____________________________
Cin(t) ---> | Cp(t)|---> Cout(t)=Cp(t)
| Vp(volume) |
| instantaneously well mixed |
| ^ |
|____________PS_______________|
| v |
| Visf(volume) Cisf(t)|
| instantaneously well mixed |
|_____________________________|
DETAILED DESCRIPTION:
A flow, Fp, carries an inflow concentration, Cin, into
a plasma compartment with volume Vp. The substance is
instantaneously well mixed. The material undergoes a passive
exchange with an interstitial fluid (ISF) space with volume
Visf. No reactions occur in this system.
For a constant concentration of inflowing material
the analytic steady state solution is Cp=Cin and Cisf=Cin if Psc
is positive.
Various methods for checking the
calculations in a model are illustrated: (1) comparison with an
analytic solution, (2) two methods of calculating the amount of
material in a compartment with flow, (3) comparison of the running
integrals of inflow and outflow concentrations, and (4) calculation
of the system transit time of a compartment model with flow by
two different methods.
The model parameters are optimized to fit a data set.
SHORTCOMINGS/GENERAL COMMENTS:
- None.
KEY WORDS: Course, compartment, compartmental, tutorial, flow, exchange,
multi-compartments, two compartments, data
REFERENCES: None.
REVISION HISTORY:
Revised by: BEJ Date:14aug13 : update copyright, key words
COPYRIGHT AND REQUEST FOR ACKNOWLEDGMENT OF USE:
Copyright (C) 1999-2013 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@physiome.org.
*/
0.0 4.858334062841125E-4 0.0029339831384477292 0.009737661663644214 0.051778213426783896 0.08075394927911614 0.15234308887573017 0.19752705118132863
0.07813564744145306 0.07153277349948331 0.04519351515315636 0.03393766346949604 0.04017048077797394 0.046206522647506326 0.04151520537845266 0.02844863361619528
0.034155284397127235 0.025146607202015333 0.022934939944386175 0.016568221541763687 0.006145340874614769 0.01170635000097858 0.007474437262503254 0.006809073065136258
0.0069096428484577786 0.008887813298083939 0.0018109001504601836 0.002734950698993983 0.004130621866439656 0.004443947571767826 0.00283176643851453 0.0019319259526856048
5.917410666424478E-4 0.0013269837935407144 9.909127903982616E-4 0.001310346644680827 5.659528761961872E-4 0.0012825967939334227 7.240962703374919E-4 0.0010194877474906346
1.855791862514878E-4 4.052728422831954E-4 2.5015530301067136E-4 5.3411157930859E-4 4.443215673190586E-4 3.657174432881684E-4 2.358921272611364E-4 1.3978943240310171E-4
1.8787513275484748E-4 2.4856747140646106E-4 1.2738080928337858E-4 1.7724184845536992E-4 9.171933212862799E-5 1.082590852564283E-4 4.281952629018784E-5 9.31461779762173E-5
3.216431031348813E-5 2.772232803609248E-5 3.407768882222002E-5 2.3758612975233894E-5 3.714514635025452E-5
0.0 3.792046150774857E-4 0.0029127974778494687 0.01417077904876247 0.04483835531677874 0.09355456835773648 0.13194292205817662 0.1323489253039352
0.10446639400793004 0.07599153701603494 0.05831530957199138 0.048112048213356476 0.040998573630025015 0.03521642496316819 0.03028954746784854 0.02605638916461771
0.022415218816938327 0.019282905815585522 0.01658830657684153 0.014270251724229483 0.012276122562108976 0.010560653595870575 0.009084904766041547 0.00781537751034057
0.006723254365551539 0.005783744829222063 0.004975522630975139 0.0042802416397039475 0.0036821194180377674 0.0031675789710286983 0.002724940556981681 0.0023441565647292955
0.0020165834392337537 0.0017347854783720169 0.0014923660472155945 0.0012838223784763024 0.0011044206631802378 9.500885962075646E-4 8.173229375500442E-4 7.031099909855143E-4
6.048571950857003E-4 5.203342737166404E-4 4.476226101854308E-4 3.850716958585429E-4 3.312616646629849E-4 2.849710630272551E-4 2.45149123666714E-4 2.1089191370357412E-4
1.8142181623325652E-4 1.5606987876346437E-4 1.3426062841764255E-4 1.1549900906631362E-4 9.93591438674758E-5 8.547466813286861E-5 7.353041308231425E-5 6.325525171264261E-5
5.4415944386971334E-5 4.681184444312703E-5 4.027034364188459E-5 3.464295406959225E-5 2.9801937556862612E-5