STRUCTURED HIERARCHICAL REAL-TIME OPERATING SYSTEM FOR A SEQUENTIAL PROCESS CONTROL J, G&ski, R. Ed and J. Sobysik Institute
O~In~or~tjcs,
Technical
~ni~er~~~ o~G~~k,
80-952 Gdafisk, Poland
A multilevel hierarchical real-time operating system Abstract. This system SPS for sequential process control is presented, has been realized to carry out the gas turbins tests in a proTh8 system has b88fl built up using th8 duction environment. “bottom up” principle in such a way that each level implements a higher level machine in terms of primitives offered at that In this paper the modular system representation is level. given as well as it8 funcrional representation. Both, modular and functional, system representation, are discueed from the utilitary for d8sign%r and user point of view. Control Keywords. nes ; minicomputera; software systems;
engineering computer engineering
computer software; ; SOftWar
application; heat real-time operating modulatiretion.
engi-
Interface definition for every module defines the relation “supports” b%tW88n modules which establishes an internal struotura of the modular A suitability system representation. of the modular system representation, Where module8 are defined in terms of their external and supporting interfaces, with respect to modifiability was discussed in more details in G6rski, 1978 . In this paper such the modular representation Of th8 real-time operating system which is dedicated to a sequential process control applications is presented. This systsm was designed and developed between 1976 and 1977 and it is currently used to carry out gas turbines tests an a preductlen environment, Soltysik, 1977 c Another representation of the system is its functional representation. There exist some important functional levels in the system. Their importance may be significant during the system designing process as well as during system utilization because at least one of those levels has to be accessible t0 system ussrs . Our system was built up moving from one functional level to another using “bottom-up” dessigning principle. Wa observe how these two system remodular and f uncriopresentations nal interfere one another forming the more finer grained structure similar to that described in Habermann, 1976 .
INTRODUCTION A complex software product euch as operating system is created to perform a variety of goals. It is seldom and lucky situation if all those design goals are clearly stated well before Thersthe designing procses Starts. fore the system designers have to be bargained for the necessity to modify early versions of the system several Moreover thOe8 modifications times. are never ending during the life of the system. Keeping th8 above in mind it become clear that of the primary importance is such 8 system representation which would be especially dedicated to those system modifications facilitation, i.8. Using this system representation it is relatively easy to localize and introduce Changes which mirror all the new requirements, The modular representation, where modules are defined on the basis of the information hidding criterion Parnas, seems to be the most 1972a , 1972b suitable one with regard to that purAn information module hides pOS8. some important design decisions which are common to the module and makes visible outside the module only those informations which are necessary to use the module properly. An external interface of the module is implemented in terms of its supporting interface which forms a window through which the module ‘*looks” at the information exported by the other modules for a public use. An explicit supporting
67
J. G6rski, R. %os’ and J. Sortysik
68
THE CLASS OF POSSIBLE SYSTEM APPLICATIONS The primary goal of our activity it was to realize a small operating system capable to carry out the gas turbine tests on a single stand alone test-bench. From the user point of view several tasks have to be performed by the system, such as
real-time data acquisition, producing the protocole test history, storing all the about the system an output file,
information behaviour
of
a
in
current supervision of errors in the object and in the syssituation tem ; when an alarm for the object occurs, the system has to response performing its alarm routine with a minimal time delay,
1 I
DATA ACQUlSlTlON
Because the total set of gas turbine tests algorithms was still undetermined and it was a subject of permanent our main designing line was changes, to offer to a user the specialized machine dedicated to his area of interest and allowing him to create and execute programs of tests written by the SPS-machine himself, This machine models a hardware machine closely in the facilities it provides to its The machine instructions are users. dedicated to facilitate a sequential control of the object and the interrupt system enables creation of parallel processes in the machine in order to handle alarm situations or some The virother external exeptions tual address space was implemented
ii. CONTROL
UNIT I
communication with the system operator by means of the operators console providing the push-buttons and also some numeric information inputting facility . The real-time requirements were stated with regard to the timing restrictions given by gas turbine tests algorithms which were expressed in seconds, in and also with respect to the general “alarm response time” restrictions which were expressed in miliseconds . The hardware configuration of the system was imposed in advance CPU, peripherals, data acquisition and conand it is illustrated trol channel Processor MOM 8b/lOO is in Fig. 1. a very small minicomputer with a very poor instruction set and 8 k8 core memory.
-
CPU MOM 8b/lOO 8KB CORE
real-time control of the object gas turbine and test bench performing all technologically provided tests in a fully automatic manner,
HOSAIC tllNl PRINTER
TRANSDUCERS CONIUNCTION
& Bo%
1IT T
C -
GAS TURBINE
1
,
SINGLE TEST - BENCH !
t
t
I Fig. 1. ration System
The Hardware Configuof the Implemented Version
using the technique of overlays employing the core memory and casette magnetic tape memory.
the
Such the external picture of the system enables its users to create and execute a large variety of different programs and those programs may be used to control objects in different ways and those objects are controlled in real-time if only the timing requirements imposed by them do not conflict with the timing restrictions given by the system.
Structured
hierarchical
up to now some successful experiments were carried out to use the system for controlling tests of different kinds of heat engines Diesel engines, gas turbines, etc. .
real-time
operating
Instruction
The red
following instructions by the SPS-machine.
LEVEL
0
This is the host machine MOM 8b/lOO enhanced by a software implemented stack for storing the processor state for interrupts and for the call/return mechanism implemented on a single The set of trap instruction basis. machine instructions is enhanced by POP, PUSH and the stack functions the address space is reduced because some space necessary for a software implementation of those functions is hidden. LEVEL
2
This is the executive level enhanced by the memory overlays control facilities. The two additional functions, namely RO read overlay and WO write overlay are added. Those functions enables interchanging overlays between core and tape memory and are used to implement the virtual address space offered at LEVEL 3. LEVEL
Integer
Data
3
This level represents a new virtual machine having its own instruction set, the multilevel interrupt system, I/O functions and the virtual address space. The control of this machine is realized by software implemented interpretive loop. This level, called SPS-machine level, is accessible to the system users and therefore we give its description in more details.
offe-
addition subtraction
in
memory
assignment conditional
jump
facilities FL set output format for reals text onto the mosaic WRT write printer text from the keyboard RED read OT send a block of memory to the output file residing on the magnetic tape output RG8 digital input PMC digital PMA analoug input
Interrupts control WR set a new interrupt The
are
point arithmetic addition subtraction multiplication division
assignment MV move
CJ I/O
Set
arithmetic A01 integer SUI integer
Control
1
This is a monitor executive leve 1. All the interrupts and I/O instructions are not visible at this level. Instead, some system flags cant rolled by interrupts and a collection of extracodes which serves to perform some special functions, such as data transfer to/from peripherals, floating point arithmetic, interchanging blocks between core and tape memory, etc. is provided. The implementation of this level consume the further segment of a free space. LEVEL
AD su MX DV
SYSTEM
The system may be regarded as composed of several functional levels each of them offering different facilities In the sequel each of to its users. those levels is briefly characterized.
69
The
Floating THE FUNCTIONAL REPRESENTATION
system
Interrupt
instructions binary pattern prohibitions
of
System
Programs of the SPS-machine may be executed on the seven different levels. The control switching between levels is by interrupt signals. Some levels of interrupts except I/O interrupt may be temporarily prohibited leve 1 by means of the WR instruction, The SPS-machine provides a separate instruction counter for each,program levels. The
address
space
The address space of SPS-machine is a set of virtual addresses given by a working core block about 3 k8 in the implemented version and a casette magnetic tape campacity 256 kB , The virtual memory control system not visible to the user controls the overlays traffic between core and tape memory. The
control
of
the
SPS-machine
This is realized by the program which executes the interpretive loop between every two subsequent instructions of the SPS-machine. It fetches a next instruction to be executed, calculates its operands addresses or values call the proper function, tests in;errupt conditions, etc.
J. G&ski,
70 LEVEL
R. f;og and J. Sottysik
4
This level offers a symbolic language If we treat the for the SPS-machine. LEVEL 3 as host hardware machine then the LEVEL 4 may be thought of as It provian assembly language level. des a symbolic reference facilities and separate the user from all the problems of address management which The translator arise at the LEVEL 3. of this symbolic language is not completely implemented yet. THE MOOULAR SYSTEM REPRESENTATION The another important representatidn of our system is the modular one where the overall system is viewed ss the collection of information modules interconnected by the “supports” reThis representation is lationships. illustrated in the graphical form in Nodes of the graph represent Fig. 2.
information modules and edges represent “supports” relationships between modules. In the sequel we give more detailed informal description of this representation. Each module is defined in terms of its external and supporting Interfaces and for each “supporting” edge we state explicitely which information is supplied by In the external interface defiit. nition of every module It is indicated on the right hand side how objects exported through the interface are attached to the “supporting” edges leaving the module. The edges are labeled Ll, L2, . . . , etc. For every function in the external interface definiotion of a module the type of the value returned by it if any is given explicitely. It is necessary to emphasize that modules are described in terms of their existing interface and those interfaces need not be complete in general for instance, there are not STACK OVERFLOW and STACK UNDERFLOW functions In the Stack Module external interface definition . The reasons for such the incomplete implementation of moduls interfaces stem from the very limited in size core memory which was in our disposal while implementing the system. Of course, in an implementation on a larger machine all the incomplete module interfaces may be extended to ensure their completness. A Stack
Module
External
interface
Al
PUSH
A2
POP
program state returns :none this function loads the topmost state to the machine registers
Ll, L3, L5, L7,
LZ, L4, L6, L8
Supporting interface The implementation of that module is supported by the host machine not shown in Fig. 2 8 Magnetic External 81
02
83
84
Fig.
2. The Modular Representarion
System
Tape
Driver
Module
interface READ BLOCK
casette driver unit number returns: block of memory WRITE BLOCK casette driver unit number, block of memory REWIND TO THE BEGINNING casette driver unit number REWIND ONE BLOCK AHEAD casette driver unit number returns :none
L9
71
Structuredhierarchicalreal-time operating system 65
REWIND
E3
ONE BLOCK BACK casette driver
unit number returns :none 86
STATUS
WORD
87
INTERRUPT TIC TAPES
LEVEL
drfnumber vector
E5
FOR MAGNE-
E6 Lie
Supporting fnterf ace The implementation is supported by the Stack Module Ll which provides the call/return mechanism for the functions implemented in rhis module. C Mosaic
Printer
External
inrerface
Cl
Driver
C2 C3
INPUT
C4 C5 C6
Supporting Stack
interface Module LS
F Oouble Arithmetic
Precision Module
External Fl
L12
: boolean
Lll
Supporting Stack
interface Module
G Address
Arithmetic
External Cl
G2
characters C7
INTERRUPT LEVEL FOR MOSAIC PRINTER
Supporting Stack
L2
0 Data Acqusition and Chann81 Driver Module External Dl
interface DIGITAL INPUT
D2
ANALOUG
03
OUTPUT
04
ERROR
05 06 57
E Floating
E2
returns: output value returns
:none
Arithmetic
interface ADO real, real returns :real SUBTRACT real, rea 1 returns: real
Module
address, address returns:address ADDRESS OVERFLOW returns :boolean interface Module
External Hl
interface SET THE OUTPUT FORMAT real, format returns :none NEW PAGE returns :none SET THE NUMBER OF LINES ON A PACE integer returns :none SET NEW PACE NUMBER integer returns :none
H3
H4
L17
L7
Editor
HZ
Module
LiB
L13
L14
interface Module L8 Point
L6
H Text
input number :integer input number real number,
returns : boolean STATUS WORD returns: bit vector INTERRUPT LEVEL FOR CHANNEL TABLE OF INPUTS AN0 OUTPUTS NUMBERS
Supporting Stack
External El
returns INPUT
Control
Ll.6
interface ADD ADDRESSES
Supporting Stack
interface Module
integer, integer returns :integer SUBTRACT INTEGERS integer, integer returns :integer
F2
TEXT FROM THE KEYBCARO returns :none NUMBER OF READ CHARACTERS returns:integer EN0 OF THE INPUT retUrns:bOOl88n GIVE THE READ TEXT returns:string of
Integer
interface ADD INTEGERS
Module
OUTPUT TEXT text returns:none EN0 OF THE OUTPUT
returns
real, real returns : real DIVIDE real, real returns:real OVERFLOW OR ZERO-DIVISION returns:boolean SIGNUM returns:-l,O,i
E4
cas8tte
ver unit returns:blt
MULTIPLY
Supporting Stack Mosaic
interface Module Printer
L3 Driver
I
Overlays
Control
Memory
External
Module Module
13
interface WRITE OVERLAY overlay identifier returns:none READ OVERLAY Overlay identifier returns :overlay WRITE BUFFER
14
STATE
11
I2 Module
L15 I5
buffer
L12
identifier
OF FILE file number returns: bit vector ERROR returns:boolean
L20
L19
J. G&ski,
72 Supporting Magnetic
interface Tape Driver
J Interpreter
Module
External 31 52
Module
R. f;oi and J. SoTtysik
L9
interface SPSkMACHINE SPECIFICATION EXECUTE program
L21
Supporting interface Stack Module L4 Memory Overlays Control
Module L19 Magnetic Tape Driver Module LlO Mosaic Printer Driver Module Lll Text Editor Module L18 Floating Point Arithmetic Module L15 Double-Precision Integer Arithmetic Module L16 Address Arithmetic Module L17 Data Acquisition and Control Channel Driver Module L13
K Sequential Control Language Module External Kl K2 K3
interface SYMBOLIC
L22
Supporting interface Memory Overlays Control Module Interpreter Module L21 Data Acquisition and Control Channel Module L14 L User
there exist no necessary relation between modular and functional representation of the system ; several modules may appear on the same functional level as well as a single module may be distributed among several functional levels the similiar observation was given in Habermann, 1976 ,
Symbolic
LANGUAGE SPECICAT1 ON TRANSLATE source program EXECUTE object program
Programs
CONTROL
Supporting interface Sequential Control Symbolic Language Module L22 CONCLUSION There are some interesting which may be formed with the two different system tions as presented above. the following :
remarks regard to representaThey are
the modular system representation is rather system designer oriented then user oriented one, i.e. it is very useful during designing and maintenance of the system but the users are interested in the first place in functional levels which are given to their disposal, both of those system representations may be very far from the run-time representation;
the functional levels representation is better when we are going to understand or explain how to use the system; the modular representation we find to be very useful while considering modifications; for example we currently use this representation developing SPS-machine implementation on an INTEL 8080 microcomputer.
L20
Module
External interface SEQUENTIAL PROCESSES REQUIREMENTS
it is very difficult, if not impossible, to find modules in the run-time representation; the large variety of methods may be employed to transform the modular representation into the run-time system representation; special software devices which support that transformation are necessary,
REFERENCES Gbrski, J. 1978 . Some Remarks on Software Systems Modifications. Proc. International workshop on Software Eng. May, 1978, Aarhus, Denmark. Habermann, A.N., L. Flon, and L. Cooprider Modularization 1976 . and Hierarchy in a Family of Operating Systems. CACM’ 19. DR. 266-272, Par&s, D.L. 1972a . On the Criteria To Be Used in Decomposing Systems into Modules. CACM 15, PP. 1053-1058. Parnas, D.L. 1972b . A Technique for Software Module Specification with Examples. CACM 15, pp. 330-336. So1tysik, J. Ed. Minicompu1977 . ter System for Gas Turbines Tests Control Institute of Informatics, Technic;1 Univ. of Gdansk, Techn. in Polish . Rep. -No 7.