Haemo Dialysis Software Architecture Design Experiences
Haemo Dialysis Software Architecture Design Experiences
Design Experiences
Abstract
In this paper we present the experiences and architecture from a research
project conducted in cooperation with two industry partners. The goal of
the project was to reengineer an existing system for haemo dialysis
machines into a domain specific software architecture [23]. Our main
experiences are (1) architecture design is an iterative and incremental
process, (2) software qualities require a context, (3) quality attribute
assessment methods are too detailed for use during architectural design,
(4) application domain concepts are not the best abstractions, (5)
aes-thetics guides the architect in finding potential weaknesses in the
archi-tecture, (6) it is extremely hard to decide when an architecture
design is ready, and (7) documenting software architectures is a
important prob-lem. We also present the architecture and the design
rational to give a basis for our experiences. We evaluated the
resulting architecture by implementing a prototype application.
1. Introduction
Software architecture design is an art. Today only a few, sketchy meth-ods
exist for designing software architecture [3,14,15,16]. The challenge facing
the software architect is to find an optimal balance in software
Filter
Patient
= pump
Figure 1. Schematic of Haemo Dialysis Machine
Hardware API
2.2 Requirements
The aim during architectural design is to optimize the potential of
the architecture (and the system built based on it) to fulfil the
software quality requirements. For dialysis systems, the driving
software quality requirements are maintainability, reusability, safety,
real-timeliness and demonstrability. Below, these quality
requirements are described in the context of dialysis systems.
Maintainability
Past haemo dialysis machines produced by our partner company have
proven to be hard to maintain. Each release of software with bug correc-
tions and function extensions have made the software harder and harder to
comprehend and maintain. One of the major requirements for the software
architecture for the new dialysis system family is that maintain-ability
should be considerably better than the existing systems, with respect to
corrective but especially adaptive maintenance:
Reusability
The software developed for the dialysis machine should be reusable.
Already today there are different models of haemo dialysis machines
and market requirements for customization will most probably require a
larger number of haemo dialysis models. Of course, the reuse level
between different haemo dialysis machine models should be high.
Safety
Haemo dialysis machines operate as an extension of the patients blood
flow and numerous situations could appear that are harmful and possi-
bly even lethal to the patient. Since the safety of the patient has very
high priority, the system has extremely strict safety requirements. The
haemo dialysis system may not expose the dialysis patient to any
hazard, but should detect the rise of such conditions and return the
dialysis machine and the patient to a state which present no danger to
the patient, i.e. a safe-state. Actions, like stopping the dialysis fluid if
con-centrations are out of range and stopping the blood flow if air
bubbles are detected in the extra corporal system, are such protective
measures to achieve a safe state. This requirement have to some extent
already been transformed into functional requirements by the safety
requirements standard for haemo dialysis machines [8], but only as far
as to define a number of hazard situations, corresponding thresh-hold
values and the method to use for achieving the safe-state. However, a
number of other criteria affecting safety are not dealt with. For
example, if the communi-cation with a pump fails, the system should be
able to determine the risk and deal with it as necessary, i.e. achieving
safe state and notify the nurse that a service technician is required.
Real-timeliness
The process of haemo dialysis is, by nature, not a very time critical pro-
cess, in the sense that actions must be taken within a few milli- or
microseconds during normal operation. During a typical treatment, once
the flows, concentrations and temperatures are set, the process only
requires monitoring. However, response time becomes important when
a hazard or fault condition arises. In the case of a detected hazard, e.g.
air is detected in the extra corporal unit, the haemo dialysis machine
must react very quickly to immediately return the system to a safe state.
Timings for these situation are presented in the safety standard for
haemo dialysis machines [8].
Demonstrability
As previously stated, the patient safety is very important. To ensure
that haemo dialysis machines that are sold adhere to the regulations
for safety, an independent certification institute must certify each
construc-tion. The certification process is repeated for every (major)
new release of the software which substantially increases the cost for
developing and maintaining the haemo dialysis machines. One way
to reduce the cost for certification is to make it easy to demonstrate
that the software per-forms the required safety functions as required.
This requirement we denote as demonstrability.
Architecture Architecture
Improvement Evaluation
Improvement Good
Opportunity Analysis enough?
NO
YES Arch.
Descr.
3. Lessons Learned
During the architecture design project, we gathered a number of experi-
ences that, we believe, have validity in a more general context than the
project itself. In this section, we present the lessons that we learned. In
the next section, the architecture design process leading to them and the
foundations for our experiences are presented.
4. Architecture
The haemo dialysis architecture project started out with a very informal
description of the legacy architecture, conveyed both in text and figures
and via several discussions during our design meetings. For describing
the resulting architecture we use two of the four views from the 4+1
View Model [16], i.e. Logical View and Dynamic View. The develop-
Device
The system is modeled as a device hierarchy, starting with the entities
close to the hardware up to the complete system. For every device,
there are zero or more sub-devices and a controlling algorithm. The
device is either a leaf device or a logical device. A leaf device is
parameterized with a controlling algorithm and a normalizer. A logical
device is, in addition to the controlling algorithm and the normalizer,
parameterized with one or more sub devices.
ControllingAlgorithm
In the device archetype, information about relations and
configuration is stored. Computation is done in a separate archetype,
which is used to parameterize Device components. The
ControllingAlgorithm performs calculations for setting the values of
sub output devices based on the val-ues it gets from input sub
devices and the control it receives from the encapsulating device.
When the device is a leaf node the calculation is normally void.
Normaliser
To deal with different units of measurement a normalization archetype
is used. The normalizer is used to parameterize the device components
and is invoked when normalizing from and to the units used by up-hier-
archy devices and the controlling algorithm of the device.
AlarmDetectorDevice
Is a specialization of the Device archetype. Components of the
Alarm-DetectorDevice archetype is responsible for monitoring the
sub devices and make sure the value read from the sensors are within
the alarm threshold value set to the AlarmDetectorDevice. When
threshold limits are crossed an AlarmHandler component is invoked.
AlarmHandler
The AlarmHandler is the archetype responsible for responding to
alarms by returning the haemo dialysis machine to a safe-state or by
addressing the cause of the alarm. Components are used to
parameterize the AlarmDetectorDevice components.
0 1 ControllingAlgortihm
Device calculate( )
getValue( )
setValue( ) * Normaliser
normalise( )
denormalise( )
hazard surveillance
0
AlarmHandler
AlarmDetectorDevice activate( )
reset( ) Sends alarm events reset( )
Scheduler
The scheduler archetype is responsible for scheduling and invoking the
periodic objects. Only one scheduler element in the application may
exist and it handles all periodic objects of the architecture. The sched-
uler accepts registrations from periodic objects and then distributes the
execution between all the registered periodic objects. This kind of
scheduling is not pre-emptive and requires usage of non-blocking I/O.
Periodic object
A periodic object is responsible for implementing its task using non-
blocking I/O and using only the established time quanta. The tick()
method will run to its completion and invoke the necessary methods
to complete its task. Several periodic objects may exist in the
application architecture and the periodic object is responsible for
registering itself with the scheduler (figure 5).
Scheduler
execute( )
1..*
PeridicObject
tick( )
Target
holds data other entities are dependent on. The target is responsible
for notifying the link when its state changes.
Observer
depends on the data or change of data in the target. Is either updated
by a change or by own request.
Link
Maintains the dependencies between the target and its observers.
Also holds the information about the type of connection, i.e. push or
pull. It would be possible to extend the connection model with
periodic updates.
Link
update( )
Target Observer
notify( )
update( ) pushconnect( ) notify( )
pullconnect( )
conductivity.set(0.2); // in milliMol
temperature.set(37.5); // in Celsius
weightloss.set(2000); // in milliLitre
dialysisFluidFlow.set(200);//in milliLitre/minute
overHeatAlarm.set(37.5,5); // ideal value in
/ Celsius and maximum deviation in percent
wait(180); // in minutes
HD Treatment HaemoDialysisMachine
ReversedFlowAlarm Protective
System
TempCtrlConcCtrl SetCtrl
FrequenceToRevolutions
Control System: Hardware API Level
Alarm Monitoring
The control system may utilize AlarmDevices to detect problem
situa-tions and the protective system will consist of a more complex
configu-ration of different types of AlarmDevices. These will also
be run periodically and in pseudo parallel. The message sequence of
one tick() for alarm monitoring is shown in figure 9.
scheduler AlarmDevice Monitored Controlling Alarm
Device Algorithm Handler
tick
getValue
calculate
Activate
Treatment Process
The treatment process is central to the haemo dialysis machine and
its software. The general process of a treatment consists of the
following steps; (1) preparation, (2) self test, (3) priming, (4)
connect patient blood flow, (5) set treatment parameters, (6) start
dialysis, (7) treatment done (8) indication, (9) nurse feeds back
blood to patient, (10) discon-nect patient from machine, (11)
treatment records saved, (12) disinfect-ing, (13) power down.
The process generally takes several hours and the major part of the
time the treatment process are involved in a monitoring and controlling
cycle. The more detailed specification of this sub process is here.
1. Start fluid control
2. Start blood control
3. Start measuring treatment parameters, e.g. duration, weight
loss, trans-membrane pressure, etc.
4. Start protective system
5. Control and monitor blood and fluid systems until time-out
or accumulated weight loss reached desired values
6. Treatment shutdown
4.6 Rationale
During the design of the haemo dialysis architecture we had to make
a number of design decisions. In this section the major design
decisions and their rationale are presented.
The iterations
The architecture design was iterated and evaluated some three times
more, each addressing the requirements of the previous design and
incorporating more of the full requirement specification.
In the first iteration, we used the Facade design pattern [11] to rem-
edy the problem of hiding details from the treatment specifications.
Spurred by the wonderful pattern we introduced several facades in the
architecture. The result was unnecessary complexity and did not give
the simple specification of a treatment that we desired.
In the second iteration, we reduced the number of facades and
adjusted the abstraction, into a device hierarchy. This allowed us to use
sub-devices that were communicating with the hardware and dealt with
the low-level problems such as normalization and hardware APIs.
These low-level devices were connected as logical inputs and outputs to
other logical devices. The logical devices handle logical entities, e.g. a
heater device and a thermometer device are connected to the logical
device Temperature (figure 7). This allows for specification of
treatments using the vocabulary of the logical devices, adapted from the
low level hard-ware parameters to the domain vocabulary.
In the third major iteration, the architecture was improved for flexi-
bility and reuse by introducing parameterization for normalization and
control algorithms. Also the alarm detection device was introduced for
detecting anomalies and hazards situations.
Concurrency
The control system involves constantly executing control loops that
evaluate the current state of the process and calculates new set values to
keep the process at its optimal parameters. This is supposed to be done
simultaneously, i.e. in parallel. However, the system is in its basic ver-
sion only equipped with a signal processor reducing parallelism to
pseudo parallel. On a single processor system we have the options of
(1) choose to use a third party real-time kernel supporting multi-threads
and real-time scheduling. And (2) we can design and implement the
sys-tem to be semi-concurrent using the periodic objects approach [20]
and make sure that the alarm functions are given the due priority for
achiev-ing swift detection and elimination of hazards. Finally (3) we
may choose the optimistic approach, i.e., design a sequentially
executing sys-tem and make it fast enough to achieve the tightest
response time requirements.
The first one is undesirable because of two reasons, i.e. resource
con-sumption and price. The resources, i.e. memory and processor
capacity, consumed by such a real-time kernel are substantial especially
since we most likely will have to sacrifice resources, e.g. processor
capacity and memory, for service we will not use. In addition, the price
for a certified real-time kernel is high and the production and
maintenance depart-ments become dependent on third-party software.
The third option is perhaps the most straightforward option and
could probably be completed. The profound problem is that it becomes
un-deterministic. This is affecting the demonstrability negatively.
Because of the software certification, it is unrealistic to believe that
such an implementation would be allowed in a dialysis machines.
The second option, pose limitations in the implementation and
design of the system, i.e. all objects must implement their methods
using non-blocking I/O. However, it still is the most promising solu-
tion. Periodic objects visualize the parallel behavior clearly, using
the scheduler and its list of periodic objects especially since it has
been used successfully in other systems.
Communication
The traditional component communication semantics are that a sender
sends a message to a known receiver. However, this simple message send
4.7 Evaluation
In this section an analysis of the architecture design is presented with
respect to the quality requirements. As stated in section 3.2, the
tradi-tional assessment methods are inadequate for the architecture
level and therefore our evaluation was strongest on maintainability
(prototype) and more subjective for the other quality requirements.
Maintainability
To evaluate the maintainability and feasibility of the architecture the
industrial partner EC-Gruppen developed a prototype of the fluid-
sys-tem. The prototype included controlling fluid pumps and the
conduc-tivity sensors. In total the source code volume for the
prototype was 5,5 kLOC.
The maintainability was validated by an extension of the prototype.
Changing the pump process control algorithms, a typically common
maintenance task. The change required about seven (7) lines of code to
change in two (2) classes. And the prototype was operational again
after less than two days work from one person. Although this is not
scientifi-cally valid evidence, it indicates that the architecture easily
incorporates planned changes.
Reusability
The reusability of components and applications developed using this
architecture has not been measured, for obvious reasons. But our pre-
liminary assessment shows that the sub quality factors of reusability [19],
i.e. generality, modularity, software system independence, machine
independence and self-descriptiveness, all are reasonably accounted for in
this architecture. First, the architecture supports generality. The device
archetype allow for separation between devices and most of the application
architecture will be made of devices of different forms. Sec-ond, the
modularity is high. The archetypes allows for clear and distin-guishable
separation of features into their own device entity. Third, the architecture
has no excessive dependencies to any other software system, e.g. multi
processing kernel. Fourth, the hardware dependencies have been separated
into their own device entities and can easily by substi-tuted for other
brands or models. Finally, the archetypes provide com-prehensible
abstraction for modeling a haemo dialysis machine. Locating,
understanding and modifying existing behavior is, due to the architecture
an easy and comprehendible task.
Safety
The alarm devices ensure the safety of the patient in a structured and
comprehensible way. Every hazard condition is monitored has its
own AlarmDetectorDevice. This makes it easier to demonstrate what
safety precautions have been implemented from the standard.
Real-timeliness
This requirement was not explicitly evaluated during the project.
Instead our assumption was that the data processing performance would
equal that of a Pentium processor. Given that the prototype would work
on a PC running NT, it would be able to run fast enough with a less
resource consuming operating system in the haemo dialysis machine.
Demonstrability
Our goal when concerned with the demonstrability was to achieve a
design that made the specification of a treatment and its complex
sub-processes very similar to how domain experts would express the
treat-ment their own vocabulary. The source code example in section
4 for specifying a treatment in the application is very intuitive
compared to specifying the parameters of the complex sub processes
of the treat-ments. Hence, we consider that design goal achieved.
5. Conclusions
In this paper, the architectural design of a haemo dialysis system and the
lessons learned from the process leading to the architecture have been
presented. The main experiences from the project are the following. First,
quality requirements are often specified without any context and this
complicates the evaluation of the architecture for these attributes and the
balancing of quality attributes. Second, assessment techniques developed
by the various research communities studying a single quality attribute,
e.g. performance or reusability, are generally intended for later phases in
development and require sometimes excessive effort and data not available
during architecture design. Third, the archetypes use as the foundation of a
software architecture cannot be deduced from the appli-cation domain
through domain analysis. Instead, the archetypes repre-sent chunks of
domain functionality optimized for the driving quality requirements.
Fourth, during the design process we learned that design is inherently
iterative, that group design meetings are far more effective than individual
architects and that documenting design decisions is very important in order
to capture the design rationale. Fifth, architecture designs have an
associated aesthetics that, at least, is perceived inter-sub-jectively and an
intuitively appealing design proved to be an excellent indicator, as well as
the lack of appeal. Sixth, it proved to be hard to decide when one was done
with the architectural design due to the nat-ural tendency of software
engineers to perfect solutions and to the required effort of architecture
assessment. Finally, it is very hard to doc-ument all relevant aspects of a
software architecture. The architecture design presented in the previous
section provides some background to our experiences.
Acknowledgements
We would like to thank our partners in the research project,
Althin Medical AB, Ronneby, and Elektronik Gruppen AB,
Helsingborg, espe-cially, Lars-Olof Sandberg, Anders Kambrin, and
Mogens Lundholm, and our collegues, Michael Mattsson and Peter
Molin, who participated in the design of the architecture.
References
[1] G. Abowd, L. Bass, P. Clements, R. Kazman, L. Northrop, A. Moormann
Zaremski, Recommend Best Industrial Practice for Software Architecture
Evaluation, CMU/SEI-96-TR-025, 1997.
[2] C. Argyris, R. Putnam, D. Smith, Action Science: Concepts, methods, and
skills for research and intervention, Jossey-Bass, San Fransisco, 1985
[3] P. Bengtsson, J. Bosch, "Scenario-based Software Architecture
Reengineering", Proceedings of the 5th International Conference on
Software Reuse (ICSR5), IEEE, 2-5 june, 1998
[4] B. W. Boehm, “A Spiral Model of Software Development and
Enhancement”, IEEE Computer, 61-72, May 1988
[5] G. Booch, Object-Oriented Analysis and Design with Applications,
Benjamin/ Cummings Publishing Company, 1994.
[6] J. Bosch, ‘Design of an Object-Oriented Measurement System Framework’,
Object-Oriented Application Frameworks, M. Fayad, D. Schmidt, R. Johnson
(eds.), John Wiley, (coming)
[7] F. Buschmann, R. Meunier, H. Rohnert, M.Stahl, Pattern-Oriented Software
Architecture - A System of Patterns, John Wiley & Sons, 1996.
[8] CEI/IEC 601-2, Safety requirements std.for dialysis machines
[9] P. C. Clements, A Survey of Architecture Description Languages, Eight
International Workshop on Software Specification and Design, Germany,
March 1996
[10] N.E. Fenton, S.L. Pfleeger, Software Metrics - A Rigorous & Practical
Approach (2nd edition), International Thomson Computer Press, 1996.
[11] Gamma et. al., Design Patterns Elements of Reusable Design,
Addison.Wesley, 1995.
[12] IEEE Standard Glossary of Software Engineering Terminology, IEEE Std.
610.12-1990.