Introduction to Z-notation Formal Specification Language
Question:
Describe about the topic "Z-Schema on Wheat Truck Control System".
This is also known as formal specification language based on Z-notation after Zermelo–Fraenkel set theory , used for describing and modelling the computing based systems. This theory was proposed by Jean-Raymond Abrial with the help of Steve Schuman and Bertrand Meyer. It utilises the standard Mathematical notations used in First Order Predicated Logic, Lambda Calculus and Axiomatic Set Theory. Not only it uses the notation of above given mathematical theories it also combines there rules and assumptions too for describing the computing system.
This language describes the Software as a Mathematical Function. It defines a software with using functions and the relation in between. This formal language stresses that the-
- Analysing a system with mathematical techniques is more powerful than human being.
- It helps to eliminate the Ambiguity in the specification by avoiding the reasoning errors and proving the implementation specification correct according to the requirement.
- It helps to perform systematic deduction of programs based on the predicate language.
- It also helps in automated QA techniques and also Automated Testing the models and computing systems.
The concept it uses for Specification & Reasoning-
Logic: Propositional Language, Predicated Language
Data: Sets, Relations and Functions, sequences, bags etc
The Z-schema also defines the structure of the system, it is a 2-Dimensional graphical notation for describing –
- State Spaces
- Operations
Z-Schema Conventions:
- Place the name of the schema in the declaration part by using-‘includes’, by using variables in it.
- Input variable name is terminated by question mark (?).
- Only input will be variable name.
- The output variable is terminated by an exclamation mark (!).
- The ≡ (Xi) symbol means that schema is not changed.
- If we write â–² (delta) instead of ≡ then it means that Schema will change.
- The pre- condition is defined by using ‘Known’ and it is under variable name.
- The post condition is defined by using ‘tel’ .
Scenario given in the assignment:
Software Methodologies
Wheat Truck Control System (WTC)
As a Software Engineering consultant, your task is to develop a formal specification in Z for the following proposed system:
Wheat Truck Control System (WTC)
A new computerized system is to be developed for the storage and handling of accounts for wheat farmers and truck deliveries to Mahsroh Wheat Board silos. Detailed below are the major objects to be considered in the system: silos, ships, trucks and farmers.
This system could be quite complicated. However, to simplify the system for this assignment we will be content to include the following in our proposed system:
The Board currently has ten (10) wheat silos around the country but the system must be written to seamlessly handle at least twice that number. Each silo has a unique name and storage capacity (in tonnes) that must be stored in the proposed system. In addition the system must maintain the current amount of wheat stored in the silo. Obviously when the silo is full no further deliveries of wheat can be made to that silo before some is off-loaded onto a ship for export overseas. Similarly a silo cannot off-load more wheat onto a ship than is currently stored. We will assume that when off -loading to a ship, no trucks can unload due to operational and safety considerations. Only one ship can be handled at a time at each silo.
We will assume that only one truck can unload into a particular silo at any one time. Therefore during busy times each silo also maintains a queue of trucks waiting to unload. Trucks should only be entered into the waiting queue when there is sufficient room for the wheat that the truck holds, i.e. you need to know that the current storage plus all the loads currently in the queue will not exceed the silos capacity.
The system will keep a record of all ships that have been registered to transport wheat overseas for the Wheat Board. The ships name, nationality and capacity (in tonnes) will be stored. The ship's captain can specify the amount of wheat to be off-loaded into the ship as long as it is less than the ships capacity and also the silos current amount in storage. The system will keep a record of the amount of wheat off-loaded to the ship and adjust the current storage appropriately.
Use of Standard Mathematical Notations for Logic, Data, and Structure
As each loaded truck arrives at the silo, it is weighed to ascertain the amount of wheat in the truck. The system maintains a list of registered trucks and their empty weight (in tonnes). Therefore, a single weighing is sufficient to determine the wheat load. If there is sufficient room in the silo then the wheat is off-loaded into the silo and a record is kept of the amount off-loaded against both the truck registration number and the farmer providing the wheat.
Normally we would maintain the date and time of each operation (truck delivery or ship off-loading) however to simplify this assignment we will ignore those aspects. Instead, we will keep a sequential count of each operation for each silo. Therefore, we will have a history of the order of truck unloading and ship off-loading operations that take place for each silo.
The system would be able to say for example, that silo HORSHAM_1, operation number 999 involved 25 tonne of wheat delivered by the truck registered TONKA owned by Jack Black from farmer Bob Smith. Then operation 1000 was an off-loading operation of 125,000 tonnes to the ship -Southern Aurora-.
There is also a need to keep track of the operation order between silos, therefore we will keep a global sequential count of the operations at silos as well. See the following table for an example:
Global No Silo Count Operation Vehicle Name Tonnes Farmer
12336 HORSHAM_1 999 Load TONKA 25 Smith, Bob
12337 MELBOURNE 555 Load DUPLO 20 Jones, Mark
12338 HORSHAM_1 1000 Off-Load Southern Aurora 125,000
12339 MELBOURNE 556 Load LEGGO 50 Simons, Jill
12340 HORSHAM_1 1001 Load TONKA 25 Jones, Mark
The system will maintain a record of each farmer supplying wheat to the silo. Details to be kept include the farmer’s name, address and phone number.
Z Schema Operations
You are to create a Z schema that adequately describes the WTC system. It should include at least one state space and the following operations:
- An initialization operation called Init.
- An operation Enter_new_silo that an operator uses to enter the details of a new silo into the system. Assume the new silo is currently empty.
- An operation Accept_delivery that an operator uses to signal the system to begin off-loading x tonne of wheat from a truck. Note that the system must do a check to see if that storage capacity is available in the silo, if not then an error message must be output and no truck unloading done. Additional information needed by this routine is the truck registration and the farmer’s name. If successful this operation stores all necessary details into the system for that delivery. If a truck is already unloading then this new truck will be placed in a queue waiting for its turn to unload.
- An operation Leave_queue. This operation is run by the system operator each time there is a queue for a silo 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 or if none in the queue a reasonable error message.
- An operation Silo_account that outputs the total amount of wheat in tonnes delivered to a particular silo by ALL farmers in a specified time period (note that means between two global operations numbers in our simplified system). In other words between global operations 10000 and 10500 for example.
- An operation Ships_total_account that outputs the total amount of wheat that a particular ship has taken from ALL silos in the total history of the system.
- An operation Farmers_account that outputs the total amount of wheat delivered to ALL silos in between two specified global operation numbers (e.g. 10000 and 10500).
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.
Pseudocode for each operation specified for Z-Schema-
Operation Init;
Start
- Login to Wheat Control system
- Select operation to perform
- Execute the operation
- Accept result
End
Operation Enter_new_Silo;
Start
- Open new account for Silo.
- Enter name , Name should be unique from the stored list.
- Enter Storage Capacity.
- Display-Silo is currently empty.
End
Operation Accept Delivery
Start
- Select Operation Accept Delivery.
- Verify Truck Registration No.
- Verify Farmer Name
- Check load in Truck
- Check if Silo has capacity to store this load(Silo Capacity> current Silo Load+ Truck Load)
- If Silo can store load then
- Check loaded status of Truck (Unloaded or Not Unloaded)
- If not unloaded then unload wheat from Truck
- Else bring next Truck from the Queue
- Perform Operation Accept Delivery.
End
Operation Leave_Queue
Start
- Select Operation Leave_Queue .
- Check Truck Queue
- If no truck in queue then display message “ No Truck in the queue”
- If trucks in the queue then update Queue status(No of Trucks in queue, Truck R. No, Driver Info, Farmer info, sequence no of Truck in queue)
- Check if any driver wants to leave as the queue is too long and it will take more time in queue
- Then update status of the Queue
End
Start
- Select operation Silo_Account
- Display List of Delivered Truck on the Silo
- Perform sum of amount of wheat delivered (Sum=weight(truck1+truck2+………….truck n)
- Display Sum
End
Operation Ships_Total_ Account:
Start
- Select Operation Ships_Total_Account
- Display List of Silos from where the Wheat is loaded on the Ship.
- Perform Sum of amount of wheat delivered (Sum=weight(Silo1+Silo2+…………Silo n)
- Display Sum
End
Operation Farmer_Account
Start
- Select Operation Farmer Account
- Display list of Farmers that delivered weight on silos
- Accept Farmer no
- Display Farmer details
End
Z-Schema for Wheat control Truck-
Wheat control truck System
Operation Init
Wheat Control Truck System
Name?: Init
Name ?:Select operation
Result! accept Result
Known’= known U {name ?}
{Operation Display→Not valid Operation}
Operation Enter_new_Silo
Wheat Control Truck System
Name ? : Enter_new_Silo
Outcome! New Silo Info
{ {Name of Silo : Name of Silo Name Of Silo List
Not valid Entry}
Display Status→ Silo Currently Empty
S:Silo detail Updated
Operation Accept Delivery
Wheat Control Truck System
Farmer→ Wheat Truck→ Silo
Name ? Accept Delivery
Operation Leave_Queue
Wheat Control Truck System
Wheat Truck→Queue→Silo
Name ? Leave_Queue
Outcome! Status of the Queue
References
Alexander. C, Chris F, Shalom. L, (2012), The Handbook of Computational Linguistics and Natural Language Processing, Wiley Publication
Ronald .V, (2014), Formal Language Theory: Perspectives and Open Problems, Academic Press
Shaoying. L, Zhenhua .D, (2016), Structured Object-Oriented Formal Language and Method, Springer Publication
Sommerville, (2011), Software Engineering, Pearson Publication
.Roger S. Pressman, Software Engineering-A Practitioner’s Approach, Mc Graw-Hill International Edition
David .G ,(2000), Software Engineering- Schaum’s Outlines, , Tata Mc Graw-Hill.
J.M Spivey, An Introduction to Z –Formal Language, From- www. people.csail.mit.edu (Accessed on 29 May 2016).
To export a reference to this article please select a referencing stye below:
My Assignment Help. (2017). Formal Specification Language Based On Z-Notation For Computing Systems. Retrieved from https://myassignmenthelp.com/free-samples/z-schema-on-wheat-truck-control-system.
"Formal Specification Language Based On Z-Notation For Computing Systems." My Assignment Help, 2017, https://myassignmenthelp.com/free-samples/z-schema-on-wheat-truck-control-system.
My Assignment Help (2017) Formal Specification Language Based On Z-Notation For Computing Systems [Online]. Available from: https://myassignmenthelp.com/free-samples/z-schema-on-wheat-truck-control-system
[Accessed 05 December 2024].
My Assignment Help. 'Formal Specification Language Based On Z-Notation For Computing Systems' (My Assignment Help, 2017) <https://myassignmenthelp.com/free-samples/z-schema-on-wheat-truck-control-system> accessed 05 December 2024.
My Assignment Help. Formal Specification Language Based On Z-Notation For Computing Systems [Internet]. My Assignment Help. 2017 [cited 05 December 2024]. Available from: https://myassignmenthelp.com/free-samples/z-schema-on-wheat-truck-control-system.