Copyright «> IFAC Modelling and Control in Biomedical Systems, Karlsburg/Greifswald, Germany, 2000
GOLEM - COMPUTER SIMULATOR OF BODY FLUIDS AND ACID-BASE DISORDERS AS AN EFFICIENT TELEEDUCAnON TOOL
Jiff Kofranek, Toma~ Velan, Patrik Janicadis Department of Pathological Physiology, I sI Faculty of Medicine, Charles University, Prague, Czech Republic
Abstract: Our aim was to enable students to try out solving of individual critical situations out of reality on simulator. Two interrelated aims have been solved during the development of "GOLEM", the simulator of physiological functions - the generation of a simulation model, which is the essential concept of the simulator and the simulator itself. For each of these goals different developer's tools are being adequate. GOLEM is going to be a very useful teaching device to help understanding the basic rules of physiological regulations and the manifestations of their disorders in pathogenesis of different pathological conditions. The simulator also allows to carry out virtual therapeutic interventions. Copyright © 2000 IFAC . Keywords: Computer aided instruction, Educational aids, Learning systems, Physiological models, Simulation, Simulators, Software tools.
I. THE PHYSIOME PROJECT
in literature, trying to describe integrally the intricate relations among kidney regulation, respiration, circulation, ion composition, acid-basic equilibrium and dynamics of body fluid by means of non-linear differential equation system (e.g. Ikeda et al. 1979, Coleman et al. 1983).
The expansion of computer science introduces narrative approaches to medicine and biology. Among them, computer modelling (simulation models) will enable understanding the dynamics of complex regulating processes and their disorders in living organisms. Progress in the field of modelling in biology and medicine is closely associated with the topic of mathematically formalised description of biological reality - i.e. transformation of description of a network of relations from verbal description to formalised description in the mathematical language.
Similarly to theoretical physics, where experimental research in physics and related sciences is being interpreted, a new physiological approach called integrative physiology attempts to formalize description of mutual regulations in physiology. Here, methodological tools are computer models. Activities in this field are summarized in the international project PHYSIOME, which is a descendant of the GENOME project, mapping the sequence of the nucleic acid of the human genome (GENOME is expected to be finished after the year 2002). The aim of the PHYSIOME project' is to
We have met formalised description in physiology since the end of 60s (since the pilot works of Grodins at al. (1967) describing respiration). A specific classical milestone was the description of circulation by Guyton et al. in 1972, which tried to cover wider physiologic implications of the circulatory system, respiratory system and kidney. Since the end of 70s, extensive simulation models have gradually appeared
I
197
http:// physiome.org
challenge. Our aim is to develop multimedia educational programmes that utilize various simulation games. One of those is a simulator of physiological functions called Golem 3 .
2 HOW TO DO IT? Two kinds of problems were to be solved by construction of the medical simulator (fig. 1):
••
'-----~I ~...
~ ~
Fig.
I. Process of creation physiological functions
of simulator
I.
The development of the simulation model of physiological functions - the theoretical work itself, based on formalization of physiological relations.
2.
The development of the simulator of physiological functions (the working title Golem is used) and the use of the simulator in education - practical application of the theoretical results. In addition, we have always supported the Internet accessibility of the project results.
of
integrate biophysical, biochemical and physiological knowledge by application of models of physiological systems (Bassingthwaighte, 1999). The results of this project can be immediately employed in medical education. Linking multimedia environment, serving as a graphical and sound interface, with simulation models, facilitates demonstration of complex regulatory processes (and their disorders) by an interactive simulation game. Outputs of such models are visualized as curves in charts or as changing pictures, movement of objects etc. They represent, therefore, ideal combination for explanation of causal relations and multipart processes. Computer models for biology and medicine are directly used in sophisticated educational programmes and medical simulators, the importance of which will further increase with the expansion of computers and Internet.
Each of the problems is specific and requires using different developer's tools. Whereas developing an educational simulator is a programmer's work, formalisation of global physiological relations is rather than creating a software complicated scientific problem. The effective solution needs using adequate tools. Luckily for us, in the last years substantial progress has been made in the field of software development tools for the design and testing ofsimulation models. Therefore, we could utilize the advantage of professional tools by Mathworks (Matlab, Simulink and related libraries).
With the possibility of commercial use, there is a change in the view of formal description of physiologic reality that underlies simulation models. Detailed formalised description (in the form of mathematical equations or better algorithms written in a text form of a programming language) as a pure SCientific subject has now suddenly become a confidential technological know-how, because of potential competition.
3. SIMULAnON CHIPS The theoretical concept of the simulator is a large simulation model based on mathematical formalization of the transfer of blood gasses, acidbase, electrolyte, volume and osmotic equilibrium, the function of the respiratory and urinary system, including the influence of hormones. The model design is based on classical models of Guyton et al. (1972), Cameron (1977), Ikeda et al. (1979), and Coleman et al. (1983), which we have sufficiently redesigned and extended.
For example, though by the end of the 1980's it was common to acquire, by written request, the listing of a Fortran program, which nowadays is almost impossible. Critical Concepts 2, an American company that sells medical simulators, provides only general information on the theoretical concepts on which their products are based. Since we have been involved in the work on simulation of biomedical systems for more than twenty years, we accepted the current situation as a
3 This research was partially supported by the Charles University Grant No. 217/l998 and by the Research and Development Programme MSM111100008 (physiome.cz).
2http://www.critcon.com 198
-----~~ -_._-~--
,--_----_---_-__....--_ ...-_._-----' .... _--------_.,
::=:~~.:_~ ----_ _._._----__.-,--...- .. ---_.Fig. 2. Demonstration of relatively "simple" part of simulation model of blood gases transfer subsystem. Structure is strongly similar to an electronic "chip" but on the inputs and outputs instead of current, the information about values of individual variables of the model are transmitted. By the aid of relevant software tools for computer simulation, behaviour of this "software chip" can be relatively easily tested: similarly to an electric scheme, where it is possible to carry current on individual "pins" of the chip, the same manner can be used to carry selected value (or some time course of values) of an appropriate variable to the created software chip. Herewith the measure displays, which, during passing simulation register (numeric or graphical shape) appropriate values, can be, using computer mouse, easily connected to the outputs (on the right). Analogy with an electric schema implies also from the fact, that values of variables can be found not only on outputs of a subsystem (represented by simulating "chip"), but also anywhere inside of the system - display or virtual "oscilloscope" can be consequently, by aid of mouse, interactively connected to whatever contact (it means to whatever line) on the scheme and after starting simulation programme selected values can be registered (or filed).hypochloremic acidification of urine in metabolic alkalosis due to incessant vomiting etc. Recently, we have also included ventilation-perfusion disorders and alterations in the sensitivity of the respiratory centre for pe0 2 in chronic respiratory insufficiency.
.._."
... ~-~:=.
Fig. 3. "Inside" of simulation chip we can see again the structure similar to electric network with integrated circuits connected altogether. Appropriate circles are inputs and outputs from complete scheme to individual input and output "pins" of software chips. Rectangles represent other connected software simulation chips ("integrated circuits") of a lower level in the hierarchy. And in the same way as in the electric circuits, some chips of the identical type can be utilized on different positions - in this case it is the modulus ABINVT, calculating partial pressures and pH from the concentrations of blood gases and from the value characterizing buffer capacity of blood (BE in virtual full oxygenated blood). Structural scheme of our simulation model consists of very complicated hierarchical network of mathematical equations, which, when expressed graphically, highly resembles the structure of complicated electrical circuits (instead of electrical currents the values of each variables are delivered between the chips). On figures 2-6 is shown the representation of one part of the simulation model subsystem for blood gas transfer and figure 7 displays basic links between key regulatory circuits of urinary system. For those interested in detailed structure of the entire model, the complex scheme is available on the Internet upon request (
[email protected]).
It consists of 38 non-linear differential equations and contains 89 input and 189 output variables. The simulation model comprises now also formalization of the relationships between acid-base and electrolyte homeostasis so that it is able to simulate paradoxical
199
~
..
"-"J'a==..-
_ _ _ ............ rIIIII
-+-+-If--to"r'
......... _
.• _._........ _ . _ . _ UI
-~=~
. . - . . . . . . . '''' ... T
Fig. 4. The interior of "integrated circuit" named ABINVT (mentioned above) is also composed from connected "chips". And looking inside one of these five chips (TEMP37T) we can see...
Fig. 6.... and until the last component (PH37T) we can finally see proper computation scheme (sumators, multipliers and so on) - some ''transistors in a simulation chip". These connected elements represent individual mathematical relations. These relations don't have to be only simple algebraic expressions as shown in presented example in this picture. It is possible, using integrators, to formally display also differential and integral equations and so on. Even schemes on figures 2-7 are not a product of a drawing programme - they are a direct output of the tool for simulation.
_...... :-:=_._-....--
Furthermore, drawn structures are in the environment of Simulink "alive" - constant or variable values could be entered using mouse in the appropriate inputs of the software simulation "chips" (i.e. subsystems of the simulation models) and output variables could be detected in digital or graphical representation on the outputs.
,.._.~
_
•
••-c
,
--~
---
~'l"
... _ .... t
-_
.. _."""---
This way, the Simulink scheme can be a very useful documentation itself. Because of the international collaboration, it is very useful that Mathworks develops visualizator of Simulink schemes for Internet - e.g. in the PHYSIOME project it will be possible to describe the structure of the physiological regulatory circuits directly on WWW pages in Simulink schemes, which are becoming one of the industrial standards.
Fig. 5.... that it is again composed from another three components... We use the mask of blocks of subsystems as a front label of the simulation chip with description of all inputs and outputs.We found very rewarding to write down proper documentation, which is enabled by Simulink while retaining all the functions. Documentation (updated frequently) is also designed as a library of software simulation chips.
Components (simulation chips) can be stored in libraries, and then withdrawn by a single mouse movement and reused in a new application. Using such a procedure, we generated several libraries divided by physiological subsystems (acid~ base equilibrium and transfer of blood gasses, respiration, kidneys, water and ion equilibrium, circulation etc.) Mathworks' simulation tools are designed for specialists and are not very suitable for an inexperienced user, who wants only to "play".
It might seem from the first glance that we are too
concerned about the formal features of the model, but as soon as more people are cooperating on the project (especially if the cooperation is international), goodquality documentation may save a lot of time. The concept of simulation chips enables easily create and change the structure of a model and - as well as in all modem computer-supported applications generate detail documentation.
Even though user-friendly interface could be developed, for the application of the simulation model in medical education it is still too complicated. Therefore, we had to use different developer's tools for the educational simulator of physiological functions itself.
200
Industrial plant
UO communication layer of llOftw_ dtlver
Kernel of aol'tw_ dtlver Con1roIWEB
communication la~r of eoftwa.. driver Kemel of Control Web
UMr application (written In Control Web)
Fig.. 8. Communication of the system Control Web with driver measuring! controlling adapters during creation of industrial applications
Fig. 7 Structure of the connection of basic regulatory circuits of renal functions composed by "simulating chips". Owing to the documentation and description of inputs and outputs in masks of individual subsystems can everyone work with them even if he or she did not create these simulating circuitsA
Main structural components of the user application are virtual devices (communicating with each other by means of variables and messages). Each of the virtual devices is a component, properties of which are easily modifiable using visualization and control elements. But not only this - each component is equipped with powerful programming tools as are local variables and user defined event-handling procedures.
4. COMPONENTS FOR GOLEM "Svensk kvalitet (till Tjeckisa priser)" - "Swedish quality (for Czech prices)", is the motto on a handout of a Scandinavian distributor of a powerful software tool from the Czech Republic. Swedish people are very proud of the quality of their products, so if they claim in public that the development tool Control Web made by Moravian Instruments Inc. reached Swedish quality, it is a great honour for the group of authors who have been working very hard on the product from early 1990's. Nowadays, their effort peaked in the fact that their programme (its source code contains more than 2 million lines) is fmding its way on the world market. Latest version of the programme could be used in Czech, English, German or even in Japanese characters.
Measured values of the real world are delivered to the virtual devices through input channels, control signals from the environment are sent through output channels. Importantly, the system works in real time - every input/output channel is read in the moment when the virtual device (or a group of devices) asks for it. Real-time timing is monitored in detail and controlled. Virtual devices can be scheduled in exactly defined time and order. The Control Web system supports very powerful means for development of the user interface of Golem simulator. For instance, it is easy to drag a device with the mouse from the group of virtual devices to the appropriate panel and then in an interactive dialog, set the values of its attributes, defme its local variables or individual procedures (methods of the object) etc.
Control Web is mainly designed for development of industrial visualization and control application for WIN32 platjorm 4 (collection, storing and processing of data, development of man-machine interfaces, etc.) The kernel of the Control Web system communicates trough a driver of a measuring/controlling adapter with an industrial appliance. User application created with the help of visualizing tools is then connected to the system kernel (fig. 8).
4
In order to take advantage of the developer's comfort of the Control Web system, it was necessary to create a specific driver, which would communicate
http://www.mii.cz 201
Fig. I 1. Gradual generation of the simulator.
Fig. 9. Palette of virtual instruments of the system Control Web.
Kemel of software driver Control Web communication layerr-:::--..,..L...:-''''''''' of software driver
,--.-IC-.-IC-..L...,
User interface of simulator (written in Control Web)~~!!!~
Fig. 10. Inserting of simulating model to the driver of the "virtual card" during creation of simulator Golem in the system Control Web. (through software channels) with Control Web objects. Fig. 12 Possibilities of the distributed educational simulating application.
Contrasting to drivers for real measuring and control adapters, this driver does not communicate with hardware of the adapters, but with the integrated simulation model. If the driver is smart enough, the Control Web system is deceived. Input channels (leading to measuring devices) are treated as if they were measuring signals from a technological surrounding of the computer. In reality, they are the output variables of the simulation model.
10) containing the simulation model itself. The driver was implemented in C++. For its implementation, we used simulation model, of which the comfort of Matlab and Simu/ink convinced us (fig 11). Furthermore, the virtual driver enables us to generate source code in C++ from the Simulink model using a special tool.
Through the driver, output channels of the Control Web control elements do not set active technological elements, but change inputs of the simulation model. The mutual relations between the simulation model in the virtual driver and the visualization Control. The kernel of the simulator is a virtual driver (fig.
Great advantage of the new version of Control Web is the ActiveX container included as one of the virtual devices, which represents a bridge connecting the Control Web system and the ActiveX properties and methods (OLE Automation). It is possible for example, to generate interactive educational anima202
-__-
ot=e. .. ..... .
Fig. 15. Ratio of metabolic production and renal excretion of strong acids is highly increased. H+/Na+ and WIK+ exchange on the cell membrane is activated. H+ ions are buffered by intracellular and extracellular buffers.
Fig. 13. Communication with distant educational simulating server, which was created in system Control Web by a common WWWbrowser.
--
_....-
2$
Fig. 14. Turning the knob we can increase the metabolic production rate of non volatile acids. By increasing the strong acid production, we cause metabolic acidosis.
"CI/l.tIoI9 1 - .....
I
Fig. 16. Blood buffer system - the blood has been acidified, Base Excess and actual bicarbonate concentration are decreasing, and pC0 2 is also slowly decreasing.
tions in Macromedia Director system and store them as ActiveX components in the container.
5. GOLEM INSTEAD OF THE PATIENT
Another indisputable advantage of the development of the simulator in the Control Web environment is that the system generates distributed solutions. This offers the possibility to develop a distributed application. Demanding numeric calculations of the simulator are processed on the server (Control Web) and visualization runs on the clients (fig. 12).
The practical result of our effort is Golem, a simulator of physiological functions. Simulator is drawn up so that its controlling would be as easy as possible. That is why the menus, buttons, switches (controlled by mouse), knobs (easy turnable by mouse and so appropriate values can be set), mouse controlled scroll bars, windows for inserting or displaying of numerical values etc.
Apart from that, Control Web supports visualization on any WWW clients, because Control Web contains full-value HTTP server. This will help to connect to the simulation educational server through a common WWW browser (using Java applets for the display of basic virtual devices), which will be of great importance for distant educational programmes.
Inputs ofthe simulator are:
•
203
External conditions (as atmospheric pressure, concentration of gases in inspired air etc.) and initial values of some quantities
Fig. 17. Acid-base values on this compensatory diagram are in the acute metabolic acidosis range. This is the beginning of a progressive reaction by the ventilation center to counteract metabolic acidosis.
Fig. 19. The slow response of the respiratory system on metabolic acidosis is due to the relative impermeability of bicarbonate across the bloodbrain barrier. While COz penetrates easily and pCO z in blood and cerebrospinal fluid is at a similar level, this is not the case for bicarbonate. Thus bicarbonate reaches equilibrium, cerebrospinal pH decreases, the respiratory center is more stimulated, and alveolar ventilation increases resulting in a decrease of pCO z. Values of acid-base parameters are slowly approaching to compensated metabolic acidosis range.
Fig. 18. Respiratory compensation is at a maximum in about 12 hours. Decreasing pC02 is leading to a rise of arterial blood pH. Acid-base parameters are approaching a compensated metabolic acidosis range. •
before starting simulation (amount of substances in the stores)
•
Rate of intake or loss of individual substances (ions, water, glucose) inlout of organism (through gastrointestinal tract or by infusion). Entering the rate of intake/loss enables arrangement of different scenarios of pathological disorders (for example diarrhoea, vomiting... ) and their infusion therapy (by different types of infusion solution).
Fig.
•
20. The kidney's response progressively develops. Titratable acidity and NIL + excretion increases, urine pH decreases. Renal response is in its maximum in 3-5 days. Only enough should be given to compensate pH. Turning the knob we are starting bicarbonate infusion therapy.
Outputs ofthe simulator appear:
Some of the internal parameters of physiological regulators in the model of simulation, their change can simulate different pathophysiological disorders of regulation (for example diabetes).
•
204
In windows with animated schemes of physiological subsystems: for quick oreintation the colour of the window with numerical output is green in the case of normal parameters, the window is red if the physiological limit was
Fig. 21. BE and pH slowly increase after bicarbonate infusion. pCO z remains stable for a while (thanks to respiratory compensation), at its low leveL We must take pCOz into account when choosing doses of alkaline infusion in order not to overdose.
Fig. 22. If we overdose the infusion (as shown above), we correct BE, but hyperventilation leads the patient from acidemia to alkalemia which can be dangerous. After pushing the corresponding button the variable is connected to the regulatory loop again. By disconnecting of individual regulators we can observe separately the behaviour of independent regulatory loops and partial physiological subsystems. Thus, the simulator substitutes the whole scale of models of partial physiological subsystems and it can contribute to the understanding of a single physiological regulatory link.
exceeded, the window is light blue when the value is under the lower interval limit. Changing the values of individual quantities is often accompanied by changing animated schemes (for example by changing of "level", changing of dropping from a tap, changing direction of animated arrows etc.). •
But the simulator is not only a simple collection of models of physiological subsystems. Thanks to its complexity, the simulator enables practical demonstration of continuity of physiological subsystems and how this continuity is manifested in different pathophysiological situations. The simulator is able to simulate different pathological situations and some therapeutic interventions by changing rules its input values. The simple example of an acid-base disorder should demonstrate how easy it is to manipulate the simulator (fig. 14 - 20).
In windows with graphical outputs: windows with physiological schemes and window with charts can be easily switched over using corresponding buttons.
From the pedagogic point of view it is very effective if we can locally follow the response of individual physiological subsystems to a change of values which are regulated in other part of the organism. Therefore, we introduced to the simulator the possibility of "detachment of regulation" of some regulated physiological variables and their "switching over to setting input locally". A single push of the button under the window of appropriate variable (which is input to given subsystem) immediately disconnects the variable from the outer regulatory loop.
6. CONCLUSION GOLEM is going to be a very useful teaching device to help understanding the basic rules of physiological regulations and the manifestations of their disorders in pathogenesis of different pathological conditions (Kofranek, 1996, Kofranek et aL, 1997).
The values can be changed and the response of the subsystem to set values followed. It enables to confine during the simulation to specific physiological subsystem and study its behaviour independently of the complicated regulation relationships inside the whole organism and to observe behaviour of individual physiological relationships separately. This enables better understanding during the study.
The simulator also allows to carry out "virtual therapeutic interventions ", so that we can start the therapy of a virtual patient in metabolic acidosis by an alkaline infusion. In virtual therapy we can also make a mistake, for example by overdosing of thealkaline infusion we can change the patient's acidemia to alkalemia which can cause deep decrease
205
Fig. 23. Overdosis of alkaline infusion therapy would quickly lead the patient from acidemia to alkalemia, as the cell exchanges K+ for W (from the intracellular buffers). Because extracellular stores of potassium are limited, its plasma concentration will quickly and dangerously decrease. It is necessary to replace lost potassium.
Fig. 25 ..,but also increases the entry of potassium into cells resulting in a faster correction of K+ depletion. The infusion must not contain too large concentrations of potassium (as this would increase K+ to dangerous level).
REFERENCES Bassingthwaighte, J.B. (1999). Closing in on the physiome monster. Hierarchies, independence and interdependence in strategies. In: 1999 Physiome Symposium in Seattle. Integrated biology of the heart. (yipintsoi, T., S. McCuloch, J. Caldwel, R.Reneman (Eds)) University of Washington, pp. 10-11. Cameron, W.H. (1977): A model framework for computer simulation of overall renal function. J. Theor. BioI. vol. 66., pp. 552-572 Coleman, T. G. and J.E. Randall (1983): HUMAN. A comprehensive physiological model. The Physiologist, vol. 26, (1): 15-21. Grodins, F., S., J. Buell and A. Bart (1967).: Mathematical analysis and digital simulation of the respiratory control system. J. Appl. Physio/., vol. 22, (2): p. 250-276. Guyton, A. C., T.A. Coleman and H.J.Grander (1972): Circulation: Overall regulation. Ann. Rev. Physiol., 1972, p. 13-41 Ikeda, N., F. Marumo and M. Shirsataka: A Model of overall regulation of body fluids. Ann. Biomed. Eng. vol. 7: pp. 135-166 Kofranek, J. (1996): Golem: A computer simulator of physiologic functions. Alternatives To Laboratory Animals (ATLA), voI. 24, Special Issue, October 1996, p. 199. 1. Kofranek, T. Velan, R. Kerekes (1997): Golem: A computer simulator of physiological functions as an efficient teaching tool. In: Legacy for 21 S1 Cencury. Preceedings of the First Word Congress on Systems Simulation., (Teo, Z.M., W.C.Wong., T.I.Oren, R. Rimane (Eds.)), IEEE Singapopre Section, Singapore., Singapore, 407-411.
Fig. 24. To correct the K+ depletion, we must use a potassium infusion in glucose and insulin insulin takes glucose into cells ... of the plasma concentration of potassium (Fig. 2122). We can try to correct this arising dangerous hypokalemia (fig. 23-24) or using the button "Restart" we return to the start. Nothing can happen, because the patient is virtual (and his potential death is just only virtual) - but in the case of real patient this is not the true. Our aim was to enable students to try out solving of individual critical situations out of reality on simulator. Appropriately selected software tools (Matlab, Simulink and Control Web) were very useful for us when developing the simulator.
206