SEQUENCE-BASED SPECIFICATION OF CRITICAL SOFTWARE SYSTEMS



Similar documents
Overview Motivating Examples Interleaving Model Semantics of Correctness Testing, Debugging, and Verification

Procidia Control Solutions Dedicated Backup in a Single Variable Control Loop

[Refer Slide Time: 05:10]

Model-Based Testing of Spacecraft Flight Software

Compliance and Requirement Traceability for SysML v.1.0a

How To Develop Software

Safety controls, alarms, and interlocks as IPLs

Controller Automation, Model II+

A Propositional Dynamic Logic for CCS Programs

Automated Program Behavior Analysis

Development of Application Software for Stock Material Selection for Manufacturing of Shafts

Introducing Formal Methods. Software Engineering and Formal Methods

Chapter 6, The Operating System Machine Level

Axiomatic design of software systems

Introducing Formal Methods into Industry using Cleanroom and CSP

PROPERTECHNIQUEOFSOFTWARE INSPECTIONUSING GUARDED COMMANDLANGUAGE

Programmable Logic Controller PLC

Software Engineering Reference Framework

Module 10. Coding and Testing. Version 2 CSE IIT, Kharagpur

Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay

Technical Note. Initialization Sequence for DDR SDRAM. Introduction. Initializing DDR SDRAM

Introduction. - Please be sure to read and understand Precautions and Introductions in CX-Simulator Operation Manual and

The Role of Automation Systems in Management of Change

Introduction to Formal Methods. Các Phương Pháp Hình Thức Cho Phát Triển Phần Mềm

DANSE Software Quality Assurance

Control 2004, University of Bath, UK, September 2004

Configuring PROFINET

THREE YEAR DEGREE (HONS.) COURSE BACHELOR OF COMPUTER APPLICATION (BCA) First Year Paper I Computer Fundamentals

Introduction to Modelling Embedded Systems with Alvis

Operating Systems for Parallel Processing Assistent Lecturer Alecu Felician Economic Informatics Department Academy of Economic Studies Bucharest

DO-254 Requirements Traceability

Domains. Seminar on High Availability and Timeliness in Linux. Zhao, Xiaodong March 2003 Department of Computer Science University of Helsinki

Model Checking based Software Verification

Specification and Analysis of Contracts Lecture 1 Introduction

The System Designer's Guide to VHDL-AMS

Microsoft Windows 2000 Terminal Services

Safety Requirements Specification Guideline

Towards a Framework for Generating Tests to Satisfy Complex Code Coverage in Java Pathfinder

3 Extending the Refinement Calculus

T Sentry 4 Multi-Point Digital Alarm Instruction Manual

Formal Verification of Software

Sofware Requirements Engineeing

Technical Training Module ( 30 Days)

Process Modelling from Insurance Event Log

An Automated Development Process for Interlocking Software that. Cuts Costs and Provides Improved Methods for Checking Quality.

Designing Real-Time and Embedded Systems with the COMET/UML method

Testing automation of projects in telecommunication domain

Security Overview of the Integrity Virtual Machines Architecture

Software Test Plan (STP) Template

C Programming. for Embedded Microcontrollers. Warwick A. Smith. Postbus 11. Elektor International Media BV. 6114ZG Susteren The Netherlands

Functional Programming. Functional Programming Languages. Chapter 14. Introduction

DeltaV SIS for Burner Management Systems

(Refer Slide Time: 01:52)

Six Strategies for Building High Performance SOA Applications

The SPES Methodology Modeling- and Analysis Techniques

CASSANDRA: Version: / 1. November 2001

Random Testing: The Best Coverage Technique - An Empirical Proof

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

Chapter 9 N.C. C. N.O. Single-Pole Double-Throw

DeltaV Virtual Studio

Requirements engineering

Thermostat Application Module Kit

Emulated Digital Control System Validation in Nuclear Power Plant Training Simulators

VHDL Test Bench Tutorial

Acknowledgement. Software Engineering. CS 3141: Team Software Project Introduction

Quality Management. Lecture 12 Software quality management

Elevator Security. General. In This Section. Several elevator security options are available for MCE Controllers. Basic Security

THE SIMULATION OF SOFTWARE PROCESSES IN THE INTEGRATED COMPUTER ENVIRONMENT IN THE CASE OF TELCO SECTOR

