You are on page 1of 6

PROGRAMMING LANGUAGES FOR USE IN

SAFETY RELATED APPLICATIONS


Janusz Zalewski and Wolfgang A. Halangy
 University of Central Florida, Dept. of Electrical and Computer
Engineering, Orlando, FL 32816, U.S.A., jza@ece.engr.ucf.edu
y FernUniversit
at Hagen, Faculty of Electrical Engineering,
58084 Hagen, Germany, wolfgang.halang@fernuni-hagen.de

Abstract: Programmable electronic systems are being used in almost all application
sectors to perform non-safety and increasingly to perform safety functions as well.
Although software based solutions are usually superior to hardwired ones for reasons
of eciency and exibility, there is a certain reluctance of the certi cation authorities
when it comes to licensing computer based systems which are classi ed as safety
critical. Despite many attempts to overcome problems of software safety (IEC 61508,
IEC 880, VDE 0801, IDS 00-55, RTCA/DO-178), up to now neither precise guidelines
supporting the software development process are available, nor are there serious e orts
being made to develop programming languages dedicated to the implementation of
safety critical functions. To improve this unsatisfactory situation, i.e., to meet both
economic and safety requirements, it is necessary to design appropriate language
concepts with consequent regard to safety aspects. Accordingly, four subsets of a real
time language suitable for the implementation of safety related systems are proposed,
whose de nitions ful l the respective requirements of the four Safety Integrity Levels.

Keywords: Safety related systems, safety requirements, safety integrity levels, real
time programming languages, PEARL, veri cation.

1. INTRODUCTION Software based solutions are still considered to


be less trustworthy than conventional hardwired
components, which is justi ed by the longer tradi-
Computer based solutions are permanently gain- tion of hardware and, therefore, many years of ex-
ing signi cance in almost all application elds, not perience in the development of strategies to cope
least because of the rapid progress in microelec- with corresponding failures. Actually, evaluating
tronics enabling cheap and exible implementa- software with respect to dependability or safety
tions. Although it is quite natural that industry aspects is a task which has been neglected for a
tends to bene t from these economic advantages, long time. However, owing to various e orts dur-
there is, however, a type of system designated ing recent years, there exists a number of methods
as safety related for which this trend does not and guidelines belonging to di erent application
prevail. The reason for this is to be found in elds and, among others, having the principal
the growing awareness of safety hazards, and as intention to de ne requirements for programming
a consequence of the demand for highly depend- languages for use in safety related systems IEC
able systems. The latter holds true especially if (1998), DIN (1995), MOD (1991), IEC (1986),
malfunctions of the concerned systems may result RTCA (1992). The guidelines agree on the follow-
in disastrous accidents, as it is characteristic for ing general requirements:
automation systems.
 programming languages should be fully and In an attempt to remedy this unsatisfactory situa-
unambiguously de ned or shall possess a tion, in this paper we introduce several program-
formally de ned syntax, respectively, ming language concepts which we think stand a
 be user and problem oriented, better chance of enhancing trustworthiness and
 be of a high level with preference to safety dependability of software based safety related sys-
oriented standardised subsets, tems. To this end, we rst discuss some inherent
 enable structured programming, restricting characteristics of software, focusing particularly
branches and loops and avoiding jumps and on the di erences with respect to the nature of
computed branches, software and hardware failures. We then present
 should support simple and uniform address- a basic principle which is decisive in the develop-
ing techniques, and ment of new language concepts for safety related
 strong typing, i.e., enforce explicit declara- programming. The following section de nes four
tion, initialisation and type conversions, increasingly restricted subsets of the real time
 but not comprise dynamic variables or other programming language PEARL 90 DIN (1998)
dynamic objects, recommended for use in safety related applica-
 language structures should be modular, in- tions, and classi es these subsets according to
terfaces between modules should be simple, their suitability with reference to the four discrete
uniform and fully de ned, and levels of increasing safety integrity requirements
 procedures should be simply structured, hav- (SIL 1,...,SIL 4) introduced in the Draft Interna-
