Applied Mathematics
Vol.3 No.12(2012), Article ID:25643,7 pages DOI:10.4236/am.2012.312275

CARDIOGUI: An Interface Guide to Simulate Cardiovascular Respiratory System during Physical Activity

Jean Marie Ntaganda1, Benjamin Mampassi2

1Applied Mathematical Department, National University of Rwanda, Butare, Rwanda

2Department of Mathematics and Computer Science, Cheikh Anta Diop University of Dakar, Dakar, Senegal


Received August 18, 2012; revised September 18, 2012; accepted September 25, 2012

Keywords: Graphical User Interface; Arterial Oxygen Pressure; Arterial Dioxide Pressure; Cardiovascular/Respiratory System; Optimal Control Problem; Numerical Simulation; Physical Activity


This paper aims at the presentation of an interface to simulate cardiovascular respiratory system. The authors are interested in the resolution of optimal control problem related to the performance of a 30 years old woman. The results show in the most case the determinant parameters of cardiovascular respiratory system reach the equilibrium value due to its controls that is heart rate and alveolar ventilation.

1. Introduction

By definition, a graphical user interface (GUI) is a pictorial interface to a program written by familiar environment. The GUI is common in currently used software. It displays in one or more windows containing controls, called components, that enable a user to perform interactive tasks. Therefore the user does not have to create a script or type commands at the command line to accomplish the tasks. GUI works as the mediator between systems and users and their quality is a crucial point in the users’ decision of using them. Furthermore, the use of GUI allows the program easier to use by providing it a consistent appearance. This environment contains pushbuttons, toggle buttons, lists, menus, text boxes, and so forth, all of which are already familiar to the user, so that he or she can concentrate on using the application rather than on the mechanics involved in doing things. Consequently a user knows what to expect when he or she performs an action. Sometimes, the GUI testing is used for justifying a significant amount of the overall testing efforts. GUI testing shows us that some models are very costly to be manually created and the specifications of software applications are rarely available in a way that models can be created from them [1,2]. It is easier to use GUI testing the application through its API (Application Programming Interface) than performing software testing through GUI. This is due to the fact the performing software requires additional programming effort to simulate user actions, to observe the outputs produced and to check its correctness, even when using auxiliary libraries like UI Automation [3]. The development of numerous testing tools have been done to reduce testing effort [4- 6].

Matlab has modest resources to create a GUI that is useful for applications because it is well known for its numerical problem solving power. We wish to share our experience in modelling of cardiovascular respiratory system with others. The GUI we are presenting is called CARDIOGUI and is a set of Matlab functions that defines an interactive environment for simulating an optimal control problem of cardiovascular respiratory system during physical activity. The menu based user interface also allows a choice of parameters. The objective is to stabilize the systemic arterial pressure and systemic venous pressure around their equilibrium value whether the two control (Heart rate and alveolar ventilation) of cardiovascular respiratory system are stabilized around their corresponding equilibrium value.

This paper is organized as follows. The Section 2 is interested in describing an optimal control problem to be solved. The main window of CARDIOGUI for getting optimal solutions is presented in Section 3. Some numerical results based on CARDIOGUI implemented in Matlab environment for a 30 years old woman are given in Section 4. The Section 5 deals with concluding remarks.

2. What Is the Problem to Be Solved by Using CARDIOGUI?

CARDIOGUI is an interactive environment based on Matlab Version 6.5 or 7.0 for solving the optimal control problem of cardiovascular respiratory system.

Let us consider heart rate, alveolar ventilation, systemic arterial pressure and systemic venous pressure. Based on physiology properties of the human cardiovascular respiratory system three compartments including the systemic arterial compartment (SAC), the systemic venous compartment (SVC) and the alveolar compartment (AC) can be considered. These compartments and exchanges are shown in the Figure 1.

These three compartments include two circuits (systemic and pulmonary) which are arranged in series and two pumps (left and right ventricles). Blood flow in arteries is regarded to be convective and mainly driven by pressure pulse generated by the heart beats. The respiratory control system varies the ventilation rate in response to the levels of dioxide and oxygen gases. Consequently, the ventilation rate and cardiac output influence mutually. It is then obvious that exchanges between the two compartments SAC and SVC are controlled by heart rate and alveolar ventilation functions. The mechanism of this control is not direct and can be represented by outflow functions between systemic arterial and venous compartments that depend on heart rate and alveolar ventilation (Figure 1). Therefore a nonlinear compartment analysis leads on the following global model equations [7]



where and are identified model constants and

Figure 1. Diagram for a two compartment cardiovascularrespiratory mathematical model.

, identified model functions [7]. The functions and denote respectively mean blood pressures in systemic arterial region and systemic venous region. Equation (1) and (2) arise from straightforward development of mass balance between arterial systemic arterial and systemic venous compartments. They are obtained utilizing Fick's law and Boyle’s law relating the concentration of the gas in the solution to the partial pressure. If , and are corresponding equilibrium value of , and respectively, the optimal control problem can be formulated as follows.

Find solution of


subject to




In the relation (3), the positive scalar coefficients determine how much weight is attached to each cost component term in the integrand while denotes the maximum time that the physical activity can take.

To approximate the problem (3)-(6), let us consider


a linear base of functions B-splines on a uniform grid


In fact we have

Now let us introduce the vectorial space generated by the base. We have 1)


Let us suppose and consider the operator of interpolation


such that


It is easy to verify



Now let us take



The approximative system of (4) - (6) can be formulated as follows.

Find solution of the system




such that



Now let us formulate the approximate of the optimal control problem (3)-(6).

We consider the following notations.

is state vector, represents the corresponding initial vector, is the wanted steady state vector, denotes the control vector and is its corresponding equilibrium.

et are respectively component of vectors and