A Static Analyzer for Large Safety-Critical Software. Considered Programs and Semantics. Automatic Program Verification by Abstract Interpretation

EXPERIMENT 2 TRAFFIC LIGHT CONTROL SYSTEM FOR AN INTERSECTION USING S7-300 PLC

CNC FOR EDM MACHINE TOOL HARDWARE STRUCTURE. Ioan Lemeni

71M6521 Energy Meter IC. Real Time Clock Compensation. The Challenge. The RTC in the 71M6521D/F. Theory of Operation APPLICATION NOTE

PROCESS-DRIVEN SOFTWARE DEVELOPMENT METHODOLOGY FOR ENTERPRISE INFORMATION SYSTEM

Software Engineering

Network (Tree) Topology Inference Based on Prüfer Sequence

Data Quality Mining: Employing Classifiers for Assuring consistent Datasets

Creating the program. TIA Portal. SIMATIC Creating the program. Loading the block library. Deleting program block Main [OB1] Copying program blocks

Vetting Smart Instruments for the Nuclear Industry

KNOWLEDGE FACTORING USING NORMALIZATION THEORY

Firmware version: 1.10 Issue: 7 AUTODIALER GD30.2. Instruction Manual

TECH. Requirements. Why are requirements important? The Requirements Process REQUIREMENTS ELICITATION AND ANALYSIS. Requirements vs.

Software Testing Strategies and Techniques

A UML 2 Profile for Business Process Modelling *

Lessons Learned Applying Model-Based System Engineering Methods to a Strategic Planning Activity

Software tools for safety-critical software development

Measurement Information Model

Selecting Sensors for Safety Instrumented Systems per IEC (ISA )

Software Testing. Definition: Testing is a process of executing a program with data, with the sole intention of finding errors in the program.

Transcription:

Forth American Nuclear Society International Topical Meeting on Nuclear Plant Instrumentation, Controls and Human-Machine Interface Technologies (NPIC&HMIT 2004), Columbus, Ohio, September, 2004 SEQUENCE-BASED SPECIFICATION OF CRITICAL SOFTWARE SYSTEMS Stacy J. Prowell and W. Thomas Swain The University of Tennessee 203 Claxton Complex, 1122 Volunteer Blvd., Knoxville, TN 37996-3450, USA Email: sprowell@cs.utk.edu Keywords: Software specification, formal methods, rigorous specification. ABSTRACT The plant safety and regulatory requirements for software-based systems mandate rigorous verification and validation to ensure adequate reliability. As software systems become increasingly complex, testing as the sole means to assure confidence in the end product becomes impractical. Modern software engineering provides many tools which have been used successfully to reason about software, including formal systems such as Z and CSP. Many such formal notations have tools to support their use. The use of these notations and tools requires specialized training in software engineering methods. Sequence-based software specification techniques provide a connection between the initial requirements obtained from the domain experts and the formal software derivations, which can be in any appropriate notation. 1. INTRODUCTION Application of software-based systems to plant control and protection functions offers the potential for improved measurement accuracy and operational flexibility. Additionally, for many applications today it is difficult to find instruments or controllers that do not contain microprocessors. The plant safety and regulatory requirements for such systems mandate rigorous verification and validation to ensure adequate reliability, especially since software can be a source of common mode failure. As software systems become increasingly complex, testing as the sole means to assure a desired level of confidence in the end product becomes impractical. Thorough documentation and intensive review of the transition from requirements to code are labor intensive and still do not guarantee proper operation. It is therefore necessary to focus strongly on correctness in the specification and design phase and to rely on the foundational mathematics of software to prove important properties. Modern software engineering provides many tools which have been used successfully to reason about software, including formal systems such as Z (Spivey 1992), SCR (Heitmeyer 1983, 1995), and Trace Assertion Method (Bartussek 1978, Janicki 2001), and process algebras such as CCS (Milner 1989) and CSP (Hoare 1985, Roscoe 1997). Many of these notations have supporting tools. These include tools for checking properties of the specification; theorem provers to assist in proving safety, security; and other important system properties, and code generation tools to generate correct source code directly from the formal specifications.