ing a minimum number of parameters, only; tional Standard IEC 61508-1 IEC (1998).
communication should exclusively be permit-
ted via parameters; recursive procedure calls
should be not allowed.
2. CAUSES AND NATURE OF SOFTWARE
Unfortunately, these guidelines are restricted to FAILURES
the description of shortcomings or desirable fea-
tures with respect to existing languages. They are Although always implemented with the latest
often rather imprecise, thus not o ering substan- technology, the architecture of digital comput-
tial support during system development. Actually, ers has remained essentially unchanged since the
no new language has been developed on the basis times of Konrad Zuse and John von Neumann
of these standards, nor have the mentioned guide- in the 1940s. The prevailing architectural model
lines so far motivated the re-design of existing lan- matches the technical possibilities of that time.
guages for use in safety related applications. Con- In other words, while the technology with which
sequently, even though the process of veri cation hardware is built and the capabilities of hardware
is inevitable for any code segment implementing a have tremendously advanced within the last 60
safety related function, no progress based on the years, all high level programming languages de-
cited standards is evident or is to be expected. veloped so far, and presently in use, re ect to
Indeed, because veri cation is the main prerequi- di erent extents the way programs are executed
site to enable the certi cation of larger software by Von Neumann machines, allowing maximum
based solutions, only serious improvements aiming exibility at the price of facilitating errors and
to support the process of program veri cation will being unsafe. As a consequence of this and due
be a step in the right direction. The importance of to the in ationary increase in the demand for
this becomes even more evident when we consider functionality, the complexity of software is explod-
the fact that for practicability reasons the work- ing exponentially. This, in turn, leads to error-
load involved in verifying safety related software prone software development and results in a lack
has to be restricted to a reasonable limit. The of software dependability.
present state of the art implies, for example, that In society, there is a growing concern for safety
formal methods only apply for such veri cation and environmental hazards, and an increasing
processes when the code sequences are quite short. demand for dependable technical systems which
Summing up, up to now approaches aimed at prevent loss of human lives and environmental dis-
improvements in the eld of software safety obvi- asters. To enable a exible adaptation of system
ously have not yielded results which enhance the functions to new needs and to enhance the produc-
con dence in software based solutions. The cer- tivity of system development processes, computer
ti cation authorities are, therefore, still reluctant based systems are increasingly being applied for
to license exclusively software based safety related both control and automation functions under real
systems and, consequently, system designers often time constraints. These systems have the special
prefer to employ conventional hardwired solutions property of hardware and software being closely
despite their manifest disadvantages with respect coupled to form complex mixed-technology sys-
to the mentioned economic aspects. tems such as manufacturing, process or trac
control systems.
When analysing malfunctions of computer based with machine oriented interfaces. Object oriented
safety related systems, it can be observed that and visual higher level programming languages
often the reasons are not to be found in random have been developed in parallel with, and re ect-
hardware failures, i.e., failures occurring at ran- ing the need for, graphical user interfaces for a
dom times or resulting from a variety of degra- wider population of end users. However, in order
dation mechanisms in the hardware. Rather, they to support the process of system veri cation as
result from special system states during operation, far as possible, we need to go a step further and
which had not been considered in the speci cation develop a new brand of \subject oriented" rather
or implementation phases of the software. Natu- than \object oriented" programming languages to
rally, programs are immaterial and, consequently, ensure that programming and non-programming
do not degrade in a similar way to hardware com- system developers and certi cation licensors can
ponents. Software failures, which must be clas- be given a common ground at the interface.
si ed as systematic, are due to errors, mistakes The assertion that a program is apparently free
or omissions in any development life cycle phase. of software faults is the major prerequisite for
Systematic failures include IEC (1998): granting a safety licence by authorised certi ca-
 failures due to errors in the safety require- tion institutions. Since everybody grasps a simple
