Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Assignment - Formal System Specification Overview The purpose of this assessment is to provide students with the opportunity to apply knowledge and skills developed during the semester with particular...

1 answer below »

Assignment - Formal System Specification

Overview

The purpose of this assessment is to provide students with the opportunity to apply knowledge and skills developed during the semester with particular reference to the formal specification of a system through the use of Z notation. Students complete the assignment in groups of two.

As described in this course's third study guide, Software Analysis, Modelling and Specification, a Formal Specification (Technique) is one that has a rigorous mathematical basis and one of its advantages is that it can be mathematically checked for completeness. The course's fourth study guide, System and Software Design, also states that by using formal methods it is possible to derive a formal design from a formal specification and then be able to prove that the design and specification are functionally equivalent.

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.

Learning Outcomes

The following course learning outcomes are assessed by completing this assessment:

S1. Critically analyse and use complex decision making to research and determine the appropriate
Software Engineering tools and methodologies to utilize in a given situation

S2. Apply professional communication skills to support and manage the engineering of a large software system
S3 Review, critically analyse and develop artefacts to define processes for quality assurance, risk management and communication in large software development projects
S4 Implement quality assurance activities in order to verify user requirements and validate design decisions
A1 Analysis of a large system development problem to decide upon the best methodological approach
A2 Development of appropriate artefacts to support and manage the software engineering process such as change control and configuration management

Requirements

Demonstrate an understanding of particular concepts covered in lectures, tutorials, laboratories and reading to provide the specification requested. This may require further reading and research beyond the material discussed in class.

Assessment Details

This assignment will be assessed by your lecturer/tutor. The assignment requires you to produce a formal specification containing the components identified below.

Assessable Tasks/Requirements

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_terminal that 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_delivery that 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_pickup that 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_ship that 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_account that 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 XXXXXXXXXXand 10500).

- An operation Ships_total_account that 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_account that 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.

Answered 348 days After May 14, 2022

Solution

Shivali answered on Apr 28 2023
33 Votes
To approach the task of creating a formal specification of the Container Control System (CCS) using Z notation. Here are some steps you can follow:
1. Understand the CCS: Read and analysed the description of the CCS provided in the assignment. Identify the key components, data entities, and operations that the system needs to perform.
2. Identify the sets and relations: Based on your analysis of the CCS, identify the sets and relations that need to be defined in the Z specification. For example, you may need to define sets for containers, ports, and ships, and relations between them.
3. Define the state space: Identify the states that the CCS can occupy and define the state space. This will involve defining the initial state of the system and the operations that can change the state of the system.
4. Define the functions: Identify the functions that the CCS needs to perform and define them using Z schemas. For example, you may need to define functions for loading and unloading containers, checking the status of containers, and calculating the weight of containers.
5. Define e
or handling: Identify the possible e
ors that can occur during the operation of the CCS and define how they will be handled. For example, you may need to define e
or messages and e
or recovery procedures.
6. Review and refine: Review your Z specification and refine it to ensure that it is complete, consistent, and unambiguous. Make sure that all the requirements of the CCS are captured in the specification.
7. Validate and verify: Validate and verify your Z specification by checking it for co
ectness and completeness. Use tools such as Z live or FDR4 to validate your specification.
8. Document and communicate: Document your Z specification and communicate it to the stakeholders of the CCS. Ensure that your specification is understandable and usable by others.
To define the initialization operation Init, we first need to define the initial state of the system. Let's assume that the CCS has no container terminals, trucks, or ships initially. The initial state of the system can be defined as:
state_0 == (terminals=\{\}, trucks=\{\}, ships=\{\}, deliveries=\{\}, pickups=\{\}, queues=\{\})
where:
terminals: a set of container terminals, initially empty
trucks: a set of trucks, initially empty
ships: a set of ships, initially empty
deliveries: a set of ongoing deliveries, initially empty
pickups: a set of ongoing pickups, initially empty
queues: a set of delivery queues, initially empty
With this initial state, we can define the initialization operation as:
Init == state' = state_0
This operation sets the cu
ent state of the system to the initial state.
-Here is the Z schema for the Enter_new_container_terminal operation:
Enter_new_container_terminal ==
    \lambda id, location, capacity, tonnage, terminals : \\
        terminals' == terminals \cup \{ id \mapsto (location, 0, capacity, tonnage) \}
where:
id is the identifier of the new container terminal
location is the location of the new container terminal
capacity is the storage capacity of the new container terminal (in number of containers)
tonnage is the storage capacity of the new container terminal (in tonnes)
terminals is the set of all container terminals in the system
terminals' is the updated set of container terminals after adding the new one
The operation takes in the identifier, location, capacity, tonnage of the new container terminal, and the cu
ent set of terminals. It returns the updated set of terminals with the new one added. Note that the initial quantity of containers in the new terminal is set to 0, since it's assumed to be cu
ently empty.
-Here is a possible schema for the Accept_delivery operation:
Accept_delivery ==
  PRE
    trucks_delivering < 5
    x > 0 /\ y > 0 /\ x + containers_quantity <= containers_capacity /\ y + containers_tonnage <= tonnage_capacity
    truck_reg \notin trucks_in_delivery /\ truck_reg \notin trucks_in_pickup /\ truck_reg \notin trucks_in_queue
  THEN
    trucks_in_delivery' = trucks_in_delivery \cup {truck_reg}
    trucks_in_pickup' = trucks_in_pickup
    trucks_in_queue' = trucks_in_queue
    containers_quantity' = containers_quantity + x
    tonnage_capacity' = tonnage_capacity + y
    deliveries' = deliveries \cup {}
    e
or' = no_e
o
  ELSE
    trucks_in_delivery' = trucks_in_delivery
    trucks_in_pickup' = trucks_in_pickup
    trucks_in_queue' = trucks_in_queue \cup {truck_reg}
    containers_quantity' = containers_quantity
    tonnage_capacity' = tonnage_capacity
    deliveries' = deliveries
    e
or' = "Cannot accept delivery: container terminal is full or the truck is already in the system"
  END
Where:
trucks_delivering is the number of trucks cu
ently delivering
x is the quantity of containers in the delivery
y is the tonnage of containers in the delivery
containers_quantity is the cu
ent quantity of containers in the container terminal
containers_capacity is the total capacity of the container terminal in terms of quantity of containers
tonnage_capacity is the cu
ent tonnage of containers in the container terminal
freight_company is the name of the company that owns the delivery truck
truck_reg is the registration number of the delivery truck
trucks_in_delivery is the set of trucks cu
ently delivering
trucks_in_pickup is the set of trucks cu
ently picking up containers
trucks_in_queue is the set of trucks waiting in the delivery queue
deliveries is the set of all completed deliveries
e
or is a string containing an e
or message if the delivery cannot be accepted
The schema checks that the container terminal has enough space to accept the delivery and that the delivery truck is not already in the system. If the conditions are met, the operation adds the delivery truck to the trucks_in_delivery set, updates the containers_quantity and tonnage_capacity variables, and stores the details of the delivery in the deliveries set. If there are already five trucks delivering, the operation adds the delivery truck to the trucks_in_queue set. If the conditions are not met, the operation outputs an e
or message and does not modify the state of the...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here