The use of these notations and tools requires specialized training. Application domain experts cannot be expected to learn these notations and tools; this is the province of the software engineer. Unfortunately, this can create a disconnect between the domain experts who understand how the system must perform, and the software professionals who understand how to construct provably correct software systems. Sequence-based software specification techniques (Prowell 2003) provide a connection between the initial requirements obtained from the domain experts and the formal software derivations which can be in any appropriate notation. The core techniques, sequence enumeration and sequence abstraction, can be used to transform the initial requirements into an appropriate formal notation for rigorous verification and semi-automated implementation (Broadfoot 2003). Sequence enumeration involves the deliberate, systematic consideration of each possible scenario of use and the assignment of the appropriate software response. Each decision is traced to the initial requirements. This process is made practical by the introduction of sequence abstractions, which allow practitioners to work at higher levels of abstraction without losing completeness and consistency. This paper provides an overview and example of the sequence-based specification process and the transformation of the result into an external, implementation-free description of software behavior. 2. SEQUENCE SPECIFICATION Sequence enumeration is a systematic, rigorous method of iteratively discovering a complete, consistent, and traceably correct system specification from initial requirements. Initial system requirements are typically written in a combination of natural language and mathematical notation. These requirements are seldom written in a formal notation suitable for automated reasoning, because such a notation may actually obscure the very details the domain experts find most interesting. Only a short overview of sequence-based specification is presented here; for more details, see (Prowell 2003). For a larger case study which follows the process through coding and the development of a test plan, see (Prowell 1999). 2.1. Example To illustrate sequence-based specification, this paper will present highlights of the method as it would be applied to a hypothetical PWR Thermal Margin Calculator (TMC). Table 1 shows a simplified list of requirements for the TMC, as they might be expressed at the beginning of system development, regardless of the design method used. (2)

Table 1 TMC Requirements Tag Requirement 1 The TMC shall compute an accurate, but conservative, static estimate of DNBR every 100 ms. Sensor inputs for the DNBR calculation are pressurizer pressure ( p ), neutron flux at selected locations ( φ ), primary coolant mass flow rate ( F ), cold leg temperature ( T ), and hot leg temperature ( T ). c 2 The DNBR, denoted D, is compared to a trip setpoint, D, each time it is computed. If D d d i is less than the setpoint, then the trip contact output is set. 3 Sensor inputs p, φ i, F, Tc, and Th are checked for validity when sampled. If a sensor value is invalid, the channel failure indicator is set. 4 The operator interface has the following features: Numeric displays for the point ID and value of sensor inputs, calculated values, calibration constants, and setpoints. An alphanumeric display of the current point ID. A numeric keypad and associated function keys for entry of point ID selections and new values for calibration constants and setpoints. Indicator lights for trip status and channel failure status. A keyswitch to turn power on and off. 5 If a non-existent or invalid point ID is entered, the point ID and value displays revert to their previous values. 6 If an invalid calibration or setpoint value is entered, the value display reverts to the original value. 7 A watchdog timer must be reset at least every 100 ms. Otherwise the channel failure indication is set and a reboot command is issued. 8 When a TMC is powered up or rebooted, all sensor inputs are read and used to initialize the DNBR calculation, the watchdog timer is reset, and the trip contact output is set. 9 If a TMC is powered down or rebooted the trip contact output must be set. h t These requirements imply a software system involving a real time executive with preemptive task scheduling. Figure 1 shows a conceptual partitioning of the system into the executive and a few modules dedicated to computations or handling I/O interfaces. This partitioning reflects the expected system architecture and helps simplify the design task. (3)

Invoke System Timer 100 ms Interrupt Complete Trip Channel Fail DNBR Calculation Trip Decision Operator's Console RO / Cal / Inv PID Entry Cal / Setpt Entry Power On TMC Executive Reset Channel Fail Update Watchdog Timer PID Display Power Off Update Cal / Setpt Change Set / Reset Trip 2.2. System Boundary, Stimuli, and Outputs Fig. 1 TMC Software System Organization The first step in sequence-based specification is to construct the list of external interfaces to the system being specified. The system may interface with other hardware and software components, or with the end user. This list of interfaces is called the system boundary, and it delimits the problem to be solved. All components which interface directly with the system being specified comprise the system s environment. For the TMC the executive is to be developed. Thus the system boundary is as shown in Figure 1, with the interfaces indicated, and with all other components in the executive s environment. Next, each interface is considered and stimuli are identified. A stimulus is some event in the system's environment which is observed by the executing software, and a response is any system behavior which is observable from the environment. A sequence of stimuli therefore represents the history of use of the system. All information required by the software to generate responses must either be stored in the software itself, or it must come from stimuli. Thus it is possible to write down, for each possible stimulus sequence, the appropriate next response. For a hand calculator with stimulus history ON 1 2 + 2 =, the appropriate next response is to display 14. (4)