The problem (3)-(6) is written as follows


where is solution of approximate system (14)-(16).

We look for an approximate solution of (19) in It is noted that we can write


Hence the objective function becomes



Finally, CARDIOGUI solves the following discrete optimal problem obtained from (19)-(21).


where is a matrix whose are components of the function in and is the matrix where component is with

solution of (14)-(16) associated to

, and are weight matrix defined by


The detail related to function identification and is presented in [7]. According to the type of physical activity, their explicit form is as follows.

1) Walking case

2) Jogging case

3) Running case

Model constants are


while the identity matrix and are taken in numerical simulation.

3. How Does CARDIOGUI Allow Getting Results?

CARDIOGUI is an uncompressed folder whose the files are written in Matlab environment. It should be copied in a choice directory as follows “myname/CARDIOGUI” for example. To run CARDIOGUI simply the user changes her or his directory start up Matlab and type CARDIOGUI. The main window is shown in the Figure 2.

The Figure 2 shows us how we can set different parameters. The default parameters have been put. The frame on the right illustrates eight parameters. Each button in the frame includes two types parties: Static button and Edit button. Except “Age” button where the number of age can be written by the user, others parameters can be set.

CARDIOGUI simulates three types of physical activeity: Walking, Jogging and Running. Both Walking for type physical activity and Female for sex are chosen as default in the Figure 2. In the same figure, also the rest parameters of cardiovascular respiratory system are set by default. Four push buttons allow the user to run CARDIOGUI.m: “Start” button leads to run it by using the set parameters, “Own parameters” button allows the user to set her/his own parameters. When the user has already run CARDIOGUI.m the results are removed by clicking “Reset” button which displays this first Figure 2. To close the figure of simulation the user clicks the “Close” button.

Figure 2. The main CARDIOGUI window as Guide user Interface of cardiovascular-respiratory mathematical model where we have a woman during physical activity, the blood circulation and the heart in vasoconstriction. The parameters are set by using the frame menus.

4. Some Simulations

4.1. Simulation by Using Parameters of Frame on Right

In our simulation we consider equilibrium values as given in [7]. These values are presented in the Table 1.

To use default parameters (the parameters at rest), the user clicks directly on Start button. For example using the rest value presented in the Table 2, the Figures 3-5 illustrate respectively results in walking, jogging and running case.

The Figures 3-5 illustrate very well the crucial role heart rate and alveolar ventilation that are controls of cardiovascular respiratory system. They show that the stabilization of these controls allows systemic arterial and venous pressures to reach their equilibrium values.

4.2. Simulation Using Own Parameters

By using CARDIOGUI, the user can set his/her own parameters. This processus is possible by clicking on “Own Parameters” button. Then the he/she sees the modal dialog box which is the result of the Matlab built-in function “” function. This function can be generally described as follows.

The syntax is answer = inputdlg (prompt,dlg title,num lines, defAns) where prompt is a cell array containing “ prompt” strings, “dlg_title” specifies a title for the dialog box, “num_lines” is a scalar, it applies to all prompts and “defAns” specifies the default value to display for each prompt. “defAns” must contain the same number of elements as prompt and all elements must be strings. As inputdlg uses a Matlab “uiwait” function to suspend execution until the user responds, the user can get the detail whither he/she clicks on “Own Parameters” button. After clicking on OK which confirms that the user has already put the last parameter (Rest Venous Pressure), CARDIOGUI starts the simulation.

Table 1. Equilibrium values used in numerical simulation.

Table 2. The rest parameters used in numerical simulation.

Figure 3. Optimal cardiovascular-respiratory controls and optimal cardiovascular-respiratory pressures by using CARDIOGUI in walking case.

Figure 4. Optimal cardiovascular-respiratory controls and optimal cardiovascular-respiratory pressures by using CARDIOGUI in jogging case.

Figure 5. Optimal cardiovascular-respiratory controls and optimal cardiovascular-respiratory pressures by using CARDIOGUI in running case.

5. Concluding Remarks

In this work we have investigated a role of controls of cardiovascular-respiratory system during physical activity to its main pressures using an interface guide called CARDIOGUI. The influence of these controls to this system is illustrated by efficient results. CARDIOGUI is the first version to simulate cardiovascular respiratory system during the physical activity. The contributions and comments from the readers will be necessary allow us its improvement. They are welcome to plan to release future versions of CARDIOGUI that incorporate enhancements.


  1. A. M. Memon, M. E. Pollack and M. L. Soffa, “Using a Goal-Driven Approach to Generate Test Cases for GUIs,” Proceedings of the 21st International Conference on Software Engineering, Los Angeles, 16-22 May 1999, pp. 257-266. doi:10.1145/302405.302632
  2. A. C. R. Paiva, et al., “A Model-to-Implementation Mapping Tool for Automated Model-Based GUI Testing,” Proceedings of the 7th international conference on Formal Methods and Software Engineering, Manchester, 1-4 November 2005, pp. 450-464.
  3. Microsoft, “UI Automation, msdn 2009,” 2009.
  4. P. Hamill, “Unit Test Frameworks,” O’Reilly Media, Sebastopol, 2004, p. 216.
  5. E. Hendrickson, “Making the Right Choice,” Software Testing & Quality Engineering, 1999, pp. 21-25.
  6. N. Nyman, “Using Monkey Test Tools,” Software Testing & Quality Engineering, Vol. 29, No. 2, 2000, pp. 18- 21.
  7. J. M. Ntaganda, B. Mampassi and D. Seck, “Modelling Blood Partial Pressures of the Human Cardiovascular/ Respiratory System,” Applied Mathematics and Computation, Vol. 187, No. 2, 2007, pp. 1100-1108. doi:10.1016/j.amc.2006.09.016