ments speci cation, and thing instantly and as intended, to enable ver-
 failures due to errors in the design, imple- i ability of software, we have chosen simplicity
mentation, etc. of software. as an appropriate, fundamental and particularly
Thus, provision against these types of failures human oriented design concept. The ease with
should already have been taken into account in which simple systems are understood and their
the early phases of system development. clear and distinct behaviour when executed is a
pre-condition to achieve social consensus which
Software has to be valid and correct. The latter constitutes the essence of veri cation. The fact
means that software has to ful l a given problem that everybody understands an item under con-
speci cation, i.e., it must exclude systematic fail- sideration immediately as intended increases the
ures based on program design, coding, or the use trustworthiness of the result. Thus, simplicity is a
of software tools. Correctness of software cannot fundamental feature to increase the con dence in
be achieved by testing, reviews, audits, inspec- computer based systems.
tions, walkthroughs or other heuristic methods, If varied pragmatic interpretation is possible or
because these inherently lack the rigour necessary required due to vagueness or ambiguity of expres-
to be able to detect all errors contained in a sion, an interpreted item is not simple. This leads
program. And, since by de nition correct software to confusion as, unless speci cally prevented, peo-
meets its speci cation, establishing software cor- ple seldom interpret the same thing in the same
rectness alone is not sucient. When a program way. Conversely, we can conclude that an item of
does not behave as expected, often its very spec- consideration is simple, if its meaning can be taken
i cation is incorrect, incomplete or inconsistent. literally as given and requires no extra cognitive
Thus, it and the resulting software cannot be processing e ort to arrive at. Applied to software,
valid. Consequently, to produce proper software a program may be regarded as simple if it can be
based systems it is essential to invest high vali- veri ed in a mechanised way. Such a mechanised
dation e orts already in the speci cation phase. software veri cation is a complete test, because it
Unfortunately, at this stage there are no usability would not require intellectual understanding and
checklists or measures for assessing whether a can be carried out by a computer.
speci cation is valid.
Irrespective of the fact that in reality strict causal-
ity is often questionable, people usually think in
terms of actions or events and their results, which
3. FOSTERING SAFETY BY SIMPLICITY they tend to perceive as causes and e ects. There-
fore, cause/e ect tables or decision tables appear
Although sometimes supported by computerised to be highly appropriate as a form of software rep-
tools, the proof of a program's correctness de- resentation oriented at human cognition. This is
pends for its success on human cognizance. In further substantiated by the property that tables
order to minimise the cognitive e ort necessary to are visual means. If such diagrams of causes and
produce it, and to maximise its trustworthiness, it e ects are simple and follow accepted ergonomic
is essential to employ user oriented programming standards, everybody will develop the same men-
concepts. By their very nature, programming lan- tal model of the operations of the formulated soft-
guages are human-computer interfaces par excel- ware. This cannot be guaranteed if text or words
lance. This property is seldom recognised, possibly are used for programming since people tend to use
due to the programmers' familiarity with the Von their idiosyncratic experience to interpret them.
Neumann architecture and their acquired comfort
Hence, visualisation is a conditio sine qua non of of real time control software, and to be viewed
interface design supporting shared understanding as potential candidates for consideration in this
across a varied user population. As they have domain. These subsets are associated with the
nite size, cause/e ect tables also lend themselves safety integrity levels as follows:
to a complete test. Because of their more accurate SIL PEARL Subset
t to human cognition and because the results SIL 1 HI-PEARL
of complete tests are absolutely sure, programs SIL 2 Safe PEARL
thus veri ed may be permitted to be employed SIL 3 Veri able PEARL
in automation systems which have to meet the SIL 4 Table PEARL
requirements of Safety Integrity Level 4.
Although the subsets are traditional procedural
languages, they are simple and subject oriented,
4. SAFETY INTEGRITY LEVELS AND because oriented at the absolutely necessary they
INHERENTLY SAFE LANGUAGES comprise the simplest and most well understood
language constructs, only. The four PEARL 90
Guided by the principle of simplicity, but relax- subsets are becoming progressively restrictive to-
ing the requirements gradually, we now de ne a wards higher safety integrity levels. The assign-
sequence of programming language subsets for im- ment of the subsets to the di erent safety integrity
plementing software that has to ful l the demands levels results from the simplicity and clarity of the
of Safety Integrity Level 4 through 1. veri cation methods available for the program-
ming paradigms on which the single languages are
4.1 PEARL 90 based. As outlined above, the simplicity of the
software veri cation process directly correlates to
The textual language PEARL 90 DIN (1998) is the trustworthiness of computerised systems. Ba-
one of the very few genuine high level real time sically, the language subsets di er in some \un-
languages. Owing to its clear concepts and its safe" language features that are gradually prohib-
modular, block oriented structure, PEARL 90 ited. The main advantage of this approach is that
is especially suitable for industrial process con- one does not have to learn a di erent language for
trol applications and is also increasingly used in each safety level and the compiler can help to ver-
academia for teaching purposes. Its algorithmic ify if the programs respect certain safety require-
part has approximately the same facilities as Pas- ments. The use of language subsets to implement
cal. Additionally, PEARL 90 provides the data safety critical systems also allows to mix code with
types clock an duration and the following state- di erent levels of safety integrity, which enables
ments for task scheduling and control: a seamless connection between safety critical and
uncritical parts of a system.
 activate for task activation,
 terminate for task termination,
 suspend for temporary blocking of a task, 4.3 Table PEARL
 continue for releasing a suspended task,
 resume for the combination of suspend and The subset Table PEARL de ned below consists
