Using Z Specification Language for CCS
Overview
Your text, Software Engineering: A Practitioners Approach (Pressman, 2010) indicates that formal methods provide frameworks that allow people to specify, develop and verify systems in a structured and systematic way and that the mathematical based specification language used in formal methods ensures a greater chance of consistency, completeness and lack of ambiguity in a specification. Pressman also discusses formal specification languages and their common components – syntax, semantics and sets of relations. Of the four formal specification languages he identifies – OCL, LARCH, VDM and Z – he provides useful discussion with respect to OCL and Z.
In this assignment, you will use the Z specification language to provide the sets, relations and functions in schemas to specify the Container Control System (CCS) described below. Your schemas should provide the stored data that the system accesses and alters and identify the operations that are applied to change the state as well as the relationships that occur within the system. Remember, as specified in Spivey’s 2001 text, The Z Notation: A Reference Manual, schemas are utilized to illustrate both static and dynamic aspects of a system. Static aspects include such things as the states a system occupies and the invariant relationships that continue to exist as the system moves between states. Dynamic aspects include the changes of state that occur, possible operations and the relationships between their inputs and outputs. Remember also you should always be conscious of the fact that a specification tries to describe what the system must do without saying how it is to be done (Spivey, 2001).
Keep all the above in mind as you read the following information. You are required to create a set of Z schema that adequately describes the CCS. Your assignment should include at least one state space and provide schema for the prescribed functions (including error handling) described below.
Demonstrate an understanding of particular concepts covered in lectures, tutorials, laboratories and reading to provide the specification requested.
As a Software Engineering consultant, your task is to develop a formal specification in Z for the Container Control System (CCS). The CCS is a new computerized system to be developed for the storage and handling of accounts for freight companies and truck container deliveries/pickups to/from the Port of Melbourne (PoM) container terminals.
This system could be quite complicated. However, to simplify the system for this assignment only the following detail will be included in the proposed system (we do not for example track individual containers but only truck deliveries and pickups and ship loading and unloading and we assume one container size only (standard twenty-foot equivalent unit (TEU)):
You are to create a set of Z schemas that adequately describes the CCS. It should include at least one state space and the following operations:
- An initialization operation called Init.
- An operation Enter_new_container_terminalthat an operator uses to enter the details of a new container terminal into the system. Assume the new container terminal is currently empty.
- An operation Accept_deliverythat an operator uses to signal to the system to begin delivery (placing in the container terminal) of x quantity and y tonnes of containers from a truck. Note that the system must do a check to see if that storage capacity is available in the container terminal. If it is not then an error message must be output and no truck delivery occurs. Additional information needed by this routine is the truck registration and the freight company’s name. If successful, this operation stores all necessary details into the system for that delivery. If five trucks are already delivering then this new truck will be placed in a queue waiting for its turn to deliver.
- An operation Accept_pickupthat an operator uses to signal to the system to begin pickup (placing on the truck) of x quantity and y tonnes of containers from the container terminal. Additional information needed by this routine is the truck registration and the freight company’s name. If successful, this operation stores all necessary details into the system for that pickup. If five trucks are already picking up then this new truck will be placed in a queue waiting for its turn to pickup.
- An operation Leave_delivery_queue. This operation is run by the system operator each time there is a delivery queue for a container terminal and the driver of a specified truck decides that the anticipated waiting time is too long and leaves the queue. The operation outputs to the operator the list of trucks in the queue after the specified truck is removed. If no trucks are left in the queue a reasonable error message should be produced.
- An operation Unload_shipthat an operator uses to signal to the system to begin unloading (placing in the container terminal) of x quantity and y tonnes of containers from the ship. Note the system must check that all deliveries and pickups have stopped before unloading can commence. A suitable message must be output until this has been achieved. The system must also do a check to see if the quantity and tonnage storage capacity is available in the container terminal. If this check fails, then an error message must be output and no ship unloading occurs. (From an operational perspective, the operator may, after consultation, try the operation again with adjusted values to have a successful ‘partial’ unload but you do not need to be concerned with this as the functionality already described would accommodate this process). Additional information needed by this routine is the ship identifier. If successful, this operation stores all necessary details into the system for that unloading.
- An operation Container_terminal_accountthat outputs the total number and tonnage of containers delivered to a particular container terminal by ALL freight companies in a specified time period (in this simplified system, that is the total quantity and tonnes delivered between two specified global count values e.g. 10000 and 10500).
- An operation Ships_total_accountthat outputs the total number and tonnage that a particular ship has loaded from ALL container terminals in the total history of the system.
- An operation Freight_company_accountthat outputs the total number and tonnage of containers delivered to and the total number and tonnage picked up from ALL container terminals for each freight company between two specified global count values.
You should provide robust versions of each operation that are capable of handling any possible error conditions. For example, if the ship or truck is not correctly registered in the system an appropriate error message must be given.
You should also add a narrative to explain any schemas or logic that you have used. Authorship should be made clear. You might be asked to explain and answer questions about your work.
The Z-Notation has been evolved in the recent years so that software specification and design can be done in a better way through identifying a standard set of notations. The Z-notations does not only allow better capture of specification but also gathers the vital features of the software methods. The Z permits the application designer to give a model of the model as scientific notation that can be utilized to formalize the possibility of documentation necessities. The Z-notation is utilized for making the notations in z-schema. The Z-notation is formal numerical language that deals with scientific articulations. The Z-notation has different components like passages, rationale, sets, schemas, relations, capacities, numbers, arrangements and packs.
The study is completely based on the eight operations of terminal container control system. These eight operations are inter related and uses most of the common variables through entire life-cycle. The first operation adds the terminal and the following state changing operations entails the lifecycle of the terminal. The last three operations are non-state changing that means these three are used for collecting information, not entering new data or altering existing one.
The Z is not a programing that can be compiled for getting output against provided inputs. Rather Z should be considered as the blueprint of a software that shows the structure of the operations in the software. Various notations in the Z has individual meaning and many notations are used for creating a Z-specification of particular software method. The Z-specification utilize the mathematical notations for describing the properties of a software program in an accurate manner. The notations entails what the program does along with suggesting how it is actually done. This makes the Z-specification better than formal specification. The usage of the vast range of complex mathematical notation makes this possible. The Z-specification is used as reliable and single reference pint for evaluating the customer needs and developing programs for fulfilling those needs. The Z is consisting of schemas that are decomposed from the specifications. The schemas are more understandable, small in size and easily creatable. This is why, the Z specifications are always divided into z-specifications first. The Schema is able to describe both the dynamic and static characteristics of the software program. The static aspects are occupied states and invariant relations that are maintained for supporting state alterations. The dynamic properties are potential operations of the software program, relation among the operation input and output and state alterations.
Initialization and State Changes in CCS
initTerminal
name: ?
storage: ?
containerNumber: ?
ton: ?
containerNumber ≥ 0
ton ≥ 0
initDelivery
queVehicleNumber: ?
que: ?
queVehicleNumber ≤ 5
que ≤ 2
In this section, the variables are initialized before starting any operation. The initialization allows to name the sets even without suggesting containing objects. The initialization is done to all the global variables. The nature of the variables are stated in this phase. The initialization is not an operation. This should be seen as the initiation of variables before declaring the constructor or methods. The initialization states that vehicle numbers must be less than five and que should be maximum two.
initContainerTerminal
containerTerminal
known = ∅
addTerminal
ΔContainerTerminal1
name?: Name
storage?: Storage
containerNumber?: ContainerNumber
ton?: Ton
∀i: 1…hwm?name? ≠ names(i)
hwm' = hwm+1
name′ = names⊕{hwm′ ? names?}
storage′ = storages ⊕{hwm′ ? storage?}
containerNumber = containerNumbers ⊕ {hwm′ ? containerNumbers?}
ton = tons ⊕ {hwm′ ? tons?}
The variables are declared in the bottom part of the schema. The above section shows the variables and whether it is user input or available data. The below section is for operations. The Z-schema describes that state change is done in this operation. The container terminal initialization states that the terminal data is empty. The first data will be entered through the addTerminal operation. The name, storage, container number and more variables are act as input. As this is the first data in the database, there is no existing value. The terminal data are collected completely from the users. The system stores the terminal data and it becomes available for other following operations. It can be assumed that if a terminal is added, it cannot be deleted as the organization may want this data as historical data to create new working strategies.
acceptDelivery
ΔDelivery1
queVehicleNumber? : QueVehicleNumber
vehicleIdentifier? : VehicleIdentifier
∀i: 1…hwm?VehicleIdentifier? ≠ vehicleIdentifier(i)
hwm′ = hwm +1
currentLoad ≤ ton – storage
containerNumber ≤4
⇒(vehicleIdentifiers′ = VehicleIdentifier ⊕ {hwm′ ? VehicleIdentifier })
containerNumber = 5
⇒ (queVehicleNumber ′ = queVehicleNumber +1)
The delivery operation is done by one or more vehicles. Each delivery is done from a source to a container. A vehicle will do the work of delivering products. Each time a deliver is done, the system needs to initiates the pick operation. The schema describes change of state.
acceptPickup
ΔDelivery1
vehcileIdentifier? : VehicleIdentifier
freightCompany? : FreightCompany
qty? : Qty
tons? : Tons
∀i : 1…hwm?VehicleIdentifier? ≠ VehicleIdentifier(i)
hwm′ = hwm +1
Operations in CCS
currentLoad ≤ ton – storage
containerNumber ≤4
⇒(vehicleIdentifiers′ = VehicleIdentifier ⊕ {hwm′ ? VehicleIdentifier }
Tons′= Loads ⊕ {hwm′ ? Tons}
freightCompany′ = freightCompany ⊕ {hwm′ ? freightCompany }
qty′ = qty ⊕ {hwm′ ? qty}
currentLoad′ = currentLoad ⊕ {hwm′ ? currentLoad })
containerNumber = 5
⇒ (queVehicleNumber ′ = queVehicleNumber +1
Tons′= Loads ⊕ {hwm′ ? Tons}
freightCompany′ = freightCompany ⊕ {hwm′ ? freightCompany }
qty′ = qty ⊕ {hwm′ ? qty}
currentLoad′ = currentLoad ⊕ {hwm′ ? currentLoad })
The schema describes state change. The pickup acknowledge is the following period of conveyance task. This activity will change the state of conveyance process. The characteristics like vehicleIdentifier, frieghtCompany, amount and ton are utilized in this activity. The entire procedure is driven to vehicle identifier. In the event that the number is 5 then the framework will add the new conveyance demand to que alongside the vehicle id. In the event that the quantity of vehicles is under 5 then the vehicle will be allocated for stacking container. The framework will figure the present load. The framework will likewise check if the present load is not exactly or equivalent to accessible capacity in the container.
leaveDeliveryQue
Δque1
vehcileIdentifier? : VehicleIdentifier
waitingTime?: WaitingTime
preferredWaitingTime? : PreferredWaitingTime
error!: ?
preferredWaitingTime ≤ waitingTime
⇒(queVehicleNumber′ = queVehicleNumber - 1)
queVehicleNumber′ = ∅
⇒ error = No truck available in que
The driver will leave conveyance que of holding up time is more than favoured time. As each truck has just a single driver, the framework will consider the driver as vehicle for information respectability reason. The framework will likewise appear, the mistake message of the que is vacant. The schema describes state change.
unloadShip
ΔcontainerTerminal1
qty?: X
ton? : Y
error!: Report
qty?* ton? ≥ storage
⇒ error!= no space available
qty?* ton? ≤ storage
⇒(storages′ = storages ⊕ {hwm′ ? qty?* ton? })
The trucks does the activity of emptying the ship. The framework computes which vehicle is emptying which holder and how much measure of merchandise are emptied. The framework will figure the measure of item by increasing the amount with ton. The capacity is additionally refreshed when the vehicle empty the ship.
findComntainerTerminalAccount
ΞcontainerTerminal1
startDate! : Date
endDate! : Date
freightCompany? : FreightCompany
qty? : Qty
tons? : Tons
count1!: X
count2!: Y
freightCompany? ∈ known
Date! = endDate!- startDate!
qty?* ton? ≤ count1
qty?* ton? ≥ count2
Date! = containerTerminal(freightCompany?, qty?, tons?)
It outputs the total number and tonnage of containers delivered to a particular container terminal by ALL freight companies in a specified time period (in this simplified system, that is the total quantity and tonnes delivered between two specified global count values.
findShipTotalAccount
ΞcontainerTerminal
name! = Name
qty? : Qty
tons? : Tons
name? ∈ known
name! = containerTerminal(qty?, tons?)
This schema is used for finding the total number and tonnage that a particular ship has loaded from ALL container terminals in the total history of the system. The name means the name of the ship. This value is provided by the user. Based on this input value, the system will collect and show the data to the user.
findFreightCompanyAccount
ΞcontainerTerminal
name! = Name
freightCompany? : FreightCompany
qty? : Qty
tons? : Tons
count1!: X
count2!: Y
freightCompany? ∈ known
qty?* ton? ≤ count1
qty?* ton? ≥ count2
freightCompany! = containerTerminal(qty?, tons?)
This operations describes that no state is changed for the schema. The terminal name is essential for showing the output as users may not recognize the id of the company. The operation implies the condition that to run the schema, the system must recognize the user input freight company name. If the name is valid, then the system show the goods delivered from a particular freight company to the terminal for two values count1 and count2.
Conclusion:
The above descriptions concludes that Z-schemas are great tool for understanding the internal nature of the software programs. The Z has provided an idea about the states that has been extensively used for implying change in database. The operations were interconnected therefore many common variables has been utilized. Various operations were just opposite of each other, those operations used the same variables along with some conditional values. The implementation of the Z has become a great approach for describing the software operations. The study has stated all the operations in the terminal container control system properly. However, those operations were competitively simple than real life system operations. Two or three complex operations could have made possible to apply more complex z-notations.
Ali, T. (2018). Z Notation Formalization of Blockchain Healthcare Document Sharing Based on CRBAC. JOURNAL OF INFORMATION COMMUNICATION TECHNOLOGIES AND ROBOTICS APPLICATIONS (JICTRA).(Formally known as NICE Research Journal of Computer Science). ISSN# 2226-3683, 9, 16-29.
Bowen, J. P. (2016). The Z Notation: Whence the Cause and Whither the Course?. In Engineering Trustworthy Software Systems (pp. 103-151). Springer, Cham.
El Miloudi, A. K., & ETTOUHAMI, A. (2015). A multi-view approach for formalizing UML State Machine Diagrams Using Z Notation. WSEAS Transaction on Computers, 14, 72-78.
Klein, M. J., Sawicki, S., Roos-Frantz, F., & Frantz, R. Z. (2014, April). On the Formalisation of an Application Integration Language Using Z Notation. In ICEIS (1) (pp. 314-319).
To export a reference to this article please select a referencing stye below:
My Assignment Help. (2021). Formal Specification In Z For Container Control System (CCS) Essay.. Retrieved from https://myassignmenthelp.com/free-samples/itech7410-software-engineering-methodologies/container-control-system.html.
"Formal Specification In Z For Container Control System (CCS) Essay.." My Assignment Help, 2021, https://myassignmenthelp.com/free-samples/itech7410-software-engineering-methodologies/container-control-system.html.
My Assignment Help (2021) Formal Specification In Z For Container Control System (CCS) Essay. [Online]. Available from: https://myassignmenthelp.com/free-samples/itech7410-software-engineering-methodologies/container-control-system.html
[Accessed 15 November 2024].
My Assignment Help. 'Formal Specification In Z For Container Control System (CCS) Essay.' (My Assignment Help, 2021) <https://myassignmenthelp.com/free-samples/itech7410-software-engineering-methodologies/container-control-system.html> accessed 15 November 2024.
My Assignment Help. Formal Specification In Z For Container Control System (CCS) Essay. [Internet]. My Assignment Help. 2021 [cited 15 November 2024]. Available from: https://myassignmenthelp.com/free-samples/itech7410-software-engineering-methodologies/container-control-system.html.