next up previous contents
Next: Modifications and Extensions Up: Source Code Previous: Source Code

   
Flowchart and Functions

The source code is based on the MATLAB function simulate.m. The input arguments to 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 2 as well as in Appendix A. However, the flowchart of Figure 7 depicts how the function simulates the data from the desired parameter values characterizing only the models of Section 2. The pertinent details of each block of the flowchart are provided below.

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

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

The function simulate.m is called by a wrapper function 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 rcvsim.m, which also includes a help option, reads in the parameter file with read_param.m (see above), creates a header file in MIT format, executes 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 plot_cfvr.c (which employs Gnuplot). In order to execute rcvsim.m, the function must be compiled with the file make.m which creates the binary file rcvsim. The function simulate.m may also be compiled independently of rcvsim.m with the file makem.m which creates the binary file simulate.mexlx (in the Linux environment). Each of these make files greatly improve execution speed specifically through mcc (MATLAB compiler) optimization arguments r (real numbers only) and i (no dynamic memory allocation). Note that simulate.m may only be executed in the MATLAB environment without on-line viewing and parameter updating capabilities.


next up previous contents
Next: Modifications and Extensions Up: Source Code Previous: Source Code
Ramakrishna Mukkamala (rama@egr.msu.edu)
2004-02-03