Table 2 TMC Stimuli Interface Stimulus Description Trace Clock interrupt C1 100 ms interrupt 1 Operator console Pr Selection of read-only PID 4 Pc Selection of PID for calibration constant or setpoint 4 Pn Entry of non-existent or invalid PID 5 Cs Entry of new calibration constant or setpoint 4 Ci Entry of invalid calibration constant or setpoint 6 Power Pi Power on (initialize) 8 Pe Power off (exit) 9 Task control Tc Task complete with no trip 1 Tt Task resulted in trip event 2 Tf Task reported a sensor or channel failure 3,7 System R Restart executive 7,8,9 Table 3 TMC Outputs Interface Output Description Trace Task control T1 Invoke 100 ms task 1 Watchdog timer Wr Reset watchdog timer 7 Operator console Ud Update PID display 4 Uc Update calibration constant or setpoint 4 Fa Activate failure indicator 2,4,8,9 Fd Deactivate failure indicator 2,4,8,9 Ta Activate trip indicator 3,4,7 Td Deactivate trip indicator 3,4,7 Trip logic Ts Set trip output 2,8,9 Tr Reset trip output 2,8,9 System Ri Initiate reboot 7,8,9 The system stimuli and outputs are given in Tables 2 and 3. The stimuli for displaying point IDs and modifying calibration constants and setpoints are actually abstract stimuli. An abstract stimulus is a combination of a prior history condition and an atomic event, and is used to change the view of the stimulus sequence during enumeration. See Prowell (2003) for a formal definition. One or more outputs are combined to form a single response. As with stimuli the two outputs related to the operator interface are abstractions of the specific values to be displayed. 2.3. Sequence Enumeration Sequence enumeration is performed by writing down each stimulus sequence, in order by length, and then noting the appropriate response for the most recent stimulus, based on the previous history. There are two special cases to deal with: sequences for which no external event is observed and sequences which, given the operational definitions of the system and stimuli, are not possible. There are often sequences for which the appropriate response is to do nothing. For example, monitoring software may receive temperature reports but do nothing unless the temperature reports are outside a control range. For such sequences the response is said to be the null response. (5)

Consider the following sequence for a simple calculator: 1 2 + 2 = ON. This sequence cannot occur; it is impossible since the first event in any sequence for the calculator must be ON. Further, no sequence which starts with this sequence can occur. All such sequences are said to be illegal, and this is noted in place of the response. As each sequence is written down, or enumerated, the appropriate next response (possibly null) is written. If the history is illegal, then illegal is written in place of the response. Then traces to the initial requirements are defined which justify the choice of response; every line of the sequence enumeration must have such justification. For each sequence there are three possibilities: (1) The requirements uniquely specify a response. The specified response is written down, with a trace to the requirement(s) which justify it. (2) The requirements do not specify a response; they are incomplete. A response must be chosen, and the reason for the decision written down as a derived requirement. (3) The requirements seemingly specify two distinct responses for the sequence. A single response must be chosen for each sequence, and the reason for the decision written down as a derived requirement. Consider again a simple calculator and the sequences ON 1 2 Clear 1 + 1 = and ON 1 + 1 =. Both sequences have the same appropriate next response: display 2. Further, if these sequences are extended identically they will always have the same response. When two sequences are intended to agree for all extensions, it makes no sense to enumerate both. In sequence enumeration the second sequence is noted as equivalent or reduced to the first, and need not be extended. The sequence enumeration process works by extending each legal, unreduced sequence with every stimulus. These new sequences are then considered and a response, trace, and possibly a prior equivalent sequence noted. When all sequences of a particular length are either illegal or reduced to prior sequences, the sequence enumeration is complete and denotes a complete, consistent, and traceably-correct external specification. The sequence enumeration for the TMC executive includes 204 sequences with a maximum length of eight stimuli. Table 4 is an excerpt from the full enumeration, showing sequences of length two and three. In this enumeration lambda (λ) is used to denote the empty sequence, which represents the initial conditions of the system. Table 4 TMC Sequence Enumeration Excerpt Prior Sequence Stimulus Response Equivalent Sequence Trace Length 2 Pi Pi Illegal 4 Pe Ts λ 9 C1 T1 1 Pr Ud Pi 4 Pc Ud 4 Pn Null Pi 5 Cs Illegal 4 Ci Illegal 4 (6)

