vienna development method -ii. improving the incubator system the software will not only record the...

18
VIENNA DEVELOPMENT METHOD -II

Upload: antony-jefferson

Post on 30-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: VIENNA DEVELOPMENT METHOD -II. Improving the Incubator System  The software will not only record the current temperature of the system, but will also

VIENNA DEVELOPMENT METHOD -II

Page 2: VIENNA DEVELOPMENT METHOD -II. Improving the Incubator System  The software will not only record the current temperature of the system, but will also

Improving the Incubator SystemThe software will not only record the current

temperature of the system, but will also control the hardware

The system will be able to respond to a request from the user to change the temperature, and to signal the hardware to increase or decrease the temperature.

When the software receives such a signal, in addition to recording the new temperature , it must send back a response This response tells the hardware whether changes are

required or not required to achieve the temperature that has been requested.

Page 3: VIENNA DEVELOPMENT METHOD -II. Improving the Incubator System  The software will not only record the current temperature of the system, but will also

Improving the Incubator System1.New system will behave according to initial behavior 2.In the new system, the temperature of the incubator will not be recorded until a message is received from the hardware3.The operations on the system will not be able to run until the initial temperature is set.4.It will be necessary for the software to record both the actual temperature of the system and the requested temperature

Page 4: VIENNA DEVELOPMENT METHOD -II. Improving the Incubator System  The software will not only record the current temperature of the system, but will also

The UML diagram for the new software

The previous class IncubatorMonitor

Page 5: VIENNA DEVELOPMENT METHOD -II. Improving the Incubator System  The software will not only record the current temperature of the system, but will also

Specifying enumerated typesThree operations of the class IncubatorController• requestChange, • increment and • decrement) have an output of type Signal;Signal is not a standard UML type such as Integer;The internal details of this Signal class arerelevant to the specification of the IncubatorMonitor

class

Page 6: VIENNA DEVELOPMENT METHOD -II. Improving the Incubator System  The software will not only record the current temperature of the system, but will also

Specifying Enumerated Types

The signal that must be sent to the hardware could be one of three possible values: an instruction to the hardware to increase the

temperature; an instruction to the hardware to decrease the

temperature; an instruction to the hardware to do nothing.

A type that consists of a number of named values is often referred to as an enumerated type;

Page 7: VIENNA DEVELOPMENT METHOD -II. Improving the Incubator System  The software will not only record the current temperature of the system, but will also

In VDM-SL the types clause is the appropriate place to define new types.

UML Specification of Signal type

A type is defined by type construction

Page 8: VIENNA DEVELOPMENT METHOD -II. Improving the Incubator System  The software will not only record the current temperature of the system, but will also

Specifying the state of the IncubatorController

·There need to be two components of the statehold the actual temperaturehold the temperature that has been requestedwhen the system first comes into being these

values will be undefined, therefore be set to nil

Page 9: VIENNA DEVELOPMENT METHOD -II. Improving the Incubator System  The software will not only record the current temperature of the system, but will also

The InvariantThe actual temperature must not be allowed to go

outside the range of -10 to +10 degrees;We also know the possibility that actual temprature

could be equal to the nil value; The same is true for the requested temperature.They are defined as make function

Page 10: VIENNA DEVELOPMENT METHOD -II. Improving the Incubator System  The software will not only record the current temperature of the system, but will also

Improving the Readibility of the Specification by using a function

The purpose of this function is to check whether an integer value, val, is within the range MIN and MAX as defined earlier we can now use this function in the invariant,:

Page 11: VIENNA DEVELOPMENT METHOD -II. Improving the Incubator System  The software will not only record the current temperature of the system, but will also

Specifying the Operations for the IncubatorController

Initial temperature of the system;This will be invoked by the hardware when the

incubator has established a initial temperatureInitialization clause

The initialization clause is simply a function that states the conditions that must exist

When the system first comes into being - it is not an operation that can be invoked during the system's life time.

Page 12: VIENNA DEVELOPMENT METHOD -II. Improving the Incubator System  The software will not only record the current temperature of the system, but will also

setInitialSet operation requires an input parameter TempInread-write access is needed to the actualTemp component , Preconditon: the first conjunct is validating the input - if the input

value is out of range, then the behavior of the system for this operation is not defined;

the second part ensures the actual temperature of the incubator has a value of nil,

Once the temperature has been set, the temperature has an actual value, and this operation could not take place again unless some other operation set the temperature back to nil;

The setInitialTemp Operation

Page 13: VIENNA DEVELOPMENT METHOD -II. Improving the Incubator System  The software will not only record the current temperature of the system, but will also

The requestChange OperationThis operation records the value of the temperature

It has been requested by the user of the system, and to signal the hardware to take the appropriate action in order to bring about the change;

It will require an input of an integer, and will result in an output of type Signal.

Page 14: VIENNA DEVELOPMENT METHOD -II. Improving the Incubator System  The software will not only record the current temperature of the system, but will also

we need access to both components of the state, but the mode of access is different in each case;

case of requestedTemp requires to have write access to this component we must record the temperature that has been requested;

case of actualTemp, requires read access in order to compare it to the requested temperature and determine the action that must be taken by the hardware.

the precondition is similar to that of the previous operation, but we are checking that the actual temperature is not undefined, thus the initial temperature had been properly set.

the postcondition consists of two conjuncts;

Page 15: VIENNA DEVELOPMENT METHOD -II. Improving the Incubator System  The software will not only record the current temperature of the system, but will also

The increment operation

The precondition consists of three conjunctsThe first checks that the actual temperature is less than the requested temperature (otherwise we should not increment it);Since all operations must preserve the invariant, assume that the requested temperature will not be greater than MAX, so this conjunct automatically checks that the actual temperature is less that the maximum allowed temperature;The second and third conjuncts check that an initial temperature and a requested temperature has been set.

Page 16: VIENNA DEVELOPMENT METHOD -II. Improving the Incubator System  The software will not only record the current temperature of the system, but will also

Operations for the Requested Temperature and the Actual Temperature:

Page 17: VIENNA DEVELOPMENT METHOD -II. Improving the Incubator System  The software will not only record the current temperature of the system, but will also

A standard template for VDM-SL specifications

Page 18: VIENNA DEVELOPMENT METHOD -II. Improving the Incubator System  The software will not only record the current temperature of the system, but will also

values MAX:=10 MIN : Z=--10The system

that monitoredthe temperatureof an incubator