A Cardiovascular Simulator for Research 1.0.0

File: <base>/doc/manual.tex (113,618 bytes)
\documentclass[12pt]{article}
\usepackage{rawfonts}
\IfFileExists{times.sty}{\usepackage{times}}{\@missingfileerror{times}{sty}}
\usepackage{fullpage}
\usepackage{fancyheadings}
\usepackage{epsfig}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{cite}

\newcommand{\sect}[1]{\vspace{15pt}\noindent\textbf{#1}\vspace{15pt}}
% \setlength{\evensidemargin}{0in}
% \setlength{\oddsidemargin}{0in}
% \setlength{\topmargin}{.4in}
% \setlength{\textwidth}{6.5in}
% \setlength{\textheight}{9in}

\begin{document}

\thispagestyle{empty}

\mbox{}
\vfill
\begin{center}
\vspace{-.5in}
  {\bf \LARGE A Cardiovascular Simulator for Research \\
  \vspace{0.5in} User's Manual and Software Guide} \\
  \vspace{1.5in} {\bf \large Ramakrishna Mukkamala} \\ \vspace{0.5in}
  {\bf Harvard-MIT Division of Health Sciences and Technology \\
  Massachusetts Institute of Technology, Cambridge, MA, 02139} \\
  \vspace{0.5in} {\bf \today}
\end{center}
\vfill

\newpage

% \pagestyle{plain}
% \chead{\small\emph{{\it RCVSIM} User's Manual and Software Guide}}
% \lhead{} \setlength\headrulewidth{0pt}
% \rhead{} \setlength\headrulewidth{0pt}

\pagestyle{plain}
\tableofcontents

\newpage

\section{Introduction}

Computational  modeling  and  simulation  studies can  facilitate  the
advancement of  cardiovascular research by  complementing experimental
studies.  Through computational  studies, the researcher may formulate
hypotheses  which  may  be  subsequently tested  through  experimental
studies or  the researcher may  develop and evaluate  inverse modeling
algorithms  for determining  important cardiovascular  parameters from
experimental  data.    Experimental  studies,  in   turn,  permit  the
researcher  to construct  more accurate  computational  models thereby
improving the researcher's  understanding of the cardiovascular system
and ability to devise new experimental hypotheses and inverse modeling
algorithms.

The  general  aim  of  this  document is  to  introduce  the  Research
CardioVascular  SIMulator   ({\it  RCVSIM})  software   which  may  be
downloaded from  PhysioNet ({\it www.physionet.org})  -- an NIH-funded
national   research  resource   that   provides  well   characterized,
experimental data  sets and open-source  software for their  analysis. 
{\it  RCVSIM}  is capable  of  generating  reasonable human  pulsatile
hemodynamic waveforms, cardiac function  and venous return curves, and
beat-to-beat  hemodynamic  variability.  The  data  simulated by  {\it
  RCVSIM}  is  written   in  a  format  which  is   identical  to  the
experimental  data  sets.   As  such, the  open-source  data  analysis
software may  be readily applied to  the simulated data  as well.  The
data  generated  by {\it  RCVSIM}  may be  viewed  as  they are  being
calculated  (on-line  viewing)  or  any  time  after  they  have  been
calculated (off-line  viewing) with the WAVE display  system (which is
also provided by PhysioNet) and Gnuplot.  The {\it RCVSIM} software is
open-source and extensively commented and includes Linux binaries that
may be  executed at the  Linux or MATLAB  prompts.  It should  also be
possible to  compile the  source code to  create binaries that  may be
executed  on  Unix platforms  ({\it e.g.},  Solaris,  SunOS).  (Note  that
MATLAB is required  for compiling the source code.)   {\it RCVSIM} has
been   previously  employed   in  cardiovascular   research   for  the
development and  evaluation of system identification  methods aimed at
the  dynamical  characterization  of autonomic  regulatory  mechanisms
\cite{mukkamala2000, mukkamala2000b, mukkamala2000c}.

This document  specifically explains how  to install and use  the {\it
  RCVSIM} software and describes the  open-source code and each of its
functions so that {\it RCVSIM}  may be easily extended and modified by
the  researcher  to  achieve   his  desired  research  objective.   In
Section~\ref{sec-md},  a  brief  description  of  the  components  and
parameters of  the human cardiovascular  model is given.   (A detailed
description  may  be  found  in  \cite{mukkamala2000,  mukkamala2000a,
  mukkamala2000b}.)   In Section~\ref{sec-sc},  a  description of  the
source code  and an explanation of  how to alter it  are provided.  In
Section~\ref{sec-si},  detailed instructions on  software installation
and compilation  are outlined.  In  Section~\ref{sec-me}, instructions
on software  execution, including many examples,  are given.  Finally,
in Section~\ref{sec-re}, an example  illustrating how the software may
be utilized in cardiovascular research  is provided.  Note that if the
researcher is interested in executing the software but not editing it,
then he may skip Section~\ref{sec-sc} without loss of continuity.

\section{Human Cardiovascular Model}
\label{sec-md}

The  human  cardiovascular model  upon  which  {\it  RCVSIM} is  based
includes  three major  components.  The  first component  is  a lumped
parameter model  of the pulsatile  heart and circulation which  may be
implemented as  an intact  preparation, a heart-lung  unit preparation
designed  for  measuring  cardiac   function  curves,  or  a  systemic
circulation preparation  designed for measuring venous  return curves. 
The  second component is  a short-term  regulatory system  model which
includes an  arterial baroreflex system,  a cardiopulmonary baroreflex
system, and a direct neural coupling mechanism between respiration and
heart rate.   The final  component is a  model of  resting physiologic
perturbations  which  includes  respiration, autoregulation  of  local
vascular beds (exogenous disturbance to systemic arterial resistance),
and higher  brain center activity  impinging on the  autonomic nervous
system({\it 1/f} exogenous disturbance to heart rate).

\begin{figure}
  \centerline{\psfig{figure={epsfig/cvsim1.eps},width=6in,silent=1}}
  \caption{Electrical circuit analog of the intact human pulsatile
    heart and  circulation.  Each  box encompassing a  circuit element
    denotes a nonlinear element.}
    \label{fig:rcvsim}
\end{figure}

\subsection{Pulsatile Heart and Circulation}

The  lumped  parameter  model   of  the  intact  pulsatile  heart  and
circulation is illustrated in  Figure~\ref{fig:rcvsim} in terms of its
electrical circuit analog.  Here,  charge is analogous to blood volume
($Q$, ml), current, to blood flow rate ($\dot{q}$, ml/s), and voltage,
to pressure ($P$, mmHg).  The model consists of six compartments which
represent the  left and right  ventricles ($l, r$),  systemic arteries
and veins ($a, v$), and pulmonary arteries and veins ($pa, pv$).  Each
compartment  consists  of  a  conduit  for  viscous  blood  flow  with
resistance ($R$)  and a volume  storage element with  compliance ($C$)
and unstressed volume ($Q^0$).  Two  of the resistances and two of the
compliances  are   nonlinear.   The  systemic   venous  resistance  is
represented  by a  Starling  resistor (with  chamber  pressure set  to
atmospheric  pressure),  while the  pulmonary  arterial resistance  is
represented by an infinite number of parallel Starling resistors (with
chamber  pressure  equal   to  alveolar  ($alv$)  pressure),  arranged
vertically,   one  on   top   of  the   other.   The   pressure-volume
relationships  of  the  left   and  right  ventricles  consist  of  an
essentially linear regime  (characterized by compliance and unstressed
volume), a diastolic volume limit ($Q^{max}$), and a systolic pressure
limit  ($P^{max}$).   The compliances  of  the  linear  regime of  the
ventricular pressure-volume  relationship vary periodically  over time
(time   evolution  is  precisely   determined  by   the  end-diastolic
compliance ($ed$),  the end-systolic ($es$) compliance,  and the heart
rate ($F$))  and are responsible for  driving the flow  of blood.  The
four ideal diodes represent  the ventricular inflow and outflow valves
and  ensure  uni-directional   blood  flow.   Finally,  the  reference
pressure is  set to intrathoracic ($th$) pressure  for the ventricular
and pulmonary compartments.

\begin{figure}
  \centerline{\psfig{figure={epsfig/hlu.eps},width=6in,silent=1}}
  \caption{Electrical circuit analog of the human heart-lung unit
    preparation designed for  measuring cardiac function curves.  Each
    box encompassing a circuit element denotes a nonlinear element.}
    \label{fig:hlu}
\end{figure}

Figure~\ref{fig:hlu} illustrates the  electrical circuit analog of the
lumped parameter model of  the human heart-lung unit preparation.  The
input pressure to  the heart-lung unit here is defined  to be the node
labelled $P_{\text{``$ra$''}}(t)$  -- the location of  where the right
atrium would be if it  were explicitly included in the model.  Cardiac
function curves may  be obtained from this preparation  by varying the
independent voltage  sources, $P_a$ and $P_v$,  and time-averaging the
resulting $\dot{q}_l(t)$ and $P_{\text{``$ra$''}}(t)$.

Figure~\ref{fig:sc} illustrates  the electrical circuit  analog of the
lumped parameter model of  the human systemic circulation preparation. 
Venous  return  curves  may  be  measured  from  this  preparation  by
adjusting the value of  $C_r(t)$ at end-diastole ($C_r^{ed}$) in order
to  vary $P_{\text{``$ra$''}}(t)$  -- the  pressure that  impedes flow
into  the   right  ventricle  --  and   time-averaging  the  resulting
$\dot{q}_v(t)$   and    $P_{\text{``$ra$''}}(t)$.    Note   that   the
independent  current  source  here  ($\dot{q}_v(t)$)  keeps  the  mean
systemic ($ms$) pressure precisely constant throughout the measurement
period  by pumping into  the systemic  circulation whatever  is pumped
out.

\begin{figure}
  \centerline{\psfig{figure={epsfig/vrc1.eps},width=6in,silent=1}}
  \caption{Electrical circuit analog of the human systemic circulation
    preparation designed for measuring venous return curves.  Each box
    encompassing a circuit element denotes a nonlinear element.}
    \label{fig:sc}
\end{figure}

\subsection{Short-Term Regulatory System}

The arterial  baroreflex arc is implemented according  to the feedback
system illustrated in Figure~\ref{fig:abfs}.   This system is aimed at
tracking a setpoint ($sp$)  pressure through the following sequence of
events.  The  baroreceptors sense $P_a(t)$ and relay  this pressure to
the autonomic  nervous system (ANS).   The ANS compares  the deviation
between the sensed pressure and $P_a^{sp}$ with zero and then responds
by adjusting four parameters of the pulsatile heart and circulation in
order  to  keep  the  ensuing  $P_a(t)$  near  $P_a^{sp}$.   The  four
adjustable   parameters  are   $F(t)$,  $C_{l,r}(t)$   at  end-systole
($C_{l,r}^{es}(t)$), $Q_v^0(t)$, and $R_a(t)$.  The ANS controls these
parameters  based  on the  history  of $P_a(t)-P_a^{sp}$  specifically
according to the following nonlinear, dynamical mapping:
\begin{equation}
  \label{eq:effector}
  ap(t)=\int (G_pp(\tau)+G_ss(\tau))S\,{\rm arctan} \left(\frac{P_a(t-\tau)-P_a^{sp}}{S}\right)d\tau+ap^{sp},
\end{equation}
where $ap$  may represent any  of the four adjustable  parameters, the
arctan function  (which is parametrized  by the constant  $S$) imposes
arterial  baroreflex  saturation,  $p(t)$  and  $s(t)$  are  unit-area
effector   mechanisms   which   respectively   represent   the   fast,
parasympathetic limb of the ANS and the slower, sympathetic limb (both
$\alpha$-       and       $\beta$-sympathetic      sublimbs;       see
Figure~\ref{fig:spir}),  and $G_p$  and $G_s$  reflect  the respective
static gain values of the  effector mechanisms.  Note that in order to
map $F(t)$  to the  times of onset  of ventricular  contraction (which
amounts  to re-initiating  the variable,  ventricular  compliance time
evolution), an ``integrate and fire''  model of the sinoatrial node is
incorporated in the model.

\begin{figure}
  \centerline{\psfig{figure={epsfig/abfs1.eps},width=6in,silent=1}}
  \caption{Block  diagram  of  the  feedback  system
    depicting the arterial baroreflex arc.}
    \label{fig:abfs}
\end{figure}

The cardiopulmonary baroreflex arc  is also implemented according to a
feedback  diagram analogous  to  Figure~\ref{fig:abfs}.  However,  the
sensed  pressure here  is defined  to  be the  effective right  atrial
transmural                                                     pressure
($P_{\text{``$ra$''}}^{tr}(t)=P_{\text{``$ra$''}}(t)-P_{th}(t)$)     of
the pulsatile heart and circulation model.

\begin{figure}
  \centerline{\psfig{figure={epsfig/spir1.eps},width=4in,silent=1}}
  \caption{Unit-area effector mechanisms representing
    (a)  the fast,  parasympathetic limb  $p(t)$ and  (b)  the slower,
    sympathetic limb  $s(t)$.  These effector  mechanisms characterize
    the   dynamical  properties   of   the  block   labelled  ANS   in
    Figure~\ref{fig:abfs}.}
    \label{fig:spir}
\end{figure}

The  direct neural  coupling mechanism  between respiration  and heart
rate  is characterized  by a  linear, time-invariant  impulse response
which maps fluctuations in instantaneous lung volume ($Q_{lu}(t)$; see
Section~\ref{sec-rpp})  to   fluctuations  in  $F(t)$.    The  impulse
response is defined here by a linear combination of $s(t)$ and $p(t)$,
each of which  are advanced in time  by 1.5 s in order  to account for
the noncausality of this mechanism \cite{mukkamala1999, mullen1997}.

\subsection{Resting Physiologic Perturbations}
\label{sec-rpp}

Respiratory   activity,  which   may  either   be  at   fixed-rate  or
random-intervals   \cite{berger1989a},   is   modeled  in   terms   of
$Q_{lu}(t)$.   Fixed-rate   $Q_{lu}(t)$  is  represented   by  a  pure
sinusoid,  which  is  characterized  by  tidal  volume  ($Q_{t}$)  and
respiratory period  ($T_r$), as well  as a DC offset  representing the
functional reserve  volume of the lungs  ($Q_{fr}$).  Each respiratory
cycle of random-interval $Q_{lu}(t)$ is also represented by one period
of a sinusoid with the DC offset $Q_{fr}$.  However, the period is not
constant  here  but  rather  determined  based on  the  outcome  of  a
probability experiment  (which ranges  from one to  15 seconds  with a
mean  of five  seconds), and  the tidal  volume is  set such  that the
instantaneous  alveolar  ventilation rate  (which  considers the  dead
space in  the airways ($Q_{ds}$))  is identical to that  of fixed-rate
breathing.

In  order to  account for  the  mechanical effects  of $Q_{lu}(t)$  on
$P_{th}(t)$  and  $P_{alv}(t)$,   the  simple  model  of  ventilation,
illustrated in Figure~\ref{fig:rc} in  terms of its electrical circuit
analog, is also incorporated  in the model.  The electrical components
may be  interpreted similarly  to those in  Figure~\ref{fig:rcvsim} by
considering  air   here  rather  than  blood.    Hence,  the  resistor
($R_{air}$) may  be thought  of as a  conduit for airflow  between the
atmosphere and the lungs, while the capacitor may be interpreted as an
air  volume  container representing  the  lung  compartment, which  is
parametrized  by  an unstressed  volume  ($Q_{lu}^0$)  in addition  to
$C_{lu}$.

\begin{figure}
  \centerline{\psfig{figure={epsfig/rc.eps},width=3in,silent=1}}
  \caption{Electrical circuit analog of the human ventilatory
    mechanics model.}
    \label{fig:rc}
\end{figure}

The systemic effects  of the autoregulation of local  vascular beds is
represented with an exogenous disturbance to $R_a(t)$ which is defined
by  a  bandlimited Gaussian  white  noise  process.   This process  is
created  by convolving  Gaussian white  noise  of zero  mean and  {\it
  stdwr} standard deviation with a lowpass filter (truncated unit-area
sinc function) of desired  frequency cutoff ({\it fco}).  Higher brain
center  activity impinging  on the  ANS is  modeled with  a  {\it 1/f}
exogenous,  Gaussian disturbance  to  $F(t)$ convolved  with a  filter
defined  by  a   linear  combination  of  $s(t)$  ($\beta$-sympathetic
sublimb) and $p(t)$.  The {\it 1/f} Gaussian disturbance is created by
convolving Gaussian white noise of  zero mean and {\it stdwf} standard
deviation with  a unit-area filter of  {\it 1/f$^{\,alpha}$} magnitude
squared  frequency response  from $10^{-4}$  Hz  to 1  Hz, where  {\it
  alpha}  is set  to one.   Each of  these exogenous  disturbances are
treated as unobservable quantities.

\section{Source Code}
\label{sec-sc}

The {\it RCVSIM}  source code was written predominantly  in the MATLAB
language (version 5.3.1; R11.1) and includes some C language necessary
for on-line  viewing and parameter  updating.  The source code  may be
compiled  using  the MATLAB  compiler  (version  1.2)  with the  libc5
development     environment    at     the    MATLAB     prompt    (see
Section~\ref{sec-compile}).   Note that  compilation  permits software
execution  at the Linux  prompt {\it  and} greatly  improves execution
speed.  The  source code  not only consists  of code to  implement the
models  described in  Section~\ref{sec-md} but  also includes  code to
implement  other  models.  These  latter  models  have been  minimally
tested  and  documented  and  may  only  be  executed  in  the  MATLAB
environment.  A description of the code for implementing the models of
Section~\ref{sec-md}  and  an explanation  of  how  this  code may  be
modified   or  extended  to   implement  arbitrary   lumped  parameter
cardiovascular models are  provided below.  See Appendix~\ref{sec-usc}
for a  brief description of the  other models and the  source code for
executing them.

\subsection{Flowchart and Functions}
\label{sec-flowchart}

The source code is based on the MATLAB function {\it simulate.m}.  The
input  arguments to  {\it  simulate.m} include  the desired  parameter
values   characterizing  the  human   cardiovascular  model   and  its
execution, while the  outputs are the simulated data  -- all pressures
($P(t)$),  volumes ($Q(t)$),  flow  rates ($\dot{q}(t)$),  ventricular
elastances   $E(t)$,    adjustable   parameters   ($ap(t)$),   cardiac
function/venous   return    curves   ($numerics$),   and   ventricular
contraction times ($qrs$).  This function may also write the simulated
data to  file (with  a desired  prefix file name  also provided  as an
input argument)  and display  the data as  they are being  calculated. 
The  function is  responsible for  executing the  models  described in
Section~\ref{sec-md} as  well as in  Appendix~\ref{sec-usc}.  However,
the  flowchart   of  Figure~\ref{fig:fc}  depicts   how  the  function
simulates the  data from  the desired parameter  values characterizing
only  the models  of Section~\ref{sec-md}.   The pertinent  details of
each block of the flowchart are provided below.

\begin{figure}
  \centerline{\psfig{figure={epsfig/flowchart.eps},height=5.9in,silent=1}}
  \caption{Flowchart of the MATLAB function {\it simulate.m}.}
    \label{fig:fc}
\end{figure}

\begin{itemize}
\item  {\it Declaring  and  Initializing Variables  (t=0).}  With  the
  desired parameter  values provided as function  input arguments, all
  variables of the simulation are declared and initialized.  Memory is
  pre-allocated for all of the  data to be simulated over their entire
  integration  period in order  to increase  execution speed  with the
  MATLAB compiler.  The respiratory-related waveforms are pre-computed
  over the entire integration period.
\item  {\it  Numerical   Integration  for  Calculating  $P(t)$.}   The
  pressures  of   the  desired  model  of  the   pulsatile  heart  and
  circulation are  calculated at the current time  step ($t+T_s$) from
  the  pressures  at the  previous  time  step  ($t$) by  fourth-order
  Runge-Kutta  integration   of  the  set   of  ordinary  differential
  equations governing the  model.  $T_s$ must be set  to $\sim$0.005 s
  for reasonable accuracy.
\item   {\it  Adjusting   Parameters  by   Regulation/Perturbations.}  
  Parameters of  the pulsatile heart  and circulation are  adjusted by
  the   short-term   regulatory   system   and   resting   physiologic
  perturbations models.   Because of the  relatively narrow bandwidths
  of  these models,  the  parameter adjustments  are  calculated at  a
  sampling  period  of  0.0625  s.   First,  the  requisite  waveforms
  originally computed at a sampling period of $T_s$ are decimated to a
  sampling period of 0.0625 s by  averaging over the past 0.25 s every
  0.0625 s.  Then, the  mandated parameter adjustments are computed at
  a  sampling period  of 0.0625  s.  Finally,  the  mandated parameter
  adjustments are converted  to a sampling period of  $T_s$ via linear
  interpolation   (with   the   exception   of  the   adjustments   to
  $C_{l,r}^{es}$ which do not take  effect until the initiation of the
  next  ventricular contraction)  in order  to compute  the subsequent
  waveforms.
\item {\it Establishing qrs  via``Integrate and Fire.''}  The mandated
  changes to  $F(t)$ are mapped to  the times of  onset of ventricular
  contraction by integrating $F(t)$ (in  units of bps) over time until
  the  integral  is equal  to  one.   Then,  systole is  initiated  by
  resetting the variable, ventricular elastance model, the integral is
  set to zero, and the integration is repeated.
\item        {\it       Heart-Lung       Unit        or       Systemic
    Circulation?$\,\overset{yes}{\longrightarrow}\,$Varying      $P_v$,
    $P_a$,    $C_r^{ed}$    and   Averaging    $P_{\text{``ra''}}(t)$,
    $\dot{q}_v(t)$.}   Cardiac function  or venous  return  curves are
  generated, if desired.  Following  every fifth beat, $P_v$ and $P_a$
  are varied in  steps for generation of cardiac  function curves, and
  $C_r^{ed}$  is  varied  for  simulation  of venous  return  curves.  
  Time-averaged $P_{\text{``$ra$''}}(t)$  and $\dot{q}_v(t)$ and $P_a$
  (for cardiac  function curves) are recorded over  the beat preceding
  the step variation.
\item {\it  Calculating $Q(t)$ and  Storing $E(t)$ and  $ap(t)$.}  The
  blood  volumes of  each  compartment  of the  desired  model of  the
  pulsatile  heart and circulation  are computed  at the  current time
  step from the pressures at the  current time step, and the values of
  the ventricular elastances and  adjustable parameters at the current
  time step are stored into their pre-allocated memory slots.
\item                            {\it                           Intact
    Circulation?$\,\overset{yes}{\longrightarrow}\,$Correcting
    $Q_{tot}(t)$ by  Adjusting $P_v(t)$.}   Total blood volume  of the
  intact  pulsatile heart  and circulation  at the  current  time step
  ($Q_{tot}(t)$),  which  may  vary   due  to  integration  error,  is
  conserved.  The difference between the computed $Q_{tot}(t)$ and its
  assigned  value  is  added/removed  from $Q_v(t)$  and  $P_v(t)$  is
  altered accordingly.
\item                          {\it                          Parameter
    Updates?$\,\overset{yes}{\longrightarrow}\,$Conserving  $Q(t)$ and
    Documenting Updates.}  The parameter values of a simulation may be
  updated  after the  initiation  of each  ventricular contraction  by
  pausing the simulation, updating  the parameter values, and resuming
  the simulation.  The newly chosen parameter values are documented to
  file if they  are relevant to the current  simulation, and the blood
  volumes in each  compartment at the current time  step are conserved
  by adjusting the pressures at  the current time step (if necessary). 
  Adjustments to the respiratory-related waveforms are implemented for
  the remainder of the integration period.
\item {\it Calculating $\dot{q}(t)$.}  The flow rates of the pulsatile
  heart and circulation models are calculated at the current time step
  from the pressures at the current time step.
\item {\it On-Line Viewing?$\,\overset{yes}{\longrightarrow}\,$Writing
    Waveforms                to               MIT               Format
    Files$\,\overset{yes}{\longrightarrow}\,$Displaying   Waveforms.}  
  When  viewing  simulated data  as  they  are  being calculated,  the
  waveforms are  periodically written  to file in  MIT format  (with a
  desired  period).   The  newly  written data  are  then  immediately
  displayed with WAVE.
\end{itemize}

\noindent 
The  flow of  each of  the blocks  is then  repeated starting  at {\it
  Numerical  Integration for Calculating  $P(t)$} with  $t=t+T_s$.  In
order to execute  the blocks in the flowchart,  {\it simulate.m} calls
upon many MATLAB and C  functions, each of which are briefly described
below.

\begin{itemize}
\item  {\it  intact\_init\_cond.m}  computes  the  initial  pressures,
  volumes,  and   flow  rates  of  the  intact   pulsatile  heart  and
  circulation model  from the  desired parameter values.   The initial
  values  are determined  from  the  solution of  a  linear system  of
  equations  which are  derived from  the application  of steady-state
  conservation laws to a linearized version of the model.
\item {\it hlu\_init\_cond.m} computes the initial pressures, volumes,
  and flow  rates of  the heart-lung unit  preparation model  from the
  desired parameter  values.  The  initial values are  determined from
  the solution of a linear  system of equations which are derived from
  the application  of steady-state  conservation laws to  a linearized
  version of the model.
\item {\it sc\_init\_cond.m}  computes the initial pressures, volumes,
  and flow  rates of the  systemic circulation preparation  model from
  the  desired parameter  values.  The  initial values  are determined
  from the solution of a  linear system of equations which are derived
  from  the  application  of   steady-state  conservation  laws  to  a
  linearized version of the model.
\item {\it  rk4.m} computes the  pressures of the pulsatile  heart and
  circulation  (any preparation)  at the  current time  step  from the
  pressures  of the  previous time  step,  the current  values of  the
  parameters, respiratory-related waveforms, and time surpassed in the
  current   cardiac  cycle   according  to   fourth-order  Runge-Kutta
  integration.
\item {\it  intact\_eval\_deriv.m} is called  only by {\it  rk4.m} and
  computes  the   derivative  of   the  intact  pulsatile   heart  and
  circulation  pressure  values  at  a  desired  time  step  which  is
  necessary for the fourth-order Runge-Kutta integration.
\item  {\it hlu\_eval\_deriv.m}  is  called only  by  {\it rk4.m}  and
  computes the derivative of  the heart-lung unit preparation pressure
  values  at  a   desired  time  step  which  is   necessary  for  the
  fourth-order Runge-Kutta integration.
\item  {\it  sc\_eval\_deriv.m} is  called  only  by  {\it rk4.m}  and
  computes  the  derivative of  the  systemic circulation  preparation
  pressure values  at a desired time  step which is  necessary for the
  fourth-order Runge-Kutta integration.
\item {\it  var\_cap.m} is also called  by {\it intact\_eval\_deriv.m,
    hlu\_eval\_deriv.m,   and   sc\_eval\_deriv.m}   and  computes   a
  ventricular elastance value  as well as its derivative  at a desired
  time step from the current values of $C_{l,r}^{es}$, $C_{l,r}^{ed}$,
  the previous  cardiac cycle  length, and the  time surpassed  in the
  current cardiac cycle.
\item {\it vent\_vol.m} is  also called by {\it intact\_eval\_deriv.m,
    hlu\_eval\_deriv.m,   and  sc\_eval\_deriv.m}  and   computes  the
  current  ventricular  blood  volume  from  the  current  ventricular
  pressure according  to Newton's search method with  an initial guess
  given by the previous ventricular blood volume.
\item  {\it  rand\_int\_breath.m} computes  the  time  until the  next
  respiratory cycle  commences based on the outcome  of an independent
  probability experiment.
\item  {\it resp\_act.m}  computes  the respiratory-related  waveforms
  ($Q_{lu}(t)$,      $P_{th}(t)$,     $\frac{dP_{th}(t)}{dt}$,     and
  $P_{alv}(t)$) over the entire  integration period from the parameter
  values and the times of commencement of each respiratory cycle.
\item  {\it ilv\_dec.m}  decimates  $Q_{lu}(t)$ to  a sampling  period
  equal to  0.0625 s.  This  decimated waveform is convolved  with the
  filter  created  by  {\it  dncm\_filt.m}  (see below)  in  order  to
  establish  the  changes in  $F(t)$  mandated  by  the direct  neural
  coupling mechanism.
  \item {\it dncm\_filt.m} generates a filter which characterizes the
    direct neural coupling mechanism between $Q_{lu}(t)$ and $F(t)$.
  \item  {\it bl\_filt.m}  generates a  lowpass filter  with  a narrow
    transition band (truncated sinc function of unit-area) and desired
    cutoff  frequency which  is  utilized to  bandlimit the  exogenous
    disturbance to $R_a$.
  \item  {\it  oneoverf\_filt.m}  generates   a  filter  with  a  {\it
      1/f$^{\,alpha}$}  magnitude-squared  frequency  response over  a
    desired  frequency range (in  decades) and  at a  desired sampling
    period (see below).
  \item  {\it  ans\_filt.m}  creates   a  filter  which  is  a  linear
    combination of  $s(t)$ and $p(t)$.  This filter  is convolved with
    the  filter generated  by  {\it oneoverf\_filt.m}  and then  white
    noise in order to create the exogenous disturbance to $F(t)$.
  \item {\it  abreflex.m} computes the  parameter adjustments mandated
    by the  arterial baroreflex system  based on the  current setpoint
    and static gain values.
  \item {\it  cpreflex.m} computes the  parameter adjustments mandated
    by  the cardiopulmonary  baroreflex  system based  on the  current
    setpoint and static gain values.
  \item {\it param\_change.m} determines whether the parameter updates
    are relevant to the status  of the current simulation based on the
    current parameter  values, the previous parameter  values, and the
    status parameters (see Section~\ref{sec-pf}).
  \item {\it  conserve\_vol.m} computes  the pressures at  the current
    time  step  necessary  to   conserve  the  blood  volume  in  each
    compartment  at the current  time step  when parameter  values are
    updated.
  \item {\it read\_param.m} reads a file which contains the parameters
    values of the cardiovascular model and its execution in a specific
    format and stores the values in a MATLAB vector.
  \item  {\it  read\_key.c}  reads  the  standard  input,  pauses  the
    simulation  if a ``p''  is entered  followed by  $<$RETURN$>$, and
    resumes  the  simulation  if   a  ``r''  is  entered  followed  by
    $<$RETURN$>$.
  \item {\it write\_param.c}  copies the parameter file to  a new file
    of the same name but with the extension {\it .num}.  This function
    is implemented when the parameter update occurs.  The extension is
    set equal to  the number of parameter updates  that have been made
    during the simulation period.
  \item {\it wave\_remote.c} plots the desired simulated waveforms and
    annotations with the WAVE display system.  This function is called
    when  the simulated data  are written  to file  in MIT  format and
    plots the most recent desired window of written data.
\end{itemize}

The function  {\it simulate.m}  is called by  a wrapper  function {\it
  rcvsim.m} for execution at  the Linux prompt.  This wrapper function
takes two command line arguments: 1) the name of a file containing the
desired parameter values and 2) the prefix name of the output files to
be generated in  MIT format.  The function {\it  rcvsim.m}, which also
includes  a  help  option,  reads  in the  parameter  file  with  {\it
  read\_param.m}  (see above), creates  a header  file in  MIT format,
executes  {\it simulate.m}, writes  the simulated  data to  MIT format
files  if the  on-line  viewing  option is  not  chosen, and  displays
cardiac  function  and venous  return  curves,  if  desired, with  the
function  {\it plot\_cfvr.c}  (which  employs Gnuplot).   In order  to
execute {\it  rcvsim.m}, the function  must be compiled with  the file
{\it make.m} which creates the binary file {\it rcvsim}.  The function
{\it simulate.m} may also  be compiled independently of {\it rcvsim.m}
with  the  file {\it  makem.m}  which  creates  the binary  file  {\it
  simulate.mexlx}  (in the  Linux  environment).  Each  of these  make
files greatly  improve execution speed specifically  through {\it mcc}
(MATLAB compiler)  optimization arguments {\it r}  (real numbers only)
and  {\it   i}  (no  dynamic  memory  allocation).    Note  that  {\it
  simulate.m} may  only be executed in the  MATLAB environment without
on-line viewing and parameter updating capabilities.

\subsection{Modifications and Extensions}

Although  the human cardiovascular  model upon  which {\it  RCVSIM} is
based  accounts  for  a  wide  variety of  hemodynamic  behaviors,  it
certainly cannot address arbitrary cardiovascular research objectives.
For example, if  the researcher is interested in  analyzing how stroke
volume is compromised  at very high heart rates  ($>\,\sim$150 bpm) in
the absence  of cardiovascular regulation, the model,  as described in
Section~\ref{sec-md}, would not be adequate because contracting atrial
compartments  are  not  explicitly   included.   In  such  cases,  the
researcher may  utilize the  {\it RCVSIM} source  code as a  basis for
facilitating  the  construction  of  a  model which  can  address  his
research objective.  An  outline of the major steps  necessary for the
researcher to  create different  lumped parameter pulsatile  heart and
circulation models and add new bandlimited regulatory systems ({\it e.g.},
arterial chemoreflex)  and resting physiologic  perturbations ({\it e.g.},
central oscillator) is provided below.  Note that additional steps may
also be necessary depending upon the particular extension.

\begin{itemize}
\item  Creating lumped  parameter models  of the  pulsatile  heart and
  circulation.
  \begin{enumerate}
  \item Name  the new lumped  parameter model ({\it  preparation}) and
    assign  a  unique number  to  it.  This  number  will  be used  in
    conditional statements which must be added to the code in order to
    distinguish the desired preparation  to be executed from the other
    possible preparations  (see, for  example, the {\it  rk4.m} source
    code).
  \item Extend the  MATLAB parameter vector ({\it th})  to include any
    additional, necessary parameters.  Add  the new parameters (in the
    correct format) to the  parameter file (see Section~\ref{sec-pf}). 
    Expand the function {\it read\_param.m}  so that it can read these
    new parameters.  If the researcher would like to implement the new
    preparation   in  the  MATLAB   environment,  the   function  {\it
      header\_def.m}   must   also   be   altered   accordingly   (see
    Appendix~\ref{sec-usc}).
  \item  Create a function  called {\it  preparation\_init\_cond.m} to
    generate  the initial  pressures, volumes,  and flow  rates.  Call
    this newly created function at  the same point in {\it simulate.m}
    as the function call for {\it intact\_init\_cond.m}.
  \item Create  a function called  {\it preparation\_eval\_deriv.m} to
    calculate the derivative of the  pressure values at a desired time
    step.  Call this newly created function from {\it rk4.m} analogous
    to the function calls for {\it intact\_eval\_deriv.m}.
  \item Add code  for calculating volumes and flow  rates at the point
    in {\it simulate.m} in which  these waveforms are computed for the
    other preparations.
  \item If necessary, pre-allocate additional memory for the simulated
    data in  {\it simulate.m},  expand matrices to  be written  in MIT
    format in {\it simulate.m} and {\it rcvsim.m}, and extend code for
    generating the MIT format header file in {\it rcvsim.m}.
  \item  Adjust parameter  update code  in {\it  simulate.m} including
    {\it conserve\_vol.m}.
  \item     Add    {\it     preparation\_init\_cond.m}     and    {\it
      preparation\_init\_cond.m} to  the make files  ({\it make.m} and
    {\it makem.m}) and recompile the code. \vspace{0.5in}
  \end{enumerate}
\item Adding  {\it bandlimited} regulatory  system/resting physiologic
  perturbation.
  \begin{enumerate}
  \item   Name   the   new   regulatory   system/resting   physiologic
    perturbation.  This  name will serve as a  flag indicating whether
    the new  addition is  to be activated  or not.  The  MATLAB vector
    {\it flag} at the start  of {\it simulate.m} should be extended to
    incorporate this name.
  \item Extend the  MATLAB parameter vector ({\it th})  to include any
    additional, necessary parameters.  Add  the new parameters as well
    as the new flag name (in the correct format) to the parameter file
    (see    Section~\ref{sec-pf}).    Expand    the    function   {\it
      read\_param.m} so that it can read these new parameters and flag
    name.  If the researcher would  like to implement the new model in
    the MATLAB environment, the function {\it header\_def.m} must also
    be altered accordingly (see Appendix~\ref{sec-usc}).
  \item Initialize  the necessary variables  at the beginning  of {\it
      simulate.m}.
  \item  Create a  function  to  compute the  mandated  change to  the
    adjustable parameter.  Call this function every 0.0625 s.  If this
    function  requires  a  simulated  waveform  as  input,  then  this
    waveform must be averaged over  the previous 0.25 s every 0.0625 s
    prior to the function call.
  \item If  a parameter other  than $F(t)$, $R_a(t)$,  $Q_v^0(t)$, and
    $C_{l,r}^{es}(t)$ is  adjusted, then  the following steps  must be
    undertaken:
    \begin{enumerate}
    \item Pre-allocate additional  memory for the adjustable parameter
      matrix {\it ap} in {\it simulate.m}.
    \item Expand the  {\it thc} vector in {\it  simulate.m} to include
      the new parameter to be adjusted.
    \item Linearly interpolate the newly adjustable parameter.
    \item Assign  the mandated  adjustment to the  {\it ap}  matrix in
      {\it simulate.m}.
    \item Expand  the {\it ap} matrix  to be written in  MIT format in
      {\it simulate.m} and {\it rcvsim.m}.
    \item  Adjust  the  parameter  update  code  in  {\it  simulate.m}
      accordingly.
    \item Extend  code for  generating the MIT  format header  file in
      {\it rcvsim.m} to include the newly adjustable parameter.
    \end{enumerate}
  \item Add the new function to  the make files ({\it make.m} and {\it
      makem.m}) and recompile the code.
  \end{enumerate}
\end{itemize}

\section{Software Installation and Compilation}
\label{sec-si}

The researcher  may download the {\it RCVSIM}  software from PhysioNet
and install and execute the  pre-compiled binaries provided that he is
running Linux.   If the researcher also  has access to  MATLAB and its
compiler (version 1.2), then he  may modify and extend the source code
as  he  wishes  and  then   recompile  it  to  create  new  binaries.  
Alternatively,  if the  researcher is  running any  other  platform in
which  the WAVE display  system is  fully supported  ({\it e.g.}, Solaris,
SunOS) and  has access  to the MATLAB  compiler (version 1.2),  he may
compile the  source code and install  and execute the  new binaries on
that platform.  (The  binaries created for such platforms  may then be
uploaded  to  PhysioNet so  that  they  may  be distributed  to  other
researchers  who  do  not   own  MATLAB.)   Detailed  instructions  on
installing  the {\it  RCVSIM}  binaries (and  required libraries)  and
compiling the source code are provided below.

\subsection{Installation}
\label{sec-install}

The installation steps that the  researcher must carry out in order to
execute the {\it RCVSIM} pre-compiled Linux binaries are as follows:

\begin{enumerate}
\item  Download  the file  {\it  rcvsim.tar.gz}  from the following
  web page: \\ {\it http://www.physionet.org/physiotools/rcvsim}
\item Type the following commands at the Linux prompt: \\
  {\it tar xvzf rcvsim.tar.gz} \\
  {\it cd rcvsim}
\end{enumerate}

The  contents of  this directory  --  henceforth referred  to as  {\it
  \$DIR} -- are as follows:

\begin{itemize}
\item  {\it README.}  This  text file  includes a  brief introduction,
  references   to  the   {\it  INSTALL}   file  and   the   {\it  doc}
  sub-directory, and basic execution and compilation instructions.
\item {\it INSTALL.}  This text file explains how to install/uninstall
  the {\it RCVSIM}  software on Linux or other  platforms in which the
  WAVE display system is fully supported.
\item {\it install.}  This shell, executable script automates some, or
  all, of the installation process.
\item {\it  uninstall.}  This shell, executable script  is designed to
  undo what was done by the {\it install} script.
\item  {\it src.}   This sub-directory  includes all  the  source code
  described in  Section~\ref{sec-flowchart} and Appendix~\ref{sec-usc}
  as  well  as two  other  C  files  ({\it check\_redhat.c}  and  {\it
    check\_wfdb.c}) which  are required by the {\it  install} and {\it
    uninstall}  shell  scripts.   The  Linux and  MATLAB  pre-compiled
  binaries  ({\it rcvsim}  and {\it  simulate.mexlx}) are  also stored
  here.
\item {\it  bin.}  This  sub-directory includes parameter  files, {\it
    parameters.def} and  {\it header\_def.m} (see Section~\ref{sec-pf}
  and  Appendix~\ref{sec-usc}), which  are  respectively required  for
  execution  at the  Linux and  MATLAB prompts,  a {\it  wfdbcal} file
  responsible for  scaling the simulated waveforms  displayed by WAVE,
  and the two binaries, {\it check\_redhat} and {\it check\_wfdb}.
\item {\it  lib.}  This sub-directory consists of  libraries which are
  required for  executing the  binaries.  These libraries  include the
  dynamic  MATLAB libraries  which  permit software  execution in  the
  absence of  MATLAB, two RPMs  containing libc5 libraries and  an old
  ld.so dynamic linker (part of  the Redhat 6.2 distribution which are
  necessary for  dynamically linking the MATLAB libraries),  and a tar
  file consisting of the WFDB software package (version 10.1.6).
\item {\it  doc.}  This sub-directory  includes this very  document in
  HTML, PDF ({\it manual.pdf}), PostScript ({\it manual.ps}) and LaTeX
  source  ({\it manual.tex}) formats.
\end{itemize}

\begin{enumerate} \setcounter{enumi}{2}
\item Login as root.
\item  Download and  install the  WFDB software  package and  the WAVE
  display  system,  if  this  has  not already  been  done.   See  the
  following       web      page      for       instructions:   \\
     {\it http://www.physionet.org/physiotools/wfdb-linux-quick-start.shtml}
\end{enumerate}

\noindent If the researcher is running Linux Redhat 6.2 or higher,
then

\begin{enumerate} \setcounter{enumi}{4}
\item Type the following command in the {\it \$DIR} directory: \\
  {\it ./install}
\end{enumerate}

\noindent The results of Step 5. are as follows:
\begin{itemize}
\item  The  WFDB  Software   Package  (version  10.1.6)  in  the  {\it
    \$DIR/lib}  directory will be  installed, if  an older  version is
  currently installed.
\item The  libc5 libraries  and old ld.so  dynamic linker RPMs  in the
  {\it \$DIR/lib} directory will also be installed.  (Note that recent
  Linux systems use libc and a  new linker but will not be affected by
  the installation of the older libraries and linker.)
\item An  {\it rcvsim} executable shell  script will be  placed in the
  {\it \$DIR/bin}  directory.  This script  sets the library  and WFDB
  paths   for   its   subsequent   execution  of   the   binary   {\it
    \$DIR/src/rcvsim}   and   is   linked   to  the   directory   {\it
    /usr/local/bin} which should already be in the researcher's path.
\item The MATLAB binary executable {\it simulate.mexlx} will be linked
  to a directory in the MATLAB path, if MATLAB is present.
\end{itemize}

\noindent Or, if the researcher is  running Linux Redhat  6.1 or lower  or any
other Linux distribution ({\it e.g.}, Suse, Debian), then

\begin{enumerate} \setcounter{enumi}{4}\renewcommand{\theenumi}{\arabic{enumi}a}
\item  Acquire  and install  the  necessary  libc5  libraries and  old
  dynamic linker, if they are not currently present on the system.
\end{enumerate}
\begin{enumerate} \setcounter{enumi}{4}\renewcommand{\theenumi}{\arabic{enumi}b}
\item Type the following command in the {\it \$DIR} directory: \\
  {\it ./install}
\end{enumerate}

\noindent For RPM-based  distributions  ({\it e.g.},
Mandrake), the  software required for Step  5a.  may be  found on {\it
  rpmfind.net} as was the case  for the RPMs provided in the directory
{\it \$DIR/lib}.  Please see the following web
pages: \\
{\it http://www.rpmfind.net/linux/rpm2html/search.php?query=ld.so} \\
{\it http://www.rpmfind.net/linux/rpm2html/search.php?query=libc} \\
Note that the results of Step 5b. differ from those of Step 5. in that
the RPMs of {\it \$DIR/lib} will {\it not} be installed.

\begin{enumerate} \setcounter{enumi}{5}
\item To undo the {\it install} script, type the following command in
  the {\it \$DIR} directory: \\
  {\it ./uninstall}
\end{enumerate}
\noindent 
This will undo everything done  by {\it install} except the removal of
the  WFDB Software  Package (version  10.1.6), if  it were  installed. 
This software  can be removed manually  (read INSTALL file  in the tar
file  {\it wfdb-10.1.6.tar.gz}  which  is located  in the  {\$DIR/lib}
directory).

\subsection{Compilation}
\label{sec-compile}

If the  researcher is  running Linux and  wishes to  modify/extend the
{\it RCVSIM}  source code or if  the researcher would like  to run the
{\it  RCVSIM} software  on another  platform  in which  WAVE is  fully
supported,  then  compilation is  necessary.   The  steps required  to
compile the source code are are as follows:

\begin{enumerate}
\item Acquire and install MATLAB with the MATLAB compiler (version
  1.2), if they are not currently available.
\item Establish a libc5 development environment.  See the following
  web page for detailed instructions: \\ 
   {\it http://www.mathworks.com/support/solutions/data/11129.shtml}
\item Launch MATLAB from the {\it \$DIR} directory.
\item At the MATLAB prompt, execute the following commands: \\
  {\it cd src} \\
  {\it make} \\
  {\it makem}
\end{enumerate} 
\noindent
By implementing these steps in the Linux environment, new {\it rcvsim}
and  {\it  simulate.mexlx}  binaries  will  be  created  in  the  {\it
  \$DIR/src} directory.  If the {\it RCVSIM} software has already been
installed, then re-installation  is unnecessary after compilation.  On
platforms other than Linux, the  above steps must be carried out prior
to software installation on platforms other than Linux.  Additionally,
the  {\it install}  and {\it  uninstall}  scripts in  the {\it  \$DIR}
directory  need  to be  slightly  modified  in  order to  include  the
different  MATLAB  binary  file   extension  name  that  results  from
compiling  on a different  platform.  For  example, if  compilation is
achieved  on the Solaris  platform, {\it  simulate.mexlx} in  the {\it
  install}  and  {\it  uninstall}  files  must be  replace  with  {\it
  simulate.mexsol}  as the  latter file  will be  created in  the {\it
  \$DIR/src}  directory.  Then,  the newly  compiled software  may be
installed according to the previous section.

Note that  it is possible to  compile the source code  with the latest
MATLAB compiler  (version 2.1).  However, the  binaries generated from
this compiler are  on the order of three  magnitudes {\it slower} than
those generated with the  MATLAB compiler (version 1.2).  Mathworks is
currently trying to improve the latest compiler, so it may be possible
in the future to use this compiler.

\section{Software Execution}
\label{sec-me}

The  researcher may  view and  record  data simulated  from the  human
cardiovascular  model  of  Section~\ref{sec-md}  by running  the  {\it
  rcvsim} executable file at  the Linux prompt.  Detailed instructions
explaining how  to execute this  file including several  examples, are
provided  below.   Execution of  {\it  simulate.mexlx}  at the  MATLAB
prompt  is touched  upon in  Appendix~\ref{sec-usc}.  (Note  that this
section requires  some familiarity with the WAVE  display system which
may be acquired by either typing {\it more /usr/help/wave/wave.hlp} at
the   Linux    prompt   or   visiting   the   web    page:   \\   {\it
  http://www.physionet.org/physiotools/wug/}.)

\subsection{Help Option}
\label{sec-help}

A  help  option  may  be  implemented  by  running  the  {\it  rcvsim}
executable with the single argument  {\it -h} at the Linux prompt
(that  is,  {\it rcvsim  -h};  see  Figure~\ref{fig:help}).  The  help
option provides  a description  of the major  components of  the human
cardiovascular model, command  line arguments, generated output files,
and on-line viewing options.

\begin{figure}
  \centerline{\psfig{figure={epsfig/help.eps},width=4in,silent=1}}
  \caption{Results of executing the {\it rcvsim} help option at the Linux prompt.}
    \label{fig:help}
\end{figure}

According  to  the  help  option,  the executable  file  requires  two
arguments at the  command line in order to  simulate hemodynamic data. 
The first argument must be the name of a file in the current directory
which contains  the desired parameter values  characterizing the human
cardiovascular model and its execution.  This is the working parameter
file  which   may  be  updated  during  the   simulation  period  (see
Section~\ref{sec-pf}).  The second argument must be the desired prefix
name of the output files to be generated by the model.

By executing {\it  rcvsim} with these two arguments,  three MIT format
files are  always generated in  the current directory  with extensions
{\it .dat},  {\it .qrs},  and {\it  .hea}.  The {\it  .dat} file  is a
binary (shorts) file consisting of all of the generated waveforms; the
{\it  .qrs} file  is a  binary  file consisting  of annotations  which
include the times of onset  of ventricular contractions as well as any
parameter updates;  and the  {\it .hea} file  is an ASCII  header file
necessary for reading, viewing, and  analyzing the {\it .dat} and {\it
  .qrs} files with the  open-source software provided by PhysioNet.  A
fourth file with  the extension {\it .txt} may  also be generated when
the heart-lung unit preparation or systemic circulation preparation is
implemented.   This   file  is  in  ASCII,   multi-column  format  and
constitutes the  simulated cardiac function  or venous return  curves. 
In order to document fully the simulation, the {\it rcvsim} executable
also saves  the working parameter  file in the current  directory each
time it is updated.  The name  of the saved files is the first command
line argument with  the extension {\it .num} which  denotes the number
of parameter updates that have been made during the simulation period.
The name of  each saved file is also recorded  in the annotation files
at the time in which the parameters were updated.  At the beginning of
the simulation, the {\it  rcvsim} executable saves the initial working
parameter file  with extension {\it  .0} to the current  directory.

The {\it rcvsim} executable also permits the simulated waveforms (as a
function of time)  to be viewed as they  are being calculated (on-line
viewing)  through the  WAVE  display system.   The  simulation may  be
paused  during on-line viewing  by simply  entering ``p''  followed by
$<$RETURN$>$ at  the standard input.   Once the simulation  is paused,
any and all of the following three actions may be carried out.  1) All
the data that have  been generated up to the time of  the pause may be
scrolled through with the arrow buttons at the top of the WAVE display
system.  2)  Plots of  one generated waveform  against another  may be
displayed by clicking  the File button at the top  of the WAVE display
system  (with  the right  mouse  button),  and  then clicking  on  the
Analyze...   option followed  by the  VCG button  (both with  the left
mouse button).  The  first two waveforms appearing in  the Signal List
(first  waveform is  plotted on  x-axis  and the  second waveform,  on
y-axis),  which may  be  adjusted  as desired,  will  then be  plotted
against each other via Gnuplot.   3) The working parameter file may be
updated  {\it and  saved}.  The  simulation may  be resumed,  with the
updated  parameter  values,  by  simply  entering  ``r''  followed  by
$<$RETURN$>$ at the  standard input.  Note that plots  of one waveform
versus  another will not  be automatically  updated upon  resuming the
simulation.   However,   these  plots  may  be   manually  updated  by
subsequently  pausing  the simulation  and  regenerating  the plot  as
described above.

\subsection{Parameter File}
\label{sec-pf}

The     parameter     file     ({\it    \$DIR/parameters.def};     see
Figure~\ref{fig:pf}) assigns  the desired  numerical values to  all of
the parameters  characterizing the human cardiovascular  model and its
execution.  The  syntax for parameter assignment must  be precisely as
written   {\it  within}  the   following  squiggly   brackets:  \{{\it
  parameter:~numerical\_value}\}.  Otherwise,  the parameters will not
be read in properly.  The  parameter file also includes definitions of
each of the parameters and  default or nominal parameter values.  Each
line containing  these definitions and  default values as well  as any
other comments must be preceded by a \%.  Parameter assignments should
never be  preceded by a \%,  else they will  not be read in  properly. 
Each of the  parameters in the file  may be updated in the  midst of a
simulation period  with the  exception of those  labelled with  \{*\}. 
Any update to these parameters will simply be ignored.

\begin{figure}
  \centerline{\psfig{figure={epsfig/parameterfile.eps},width=4in,silent=1}}
  \caption{The {\it \$DIR/parameters.def} file which contains the
    parameter values characterizing  the human cardiovascular model of
    Section~\ref{sec-md} and its execution.}
    \label{fig:pf}
\end{figure}

The parameter  file consists  of integration and  sampling parameters;
display parameters; status parameters; pulsatile heart and circulation
parameters;  short-term  regulatory  system  parameters,  and  resting
physiologic perturbation parameters.   The status parameters are flags
which indicate the preparation  of the pulsatile heart and circulation
to  be  implemented  as   well  as  whether  a  particular  short-term
regulatory  system  or  resting  physiologic  perturbation  is  to  be
activated  or deactivated.   The  status parameters,  which cannot  be
adjusted  in the midst  of a  simulation period,  override any  of the
other relevant  parameters assignments.  For example, if  {\it dra} is
set to  zero, then the  exogenous disturbance to $R_a$  is deactivated
and may  not be activated  during the simulation period  regardless of
the  value assigned  to {\it  stdwr}, which  establishes  the standard
deviation  of  the  disturbance  to  $R_a$.  Note  that  a  short-term
regulatory  system or  resting  physiologic perturbation  may also  be
deactivated  through  the  parameters  that  characterize  them.   For
example,  the exogenous  disturbance to  $R_a$ may  be  deactivated by
setting {\it stdwr} to zero.   In this case, the exogenous disturbance
to $R_a$ may be subsequently activated during the simulation period by
setting {\it  stdwr} to  a value greater  than zero.  However,  if the
researcher  knows  that  a  short-term regulatory  system  or  resting
physiologic perturbation is not  required for his simulation, then the
appropriate status parameter should be deactivated for the purposes of
increasing  execution  speed.   Note  that  the  pulsatile  heart  and
circulation parameters  may be  applicable to the  intact circulation,
heart-lung  unit,  and/or systemic  circulation  preparations and  are
labelled accordingly.

\subsection{Viewing Waveforms}

Provided that the display  parameters are properly set, the researcher
may  view the  simulated  waveforms and  update  the parameter  values
on-line  by  running  the  {\it  rcvsim} executable  which  will  make
repeated function  calls to  the WAVE display  system.  Alternatively,
the waveforms, which  are recorded to MIT format  files, may be viewed
at any time  after completion of the simulation  (off-line viewing) by
directly running the  {\it wave} executable file at  the Linux prompt. 
An explanation  on how  to set the  display parameters and  caveats to
on-line parameter updating are  provided below.  See also Examples 1-7
in Section~\ref{sec-examples}  which illustrate how  to view waveforms
both on-line and off-line.

\subsubsection{Setting Display Parameters}

The  {\it waveform}  parameter  under the  display  parameters in  the
working parameter file determines  whether the simulated waveforms are
to be viewed on-line.  If the {\it waveform} parameter is assigned the
numerical value  of -1, then the  waveforms are not  displayed as they
are  being calculated  but  may be  subsequently  viewed and  analyzed
off-line.  The researcher may choose this option, if, for example, the
data  required  for  analysis  are  very time  consuming  to  generate
({\it e.g.}, Monte Carlo simulations).  If the {\it waveform} parameter is
assigned one or more numerical values between 0 and 28 inclusive (with
a single  space inserted between each assigned  numerical value), then
the waveforms  corresponding to those  numerical values (see  the {\it
  \$DIR/pararmeters.def}  file (Figure~\ref{fig:pf}) or  the generated
file with extension  {\it .hea} for mapping key  between waveforms and
numerical values) will be displayed as they are being calculated.  For
example, in  Figure~\ref{fig:pf}, the {\it waveform}  parameter is set
such  that left  ventricle  and systemic  arterial  pressures will  be
displayed on-line.  Note that  the {\it annotations} parameter beneath
the {\it waveform}  parameter is simply a flag  indicating whether the
contents of the annotations file,  which include the times of onset of
ventricular contractions and parameter updates, will be viewed on-line
with  the waveforms selected  by the  {\it waveform}  parameter.  Note
that if the {\it waveform} parameter  is set to the numerical value of
-1,  then the  contents  of the  annotations  file will  {\it not}  be
displayed  on-line  regardless  of  the  value assigned  to  the  {\it
  annotations} parameter.

The  {\it  rcvsim}  executable  file  implements  on-line  viewing  by
periodically updating the WAVE display with the most recently computed
window of waveforms.   The time duration of the  window and the update
time period (both simulation times) may be respectively set to desired
values with the  {\it window} and {\it step}  parameters.  For optimal
on-line viewing, the {\it window} parameter should be set equal to the
time duration displayed by WAVE.   This latter time duration is set by
the  physical size  of  the WAVE  window  as well  as  the Time  scale
variable  which  is  essentially  a calibration  factor  mapping  this
physical  size to  time  duration.   The Time  scale  variable may  be
altered by  clicking the VIEW option  on the WAVE menu  bar.  The {\it
  step} parameter should be chosen  to be sufficiently small such that
the displayed waveforms appear to scroll continuously through the WAVE
window.   However, if the  {\it step}  parameter is  chosen to  be too
small,  then the actual  time required  to update  the display  of the
simulated data  may not be sufficient  and the quality  of viewing may
thus be compromised.

\subsubsection{On-line Parameter Updating}
\label{sec-caveats}

All of the parameter assignments  in the working parameter file may be
updated as waveforms are being calculated and displayed on-line except
those labelled  with \{*\}.  Any  updates to these parameters  will be
ignored.   As soon  as  any  parameter (not  labelled  with \{*\})  is
updated in the  working parameter file, the file is  saved (with a new
name)   in    order   to   document   fully    the   simulation   (see
Section~\ref{sec-help}).  Some  caveats to on-line  parameter updating
are provided below.

Since none of  the display parameters are labelled  with a \{*\}, they
{\it are permitted} to be  updated on-line.  Thus, the researcher may,
for example, change the waveforms that he is currently viewing without
having  to rerun {\it  rcvsim}.  However,  when the  working parameter
file is updated {\it only}  through the display parameters, the update
will not be documented to file.   

Updates to the working parameter file are also not documented when the
particular  update  is not  relevant  to  the  status of  the  current
simulation.   For example,  an update  to the  {\it Cls}  parameter is
relevant when the intact  circulation and heart-lung unit preparations
are  being  implemented.  Thus,  in  this  case,  the update  will  be
documented   to  file.    However,  when   the   systemic  circulation
preparation is being executed, an update to the {\it Cls} parameter is
irrelevant  (see Figure~\ref{fig:sc})  and is  thus not  documented to
file.

When  implementing the  heart-lung unit,  the  {\it Pv}  and {\it  Pa}
parameters may  be updated  on-line provided that  they are  not being
adjusted through the {\it Pvs} and {\it Pas} parameters, respectively.
Otherwise,  the  on-line adjustment  of  the  {\it  Pv} and  {\it  Pa}
parameters will be ignored.  Similarly, when implementing the systemic
circulation preparation, any update to the {\it Crd} parameter will be
ignored  unless  it is  not  being  adjusted  through the  {\it  Crds}
parameter.

As described in Section~\ref{sec-flowchart}, the volume in each of the
capacitive  elements  of  the  pulsatile heart  and  circulation  (any
preparation) is  always conserved through a  pressure adjustment.  The
only exception to  this rule is naturally when  the researcher desires
to adjust total  blood volume through the {\it  Qtot} parameter (which
is  only applicable  to  the intact  pulsatile  heart and  circulation
preparation).  In this case, the volume is added to or subtracted from
the systemic venous volume and the systemic venous pressure is adjusted
accordingly.

The instantaneous lung volume waveform may only be altered by updating
the following  parameters: {\it  Tr}, {\it Qt},  {\it Qfrs},  and {\it
  Qds}.  If parameters of the ventilatory model in Figure~\ref{fig:rc}
are updated  (which includes  the {\it Pvc}  parameter), the  value of
intrathoracic pressure  at the functional reserve volume  of the lungs
will be  adjusted instantaneously in  order to preclude any  change to
instantaneous lung volume.

Finally,  when updating  the  adjustable parameters  of the  pulsatile
heart and circulation  through the {\it F}, {\it  Ra}, {\it Qvo}, {\it
  Crs}, and  {\it Cls}  parameters, the current  values {\it  and} the
setpoint  values of  these  parameters will  be  adjusted.  Note  that
updates to the {\it Crs} and  {\it Cls} parameters will take effect at
the start of the subsequent ventricular contraction.

\subsection{Viewing Cardiac Function and Venous Return Curves}

Provided that the relevant parameters are properly set, the researcher
may view  cardiac function and venous return  curves immediately after
they  have  been calculated  (on-line  viewing)  by  running the  {\it
  rcvsim}  executable which  will make  a  function call  to Gnuplot.  
Since the  time required for  generating a cardiac function  or venous
return curve is  relatively short (within a few  seconds), the on-line
viewing capability will usually suffice.  However, it is possible that
the researcher may also desire to view the curves off-line.  Since the
curves  are  written  to  file  in  ASCII,  multi-column  format,  the
researcher may view  them any time after completion  of the simulation
by  directly   executing  {\it  gnuplot}  at  the   Linux  prompt.   A
description of how to set the relevant parameters is given below.  See
also Examples 8-13  in Section~\ref{sec-examples} which illustrate how
to view the cardiac function and venous return curves both on-line and
off-line.   (Note that  this  section requires  some familiarity  with
Gnuplot which may be garnered by typing {\it man gnuplot} at the Linux
prompt.)

In  order  for the  {\it  rcvsim}  executable  to generate  a  cardiac
function  or   venous  return   curve,  either  the   heart-lung  unit
preparation or systemic circulation preparation must be implemented by
assigning the {\it preparation}  parameter under the status parameters
a numerical value  of 1 or 2.  Provided that this  has been done, then
the {\it  numerics} parameter under the  display parameters determines
whether  the cardiac  function/venous  return curve  is  to be  viewed
on-line.  If  the {\it numerics}  parameter is assigned  the numerical
value of  -1, then the curve  will not be  displayed as soon as  it is
calculated  but may  be  subsequently viewed  off-line.   If the  {\it
  numerics}  parameter is set  to a  numerical value  between 0  and 3
inclusive  which   correspond  to  different   plotting  formats  (see
Figure~\ref{fig:pf}),  then the  cardiac function/venous  return curve
will be  automatically displayed immediately  following the completion
of  the  simulation.   The  different  plotting formats  can  be  best
understood by  recognizing that the  on-line display of the  curves is
specifically implemented by writing gnuplot  commands to a file in the
{\it /tmp}  directory and executing these commands  through a function
call  to   {\it  gnuplot}.   The   single  plot  per   window  formats
(corresponding to numerical  values of 0 and 2)  will delete this file
if it exists,  write a new file to the {\it  /tmp} directory, and thus
display only  the cardiac function/venous return curve  of the current
simulation.  The  multiple plots per window  formats (corresponding to
numerical values  of 1  and 3) will  add plotting instructions  to the
existing file in  the {\it /tmp} directory and  thus display the curve
of  the  current simulation  as  well as  all  other  curves that  are
instructed to be displayed in the file.  In this way, multiple cardiac
output and  venous return curves  can be overlayed  on the same  axes. 
The mPra x-axis formats (corresponding to numerical values of 0 and 1)
will display either cardiac function or venous return curves.  The mPa
x-axis formats  (corresponding to  numerical values of  2 and  3) will
display  average cardiac  output  as a  function  of average  systemic
arterial pressure and  is thus applicable only to  the heart-lung unit
preparation.

Whether cardiac  function and  venous return curves  are to  be viewed
on-line or  off-line, the  simulation time is  determined by  the {\it
  time}  parameter under  integration and  sampling parameters  or the
time it takes  to complete the calculation of  the entire curve, which
ever is less.  Hence, the {\it time} parameter should always be set to
a value that is greater than the time it takes to calculate the entire
curve (1000 seconds is usually more than enough).

In order  to generate venous  return curves, the {\it  Crds} parameter
under  pulsatile heart  and  circulation parameters  must be  properly
selected.  This parameter determines  the increments in which the {\it
  Crd} parameter is  stepped from the value assigned  to the {\it Crs}
parameter to 60 ml/mmHg.   Hence, this parameter determines the number
of points to  be calculated on the venous  return curve.  For example,
if this parameter is set to five and all other parameters are also set
to their  default values,  then 12 points  on the venous  return curve
will be  calculated.  If the  {\it Crds} parameter  is set to  a value
greater than 60-{\it  Crs}, then the {\it Crd}  parameter will be held
constant throughout  the simulation and  only one point on  the venous
return curve will be generated.

In order to  generate cardiac function curves, the  {\it Pvs} and {\it
  Pas}  parameters under  pulsatile heart  and  circulation parameters
must  be properly selected.   Analogous to  the {\it  Crds} parameter,
these parameters  indicate the  increments in which  the {\it  Pv} and
{\it  Pa} parameters  are stepped.   If  the simulation  of a  cardiac
output  curve  is desired,  the  {\it  Pa}  parameter should  be  held
constant  by setting the  {\it Pas}  parameter to  a very  large value
(1000 mmHg  will usually be more  than sufficient), and  the {\it Pvs}
parameter  should be set  to a  sufficiently small  value in  order to
permit  the generation  of  a  reasonably smooth  curve  (2 mmHg  will
usually do).  If  the generation of a curve  of average cardiac output
versus average  systemic arterial pressure  is required, the  {\it Pv}
parameter should be  held constant by setting the  {\it Pvs} parameter
to a very large value (100 mmHg will usually be more than sufficient),
and  the {\it Pas}  parameter should  be set  to a  sufficiently small
value in  order to allow the  generation of a  reasonably smooth curve
(30  mmHg will  usually do).   Finally, note  that the  researcher may
assign sufficiently small values to  both {\it Pvs} and {\it Pas} such
that a family of cardiac  output curves at different systemic arterial
pressures will be generated.

\subsection{Viewing Examples}
\label{sec-examples}

The following  examples illustrate how  to view waveforms  and cardiac
function/venous  return   curves  on-line  and   off-line.   Prior  to
implementing  these  examples,  the  researcher should  set  the  time
duration displayed  by the WAVE window  to 20 seconds  by resizing the
window and/or adjusting the Time  scale variable (click VIEW option at
the top of the WAVE menu bar).

% \newpage 
\vspace{0.5cm}
\noindent {\bf Ex. 1}
\begin{itemize}
\item  {\it  Desired Execution:}  
\begin{itemize}
\item  On-line display of  left ventricle  pressure, volume,  and flow
  rate.
\item   Uncontrolled,   unperturbed,   intact  pulsatile   heart   and
  circulation with default parameter values.
\end{itemize}
\item {\it Required Steps:}
\begin{enumerate}
\item  Copy   file  {\it  \$DIR/bin/parameters.def}   to  the  current
  directory with the new file name {\it parameters\_1}.
\item Open the file {\it  parameters\_1} with any text editor ({\it e.g.},
  emacs).
\item Re-assign the  following parameters: {\it waveform: 0  9 17} and
  {\it annotations:  0}.  Make sure  all of the status  parameters are
  set to zero.
\item Save the file {\it parameters\_1}.
\item  Run  the  following  command  at the  Linux  prompt: \\ {\it
    rcvsim parameters\_1 foo1}
\end{enumerate}
\item {\it Execution Output:}
\begin{itemize} 
\item The WAVE window in Figure~\ref{fig:lvwave} will initially appear
  and will automatically scroll through the simulated data as they are
  being generated.   This process will  terminate once 300  seconds of
  the data have been simulated.
\item The  following files will  be created in the  current directory:
  {\it   foo1.dat},   {\it  foo1.qrs},   {\it   foo1.hea},  and   {\it
    parameters\_1.0}  which may subsequently  be viewed  off-line (See
  Example 2).
\end{itemize}
\end{itemize}

% \newpage 

\begin{figure}
\vspace{1.9in}
  \centerline{\psfig{figure={epsfig/lvwave.eps},width=6in,silent=1}}
  \caption{Initial WAVE window generated according to Ex. 1
    and Ex.  2.}
    \label{fig:lvwave}
\end{figure}

% \newpage

\noindent {\bf Ex. 2}
\begin{itemize}
\item  {\it  Desired Execution:}  
\begin{itemize}
\item Off-line  display of left  ventricle pressure, volume,  and flow
  rate.
\item Off-line display of left ventricle pressure versus volume.
\item   Uncontrolled,   unperturbed,   intact  pulsatile   heart   and
  circulation with default parameter values.
\end{itemize}
\item {\it Required Steps:}
\begin{enumerate}
\item  Copy   file  {\it  \$DIR/bin/parameters.def}   to  the  current
  directory with the new file name {\it parameters\_2}.
\item Open  the file {\it  parameters\_2} with any text  editor ({\it e.g.},
  emacs).
\item  Re-assign the  following parameter:  {\it waveform:  -1}.  Make
  sure all of  the status parameters are assigned  the numerical value
  of zero.
\item Save the file {\it parameters\_2}.
\item  Run the  following command  at the  Linux prompt:  \\ {\it
    rcvsim parameters\_2 foo2}.
\item Any time after the  completion of the previous step, execute the
  following command at the Linux  prompt: \\ {\it wave -r foo2 -s
    0 9 17}
\item  Click on File  button with  right mouse  button and  then click
  Analyze...  option  with  left   mouse  button.   Change  first  two
  waveforms in the Signal List to 9 0 followed by $<$RETURN$>$.  Then,
  click on the VCG button.
\end{enumerate} \vspace{0.15in}
\centerline{Or, if {\bf Ex.  1} has been previously implemented, then}
\begin{enumerate}
\item Execute the following command  at the Linux prompt: \\ {\it
    wave -r foo1 -s 0 9 17}
\item  Click on File  button with  right mouse  button and  then click
  Analyze...   option  with  left  mouse  button.   Change  first  two
  waveforms in the Signal List to 9 0 followed by $<$RETURN$>$.  Then,
  click on the VCG button.
\end{enumerate}
\item {\it Execution Output:} 
\begin{itemize}
\item If  {\bf Ex.  1} has not  been previously implemented,  then the
  following  files will  be  created in  the  current directory:  {\it
    foo2.dat},    {\it   foo2.qrs},    {\it   foo2.hea},    and   {\it
    parameters\_2.0}.
\item When the  {\it wave} executable is implemented,  the WAVE window
  in  Figure~\ref{fig:lvwave}   will  again  initially   appear.   The
  researcher may  then use the  arrow buttons at  the top of  the WAVE
  display  system  to scroll  through  the  300  seconds of  generated
  waveforms.
\item   When   the   VCG   button   is   clicked,   the   Gnuplot   in
  Figure~\ref{fig:pvloop}  will  appear  illustrating  left  ventricle
  pressure-volume  loops.   (As  described in  Section~\ref{sec-help},
  plotting  one waveform  against another  can be  carried  out during
  on-line viewing  provided that the simulation  is paused.  Moreover,
  any  two  generated waveforms  may  be  plotted  against each  other
  through selection of the first two waveforms in the Signal List.) \\
\end{itemize}
\end{itemize}

\begin{figure}
  \centerline{\psfig{figure={epsfig/pvloop.eps},width=5in,silent=1}}
  \caption{Gnuplot window generated according to Ex.  2.}
    \label{fig:pvloop}
\end{figure}

% \newpage

\noindent {\bf Ex. 3}
\begin{itemize}
\item {\it Desired Execution:}
\begin{itemize}
\item On-line  display of systemic arterial pressure,  heart rate, and
  instantaneous lung volume with annotations.
\item Fully controlled, fully perturbed (fixed-rate breathing), intact
  pulsatile heart and circulation with default parameter values.
\end{itemize}
\item {\it Required Steps:}
\begin{enumerate}
\item  Copy   file  {\it  \$DIR/bin/parameters.def}   to  the  current
  directory with the new file name {\it parameters\_3}.
\item Open  the file {\it  parameters\_3} with any text  editor ({\it e.g.},
  emacs).
\item  Re-assign the following  parameters: {\it  waveform: 1  15 26},
  {\it baro: 3}, {\it dncm: 1},  {\it breathing: 1}, {\it dra: 1}, and
  {\it df: 1}.
\item Save the file {\it parameters\_3}.
\item Execute the following command  at the Linux prompt: \\ {\it
    rcvsim parameters\_3 foo3}
\end{enumerate}
\item  {\it Execution Output:}
\begin{itemize}
\item A WAVE window will  appear and will automatically scroll through
  the  simulated   data  with  annotations.   Figure~\ref{fig:varwave}
  illustrates the window after one minute of data has been calculated.
  This  process will  terminate once  300  seconds of  data have  been
  simulated.
\item The  following files will  be created in the  current directory:
  {\it   foo3.dat},   {\it  foo3.qrs},   {\it   foo3.hea},  and   {\it
    parameters\_3.0}.
\end{itemize}
\end{itemize}

% \newpage

\begin{figure}
\vspace{1.9in}
  \centerline{\psfig{figure={epsfig/varwave.eps},width=6in,silent=1}}
  \caption{WAVE window generated according to Ex. 3 and Ex. 4.}
    \label{fig:varwave}
\end{figure}

% \newpage

\noindent {\bf Ex. 4}
\begin{itemize}
\item {\it Desired Execution:}
\begin{itemize}
\item Off-line display of  systemic arterial pressure, heart rate, and
  instantaneous lung volume with annotations.
\item Fully controlled, fully perturbed (fixed-rate breathing), intact
  pulsatile heart and circulation with default parameter values.
\end{itemize}
\item {\it Required Steps:}
\begin{enumerate}
\item  Copy   file  {\it  \$DIR/bin/parameters.def}   to  the  current
  directory with the new file name {\it parameters\_4}.
\item Open  the file {\it  parameters\_4} with any text  editor ({\it e.g.},
  emacs).
\item  Re-assign the  following parameters:  {\it waveform:  -1}, {\it
    baro: 3},  {\it dncm:  1}, {\it breathing:  1}, {\it dra:  1}, and
  {\it df: 1}.
\item Save the file {\it parameters\_4}.
\item  Run the  following command  at the  Linux prompt:  \\ {\it
    rcvsim parameters\_4 foo4}
\item Any time after the completion of the previous step, execute the
  following command at the Linux prompt: \\
  {\it wave -r foo4 -s 1 15 26 -a qrs}
\end{enumerate}
\centerline{Or, if {\bf Ex. 3} have been previously implemented, then}
\begin{enumerate}
\item Execute the following command at the Linux prompt: \\
{\it wave -r foo3 -s 1 15 26 -a qrs}
\end{enumerate}
\item {\it Execution Output:}
\begin{itemize}
\item If  {\bf Ex.  3} has  not been previously  implemented, then the
  following  files will  be  created in  the  current directory:  {\it
    foo4.dat},    {\it   foo4.qrs},    {\it   foo4.hea},    and   {\it
    parameters\_4.0}.
\item When  the {\it  wave} executable is  implemented, a  WAVE window
  will appear.  The  researcher may then use the  arrow buttons at the
  top of the WAVE display system  to scroll through the 300 seconds of
  generated waveforms with annotations.  Figure~\ref{fig:varwave} will
  appear after  clicking the forward  double arrow button twice  or by
  directly  running  the  {\it  wave} executable  with  the  following
  additional argument: {\it -f 40}.
\end{itemize}
\end{itemize}

% \newpage

\noindent {\bf Ex. 5}
\begin{itemize}
\item {\it Desired Execution:}
\begin{itemize}
\item On-line  display of systemic  arterial pressure and  volume with
  annotations.
\item   Uncontrolled,   unperturbed,   intact  pulsatile   heart   and
  circulation initially with default parameter values.
\item On-line reduction in systemic arterial compliance by a factor of
  two.
\end{itemize}
\item {\it Required Steps:}
\begin{enumerate}
\item  Copy   file  {\it  \$DIR/bin/parameters.def}   to  the  current
  directory with the new file name {\it parameters\_5}.
\item Open  the file {\it  parameters\_5} with any text  editor ({\it e.g.},
  emacs).
\item Re-assign  the following parameter: {\it waveform:  1 10}.  Make
  sure all of  the status parameters are assigned  the numerical value
  of zero.
\item Save the file {\it parameters\_5}.
\item Run the  following command  at the  Linux prompt:  \\ {\it
    rcvsim parameters\_5 foo5}
\item Some time in the midst of the simulation, type ``p'' followed by
  $<$RETURN$>$ at standard input.
\item Re-assign the the following parameter: {\it Ca: 0.8}.
\item Save the file {\it parameters\_5}.
\item Type ``r'' followed by $<$RETURN$>$ at standard input.
\end{enumerate}
\item {\it Execution Output:}
\begin{itemize}
\item A WAVE window will  appear and will automatically scroll through
  the simulated  data with annotations.  The  automatic scrolling will
  stop once Step  6. is executed.  (At this  point, the researcher may
  scroll backwards with  the the arrow buttons at the  top of the WAVE
  display  system.)    After  Steps  7.-9.   are  executed,  automatic
  scrolling will resume until a total of 300 seconds of data have been
  calculated.   Figure~\ref{fig:updateCa} illustrates the  WAVE window
  during the time of  reduction in systemic arterial compliance.  Note
  that  this  reduction  is  annotated  with the  name  of  the  saved
  parameter  file.   (Also  note   how  systemic  arterial  volume  is
  conserved  through  the instantaneous  change  in systemic  arterial
  pressure.)
\item The  following files will  be created in the  current directory:
  {\it foo5.dat}, {\it foo5.qrs}, {\it foo5.hea}, {\it parameters\_5.0},
  and {\it parameters\_5.1}.
\end{itemize}
\end{itemize}

% \newpage

\begin{figure}
\vspace{1.9in}
  \centerline{\psfig{figure={epsfig/updateCa.eps},width=6in,silent=1}}
  \caption{WAVE window generated according to Ex. 5.}
    \label{fig:updateCa}
\end{figure}

% \newpage

\noindent {\bf Ex. 6}
\begin{itemize}
\item {\it Desired Execution:}
\begin{itemize}
\item  On-line display  of systemic  arterial  pressure, intrathoracic
  pressure, and instantaneous lung volume with annotations.
\item Uncontrolled,  intact pulsatile heart  and circulation initially
  with   default  parameter  values   perturbed  by   only  fixed-rate
  breathing.
\item First,  an on-line reduction in  lung compliance by  a factor of
  two.   Then, an  on-line, 500  ml  step increase  in the  functional
  reserve volume of the lungs.
\end{itemize}
\item {\it Required Steps:}
\begin{enumerate}
\item  Copy   file  {\it  \$DIR/bin/parameters.def}   to  the  current
  directory with the new file name {\it parameters\_6}.
\item Open  the file {\it  parameters\_6} with any text  editor ({\it e.g.},
  emacs).
\item Re-assign  the following parameters: {\it waveform:  1 6 15} and
  {\it breathing: 1}.
\item Save the file {\it parameters\_6}.
\item Run the  following command  at the  Linux prompt:  \\ {\it
    rcvsim parameters\_6 foo6}
\item Some time in the midst of the simulation, type ``p'' followed by
  $<$RETURN$>$ at standard input.
\item Re-assign the the following parameter: {\it Clu: 126.25}.
\item Save the file {\it parameters\_6}.
\item Type ``r'' followed by $<$RETURN$>$ at standard input.
\item At a subsequent time  during the simulation, type ``p'' followed
  by $<$RETURN$>$ at standard input.
\item Re-assign the the following parameter: {\it Qfrs: 500}.
\item Save the file {\it parameters\_6}.
\item Type ``r'' followed by $<$RETURN$>$ at standard input.
\end{enumerate}
\item {\it Execution Output:}
\begin{itemize}
\item A WAVE window will  appear and will automatically scroll through
  the simulated  data with annotations.  The  automatic scrolling will
  stop once  Step 6.  is  executed.  After Steps 7.-9.   are executed,
  automatic scrolling will  resume until Step 10.  has  been executed. 
  When Steps 11.-13. are executed, the automatic scrolling will resume
  until  a  total  of  300  seconds  of  data  have  been  simulated.  
  Figure~\ref{fig:updateClu}  illustrates the  WAVE window  during the
  reduction in  lung compliance.  (Note  that this reduction  does not
  alter  instantaneous lung  volume;  see Section~\ref{sec-caveats}).  
  Figure~\ref{fig:updateQfrs} illustrates  the WAVE window  during the
  time of  the step increase in  the functional reserve  volume of the
  lungs.   (Note  that  the  step  increase occurs  once  the  current
  respiratory cycle is complete.)
\item The  following files will  be created in the  current directory:
  {\it foo6.dat}, {\it foo6.qrs}, {\it foo6.hea}, {\it parameters\_6.0},
  {\it  parameters\_6.1},  and  {\it  parameters\_6.2}. \\
\end{itemize}
\end{itemize}

\begin{figure}
  \centerline{\psfig{figure={epsfig/updateClu.eps},width=6in,silent=1}}
  \caption{WAVE window generated according to the first
    parameter update of Ex. 6.}
    \label{fig:updateClu}
\end{figure}

% \newpage

\begin{figure}
\vspace{1.9in}
  \centerline{\psfig{figure={epsfig/updateQfrs.eps},width=6in,silent=1}}
  \caption{WAVE window generated according to the second
    parameter update of Ex. 6.}
    \label{fig:updateQfrs}
\end{figure}

% \newpage

\noindent {\bf Ex. 7}
\begin{itemize}
\item {\it Desired Execution:}
\begin{itemize}
\item  On-line display of  systemic arterial  pressure and  heart rate
  with annotations.
\item   Uncontrolled,   unperturbed,   intact  pulsatile   heart   and
  circulation initially with default parameter values.
\item First on-line hemmorhage of 500 ml.  Then, on-line initiation of
  arterial and cardiopulmonary baroreflex control.
\end{itemize}
\item {\it Required Steps:}
\begin{enumerate}
\item  Copy   file  {\it  \$DIR/bin/parameters.def}   to  the  current
  directory with the new file name {\it parameters\_7}.
\item Open  the file {\it  parameters\_7} with any text  editor ({\it e.g.},
  emacs).
\item Re-assign  the following parameters: {\it waveform:  1 26}, {\it
    baro: 3}, {\it bgain: 0}, {\it again: 0}, and {\it pgain: 0}.
\item Save the file {\it parameters\_7}.
\item Run the  following command  at the  Linux prompt:  \\ {\it
    rcvsim parameters\_7 foo7}
\item Some time in the midst of the simulation, type ``p'' followed by
  $<$RETURN$>$ at standard input.
\item Re-assign the the following  parameter: {\it Qtot: 4500}.
\item Save the file {\it parameters\_7}.
\item Type ``r'' followed by $<$RETURN$>$ at standard input.
\item At a subsequent time  during the simulation, type ``p'' followed
  by $<$RETURN$>$ at standard input.
\item Re-assign the the following parameters: {\it bgain: 1}, {\it
    again: 1}, and {\it pgain: 1}.
\item Save the file {\it parameters\_7}.
\item Type ``r'' followed by $<$RETURN$>$ at standard input.
\end{enumerate}
\item {\it Execution Output:}
\begin{itemize}
\item A WAVE window will  appear and will automatically scroll through
  the simulated  data with annotations.  The  automatic scrolling will
  stop once  Step 6.  is  executed.  After Steps 7.-9.   are executed,
  automatic scrolling will  resume until Step 10.  has  been executed. 
  When Steps 11.-13. are executed, the automatic scrolling will resume
  until  a  total  of  300  seconds  of  data  have  been  simulated.  
  Figure~\ref{fig:updateQtot}  illustrates the  WAVE  window once  the
  simulation is complete.  The {\it  Time variable} of the WAVE window
  is set such that the waveforms over the entire simulation period may
  be viewed  all at  once.  (Note how  systemic arterial  pressure has
  been returned to near normal values with the baroreflex systems.)
\item The  following files will  be created in the  current directory:
  {\it foo7.dat}, {\it foo7.qrs}, {\it foo7.hea}, {\it parameters\_7.0},
  {\it parameters\_7.1}, and {\it parameters\_7.2}.
\end{itemize}
\end{itemize}

% \newpage

\begin{figure}
 \vspace{1.75in}
 \centerline{\psfig{figure={epsfig/updateQtot.eps},width=6in,silent=1}}
  \caption{WAVE window generated according to Ex. 7 in which the
    time duration  of the window  has been expanded to  illustrate the
    entire simulation period.}
    \label{fig:updateQtot}
\end{figure}

% \newpage

\noindent {\bf Ex. 8}
\begin{itemize}
\item {\it Desired Execution:}
\begin{itemize}
\item On-line display of a cardiac output curve.
\item  On-line display of  systemic arterial  and venous  pressure and
  left ventricle flow rate.
\item  Uncontrolled,  unperturbed,  heart-lung unit  preparation  with
  default parameter values.
\end{itemize}
\item{\it Required Steps:}
\begin{enumerate}
\item  Copy   file  {\it  \$DIR/bin/parameters.def}   to  the  current
  directory with the new file name {\it parameters\_8}.
\item Open  the file {\it  parameters\_8} with any text  editor ({\it e.g.},
  emacs).
\item  Re-assign  the following  parameters:  {\it  time: 1000},  {\it
    waveform: 1 2 17}, {\it preparation:~1}, {\it Pas:~1000}, and {\it
    Pvs:~2}.
\item Save the file {\it parameters\_8}.
\item Run the following command at the Linux prompt: \\
{\it rcvsim parameters\_8 foo8}
\end{enumerate}
\item {\it Execution Output:}
\begin{itemize}
\item A WAVE window will  appear and will automatically scroll through
  the simulated  data as  they are being  calculated until  the entire
  cardiac  output curve  has been  measured.  Figure~\ref{fig:wavehlu}
  illustrates the  WAVE window at the  end of the  simulation.  (As is
  always the case with viewing waveforms on-line, the parameter values
  may be updated prior to simulation termination, if desired.)
\item  Then, the  Gnuplot window  of Figure~\ref{fig:cfc}  will appear
  immediately following  the calculation of the  entire cardiac output
  curve.
\item The  following files will  be created in the  current directory:
  {\it foo8.dat},  {\it foo8.qrs}, {\it foo8.hea},  {\it foo8.txt} and
  {\it parameters\_8.0}.
\end{itemize}
\end{itemize}

% \newpage

\begin{figure}
\vspace{1.9in}
  \centerline{\psfig{figure={epsfig/wavehlu.eps},width=6in,silent=1}}
  \caption{WAVE window generated according to Ex. 8.}
    \label{fig:wavehlu}
\end{figure}

% \newpage

\begin{figure}
\vspace{2.5in}
  \centerline{\psfig{figure={epsfig/cfc.eps},width=5in,silent=1}}
  \caption{Gnuplot window generated according to Ex. 8, Ex. 10, and
  Ex. 11.}
    \label{fig:cfc}
\end{figure}

% \newpage

\noindent {\bf Ex. 9}
\begin{itemize}
\item {\it Desired Execution:}
\begin{itemize}
\item On-line display of a venous return curve.
\item Uncontrolled, unperturbed, systemic circulation preparation with
  default parameter values.
\end{itemize}
\item{\it Required Steps:}
\begin{enumerate}
\item  Copy   file  {\it  \$DIR/bin/parameters.def}   to  the  current
  directory with the new file name {\it parameters\_9}.
\item Open  the file {\it  parameters\_9} with any text  editor ({\it e.g.},
  emacs).
\item  Re-assign  the following  parameters:  {\it  time: 1000},  {\it
    waveform: -1}, {\it preparation: 2}, and {\it Crds: 5}.
\item Save the file {\it parameters\_9}.
\item Run the following command at the Linux prompt: \\
{\it rcvsim parameters\_9 foo9}
\end{enumerate}
\item {\it Execution Output:}
\begin{itemize}
\item   The  Gnuplot  window   of  Figure~\ref{fig:vrc}   will  appear
  immediately following  the calculation  of the entire  venous return
  curve.
\item The  following files will  be created in the  current directory:
  {\it foo9.dat},  {\it foo9.qrs}, {\it foo9.hea},  {\it foo9.txt} and
  {\it parameters\_9.0}.
\end{itemize}
\end{itemize}

% \newpage

\begin{figure}
\vspace{2.5in}
   \centerline{\psfig{figure={epsfig/vrc.eps},width=5in,silent=1}}
  \caption{Gnuplot window generated according to Ex. 9.}
    \label{fig:vrc}
\end{figure}

% \newpage

\noindent {\bf Ex. 10}
\begin{itemize}
\item {\it Desired Execution:}
\begin{itemize}
\item  On-line display of  multiple cardiac  output and  venous return
  curves.
\item   Uncontrolled,  unperturbed,   heart-lung  unit   and  systemic
  circulation preparations  with default parameter values  and after a
  25\%  increase  in   systemic  arterial  resistance,  mean  systemic
  pressure, heart rate, and contractility.
\end{itemize}
\item{\it Required Steps:}
\begin{enumerate}
\item  Copy   file  {\it  \$DIR/bin/parameters.def}   to  the  current
  directory with the new file name {\it parameters\_10}.
\item Open  the file {\it  parameters\_10} with any text  editor ({\it e.g.},
  emacs).
\item  Re-assign  the following  parameters:  {\it  time: 1000},  {\it
    waveform:  -1}, {\it preparation:  1}, {\it  Pas: 1000},  and {\it
    Pvs: 2}.
\item Save the file {\it parameters\_10}.
\item Run the following command at the Linux prompt: \\
{\it rcvsim parameters\_10 foo10a}
\item  Once  the  simulation  is  complete,  re-assign  the  following
  parameters:  {\it numerics:  1},  {\it preparation:  2}, and  {\it
    Crds: 5}.
\item Save the file {\it parameters\_10}.
\item Run the following command at the Linux prompt: \\
{\it rcvsim parameters\_10 foo10b}
\item  Once  the  simulation  is  complete,  re-assign  the  following
  parameters:  {\it Ra: 1.25} and {\it Pms: 8.625}.
\item Save the file {\it parameters\_10}.
\item Run the following command at the Linux prompt: \\
{\it rcvsim parameters\_10 foo10c}
\item  Once  the  simulation  is  complete,  re-assign  the  following
  parameters: {\it  preparation: 1}, {\it  Cls: 0.3}, {\it  Crs: 0.9},
  and {\it F: 1.5}.
\item Save the file {\it parameters\_10}.
\item Run the following command at the Linux prompt: \\
{\it rcvsim parameters\_10 foo10d}
\end{enumerate}
\item {\it Execution Output:}
\begin{itemize}
\item A total of four Gnuplot windows will be displayed beginning with
  a   window   displaying  a   single   cardiac   output  curve   (see
  Figure~\ref{fig:cfc}); then a window displaying the previous cardiac
  output  curve with  a  venous  return curve;  followed  by a  window
  displaying  these two  previous  curves with  another venous  return
  curve which is enhanced; and ending with a window displaying each of
  these three  curves and an additional enhanced  cardiac output curve
  (see  Figure~\ref{fig:cfcvrcm}).   (Note  the  increase  in  average
  cardiac output  that occurs due to  the enhancement of  the curves.) 
  Each  of  the  four   windows  will  appear  immediately  after  the
  completion of  each of the  four {\it rcvsim} executions  (Steps 5.,
  8., 11., 14.).
\item The  following files will  be created in the  current directory:
  {\it foo10a.dat}, {\it  foo10a.qrs}, {\it foo10a.hea}, {\it foo10a.txt},
  {\it foo10b.dat}, {\it  foo10b.qrs}, {\it foo10b.hea}, {\it foo10b.txt},
  {\it foo10c.dat}, {\it  foo10c.qrs}, {\it foo10c.hea}, {\it foo10c.txt},
  {\it foo10d.dat},  {\it foo10d.qrs}, {\it  foo10d.hea}, {\it foo10d.txt}
  and {\it parameters\_10.0}. \\
\end{itemize}
\end{itemize}

\begin{figure}
  \centerline{\psfig{figure={epsfig/cfcvrcm.eps},width=5in,silent=1}}
  \caption{Gnuplot window generated according to Ex. 10 and Ex. 11.}
    \label{fig:cfcvrcm}
\end{figure}

% \newpage

\noindent {\bf Ex. 11}
\begin{itemize}
\item {\it Desired Execution:}
\begin{itemize}
\item Off-line display of the  cardiac output and venous return curves
  generated from Ex. 10.
\end{itemize}
\item{\it Required Steps:}
\begin{enumerate}
\item Change  directory to that  which contains the simulated  data of
  Ex. 10.
\item Run {\it gnuplot} at the Linux prompt.
\item At the Gnuplot prompt, enter the following commands: \\
  set tics out \\
  set xlabel 'mPra [mmHg]' \\
  set ylabel 'mql,mqv [l/min]' \\
  plot 'foo10a.txt' using 1:2 notitle with lines \\
  replot 'foo10b.txt' using 1:2 notitle with lines \\
  replot 'foo10c.txt' using 1:2 notitle with lines \\
  replot 'foo10d.txt' using 1:2 notitle with lines \\
  (Note that the plot command is similar to {\it numerics: 0}, while
  the replot command is analogous to {\it numerics: 1}.)
\end{enumerate}
\item {\it Execution Output:}
\begin{itemize}
\item A total of four Gnuplot windows will be displayed beginning with
  a   window   displaying  a   single   cardiac   output  curve   (see
  Figure~\ref{fig:cfc}); then a window displaying the previous cardiac
  output  curve with  a  venous  return curve;  followed  by a  window
  displaying  these two  previous  curves with  another venous  return
  curve which is enhanced; and ending with a window displaying each of
  these three  curves and an additional enhanced  cardiac output curve
  (see Figure~\ref{fig:cfcvrcm}).
\end{itemize}
\end{itemize}

% \newpage

\noindent {\bf Ex. 12}
\begin{itemize}
\item {\it Desired Execution:}
\begin{itemize}
\item  On-line display  of average  cardiac  output as  a function  of
  average systemic arterial pressure.
\item  Uncontrolled,  unperturbed,  heart-lung unit  preparation  with
  default parameter values.
\end{itemize}
\item{\it Required Steps:}
\begin{enumerate}
\item  Copy   file  {\it  \$DIR/bin/parameters.def}   to  the  current
  directory with the new file name {\it parameters\_12}.
\item Open  the file {\it  parameters\_12} with any text  editor ({\it e.g.},
  emacs).
\item  Re-assign  the following  parameters:  {\it  time: 1000},  {\it
    waveform:  -1}, {\it  numerics: 2},  {\it preparation:  1}, {\it
    Pas: 30}, and {\it Pvs: 100}.
\item Save the file {\it parameters\_12}.
\item Run the following command at the Linux prompt: \\
{\it rcvsim parameters\_12 foo12}
\end{enumerate}
\item {\it Execution Output:}
\begin{itemize}
\item  The  Gnuplot   window  of  Figure~\ref{fig:coabp}  will  appear
  immediately following the calculation of the entire curve.
\item The  following files will  be created in the  current directory:
  {\it foo12.dat},  {\it foo12.qrs}, {\it  foo12.hea}, {\it foo12.txt}
  and {\it parameters\_12.0}.
\end{itemize}
\end{itemize}

% \newpage

\begin{figure}
 \vspace{2.5in}
 \centerline{\psfig{figure={epsfig/coabp.eps},width=5in,silent=1}}
  \caption{Gnuplot window generated according to Ex. 12 and Ex. 13.}
    \label{fig:coabp}
\end{figure}

% \newpage 

\noindent {\bf Ex. 13}
\begin{itemize}
\item {\it Desired Execution:}
\begin{itemize}
\item Off-line  display of  the curve of  average cardiac output  as a
  function of  average systemic arterial  pressure generated from  Ex. 
  12.
\end{itemize}
\item{\it Required Steps:}
\begin{enumerate}
\item Change  directory to that  which contains the simulated  data of
  Ex. 12.
\item Run {\it gnuplot} at the Linux prompt.
\item At the Gnuplot prompt, enter the following commands: \\
  set tics out \\
  set xlabel 'mPa [mmHg]' \\
  set ylabel 'mql [l/min]' \\
  plot 'foo12.txt' using 3:2 notitle with lines \\
\end{enumerate}
\item {\it Execution Output:}
\begin{itemize}
\item The Gnuplot window of Figure~\ref{fig:coabp} will again appear.
\end{itemize}
\end{itemize}

% \newpage

\section{A Research Example}
\label{sec-re}

The human  cardiovascular model upon  which {\it RCVSIM} is  based was
originally  constructed in order  to advance  research in  the general
area  of  beat-to-beat  hemodynamic  variability  \cite{mukkamala2000,
  mukkamala2000b, mukkamala2000c}.  The {\it RCVSIM} software enhances
the  potential   of  the   original  human  cardiovascular   model  in
facilitating  cardiovascular research  by making  the model  more user
friendly  and compatible  with  the open-source  software provided  by
PhysioNet.    By   further   disseminating   {\it   RCVSIM}   to   the
cardiovascular research  community through PhysioNet,  researchers may
conveniently  utilize  the  computational  model to  complement  their
studies with  the experimental data sets available  on PhysioNet.  For
example,  {\it RCVSIM}  has  been previously  utilized  to develop  an
algorithm  for monitoring  systemic  arterial resistance  from only  a
peripheral   arterial  pressure   waveforms  which   was  subsequently
validated   with   data  from   the   MIMIC   database  on   PhysioNet
\cite{mukkamala2000}.  Another research  example which illustrates how
{\it  RCVSIM} may  be  utilized in  conjunction  with the  open-source
software and experimental  data sets of PhysioNet in  order to improve
the   accuracy   of  the   model,   and   thus  possibly   physiologic
understanding, is provided below.

The default  or nominal parameter  values of the  human cardiovascular
model  are  set   such  that  the  power  spectra   of  the  simulated
beat-to-beat hemodynamic variability  resembles power spectra measured
from  a  group  of  normal   humans  in  the  {\it  standing}  posture
\cite{mukkamala2000, mukkamala2001}.   The objective of  the research
example here  is to determine a  set of parameter  values which permit
the model  to generate  a realistic {\it  supine} posture,  heart rate
power spectrum.  In  order to address this objective,  it is necessary
to  obtain experimental  data sets  to  define what  is realistic  and
software to compute the heart rate power spectrum -- both of which are
available from  PhysioNet.  The specific steps  which were implemented
to achieve the research objective are given below.

\begin{enumerate}
\item Establish realistic supine posture, heart rate power spectrum.
\begin{enumerate}
\item Visit the following web page: \\
  {\it
    http://www.physionet.org/physiobank/database/meditation/data/} \\
  which  houses   Exaggerated  Heart  Rate   Oscillations  During  two
  Meditation Techniques: Data.
\item Download  the data  in the metronomic  breathing group  from the
  bottom of this web page -- {\it M\#.hea} and {\it M\#.qrs}, where \#
  ranges  from 1  to 14.   (These  data provide  the qrs  times of  14
  volunteer subjects  in the supine posture breathing  at a fixed-rate
  of 0.25 Hz.)
\item  Calculate an instantaneous  heart rate  tachogram from  the qrs
  times for each subject by executing the following command at the
  Linux prompt (14 times): \\
  {\it tach -r M\# -a qrs -f $>$ hr\#} \\
  (Note that tach is open-source software provided by PhysioNet.  Type
  {\it tach  -h} at the Linux prompt for  help.)
\item   Calculate  the   maximum   entropy  power   spectrum  of   the
  instantaneous heart rate tachogram for each subject by executing the
  following command at the Linux prompt (14 times): \\
  {\it memse -f 2 -Z -o 15 hr\# $>$ phr\#} \\
  (Note  that memse  is open-source  software provided  by  PhysioNet. 
  Type {\it  memse -h}  at the Linux  prompt for help.   The generated
  files {\it  phr\#} are two-column,  ASCII format files in  which the
  first column represents frequencies and the second column represents
  the corresponding power spectral densities.)
\item Average  the power  spectra over the  14 subjects and  write the
  averaged spectra to a two-column  ASCII file called {\it avephr} (by
  writing a simple program or  using any pre-existing software such as
  MATLAB).
\item Plot the averaged power spectrum by executing the following
  command at the Linux prompt: \\
  {\it plot2d avephr 0 1} \\
  (Note that plot2d, which is  a simple program that controls Gnuplot,
  is open-source software provided by PhysioNet.  Type {\it plot2d -h}
  at the Linux prompt for help.)
\end{enumerate}
\item  Determine model  parameter values  which permit  the  model and
  averaged, experimental heart rate power spectra to match.
\begin{enumerate}
\item  Copy   file  {\it  \$DIR/bin/parameters.def}   to  the  current
  directory with the new file name {\it parameters\_r}.
\item Open  the file {\it  parameters\_r} with any text  editor ({\it e.g.},
  emacs).
\item  Re-assign the  following parameters:  {\it waveform:  -1}, {\it
    baro: 3},  {\it dncm: 1}, {\it  breathing: 1}, {\it  dra: 1}, {\it
    df:  1}, {\it  Tr: 4},  and  {\it Qt:  430}.  (Since  accompanying
  experimental respiratory  data is not available,  the last parameter
  is arbitrarily  set such  that the alveolar  ventilation rate  is 70
  ml/s.)
\item Save the file {\it parameters\_r}.
\item Execute the following commands  at the Linux prompt: \\ {\it
    rcvsim parameters\_r foor} \\
{\it tach -r foor -a qrs -f $>$ hrsim} \\
{\it memse -f 2 -Z -o 15 hrsim $>$ phrsim} \\
{\it plot2d phrsim 0 1}
\item  If this  plot matches  the  experimental plot  above, then  the
  research  objective  has been  achieved.   Otherwise, re-assign  the
  following parameters:  {\it bgain},  {\it again}, {\it  pgain}, {\it
    stdwr}, and {\it stdwf}, and repeat the steps above beginning with
  Step  (d).  (Note that  these five  parameters have  been identified
  based on  a priori knowledge of the  physiologic differences between
  supine and standing postures.)
\end{enumerate}
\end{enumerate}

When the  values assigned  to the  parameters of Step  (f) are  set as
follows:  {\it bgain:  0.5}, {\it  again: 0.5},  {\it pgain:  1}, {\it
  stdwr: 0.04}, and {\it  stdwf: 0.175}, the averaged experimental and
model   supine  posture,   heart   rate  power   spectra  match   (see
Figure~\ref{fig:hrspectra}).  As expected,  the parameter changes from
the standing posture to supine  posture reflected a shift in autonomic
balance favoring the parasympathetic nervous system.  Interestingly, a
further comparison  of these parameter values with  the nominal values
suggests   that   the   posture   peak   in   humans   ($\sim$0.1   Hz
\cite{pomeranz1985};  present  in  the  model with  default  parameter
values) could be  due to both a system  resonance which is established
by  increased  sympathetic  nervous  activity  as  well  as  increased
fluctuations in  local vascular  resistance beds which  may be  due to
increased leg muscle activity.

\begin{figure}
 \centerline{\psfig{figure={epsfig/hrspectra.eps},width=4.5in,silent=1}}
  \caption{Model (red) and experimental (blue) supine posture, heart
    rate power spectra  at fixed-rate breathing of 0.25  Hz.  The dark
    blue  line is the  average spectrum  computed from  14 volunteers,
    while  the  two lighter  blue  lines  are  the corresponding  95\%
    confidence intervals.  See text for additional details.}
    \label{fig:hrspectra}
\end{figure}

\appendix
\section{Other Models}
\label{sec-usc}

In  addition  to  the  models of  Section~\ref{sec-md},  other  lumped
parameter models  of the pulsatile  heart and circulation  and resting
physiologic  perturbation  models may  be  implemented  with the  {\it
  RCVSIM} source  code.  These models  may only be implemented  at the
MATLAB prompt by executing  {\it simulate.mexlx}.  A brief description
of each  of these  models and the  relevant MATLAB functions  is given
below.
\begin{itemize}
\item Lumped parameter models of the pulsatile heart and circulation
\begin{itemize}
\item {\it Left ventricle preparation.}  The electrical circuit analog
  of  this  preparation  may  be  visualized by  replacing  $C_a$  and
  $C_{pv}$  in  Figure~\ref{fig:rcvsim} with  the  DC voltage  sources
  $P_a$ and $P_{pv}$, respectively.   This preparation may be utilized
  for  the  analysis  of  the  input-output  properties  of  the  left
  ventricle model; however, there is currently no source code to alter
  the  DC  voltage sources  during  a  {\it  single} simulation.   The
  initial  pressure, volume,  and  flow rate  of  the preparation  are
  computed   with  the  function   {\it  lv\_init\_cond.m},   and  the
  derivative of the pressure at a desired time step is determined with
  the function {\it lv\_eval\_deriv.m}.
\item {\it  Intact circulatory  preparation for measurement  of single
    ventricular   contraction  $P_a(t)$  response.}    The  electrical
  circuit    analog    of     this    preparation    is    given    by
  Figure~\ref{fig:rcvsim}and includes  an additional parameter ($nve$)
  which represents the beat number  after which the ventricles will no
  longer  contract.   The   single  ventricular  contraction  $P_a(t)$
  response  may then be  determined by  executing the  preparation for
  $nve$, and  then $nve$-1,  ventricular contractions and  then taking
  the difference between the two resulting $P_a(t)$ waveforms.
\item {\it Intact circulatory  preparation with only linear elements.} 
  The  electrical  circuit analog  of  this  preparation  is given  by
  Figure~\ref{fig:rcvsim}  in which  the four  nonlinear  elements are
  replaced  by  purely linear  elements.   This  model was  previously
  presented  by   Davis  \cite{davis1991}.   The   initial  pressures,
  volumes, and  flow rates  of the preparation  are computed  with the
  function {\it init\_cond.m}, and  the derivative of the pressures at
  a  desired   time  step  is   determined  with  the   function  {\it
    eval\_deriv.m}.
\item  {\it Intact circulatory  preparation with  third-order systemic
    arteries.}  The electrical circuit  analog of this preparation may
  be    visualized    by   replacing    the    capacitor   $C_a$    in
  Figure~\ref{fig:rcvsim} with  two grounded capacitors  connected via
  an  inductor.    The  capacitor  proximal  to   the  left  ventricle
  compartment represents the large,  elastic ($e$) arteries, the other
  capacitor  represents the  small, muscular  ($m$) arteries,  and the
  inductor  ($L_e$) accounts for  the inertial  effects of  blood flow
  between  the two  lumped arteries.   This third-order  model  of the
  systemic    arteries    was    previously   presented    by    Clark
  \cite{clark1990}.   The $P_m(t)$  waveform  may be  considered as  a
  first-order  approximation of a  peripheral arterial  blood pressure
  waveform.   The initial pressures,  volumes, and  flow rates  of the
  preparation     are    computed     with    the     function    {\it
    third\_init\_cond.m},  and the  derivative of  the pressures  at a
  desired   time   step  is   determined   with   the  function   {\it
    third\_eval\_deriv.m}.
\item  {\it  Intact circulatory  preparation  with nonlinear  systemic
    arterial  compliance.}   The  electrical  circuit analog  of  this
  preparation   is  given  by   Figure~\ref{fig:rcvsim}  with   a  box
  encompassing  $C_a$  to  denote  its nonlinearity.   This  nonlinear
  element  is  characterized  by  the  curvature  ($K$),  differential
  compliance  ($C_a$),  and  volume  ($Q_{nac}$) all  at  $P_a^{sp}$.  
  Provided  that  $K<0$, the  differential  compliance decreases  with
  increasing $P_a(t)$.  The initial pressures, volumes, and flow rates
  of   the   preparation  are   computed   with   the  function   {\it
    nac\_init\_cond.m},  and  the derivative  of  the  pressures at  a
  desired   time   step  is   determined   with   the  function   {\it
    nac\_eval\_deriv.m}.
\item  {\it Intact circulatory  preparation with  third-order systemic
    arteries and nonlinear,  large elastic arterial compliance.}  This
  preparation is a combination of the previous two preparations with a
  nonlinear $C_e$  and linear $C_m$.  The  initial pressured, volumes,
  and flow  rates of  the preparation are  computed with  the function
  {\it third\_nac\_init\_cond.m}, and  the derivative of the pressures
  at  a  desired  time  step  is determined  with  the  function  {\it
    third\_nac\_eval\_deriv.m}.
\item {\it  Intact circulatory  preparation with an  arterial pressure
    reservoir  preparation.}  The  electrical circuit  analog  of this
  preparation    may   be   visualized    by   replacing    $C_a$   in
  Figure~\ref{fig:rcvsim}  with  a  DC  voltage  source  $P_a$.   This
  preparation  may  be   utilized  to  understand  hemodynamics  while
  $P_a(t)$ is held constant.  The initial pressures, volumes, and flow
  rates  of  the  preparation  are  computed with  the  function  {\it
    apr\_init\_cond.m},  and  the derivative  of  the  pressures at  a
  desired   time   step  is   determined   with   the  function   {\it
    apr\_eval\_deriv.m}.
\item  {\it Intact  circulatory preparation  with contracting  atria.} 
  The electrical circuit analog  of this preparation may be visualized
  by inserting right atrial ($ra$) and left atrial ($la$) compartments
  (linear resistor  and linear, variable capacitor  with an unstressed
  volume)   between  the  venous   and  ventricular   compartments  in
  Figure~\ref{fig:rcvsim}.  The atrial  and ventricular compliances at
  a desired time step are  respectively computed by the functions {\it
    var\_vcap.m}  and  {\it   var\_acap.m}.   The  initial  pressures,
  volumes, and  flow rates  of the preparation  are computed  with the
  function {\it a\_init\_cond.m}, and  the derivative of the pressures
  at  a  desired  time  step  is determined  with  the  function  {\it
    a\_eval\_deriv.m}.
\end{itemize}
\item Resting physiologic perturbations
\begin{itemize}
\item {\it Respiratory activity.}  In addition to fixed-rate breathing
  and   random-interval   breathing   with  varying   tidal   volumes,
  $Q_{lu}(t)$ may also be represented  as a step or impulse of desired
  amplitude or area ({\it Qfrs}) and at a desired time ({\it Qfrt}) as
  well  as at  random-intervals with  a {\it  constant} tidal  volume. 
  These  breathing  patterns  are  generated with  the  function  {\it
    resp\_act.m}.
\item  {\it Autoregulation of  local vascular  beds.}  In  addition to
  bandlimited white  noise, autoregulation of local  vascular beds may
  also be represented as bandlimited, {\it 1/f} noise or a sinusoid of
  desired amplitude  ({\it ar}) and frequency ({\it  fr}).  The former
  representation is generated with  the functions {\it bl\_filt.m} and
  {\it oneoverf\_filt.m}.
\item {\it  Central oscillator.}  A central  oscillator is represented
  as  an exogenous,  sinusoidal disturbance  to $P_a^{sp}$  of desired
  amplitude ({\it ap}) and frequency ({\it fp}).
\item  {\it  Non-baroreflex  mediated  fluctuations  in  $Q_v^0(t)$.}  
  Fluctuations  in   $Q_v^0(t)$  not  due  to   the  baroreflexes  are
  represented  as a  white disturbance  of desired  standard deviation
  ({\it stdwq}) that  is bandlimited to a desired  frequency ($fcoq$). 
  These  fluctuations may specifically  be due  to, for  example, fast
  acting hormonal  loops.  These  fluctuations are generated  with the
  function {\it bl\_filt.m}.
\end{itemize}
\end{itemize}
In order to implement all of  the above models, rather than using {\it
  read\_param.m},  the parameter vector  {\it th}  must be  created by
first copying  the file  {\it \$DIR/bin/header\_def.m} to  the current
directory  and  then executing  {\it  th=header\_def;}  at the  MATLAB
prompt (Note  that {\it  header\_def.m} can be  copied to any  name as
long as it has the extension {\it .m}).  Additionally, the appropriate
option  of  the arguments  to  {\it  simulate.mexlx}  (type {\it  help
  simulate} at the MATLAB prompt) must be selected.

\newpage \bibliography{manual} \bibliographystyle{plain}

\newpage

\end{document}