R Ri,Wr,Ud,Fa,Ta,Ts 9 Tc Illegal 1 Tt Illegal 1,2 Tf Illegal 1,3 Length 3 Pi C1 Pi Illegal 4 Pe Ts λ 9 C1 Ri,Wr,Ud,Fa,Ta,Ts Pi R D1 Pr Ud Pi C1 4 Pc Ud 4 Pn Null Pi C1 5 Cs Illegal 4 Ci Illegal 4 R Ri,Wr,Ud,Fa,Ta,Ts Pi R 8,9 Tc Wr,Fd,Td 1,7,4 Tt Wr,Ta,Ts Pi 1,2,4 Tf Wr,Fa Pi R 1,3 Pi Pc Pi Illegal 4 Pe Ts λ 9 C1 T1 Pi C1 Pc 1 Pr Ud Pi Pr 4 Pc Ud Pi Pc 4 Pn Null Pi Pc 5 Cs Ud,Uc Pi 4 Ci Null Pi Pc 6 R Ri,Wr,Ud,Fa,Ta,Ts Pi R 8,9 Tc Illegal 1 Tt Illegal 1,2 Tf Illegal 1,3 Pi R Pi Illegal 4 Pe Ts λ 9 C1 T1 1 Pr Ud Pi R 4 Pc Ud 4 Pn Null Pi R 5 Cs Illegal 4 Ci Illegal 4 R Ri,Wr,Ud,Fa,Ta,Ts Pi R 8,9 Tc Illegal 1 Tt Illegal 1,2 Tf Illegal 1,3 During the enumeration process for the TMC, an omission in the original requirements was discovered. D1 denotes the derived requirement, If a second 100 ms clock interrupt is received before task completion, declare a channel failure and initiate a reboot. The discovery and documentation of such derived requirements is a natural and desirable part of the sequence enumeration process. (7)

2.4. Canonical Sequence Analysis A sequence in a complete enumeration which is legal and not reduced to a prior sequence is a canonical sequence. The empty sequence λ is a canonical sequence which stands for the initial conditions, and every other sequence in the enumeration is a combination of a canonical prefix and a single stimulus. Further, every sequence (even those not explicitly enumerated) is either illegal, or equivalent to exactly one canonical sequence. The set of canonical sequences thus represents the set of system states, and the canonical sequence analysis process encodes these sequences using state variables and values. The canonical sequences (except λ) of the TMC enumeration are encoded using four Boolean variables in Table 5. Table 5 TMC Canonical Sequence Analysis Trip Fail CalPending TaskPending Sequence Trip Fail CalPending TaskPending Sequence Pi False False False True Pi C1 Pc Tc False True False False Pi C1 True False False True Pi C1 Tc C1 True False False False Pi Pc False True False True Pi R C1 Pc True True True True Pi R False False True True Pi C1 Pc Tc C1 True True False False Pi C1 Pc True True False True Pi C1 Tc C1 Tf False False True False Pi C1 Tc False False False False Pi C1 Pc Tc C1 Tf False True True False Pi R C1 True False True True Pi C1 Tc C1 Tf C1 True False True False Pi R Pc False True True True Pi C1 Pc Tc C1 Tf C1 True True True False The enumeration of Table 4 can easily be converted into a state machine specification using Table 5 as follows. Every prefix is a canonical sequence which can be replaced with its state conditions. This gives previous state and current stimulus mapped to response. Each legal sequence is either equivalent to a prior canonical sequence or is itself canonical. Thus the next state is given by the state conditions for the equivalent canonical sequence. Requirements traces can be copied forward. An excerpt of the state machine specification for the stimulus Tc is given in Table 6. Table 6 State Machine Specification for Stimulus Tc Initial State Next State Response Trace TaskPending = False Illegal 1 TaskPending = True TaskPending = False, Fail = False, Trip = False Wr,Fd,Td 1,7,4 It is a simple matter to encode the state machine description in a variety of formal notations. It is also possible to transform the sequence enumeration directly into other notations without performing a sequence analysis. For example one can simply assign numbers to the canonical sequences. One could then construct two functions: one which maps a sequence prefix to the appropriate number (call this f), and one which maps a (8)