continue, and of only one executable statement allowing the for-
 prevent for annihilation of all scheduled mulation of the rules which constitute cause/e ect
future activations of a task. tables. As was already pointed out in Section 3,
software represented in this form can be veri-
The above statements are coupled to time re- ed with the highest certainty. Therefore, it is
lated or event driven scheduling conditions. The licensable for applications having to meet Safety
synchronisation mechanism and the protection Integrity Level 4. For the formal de nition of this
of shared data in the language are based upon and the other subsets we use an extension of the
a concept of generalised semaphores. Exception classical Backus Naur form (EBNF), brackets [ ]
handling is founded on internal signals in an un- to denote optional syntactical expressions, as well
structured manner. PEARL 90 de nes a generic as the symbols * and + to denote repetition of
input/output concept in the form of so-called the correspondingly marked expressions at least
DATIONs (DATa staTIONs), which serve the zero times or once, respectively.
speci cation of device topology, data access, con-
trol information etc. Table PEARL
hmodulei ::= MODULE [hvar-decli;]*
[hrulei;]* MODEND;
4.2 Enhancing Safety hvar-decli::= DCL hnamei : htypei;
hrulei ::= IF hbool-expressioni
In the following sections, we o er four nested THEN hvariablei := hexpressioni
subsets of PEARL aimed at enhancing the safety FIN
4.4 Veri able PEARL consequence, HI-PEARL constitutes a program-
ming language feasible for implementing systems
The derivative Veri able PEARL de ned in the classi ed as safety related on SIL 1.
following table comprises just those language con-
structs which are necessary to program in a tex- Safe PEARL
tual form the interconnection patterns of Function hmodulei ::= MODULE [(hnamei)]
Block Diagrams, as de ned in IEC 61131-3 IEC [hmod-extensioni];
(1992); in other words, parameter passing and [hitrfc-speci]*
procedure invocation. Corresponding programs [hsystem-parti]
are rather easy to verify with rigorous methods of hproblem-parti
high trustworthiness Halang et al. (1998). Hence, MODEND;
they can be certi ed for Safety Integrity Level 3. hmod-extensioni::= EXTEND (hnamei [,hnamei]+)
Veri able PEARL hitrfc-speci ::= INTERFACE (hnamei)
hmodulei ::= MODULE [(hnamei)] hitrfc-decli* ;
[hproblemi] MODEND; hitrfc-decli ::= hitrfc-var-decli
hproblemi ::= PROBLEM [hproc-speci]* j hitrfc-proc-decli
[hvar-decli]* hproc-stmti+; hitrfc-var-decli ::= SPC hnamei : htypei READ;
hproc-speci ::= SPC hnamei : PROC hlst-of-pari hitrfc-proc-decli ::= SPC hnamei : PROC
hreturn-typei; [GLOBAL]; hlst-of-pari hreturn-typei;
hvar-decli ::= DCL hnamei : htypei; hsystem-parti ::= SYSTEM;
hproc-stmti::= hproc-namei hlst-of-pari; hnamei : hnamei;
hlst-of-pari ::= ( hpari [,hpari]* ) hproblem-parti ::= PROBLEM;
hpari ::= hconsti j hvar-namei [hdeclarationsi]+
hdeclarationsi ::= hvar-decli
j hproc-decli
4.5 Safe PEARL hvar-decli ::= DCL hnamei : htypei;
hproc-decli ::= hnamei : PROC
hlst-of-pari hreturn-typei;
Only in very rare cases all features of high level hbodyi
programming languages are necessary to formu- END;
late the functionalities required in control engi- hlst-of-pari ::= ( hpar-decli [, hpar-decli]* )
neering. Therefore, in the following table we de- hpar-decli ::= hnamei : htypei
ne an inherently safe language subset restricted hbodyi ::= [hvar-decli]+
to those executable statements which are re- [hstatement-seqi]
ally necessary and, thus, indispensible, viz., pro- hstatement-seqi ::= [hstatementi;]*
cedure calls, assignments, conditional selections, hstatementi ::= (hstatement-seqi)
and loops with bounded numbers of iterations. j hassignmenti
The correctness of programs formulated with this j hconditionali
subset can be proven with adequate tool support j hfor-loopi
by, for instance, higher order logic, which is a hassignmenti ::= hvariablei := hexpressioni
typi ed variant of Church's higher predicate logic. hconditionali ::= IF hbool-expressioni
Therefore, this subset quali es for usage under THEN hstatement-seqi
the conditions of safety Integrity Level 2. The [ELSE hstatement-seqi] FIN
attribute READ within the declaration of an inter- hfor-loopi ::= FOR hvariablei
face variable ensures that other modules are only [FROM hconstanti]
permitted to read the declared variable but not [BY hconstanti]
to write it. Variables, procedures and types are TO hconstanti
just names within this language subset. Expres- REPEAT hstatement-seqi END
sions contain the usual Boolean and arithmetical
operations. For formulating critical regions, the structured
LOCK mechanism, with a time-out clause, is
introduced and the concept of semaphores is re-
4.6 HI-PEARL moved. The time-out clause ensures that the wait-
ing time before entering a critical region is limited.
The derived subset called H(igh)I(ntegrity)-PEARL In case that the lock cannot be carried through
preserves the obvious advantages of the original before this time limit is exceeded, an alternative
language, but is much more suitable for imple- action takes place. The mentioned time-out clause
menting safety related software, especially with and the lock's execution time limit enable the
respect to schedulability, since it is veri able with determination of an upper time execution limit for
respect to its functionality and timeliness. As a each lock statement at compile time. To ensure
that no synchronisation or I/O operation takes Safety Integrity Level (SIL 1) can be easily anal-
arbitrarily long | in case multiple processes claim ysed for schedulability, which is assured by elimi-
a shared resource | shared objects may only nating some \unsafe" language constructs such as
be referenced within the framework of a LOCK GOTO, WHILE and REPEAT. Although they are
statement. To prevent the formation of arbitrarily not as simple as the subset for SIL 2, HI-PEARL
long cascades of exceptions and interrupts, with programs are veri able as well.
each exception speci cation a constant value is However, much more important than the technical
associated, bounding the number of occurrences details mentioned above is the realisation of the
and the time for handling the exception within important r^ole the human component plays in the
one single activation of the process provoking it. process of engineering safe computerised systems,
The minimum time period between two interrupt which can and will lead to future research. In
signals on one line equivalent to the maximum this paper we have drawn attention to the fact
frequency of the interrupt signal has to be stated that programming languages are best perceived
in the interrupt's speci cation. To disable itera- as human-computer interfaces which are subject
tions that prohibit an analysis of schedulability to ergonomic principles that need to be followed in
of programs and, hence, lead to undeterminis- design of end user interfaces. We suggested, there-
tic behaviour WHILE and REPEAT loops are fore, that higher level programming languages
removed. Instead, iteration statements have to ought to be \subject" (i.e., human user) rather
explicitly specify their execution times and the than \object" (i.e., system) oriented. We have
maximum number of repetitions. The GOTO identi ed simplicity as a fundamental design prin-
statement which is unsuitable for structured pro- ciple for programming languages, fostering human
gramming as well as directly or indirectly recur- cognitive performance and, thus, safety.
sive procedure calls are banned.