number and stimulus to the appropriate response (call this resp). ACL2 (Kaufmann 2000) implementations of these functions can be automatically generated from the enumeration for simulation of the system, and automated reasoning about the specification. The following is a fragment of such an implementation of resp in ACL2. ; Definition of resp. (defun resp (s) (if (endp s) null (let ((C (f (cdr s)))) (case (car s) ; Other stimuli omitted here (Tc (case C (1 illegal) (2 (Wr Fd Td)) (3 illegal) (4 illegal) (5 (Wr Fd Td)) (6 illegal) (7 (Wr Fd Td)) (8 illegal) (9 illegal) (10 (Wr Fd Td)) (11 (Wr Fd Td)) (12 (Wr Fd Td)) (13 illegal) (14 illegal) (15 (Wr Fd Td)) (16 (Wr Fd Td)))))))) This ACL2 implementation can be automatically generated from the enumeration. It provides an executable version of the specification for simulation and for use as an oracle during testing. Further, one can immediately use the mechanical theorem proving capabilities of ACL2 to prove important system properties. 5. CONCLUSIONS Sequence-based specification provides a systematic way to generate a specification from initial requirements. The resulting specification can be written as a state machine, or encoded in a variety of formal notations for use with automated theorem provers, model checkers, and such. Thus one can use sequence-based specification to move from the realm of the application domain experts who understand the external control requirements for the system, to the realm of the trained software engineer, who understands how best to use notations and tools to create reliable, efficient software. NOMENCLATURE p pressure F mass flow rate T c cold leg temperature T h hot leg temperature φ i neutron flux D d computed DNBR (9)

D t DNBR setpoint REFERENCES Bartussek, W., Parnas, D.L., 1978. Using traces to write abstract specifications for software modules. In: Proceedings of the Second Conference on European Cooperation in Informatics (LNCS 65), Springer-Verlag, pp. 211-236. Broadfoot, G.H., Broadfoot, P.J., December 2003. Academia and industry meet: Some experiences of formal methods in practice. In: Proceedings of the Tenth Asia- Pacific Software Engineering Conference, IEEE Computer Society, Chiang Mai, Thailand, pp. 49-59. Heitmeyer, C., Bull, A., Gasarch, C., Labaw, B., June 1995. SCR: A toolset for specifying and analyzing requirements. In: Proceedings of the Tenth Annual Conference on Computer Assurance (COMPASS 95), IEEE Computer Society, Gaithersburg, MD, pp. 109-122. Heitmeyer, C., McLean, J., September 1983. Abstract requirements specification: A new approach and its application. IEEE Transactions on Software Engineering, 9(5). Hoare, C.A.R., 1985. Communicating Sequential Processes. Prentice Hall, New York. Janicki, R., Sekerinski, E., July 2001. Foundations of the trace assertion method of module interface specification. IEEE Transactions on Software Engineering, 27(7), pp. 577-598. Kaufmann, M., Manolios, P., Moore, J.S., 2000. Computer-Aided Reasoning: An Approach. Kluwer Academic Press, Boston, MA. Milner, R., December 1989. Communications and Concurrency. Prentice Hall, New York. Prowell, S.J., Poore, J.H., May 2003. Foundations of sequence-based specification. IEEE Transactions on Software Engineering, 29(5), pp. 417-429. Prowell, S.J., Trammell, C.J., Linger, R.C., Poore, J.H., 1999. Cleanroom Software Engineering: Technology and Process, Addison-Wesley, Reading, MA. Roscoe, A.W., 1997. The Theory and Practice of Concurrency. Prentice Hall, New York. Spivey, M., 1992. The Z Notation: A Reference Manual, Second Edition. Prentice Hall, New York. (10)