References
5. CONCLUSION
Dijkstra, E.W. (1989). The next forty years. Per-
Despite the existence of standards like IEC 61508- sonal note EWD 1051.
1 or DIN V VDE 0801, software based systems DIN 66 253-2 (1998). Programmiersprache
are still considered to be less trustworthy than PEARL 90. Beuth Verlag, Berlin.
conventional hardwired components, which is jus- Halang, W.A. A.H. Frigeri, R. Lichtenecker, U.
ti ed in part by the longer tradition of hardware Steinmann and K. Wendland (1998). Method-
engineering and many years of experience in the enlehre sicherheitsgerichteter Echtzeitprogram-
development of strategies for coping with corre- mierung. Schriftenreihe der Bundesanstalt fur
sponding failures. This situation is due to Arbeitsschutz und Arbeitsmedizin { Forschung
{ Fb 813. Verlag fur neue Wissenschaft, Bre-
 the standards being unclear about the char- merhaven.
acteristics of environments for safety critical Interim Defence Standard 00-55 (1991). The Pro-
programming, and curement of Safety Critical Software in Defence
 no programming language (and related pro- Equipment. British Ministry of Defence.
gramming environment) based on these guide- IEC 880 (1986). Software for Computers in Safety
lines being available. Systems of Nuclear Power Stations. Interna-
To overcome this situation, a dedicated subset of tional Electrotechnical Commission, Geneva.
PEARL 90 has been proposed for each of the IEC 61131-3 (1992). Programmable Controllers,
4 Safety Integrity Levels de ned in IEC 61508- Part 3: Programming Languages. International
1, following the principle of simplicity: the more Electrotechnical Commission, Geneva.
safety critical a system is, the more simple the Draft International Standard IEC 61508-1 (1998).
related control software needs to be. Accordingly, Functional Safety of Electrical/Electronic/ Pro-
on the highest Safety Integrity Level (SIL 4) the grammable Electronic Systems: Generic Aspects
safety/integrity of a \software" system can be | Part 1: General Requirements. International
veri ed just by looking at a Cause E ect Table, Electrotechnical Commission, Geneva.
i.e., without employing formal proofs. Control Krebs, H., and U. Haspel (1984). Ein Verfahren
software for SIL 3 systems can be graphically zur Software-Veri kation. Regelungstechnische
constructed, based on already proven function Praxis rtp 26, 73{78.
blocks. This will simplify the process of software RTCA/DO-178B (1992). Software Considerations
development as compared to textual languages in Airborne Systems and Equipment Certi ca-
and still keep the task of safety proofs relatively tion. (www.rtca.org)
easy. Programs written in the subset for SIL 2 DIN V VDE 0801 (1995). Grundsatze fur Rech-
have the main advantage of being formally veri - ner in Systemen mit Sicherheitsaufgaben. Beuth
able. Finally, the subset HI-PEARL for the lowest Verlag, Berlin.

You might also like