Main System Database and Interface Specifications

Authors


Outline


Entity Relationship Diagram

This Entity Relationship Diagram models the information that must be remembered and therefore stored by the Automated gas Station system over a nontrivial period of time. This information is received as input from various sources including the user, the credit card companies,a nd the system software itself and must be accessed, modified, or reported at a later time.


Data Dictionaries

Following are the data dictionaries of all the data elements that are pertinent to the Automated Gas Station system, with semi-precise definitions. These are to help ensure that both users (or "customers") and developers of systems have a common understanding of all the inputs, outputs, components of stores, and intermediate calculations used by a system.

Follwing are the entities included in the data dictionaries. The data dictionaries are divided up into four separte parts for clarification only. Each part is interrelated via these entities:


Transaction Data Dictionary

amount in litres = real

* Description: The number of litres of gas delivered for the current
* transaction.
* Parameters: OOR.RR
* Example: 100.00

card number = string

* Description: The account number of the card used for the current transaction
* Parameters: [string]
* Example: [4520 02 95643657 33]

card type = ["Mastercard" | "Visa" | "American Express" | "Bank Card"]

* Description: The type of credit card or bank card used
* Parameters: list
* Example: Visa

customer's first name = string

* Description: The first name of the customer for the current transaction.
* Type: Text
* Parameters: Length=50
* Example: John

customer's last name = string

* Description: The last name of the customer for the current transaction.
* Parameters: Length=50
* Example: Smith

summary ID = unsigned integer

* Description: The ID for the particular report being generated.
* Parameters: none
* Example: 1

summary start = date/time

* Description: The starting time for the period of time covered by the report.
* Parameters: hh:tt
* Example: 13:30

summary stop = date/time

* Description: The end time of the period of time covered by the report.
* Parameters: hh:tt
* Example: 23:30

tax total = real

* Description: The total amount in Canadian dollars charged as tax for the
* current transaction.
* Parameters: (Gas Amount in Litres * Price per Litre) * (Tax)
* Example: $3.00

Transaction = @transaction ID + transaction date + Pump + Fuel + customer's first name + customer's last name + card type + card number + amount in litres + Tax + tax total + transaction total

* The transaction entity stores data pertaining to each transaction
* processed by a pump at the station.

transaction ID = unsiged integer

* Description: The number representing the particular pump at the gas
* which delivered the gas for the current transaction.
* Parameters: from 1 to #Number of gas pumps at station
* Example: 3

transaction date = date/time

* Description: The date on which the transaction took place.
* Parameters: dd/mm/yyyy
* Example: 24/02/97

Transation Summary = @Summary ID + Summary Start + Summary Stop

* The report entity stores data pertaining to a batch report generated
* for the transactions processed during a particular period of time.

transaction total = real

* Description: The total cost for the current transaction.
* Parameters: (Gas Amount in Litres * Price per Litre) + Tax Total
* Example: $58.74


Delivery Data Dictionary

Delivery = @delivery ID + delivery date + Tank + delivery person last name + delivery person first name + delivery person ID + delivery tank level before + delivery tank level added + delivery tank level after + delivery total value

* Delivery Entity stores the definition for the data records for each
* delivery.

delivery date = date/time

* Description: The time of delivery of fuel to main tank.
* Parameters: hh:tt
* Example: 13:30

delivery ID = usinged integer

* Description: ID of the delivery of fuel to main tank.
* Parameters: none
* Example: 04

delivery person first name = string

* Description: First Name of person delivering fuel to main tank.
* Parameters: Length = 50
* Example: John

delivery person ID = usigned integer

* Description: An employee number of person delivering fuel to main tank.
* Parameters: Length = 8
* Example: 12345678

delivery person last name = string

* Description: Last Name of person delivering fuel to main tank.
* Parameters: Length = 50
* Example: Smith

delivery tank level added = real

* Description: The number of litres added to main tank.
* Parameters: OOOOO.OO
* Example: 5000.00

delivery tank level after = real

* Description: The number of litres in the main tank after delivery.
* Parameters: OOOOO.OO
* Example: 15523.50

delivery tank level before = real

* Description: The number of litres in the main tank before delivery of
* additional fuel.
* Parameters: OOOOO.OO
* Example: 10523.50

delivery total value = real

* Description: The value of the gas added to the tank at current value of
* gas.
* Parameters: $DDDDD.CC
* Example: $9158.57


Rejected Credit Card Data Dictionary

action taken = [ "Card kept" | "Card returned" | "Credit card company system informed" ]

* Non-key attribute of the entity Rejected Credit Card. This is an enumerated
* type field that specifies the action taken on the rejected credit card as
* specified by the credit card company.

card holder name = string

* Non-key attribute of the entity Rejected Credit Card. This is a string field of
* masimum 30 characters and includes the credit card holder's full name, first
* and last name, as presented on the rejected credit card.

card status = [ "Lost" | "Stolen" ]

* Non-key attribute of the entity Rejected Credit Card. This is an enumerated
* type field that specifies the status of the rejected credit card.

credit card number = string

* Non-key attribute of the entity Rejected Credit Card. This is a string field of
* maximum 30 characters holding the rejected credit card number including all
* relevent spaces.

Rejected Credit Card = @rejected credit card ID + rejected credit card date + credit card number + card holder name + card status + action taken

* Rejected Credit Card Entity; this represents credit cards that have been
* been rejected by credit card companies because they have been reported
* lost or stolen.

rejected credit card date = date/time

* Non-key attribute of the entity Rejected Credit Card. This is a date/time field
* indicating the time the Rejceted Credit Card was logged.

rejected credit card ID = usinged integer

* Key attribute of the entity Rejected Credit Card. This is a unique ID assigned
* when a new entry is added.


System Configuration Data Dictionary

access level = [ "Level 0" | " Level 1"]

* Non-key attribute of the entity Login. This is an enumerated type field that
* indicates the access level of the user.

amount of fuel in tank

* Non-key attribute of the entity Fuel. This is a real indicating the amount of fuel
* Currently in the tank.

Fuel = @fuel type + fuel price per litre + maximum amount

* Fuel Entity; this represents the fuel types and their respective prices.

fuel price per litre = real

* Non-key attribute of the entity Fuel. This is a real field indicating the
* price/litre the fuel is to purchase.

fuel sold = real

* Non-key attribute of the entity Pump. This is a real indicating the amount of
* fuel sold by the Pump since it was turned on.

fuel type = ["Regular" | "Mid Grade" | "Premium" | "Diesel"]

* Key attribute of the entity Fuel. This is an enumerated type field indicating
* the type of fuel.

gst = real

* This is a member of the entity Tax. It is used to store the value of the GST.

Login = @user + password + access level

* Login Entity; this represents the users that may log into the Remote
* Operations Interface and their corresponding access password and access
* level. *

password = string

* Non-key attribute of the entity Login. This is a string field of minimum 4
* characters and maximum 8 characters and indicates a password for the
* corresponding username.

pst = real

* This is a member of the entity Tax. It is used to store the value of the PST.

Pump = @pump number + pump status + fuel sold

* Pump Entity; this represents the different pumps at the Automated gas Station
* and allows pumps to be turned On and Off.

pump number = integer

* Key attribute of the entity Pump. This is an integer field starting at the
* minimum value of 1 to the maximum value of the number of pumps installed
* at the Automated Gas Station.

pump status = [ "On" | "Off" ]

* Non-key attribute of the entity Pump. This is an enumerated type field
* indicating whether the pump should be On or Off.

maximum amount = real

* Non-key attrinbute of the entity Fuel. This is a real indicated the maximum amount
* a transaction may have of the particular type of fuel.

Tank = @tank type + tank status + amount of fuel in tank

* Tank entity; this reporesents the different tanks at the Automated Gas
* Station and is used to identify tanks in delivery reports.

tank status = ["Locked" | "Unlocked"]

* Non-key attribute of entity Tank. This is the status of the Tank, whether it
* is locked or unlcoked.

tank type = ["Regular" | "Mid Grade" | "Premium" | "Diesel"]

* Key attribute of the entity Tank. This is the type of Tank. There is exactly
* one Tank for each type of fuel.

Tax = gst + pst

* Tax entity; this is the system configuration stored values for the Tax applied
* transactions.

Report = @report date + report type

* Report Entity; this represents when each report is to be generated by the
* Automated Gas Station.

report date = date/time

* Key attribute of the entity Report. This is a date/time field that indicates the
* when a report is to be generated. The date field may be an actual date or
* may just be "Daily".

report type = [ "Transaction" | "Deliveries" | "Rejected Credit Cards" | "Statistics" | "Monthly"]

* Non-key attribute of the entity Report. This is an enumerated type field
* that indicates the type of report to be generated.

Statistics = Fuel + Pump + Tank + Tax

* Statistics Entity; this represents the current station statistics.

user = string

* Key attribute of the entity Login. This is a string field of maximum 8
* characters and indicates a unique username for the Remote Operations
* Interface.


Process Specifications

These Process Specifcations are the interfaces for each Data Store that hold information based on the definitions given in the Data Dictionaries. One Data Store (database) exists for each Entity.


Transaction Module


Transaction.Add()
Description:
Add a Transaction to the Transaction Database.
Input: Transaction
Output: status

Error Conditions:

  1. Success -- System successfully generates the Deliveries report.
  2. Syntactical Errors: Data passed to the module is corrupt or invalid
  3. Database Errors:
    -- Delivery ID already exists
    -- Database is off-line
    -- Write error occured
    -- Could not close database after module completed.

Modules Used: None

Description:

BEGIN

if (syntactical error) then
     mesg(#TransactionAdd_SyntaxError)
     return (#ERROR)
end if

OPEN RecordSet (Transactions)

LOCK database 

Transactions.APPEND(CurrentRecord)

RELEASE LOCK

if #ERROR then
     case (exists TransactonID)
          mesg(#TransactionIDExists_DatabaseError)
          return(#ERROR)
     case (database offline)
          mesg(#DatabaseOffline_DatabaseError)
          return(#ERROR)
     case (write error)
          mesg(#WriteError_DatabaseError)
          return(#ERROR)
     case (close error)
          mesg(#CloseError_DatabaseError)
          return(#ERROR)

return (#OK)

END      


Transaction.Report()
Description:
Generate a report for all transactions conducted within the batch reporting interval.
Input: Transactions, Transaction Summary
Output: A list of transactions within the specified interval.

Error Conditions:

  1. Success -- System successfully generates the Transactions report.
  2. Syntactical Errors: Data passed to the module is corrupt, Date ranges incorrect.
  3. Database Errors:
    -- Transaction ID does not exist
    -- Database is off-line
    -- Write error occured
    -- Could not close database after module completed.

Modules Used: None

Description:

BEGIN

if (syntactical error) then
     mesg(#TransactionsReport_SyntaxError)
     return (#RESEND)
end if

OPEN RecordSet (Transaction Summary)
OPEN RecordSet (Transactions)

LOCK database 

print CURRENT_RECORD from TRANSACTION SUMMARY

while (not END_OF_RECORDS) do
     print CURRENT_RECORD from TRANSACTIONS
     if ERROR then
          set #ERROR
          break
     end if
end while

RELEASE LOCK

if #ERROR then
     case (not exists Transaction ID)
          mesg(#TransactionIDMissing_DatabaseError)
          return(#RESEND)
     case (database offline)
          mesg(#DatabaseOffline_DatabaseError)
          return(#RESEND)
     case (write error)
          mesg(#WriteError_DatabaseError)
          return(#RESEND)
     case (close error)
          mesg(#CloseError_DatabaseError)
          return(#RESEND)

return (#OK)

END      


Transaction.BackupDatabase()
Description:
This is a private function accessible only by other functions in the Transaction module.
Input: Transaction ID
Output: status

Error Conditions:

  1. Success -- System successfully backs up the Transactions database.
  2. Syntactical Errors: Data passed to the module is corrupt
  3. Database Errors:
    -- Transaction ID does not exist
    -- Database is off-line
    -- Write error occured
    -- Could not close database after module completed.

Modules Used: None

Description:

BEGIN

if (syntactical error) then
     mesg(#TransactionsBackup_SyntaxError)
     return (#RESEND)
end if

create  FILE TRANSACTIONS_BACKUP
TRANSACTIONS_BACKUP.NAME = Transaction_ID & Name

while (not END_OF_RECORDS) do
     copy CURRENT_RECORD from TRANSACTIONS to TRANSACTIONS_BACKUP
     if ERROR then
          set #ERROR
          break
     end if
end while

if #ERROR then
     case (not exists Transaction ID)
          mesg(#TransactionIDMissing_DatabaseError)
          return(#RESEND)
     case (database offline)
          mesg(#DatabaseOffline_DatabaseError)
          return(#RESEND)
     case (write error)
          mesg(#WriteError_DatabaseError)
          return(#RESEND)
     case (close error)
          mesg(#CloseError_DatabaseError)
          return(#RESEND)

return (#OK)

END      

Transaction.ClearDatabase()
Description:
This is a private function accessible only by other functions in the Transaction module.
Input: Transaction ID
Output: status

Error Conditions:

  1. Success -- System successfully clears the Transactions database.
  2. Syntactical Errors: Data passed to the module is corrupt
  3. Database Errors:
    -- Transaction ID does not exist
    -- Database is off-line
    -- Write error occured
    -- Could not close database after module completed.

Modules Used: None

Description:

BEGIN

if (syntactical error) then
     mesg(#TransactionsClear_SyntaxError)
     return (#RESEND)
end if

TRANSACTIONS_CLEAR.NAME = Transaction_ID & Name
open FILE TRANSACTIONS_CLEAR

while (not END_OF_RECORDS) do
     delete CURRENT_RECORD from TRANSACTIONS
     if ERROR then
          set #ERROR
          break
     end if
end while

CLOSE database

if #ERROR then
     case (not exists Transaction ID)
          mesg(#TransactionIDMissing_DatabaseError)
          return(#RESEND)
     case (database offline)
          mesg(#DatabaseOffline_DatabaseError)
          return(#RESEND)
     case (write error)
          mesg(#WriteError_DatabaseError)
          return(#RESEND)
     case (close error)
          mesg(#CloseError_DatabaseError)
          return(#RESEND)

return (#OK)

END      


Transaction Summary Module


TransactionSummary.Report()
Description:
Generate a header for a given report containing Report Summary information.
Input: Transaction Summary.
Output: none


Delivery Module


Delivery.Add()
Description:
Adds a delivery record to the Deliveries database.
Input: Delivery
Output: status

Error Conditions:

  1. Success -- System successfully adds a report
  2. Syntactical Errors: Data passed to the module is corrupt or invalid
  3. Database Errors:
    -- Delivery ID already exists
    -- Database is off-line
    -- Write error occured
    -- Could not close database after module completed.

Modules Used: None

Description:

BEGIN

if (syntactical error) then
     mesg(#DeliveryAdd_SyntaxError)
     return (#ERROR)
end if

OPEN RecordSet (Deliveries)

LOCK database D

Deliveries.APPEND(CurrentRecord)

RELEASE LOCK

if #ERROR then
     case (exists Delivery ID)
          mesg(#Delivery IDExists_DatabaseError)
          return(#ERROR)
     case (database offline)
          mesg(#DatabaseOffline_DatabaseError)
          return(#ERROR)
     case (write error)
          mesg(#WriteError_DatabaseError)
          return(#ERROR)
     case (close error)
          mesg(#CloseError_DatabaseError)
          return(#ERROR)

return (#OK)

END     


Delivery.Report()
Description:
Prepares a report of all deliveries of fuel to the main gas tanks.
Input: Deliveries
Output: status

Error Conditions:

  1. Success -- System successfully generates the Deliveries report.
  2. Syntactical Errors: Data passed to the module is corrupt, Date ranges incorrect.
  3. Database Errors:
    -- Delivery ID does not exist
    -- Database is off-line
    -- Write error occured
    -- Could not close database after module completed.

Modules Used: None

Description:

BEGIN

if (syntactical error) then
     mesg(#DeliveriesReport_SyntaxError)
     return (#RESEND)
end if

OPEN RecordSet (Deliveries[Date Range])

LOCK database 

while (not END_OF_RECORDS) do
     print CURRENT_RECORD from Deliveries
     if ERROR then
          set #ERROR
          break
     end if
end while

RELEASE LOCK

if #ERROR then
     case (not exists Delivery ID)
          mesg(#Delivery IDMissing_DatabaseError)
          return(#RESEND)
     case (database offline)
          mesg(#DatabaseOffline_DatabaseError)
          return(#RESEND)
     case (write error)
          mesg(#WriteError_DatabaseError)
          return(#RESEND)
     case (close error)
          mesg(#CloseError_DatabaseError)
          return(#RESEND)

return (#OK)

END      


Delivery.BackupDatabase()
Description:
This is a private function accessible only by other functions in the Transaction module.
Input: Delivery ID
Output: status

Error Conditions:

  1. Success -- System successfully backs up the Deliveries database.
  2. Syntactical Errors: Data passed to the module is corrupt
  3. Database Errors:
    -- Delivery ID does not exist
    -- Database is off-line
    -- Write error occured
    -- Could not close database after module completed.

Modules Used: None

Description:

BEGIN

if (syntactical error) then
     mesg(#DeliveriesBackup_SyntaxError)
     return (#RESEND)
end if

create  FILE DELIVERIES_BACKUP
DELIVERIES_BACKUP.NAME = Delivery_ID & Name

while (not END_OF_RECORDS) do
     copy CURRENT_RECORD from DELIVERIES to DELIVERIES_BACKUP
     if ERROR then
          set #ERROR
          break
     end if
end while

if #ERROR then
     case (not exists DeliveryID)
          mesg(#DeliveryIDMissing_DatabaseError)
          return(#RESEND)
     case (database offline)
          mesg(#DatabaseOffline_DatabaseError)
          return(#RESEND)
     case (write error)
          mesg(#WriteError_DatabaseError)
          return(#RESEND)
     case (close error)
          mesg(#CloseError_DatabaseError)
          return(#RESEND)

return (#OK)

END 


Delivery.ClearDatabase()
Description:
This is a private function accessible only by other functions in the Transaction module.
Input: Delivery ID
Output: status

Error Conditions:

  1. Success -- System successfully clears the Deliveries database.
  2. Syntactical Errors: Data passed to the module is corrupt
  3. Database Errors:
    -- Delivery ID does not exist
    -- Database is off-line
    -- Write error occured
    -- Could not close database after module completed.

Modules Used: None

Description:

BEGIN

if (syntactical error) then
     mesg(#DelivieriesClear_SyntaxError)
     return (#RESEND)
end if

OPEN FILE DELIVERIES_CLEAR.NAME = Transaction_ID & Name

while (not END_OF_RECORDS) do
     delete CURRENT_RECORD from DELIVERIES
     if ERROR then
          set #ERROR
          break
     end if
end while

CLOSE database

if #ERROR then
     case (not exists DeliveriesID)
          mesg(#DeliveryIDMissing_DatabaseError)
          return(#RESEND)
     case (database offline)
          mesg(#DatabaseOffline_DatabaseError)
          return(#RESEND)
     case (write error)
          mesg(#WriteError_DatabaseError)
          return(#RESEND)
     case (close error)
          mesg(#CloseError_DatabaseError)
          return(#RESEND)

return (#OK)

END      


RejectedCreditCard Module


RejectedCreditCard.Add()
Description:
Add a rejected credit card entry to the database.

Error Conditions:

  1. Success -- System successfully adds a Rejected Credit Card
  2. Syntactical Errors: Data passed to the module is corrupt or invalid
  3. Database Errors:
    -- Database is off-line
    -- Write error occured
    -- Could not close database after module completed.

Modules Used: None

Description:

BEGIN

if (syntactical error) then
     mesg(#RejectedCard_SyntaxError)
     return (#ERROR)
end if

OPEN RecordSet (Rejected Credit Cards)

LOCK database 

[Rejected Credit Cards].APPEND(CurrentRecord)

RELEASE LOCK

if #ERROR then
     case (database offline)
          mesg(#DatabaseOffline_DatabaseError)
          return(#ERROR)
     case (write error)
          mesg(#WriteError_DatabaseError)
          return(#ERROR)
     case (close error)
          mesg(#CloseError_DatabaseError)
          return(#ERROR)

return (#OK)

END     


RejectedCreditCard.Report()
Description:
Generates report of all rejected credit cards.
Input: Rejected Credit Cards
Output: none

Error Conditions:

  1. Success -- System successfully generates the Rejected Credit Cards report.
  2. Syntactical Errors: Data passed to the module is corrupt, Date ranges incorrect.
  3. Database Errors:
    -- Rejected Credit Card ID does not exist
    -- Database is off-line
    -- Write error occured
    -- Could not close database after module completed.

Modules Used: None

Description:

BEGIN

if (syntactical error) then
     mesg(#RejectedCreditCardsReport_SyntaxError)
     return (#RESEND)
end if

OPEN RecordSet (Rejected Credit Cards[Date Range])

LOCK database 

while (not END_OF_RECORDS) do
     print CURRENT_RECORD from Rejected Credit Cards
     if ERROR then
          set #ERROR
          break
     end if
end while

RELEASE LOCK

if #ERROR then
     case (not exists Rejected Credit Card ID)
          mesg(#Rejected Credit Card IDMissing_DatabaseError)
          return(#RESEND)
     case (database offline)
          mesg(#DatabaseOffline_DatabaseError)
          return(#RESEND)
     case (write error)
          mesg(#WriteError_DatabaseError)
          return(#RESEND)
     case (close error)
          mesg(#CloseError_DatabaseError)
          return(#RESEND)

return (#OK)

END      


RejectedCreditCard.BackupDatabase()
Description:
This is a private function accessible only by other functions in the Transaction module.
Input: Rejected Credit Card ID
Output: status

Error Conditions:

  1. Success -- System successfully backs up the Rejected Credit Card database.
  2. Syntactical Errors: Data passed to the module is corrupt
  3. Database Errors:
    -- Rejected Credit Card ID does not exist
    -- Database is off-line
    -- Write error occured
    -- Could not close database after module completed.

Modules Used: None

Description:

BEGIN

if (syntactical error) then
     mesg(#RejectedCardsBackup_SyntaxError)
     return (#RESEND)
end if

create  FILE REJECTEDCARDS_BACKUP
REJECTEDCARDS_BACKUP.NAME = Rejected Credit Card ID & Name

while (not END_OF_RECORDS) do
     copy CURRENT_RECORD from REJECTED CREDIT CARDS to REJECTEDCARDS_BACKUP
     if ERROR then
          set #ERROR
          break
     end if
end while

if #ERROR then
     case (not exists RejectedCreditCard ID)
          mesg(#RejectedCardIDMissing_DatabaseError)
          return(#RESEND)
     case (database offline)
          mesg(#DatabaseOffline_DatabaseError)
          return(#RESEND)
     case (write error)
          mesg(#WriteError_DatabaseError)
          return(#RESEND)
     case (close error)
          mesg(#CloseError_DatabaseError)
          return(#RESEND)

return (#OK)


RejectedCreditCard.ClearDatabase()
Description:
This is a private function accessible only by other functions in the Transaction module.
Input: Rejected Credit Card ID
Output: status

Error Conditions:

  1. Success -- System successfully clears the Rejected Credit Card database.
  2. Syntactical Errors: Data passed to the module is corrupt
  3. Database Errors:
    -- Rejcetd Credit Card ID does not exist
    -- Database is off-line
    -- Write error occured
    -- Could not close database after module completed.

Modules Used: None

Description:

BEGIN

if (syntactical error) then
     mesg(#RejectedCardsClear_SyntaxError)
     return (#RESEND)
end if

OPEN FILE REJECTEDCARDS_CLEAR.NAME = Rejected Credit Card & Name

while (not END_OF_RECORDS) do
     delete CURRENT_RECORD from REJECTEDCARDS_CLEAR
     if ERROR then
          set #ERROR
          break
     end if
end while

CLOSE database

if #ERROR then
     case (not exists RejectedCreditCardID)
          mesg(#RejectedCreditCardIDMissing_DatabaseError)
          return(#RESEND)
     case (database offline)
          mesg(#DatabaseOffline_DatabaseError)
          return(#RESEND)
     case (write error)
          mesg(#WriteError_DatabaseError)
          return(#RESEND)
     case (close error)
          mesg(#CloseError_DatabaseError)
          return(#RESEND)

return (#OK)

END      


Tax Module


Tax.setGST()
Description:
This function allows the current GST tax rate to be set. This function is called by the Remote Operations Interface by a User with the appropriate Access Level.
Input: A real indicating the new GST tax rate.
Output: None.

Error Conditions :

1. Success - System successfully set the new GST tax rate.
2. Syntactic Error - Some information passed to Tax.setGST() was corrupt.
          * The GST parameter was not of the REAL datatype specified.
          * There was no parameter passed to Tax.setGST() .
3. Database Error - (I/O) An error ocurred while accessing the System Configuration database.
          * Database is offline
          * Write error occured
          * Could not close database after Tax.setGST() operation.

Modules Used :

NONE

Description :

if not(Syntactic Error)
    then if not(Database Error)
        then GST = GST' (* Success *)
    else case of (* Else a Database Error Ocurred *)
             :(Offline)
               return "System Configuration Database offline in Tax.setGST()."
             :(IO)
               return "Write Error ocurred while writting GST in Tax.setGST()."
             :(General_Access_Error)
               return "Could not finish write operation when writting GST to System                        Configuration Database in Tax.setGST(). Contact Supplier Group                        11"
             default
               return "Unknown Error in Tax.setGST(). Contact Supplier Group 11"
else case of (* Else a Syntactic Eror Ocurred *)
         :(GST not_of_type(REAL))
           return "Invalid type passed to Tax.setGST()."
         :(GST = NULL)
           return "NULL value passed to Tax.setGST(). "
         default
           return "Unknown Error in Tax.setGST(). Contact Supplier Group 11"
end (* Tax.setGST() *)


Tax.getGST()
Description:
This function is an accessor function that returns the current GST tax rate. This function is called by the Gas Pump Interface when calculating the Tax Total and Transaction Total fields for a Transaction.
Input: None.
Output: A real indicating the current GST tax rate.

Error Conditions :
1. Success - System successfully returned the current GST tax rate to the Gas Pump Interface.
2. Syntactic Error - The call to the module was syntactically incorrect.
3. Database Error - (I/O) An error ocurred while accessing the tax database.
                                   - Database is offline
                                   - Write error occured
                                   - Could not close database after Tax.getGST() operation.
Modules Called : NONE

Descrption :

if not(Syntactic Error)
    then if not(Database Error)
        then return GST (* Success *)
    else case of (* Else a Database Error Ocurred *)
             :(Offline)
               return "System Configuration Database offline in Tax.getGST()."
             :(IO)
               return "Read Error ocurred while reading GST in Tax.getGST()."
             :(General_Access_Error)
               return "Could not finish write operation when writting GST to System                        Configuration Database in Tax.getGST(). Contact Supplier Group 11"
             default
               return "Unknown Error in Tax.getGST(). Contact Supplier Group 11"
else case of (* Else a Syntactic Eror Ocurred *)
         default
           return "Unknown Error in Tax.getGST(). Contact Supplier Group 11"
end (* Tax.getGST() *)


Tax.setPST()
Description:
This function allows the current PST tax rate to be set. This function is called by the Remote Operations Interface by a User with the appropriate Access Level.
Input: A real indicating the new PST tax rate.
Output: None.

Error Conditions :

1. Success - System successfully set the new PST tax rate.
2. Syntactic Error - Some information passed to Tax.setPST() was corrupt.
          * The GST parameter was not of the REAL datatype specified.
          * There was no parameter passed to Tax.setPST() .
3. Database Error - (I/O) An error ocurred while accessing the System Configuration database.
          * Database is offline
          * Write error occured
          * Could not close database after Tax.setPST() operation.

Modules Used :

NONE

Description :

if not(Syntactic Error)
    then if not(Database Error)
        then GST = GST' (* Success *)
    else case of (* Else a Database Error Ocurred *)
             :(Offline)
               return "System Configuration database offline in Tax.setPST()."
             :(IO)
               return "Write Error ocurred while writting GST in Tax.setPST()."
             :(General_Access_Error)
               return "Could not finish write operation when writting PST to System                        Configuration Database in Tax.setPST(). Contact Supplier Group                        11"
             default
               return ""Unknown Error in Tax.setPST(). Contact Supplier Group 11"
else case of (* Else a Syntactic Eror Ocurred *)
         :(PST not_of_type(REAL))
           return "Invalid type passed to Tax.setPST()."
         :(PST = NULL)
           return "NULL value passed to Tax.setPST(). "
         default
           return "Unknown Error in Tax.setPST(). Contact Supplier Group 11"
end (* Tax.setPST() *)


Tax.getPST()
Description:
This function is an accessor function that returns the current PST tax rate. This function is called by the Gas Pump Interface when calculating the Tax Total and Transaction Total fields for a Transaction.
Input: None.
Output: A real indicating the current PST tax rate.

Error Conditions :
1. Success - System successfully returned the current PST tax rate to the Gas Pump Interface.
2. Syntactic Error - The call to the module was syntactically incorrect.
3. Database Error - (I/O) An error ocurred while accessing the tax database.
                                   - Database is offline
                                   - Write error occured
                                   - Could not close database after Tax.getPST() operation.

Modules Called : NONE

Descrption :

if not(Syntactic Error)
    then if not(Database Error)
        then return PST (* Success *)
    else case of (* Else a Database Error Ocurred *)
             :(Offline)
               return "System Configuration Database offline in Tax.getPST()."
             :(IO)
               return "Read Error ocurred while reading PST in Tax.getPST()."
             :(General_Access_Error)
               return "Could not finish write operation when writting PST to System                        Configuration Database in Tax.getPST(). Contact Supplier Group 11"
             default
               return "Unknown Error in Tax.getPST(). Contact Supplier Group 11"
else case of (* Else a Syntactic Eror Ocurred *)
         default
           return "Unknown Error in Tax.getPST(). Contact Supplier Group 11"
end (* Tax.getPST() *)


Fuel Module


Fuel.addFuel()
Description:
This function is used when a new type of Fuel is added to the system. It creates a new type of Fuel in the Fuel Database and allows the Automated Gas Station to start tracking the Price per Litre of the new type of Fuel. This function is called by the Remote Operations Interface, by a User with the appropriate Access Level.
Input: An emunerated type integer indicating the Fuel Type, and a real indicating the Price per Litre.
Output: A boolean indicating success or failure to add a new type of Fuel.

Error Conditions:

  1. Success -- System successfully adds a new Fuel Type
  2. Syntactical Errors: Data passed to the module is corrupt or invalid
  3. Database Errors:
    -- Fuel Type exists
    -- Database is off-line
    -- Write error occured
    -- Could not close database after module completed.

Modules Used: None

Description:

BEGIN

if (syntactical error) then
     mesg(#Fuel_SyntaxError)
     return (#ERROR)
end if

OPEN RecordSet (Fuel)

LOCK database 

[Fuel].APPEND(CurrentRecord)

RELEASE LOCK

if #ERROR then
     case (exists fuel)
          mesg(#FuelTypeExists_DatabaseError)
     case (database offline)
          mesg(#DatabaseOffline_DatabaseError)
          return(#ERROR)
     case (write error)
          mesg(#WriteError_DatabaseError)
          return(#ERROR)
     case (close error)
          mesg(#CloseError_DatabaseError)
          return(#ERROR)

return (#OK)

END     


Fuel.deleteFuel()
Description:
This function is used when a type of Fuel is removed from the system. It removes the type of Fuel from the Fuel Database. This function is called by the Remote Operations Interface, by a User with the appropriate Access Level.
Input: An enumerated type indicating the Fuel Type.
Output: A boolean indicating success or failure to remove the type of Fuel.

Error Conditions :

1. Success - System successfully removed  fuel type.
2. Syntactic Error - Some information passed to Fuel.deleteFuel() was corrupt.
          * The fuel type parameter specified was not a valid fuel type.
          * The fuel type parameter specified was not an enumerated type.
          * There was no parameter passed to Fuel.deleteFuel().
3. Database Error - (I/O) An error ocurred while accessing the Fuel Database .
          * Fuel Database is offline.
          * Write error occured while trying to delete the Fuel Type..
          * Could not close database after Fuel.deleteFuel()operation.

Modules Used :

NONE

Description :

if not(Syntactic Error)
    then if not(Database Error)
        then case of (* Success = TRUE *)
                 
:(fuel type = "Regular")
                   Delete Regular.fuel
                 :(fuel type = "Mid-Grade")
                   Delete Mid-Grade.fuel
                 :(fuel type = "Premium")
                   Delete Premium.fuel
                 :(fuel type = "Diesel") 
                   Delete Diesel.fuel
             
return TRUE    
    else case of (* Else a Database Error Ocurred *)
             :(Offline)
               error "Fuel Database offline in Fuel.setFuelPrice() ."
             :(IO)
               error "Write Error ocurred while writting New.fuel price per litre in                        Fuel.deleteFuel()."
             :(General_Access_Error)
               error "Could not finish delete operation when removing Fuel Type from                       Fuel Database in  Fuel.deleteFuel(). Contact Supplier Group 11"
             default
               error "Unknown Error in Fuel.deleteFuel().Contact Supplier Group                       11"
          return FALSE
else case of (* Else a Syntactic Eror Ocurred *)
         :(fuel type = NULL)
           error "NULL value passed to Fuel.deleteFuel(). "
         :(fuel type not_of_type("Regular" | "Mid Grade" | "Premium" | "Diesel")
          error "fuel type not of specified enumerated value.")
         default
           error "Unknown Error in Fuel.deleteFuel(). Contact Supplier Group 11"
      return FALSE
end (* Fuel.deleteFuel() *)


Fuel.setFuelPrice()
Description:
This function allows the Price per Litre to be set for a specific type of Fuel. It updates the Fuel Database with the new Price per Litre. This function is called by the Remote Operations Interface, by a User with the Appropriate Access Level.
Input: An enumerated type indicating the Fuel Type, and a real indicating the new Price per Litre.
Output: A boolean indicating success or failure of setting the Price per Litre of the type of Fuel.

Error Conditions :

1. Success - System successfully set the new  fuel price per litre.
2. Syntactic Error - Some information passed to Fuel.setFuelPrice() was corrupt.
          * The fuel price per litre parameter was not of the REAL datatype specified.
          * The fuel type parameter specified was not a valid fuel type.
          * The fuel type parameter specified was not an enumerated type.
          * There was no parameter passed to Fuel.setFuelPrice().
3. Database Error - (I/O) An error ocurred while accessing the Fuel Database .
          * Fuel Database is offline.
          * Write error occured while trying to set the new fuel price.
          * Could not close database after Fuel.setFuelPrice() operation.

Modules Used :

NONE

Description :

if not(Syntactic Error)
    then if not(Database Error)
        then case of (* Success = TRUE *)
                 
:(fuel type = "Regular")
                   Regular.fuel price per litre = New.fuel price per litre
                 :(fuel type = "Mid-Grade")
                   Mid-Grade.fuel price per litre = New.fuel price per litre
                 :(fuel type = "Premium")
                   Premium.fuel price per litre = New.fuel price per litre
                 :(fuel type = "Diesel") 
                   Diesel.fuel price per litre = New.fuel price per litre
             
return TRUE    
    else case of (* Else a Database Error Ocurred *)
             :(Offline)
               error "Fuel Database offline in Fuel.setFuelPrice() ."
             :(IO)
               error "Write Error ocurred while writting New.fuel price per litre in                        Fuel.setFuelPrice()."
             :(General_Access_Error)
               error "Could not finish write operation when writting New.fuel price                       per litre to Fuel Database in                       Fuel.setFuelPrice(). Contact Supplier Group 11"
             default
               error "Unknown Error in Fuel.setFuelPrice().Contact Supplier Group                       11"
          return FALSE
else case of (* Else a Syntactic Eror Ocurred *)
         :(fuel price per litre not_of_type(REAL))
           error "Invalid fuel price per litre type passed to Fuel.setFuelPrice()."
         :((fuel price per litre = NULL) || (fuel type = NULL))
           error "NULL value passed to Fuel.setFuelPrice(). "
         :(fuel type not_of_type("Regular" | "Mid Grade" | "Premium" | "Diesel")
          error "fuel type not of specified enumerated value.")
         default
           error "Unknown Error in Fuel.setFuelPrice(). Contact Supplier Group 11"
      return FALSE
end (* Fuel.setFuelPrice()*)


Fuel.getFuelPrice()
Description:
This function allows access to the Price per Litre for a specific type of Fuel. It returns the current Price per Litre from the Fuel Database. This function is called by the Pump Interface, when calculating the Tax Total and Transaction Total fields for a Transaction.
Input: An enumerated type indicating the Fuel Type.
Output: A real indicating the current Price per Litre of the Fuel Type.

Error Conditions :
1. Success - System successfully returned current fuel price per litre for a specific type of fuel.
2. Syntactic Error - The call to the module was syntactically incorrect.
           * The fuel type parameter specified was not a valid fuel type.
           * The fuel type parameter specified was not an enumerated type.
           * There was no parameter passed to Fuel.getFuelPrice().
3. Database Error - (I/O) An error ocurred while accessing the Fuel Database .
           * Fuel Database is offline.
           * Write error occured while trying to delete the Fuel Type..
           * Could not close database after Fuel.getFuelPrice()operation.

Descrption :

if not(Syntactic Error)
    then if not(Database Error)
        then case of fuel type (* Success = TRUE *)
                 
:(fuel type = "Regular")
                   return Regular.fuel price per litre
                 :(fuel type = "Mid-Grade")
                   return Mid-Grade.fuel price per litre
                 :(fuel type = "Premium")
                   return Premium.fuel price per litre
                 :(fuel type = "Diesel") 
                   return Diesel.fuel price per litre
    else case of (* Else a Database Error Ocurred *)
             :(Offline)
               error "Fuel Database offline in Fuel.getFuelPrice() ."
             :(IO)
               error "Read Error ocurred while writting New.fuel price per litre in                        Fuel.getFuelPrice()."
             :(General_Access_Error)
               error "Could not finish read operation when reading fuel price per litre from
                       Fuel Database
in Fuel.getFuelPrice(). Contact Supplier Group 11"
             default
               error "Unknown Error in Fuel.getFuelPrice().Contact Supplier Group 11"
else case of (* Else a Syntactic Eror Ocurred *)
         :(fuel type not_of_type("Regular" | "Mid Grade" | "Premium" | "Diesel")
          error "fuel type not of specified enumerated value.")
         default
           error "Unknown Error in Fuel.getFuelPrice(). Contact Supplier Group 11"
end (* Fuel.getFuelPrice()*)


Pump Module


Pump.addPump()
Description:
This function is used when a new Pump is added to the system after a new Pump has been installed or a Pump has been down for repairs. It creates a Pump in the Pump Database and allows the Automated Gas Station to start accepting Transactions from the Pump. This function is called by the Remote Operations Interface, by a User with the appropriate Access Level.
Input: An enumerated type indicating the Pump Status.
Output: A boolean indicating success or failure to add a new Pump

BEGIN

if (syntactical error) then
     mesg(#Pump_SyntaxError)
     return (#ERROR)
end if

OPEN RecordSet (Pump)

LOCK database 

[Pump].APPEND(CurrentRecord)

RELEASE LOCK

if #ERROR then
     case (database offline)
          mesg(#DatabaseOffline_DatabaseError)
          return(#ERROR)
     case (write error)
          mesg(#WriteError_DatabaseError)
          return(#ERROR)
     case (close error)
          mesg(#CloseError_DatabaseError)
          return(#ERROR)

return (#OK)

END     


Pump.deletePump()
Description:
This function is used when a Pump is removed from the system for removal or repairs. It removes the Pump from the Pump Database. This function is called by the Remote Operations Interface, by a User with the appropriate Access Level.
Input: An unsigned integer indicating the Pump Number.
Output: A boolean indicating success or failure to remove the Pump.

Error Conditions :

1. Success - System successfully removed the Pump .
2. Syntactic Error - Some information passed to Pump.deletePump() was corrupt.
          * The pump number parameter specified was not an unsigned integer.
          * The pump number specified was of correct type but the pump number referred to does not exist.
          * There was no parameter passed to Pump.deletePump().
3. Database Error - (I/O) An error ocurred while accessing the Pump Database .
          * Pump Database is offline.
          * Write error occured while trying to remove the Pump.
          * Could not close database after Pump.deletePump() operation.

Modules Used :

NONE

Description :

if not(Syntactic Error)
    then if not(Database Error)
        then delete Pump
             
return TRUE    
    else case of (* Else a Database Error Ocurred *)
             :(Offline)
               error "Pump Database offline in Pump.deletePump()."
             :(IO)
               error "Write Error ocurred while deleting the Pump in                        Pump.deletePump()."
             :(General_Access_Error)
               error "Could not finish write operation when deleting the Pump                       from Pump Database in Pump.deletePump(). Contact                       Supplier Group 11"
             default
               error "Unknown Error in Pump.deletePump().Contact Supplier Group 11"
          return FALSE
else case of (* Else a Syntactic Eror Ocurred *)
         :(pump number not_of_type(UNSIGNED INTEGER))
           error "Invalid pump number type passed to Pump.deletePump()."
         :((pump number = NULL) || (Pump Status = NULL))
           error "NULL value passed to Pump.deletePump(). "
         :(pump number > Number_of_Pumps )
           error "pump number specified does not exist!"
         default
           error "Unknown Error in Pump.deletePump(). Contact Supplier Group 11"
      return FALSE
end (* Pump.deletePump()*)


Pump.setPumpStatus()
Description:
This function allows the Pump Status to be set for a specific Pump to allow the Pump to be turned on or off. It updates the Pump Database with the new Pump Status. This function is called by the Remote Operations Interface, by a User with the Appropriate Access Level.
Input: An unsigned integer indicating the Pump Number, and an enumerated type indicating the new Pump Status.
Output: A boolean indicating success or failure of setting the Pump Status.

Error Conditions :

1. Success - System successfully set the new  Pump Status.
2. Syntactic Error - Some information passed to Pump.setPumpStatus() was corrupt.
          * The Pump Status parameter was not of the enumeratd datatype specified [ "On" | "Off" ].
          * The pump number parameter specified was not an unsigned integer.
          * The pump number specified was of correct type but the pump number referred to does not exist.
          * There was no parameter passed to Pump.setPumpStatus().
3. Database Error - (I/O) An error ocurred while accessing the Pump Database.
          * Pump Database is offline.
          * Write error occured while trying to set the new Pump Status.
          * Could not close database after Pump.setPumpStatus() operation.

Modules Used :

NONE

Description :

if not(Syntactic Error)
    then if not(Database Error)
        then PumpNumber.Status = New.PumpStatus
             
return TRUE    
    else case of (* Else a Database Error Ocurred *)
             :(Offline)
               error "Pump Database offline in Pump.setPumpStatus()."
             :(IO)
               error "Write Error ocurred while writting New.PumpStatus in                        Pump.setPumpStatus()."
             :(General_Access_Error)
               error "Could not finish write operation when writting New.PumpStatus to                       Pump Database in Pump.setPumpStatus(). Contact                       Supplier Group 11"
             default
               error "Unknown Error in Pump.setPumpStatus().Contact Supplier Group 11"
          return FALSE
else case of (* Else a Syntactic Eror Ocurred *)
         :(pump number not_of_type(UNSIGNED INTEGER))
           error "Invalid pump number type passed to Fuel.setFuelPrice()."
         :((pump number = NULL) || (Pump Status = NULL))
           error "NULL value passed to Fuel.setFuelPrice(). "
         :(pump number > Number_of_Pumps )
           error "pump number specified does not exist!"
         :(Pump Status not_of_type("ON" | "OFF"))
          error" Pump Status not of specified enumerated value."
         default
           error "Unknown Error in Pump.setPumpStatus(). Contact Supplier Group 11"
      return FALSE
end (* Pump.setPumpStatus()*)


Pump.getPumpStatus()
Description:
This function allows access to the Pump Status for a specific Pump. It returns the current Pump Status from the Pump Database. This function is called by the Pump Interface, when checking whether the Pump should be on or off, and by the Remote Operations Interface, by a User with the appropriate Access Level.
Input: An unsigned integer indicating the Pump Number.
Output: An enumerated type indicating the current Pump Status of the Pump.

Error Conditions :

1. Success - System successfully return the current  Pump Status.
2. Syntactic Error - Some information passed to Pump.getPumpStatus() was corrupt.
          * The pump number parameter specified was not an unsigned integer.
          * The pump number specified was of correct type but the pump number referred to does not exist.
          * There was no parameter passed to Pump.setPumpStatus().
3. Database Error - (I/O) An error ocurred while accessing the Pump Database.
          * Pump Database is offline.
          * Write error occured while trying to read the current Pump Status.
          * Could not open/close database after Pump.getPumpStatus() operation.

Modules Used :

NONE

Description :

if not(Syntactic Error)
    then if not(Database Error)
        then return PumpNumber.Status
    else case of (* Else a Database Error Ocurred *)
             :(Offline)
               error "Pump Database offline in Pump.getPumpStatus()."
             :(IO)
               error "Read Error ocurred while reading PumpStatus in                        Pump.getPumpStatus()."
             :(General_Access_Error)
               error "Could not finish read operation when reading PumpStatus from
                      Pump Database in Pump.getPumpStatus(). Contact Supplier Group 11"
             default
               error "Unknown Error in Pump.getPumpStatus().Contact Supplier Group 11"
else case of (* Else a Syntactic Eror Ocurred *)
         :(pump number not_of_type(UNSIGNED INTEGER))
           error "Invalid pump number type passed to Pump.getPumpStatus()."
         :((pump number = NULL) || (Pump Status = NULL))
           error "NULL value passed to Pump.getPumpStatus(). "
         :(pump number > Number_of_Pumps )
           error "pump number specified does not exist!"
         default
           error "Unknown Error in Pump.getPumpStatus(). Contact Supplier Group 11"
end (* Pump.getPumpStatus()*)


Tank Module


Tank.addTank()
Description:
This function is used when a new Tank is added to the system after a new Tank has been installed or a Tank has been down for repairs. It creates a Tank in the Tank Database and allows the Automated Gas Station to start tracking the status of the new Tank. This function is called by the Remote Operations Interface, by a User with the appropriate Access Level.
Input: An enumerated type indicating the fuel type for the Tank, an enumerated type indicating the current status of the Tank, and a real indicating the amount of fuel currently in the Tank.
Output: A boolean indicating success or failure to add a new Tank.

BEGIN

if (syntactical error) then
     mesg(#Tank_SyntaxError)
     return (#ERROR)
end if

OPEN RecordSet (Tank)

LOCK database 

[Tank].APPEND(CurrentRecord)

RELEASE LOCK

if #ERROR then
     case (database offline)
          mesg(#DatabaseOffline_DatabaseError)
          return(#ERROR)
     case (write error)
          mesg(#WriteError_DatabaseError)
          return(#ERROR)
     case (close error)
          mesg(#CloseError_DatabaseError)
          return(#ERROR)

return (#OK)

END    


Tank.deleteTank()
Description:
This function is used when a Tank is removed from the system for removal or repairs. It removes the Tank from the Tank Database. This function is called by the Remote Operations Interface, by a User with the appropriate Access Level.
Input: An unsigned integer indicating the TankNumber.
Output: A boolean indicating success or failure to remove the Tank.

Error Conditions :

1. Success - System successfully removed the Tank .
2. Syntactic Error - Some information passed to Tank.deleteTank() was corrupt.
          * The TankNumber parameter specified was not an unsigned integer.
          * The TankNumber specified was of correct type but the TankNumber referred to does not exist.
          * There was no parameter passed to Tank.deleteTank().
3. Database Error - (I/O) An error ocurred while accessing the Tank Database.
          * Tank Database is offline.
          * Write error occured while trying to remove the Tank .
          * Could not close database after Tank.deleteTank() operation.

Modules Used :

NONE

Description :

if not(Syntactic Error)
    then if not(Database Error)
        then delete Tank
             
return TRUE    
    else case of (* Else a Database Error Ocurred *)
             :(Offline)
               error "Tank Database offline in Tank.deleteTank()."
             :(IO)
               error "Write Error ocurred while deleting the Pump in                        Tank.deleteTank()."
             :(General_Access_Error)
               error "Could not finish write operation when deleting the Tank                       from the Tank Database in Tank.deleteTank(). Contact                       Supplier Group 11"
             default
               error "Unknown Error in Tank.deleteTank().Contact Supplier Group 11"
          return FALSE
else case of (* Else a Syntactic Eror Ocurred *)
         :(Tank number not_of_type(UNSIGNED INTEGER))
           error "Invalid Tank number type passed to Tank.deleteTank()."
         :(Tank number = NULL)
           error "NULL value passed to Tank.deleteTank(). "
         :(Tank number > Number_of_Tanks )
           error "Tank number specified does not exist!"
         default
           error "Unknown Error in Tank.deleteTank(). Contact Supplier Group 11"
      return FALSE
end (* Tank.deleteTank() *)


Tank.getTankStatus()
Description:
This function allows access to the Tank Status for a specific Tank. It returns the current Tank Status from the Tank Database which is updated via a sensor inside the Tank. This function is called by the Pump Interface, when checking whether their is Fuel in a specific Tank, and by the Remote Operations Interface, by a User with the appropriate Access Level.
Input: An unsigned integer indicating the TankNumber.
Output: An enumerated type indicating the current Tank Status of the Tank.

Error Conditions :

1. Success - System successfully return the current  Tank Status.
2. Syntactic Error - Some information passed to Tank.getTankStatus() was corrupt.
          * The tank number parameter specified was not an unsigned integer.
          * The tank number specified was of correct type but the tank number referred to does not exist.
          * There was no parameter passed to Tank.getTankStatus().
3. Database Error - (I/O) An error ocurred while accessing the Tank Database.
          * Tank Database is offline.
          * Write error occured while trying to read the current Tank Status.
          * Could not open/close database after Tank.getTankStatus() operation.

Modules Used :

NONE

Description :

if not(Syntactic Error)
    then if not(Database Error)
        then return TankNumber.Status
    else case of (* Else a Database Error Ocurred *)
             :(Offline)
               error "Tank Database offline in Tank.getTankStatus()."
             :(IO)
               error "Read Error ocurred while reading TankStatus in                        Tank.getTankStatus()."
             :(General_Access_Error)
               error "Could not finish read operation when reading TankStatus from
                      Tank Database in Tank.getTankStatus(). Contact Supplier Group 11"
             default
               error "Unknown Error in Tank.getTankStatus().Contact Supplier Group 11"
else case of (* Else a Syntactic Eror Ocurred *)
         :(Tank number not_of_type(UNSIGNED INTEGER))
           error "Invalid tank number type passed to Tank.getTankStatus()."
         :((Tank number = NULL) || (Tank Status = NULL))
           error "NULL value passed to Tank.getTankStatus(). "
         :(Tank number > Number_of_Tanks )
           error "tank number specified does not exist!"
         default
           error "Unknown Error in Tank.getTankStatus(). Contact Supplier Group 11"
end (* Tank.getTankStatus()*)


Login Module


Login.addLogin()
Description:
This function is used when a new Login account is added to the system. It creates a Login account in the Login Database and allows a user to log into the new account via the Remote Operations Interface. This function is called by the Remote Operations Interface, by a User with the appropriate Access Level.
Input: None.
Output: A boolean indicating success or failure to add a new Login.

BEGIN

if (syntactical error) then
     mesg(#Login_SyntaxError)
     return (#ERROR)
end if

OPEN RecordSet (Login)

LOCK database 

[Login].APPEND(CurrentRecord)

RELEASE LOCK

if #ERROR then
     case (database offline)
          mesg(#DatabaseOffline_DatabaseError)
          return(#ERROR)
     case (write error)
          mesg(#WriteError_DatabaseError)
          return(#ERROR)
     case (close error)
          mesg(#CloseError_DatabaseError)
          return(#ERROR)

return (#OK)

END    


Login.deleteLogin()
Description:
This function is used when a Login account is removed from the system. It removes the Login account from the Login Database. This function is called by the Remote Operations Interface, by a User with the appropriate Access Level.
Input: A string indicating the User of the Login account.
Output: A boolean indicating success or failure to remove the Login.

Error Conditions :

1. Success - System successfully removed the User.
2. Syntactic Error - Some information passed to Login.deleteLogin() was corrupt.
          * The User parameter specified was not of the type STRING.
          * The User parameter was greater than 8 characters.
          * There was no parameter passed to Login.deleteLogin().
3. Database Error - (I/O) An error ocurred while accessing the Login Database.
          * Login Database is offline.
          * Write error occured while trying to remove the User.
          * Could not close database after Login.deleteLogin() operation.

Modules Used :

NONE

Description :

if not(Syntactic Error)
    then if not(Database Error)
        then delete User
             
return TRUE    
    else case of (* Else a Database Error Ocurred *)
             :(Offline)
               error "Login Database offline in Login.deleteLogin()."
             :(IO)
               error "Write Error ocurred while deleting User in                        Login.deleteLogin()."
             :(General_Access_Error)
               error "Could not finish write operation when deleting User from Login                       Database in Login.deleteLogin(). Contact Supplier Group 11"
             default
               error "Unknown Error in Login.deleteLogin().Contact Supplier Group                       11"
          return FALSE
else case of (* Else a Syntactic Eror Ocurred *)
         :(User not_of_type(STRING))
           error "Invalid User type passed to Login.deleteLogin()."
         :(User = NULL)
           error "NULL value passed to Login.deleteLogin(). "
         :(Lengh(User) > 8)
           error "User Length must be 8 characters or less!"
         default
           error "Unknown Error in Login.deleteLogin().Contact Supplier Group 11"       return FALSE
end (* Login.deleteLogin() *)


Login.setLoginPassword()
Description:
This function allows the Password for a specific Login account to be set. It updates the Login Database with the new Password. This function is called by the Remote Operations Interface, by a User with the Appropriate Access Level.
Input: A string indicating the User of the Login account, and string for the password of the user.
Output: A boolean indicating success or failure of setting the Password of a User's Login account.

Error Conditions :

1. Success - System successfully set the new  Password for User.
2. Syntactic Error - Some information passed to Login.setLoginPassword() was corrupt.
          * The Password parameter was not of the type STRING.
          * The User parameter specified was not of the type STRING.
          * The User parameter was greater than 8 characters.
          * The Password parameter was less 4 characters.
          * The Password parameter was greater than 8 characters.
          * There was no parameter passed to Login.setLoginPassword() .
3. Database Error - (I/O) An error ocurred while accessing the Login Database.
          * Login Database is offline.
          * Write error occured while trying to set the new  Password .
          * Could not close database after Login.setLoginPassword() operation.

Modules Used :

NONE

Description :

if not(Syntactic Error)
    then if not(Database Error)
        then User.Password = New.Password
             
return TRUE    
    else case of (* Else a Database Error Ocurred *)
             :(Offline)
               error "Login Database offline in Login.setLoginPassword()."
             :(IO)
               error "Write Error ocurred while writting New.Password in                        Login.setLoginPassword()."
             :(General_Access_Error)
               error "Could not finish write operation when writting New.Password to                       Login Database in Login.setLoginPassword(). Contact                       Supplier Group 11"
             default
               error "Unknown Error in Login.setLoginPassword().Contact Supplier Group                       11"
          return FALSE
else case of (* Else a Syntactic Eror Ocurred *)
         :((Password not_of_type(STRING)) || (User not_of_type(STRING))
           error "Invalid Password or User type passed to Login.setLoginPassword()."
         :((Password = NULL) || (User = NULL))
           error "NULL value passed to Login.setLoginPassword(). "
         :(Lengh(User) > 8)
           error "User Length must be 8 characters or less!"
         :((Length(Password) < 4) || (Length(Password) > 8))
           error "Password length must be 4 - 8 characters in length."
         default
           error "Unknown Error in Login.setLoginPassword().Contact Supplier Group 11"       return FALSE
end (* Login.setLoginPassword()*)


Login.getLoginPassword()
Description:
This function allows access to the Password for a specific Login account. It returns the current Password from the Login Database. This function is called by the Remote Operations Interface when a user attempts to log into the system.
Input: A string indicating the User of the Login account.
Output: A string indicating the Password that corresponds to the User's Login account.

Error Conditions :

1. Success - System successfully returned Password for User.
2. Syntactic Error - Some information passed to Login.getLoginPassword() was corrupt.
          * The User parameter specified was not of the type STRING.
          * The User parameter was greater than 8 characters.
          * There was no parameter passed to Login.setLoginPassword() .
3. Database Error - (I/O) An error ocurred while accessing the Login Database.
          * Login Database is offline.
          * Read error occured while trying to read the Password .
          * Could not open/close database after Login.getLoginPassword() operation.

Modules Used :

NONE

Description :

if not(Syntactic Error)
    then if not(Database Error)
        then return User.Password
    else case of (* Else a Database Error Ocurred *)
             :(Offline)
               error "Login Database offline in Login.getLoginPassword()."
             :(IO)
               error "Read Error ocurred while reading User.Password in                        Login.getLoginPassword()."
             :(General_Access_Error)
               error "Could not finish read operation when reading User.Password                        from Login Database in Login.getLoginPassword(). Contact Supplier Group 11"
             default
               error "Unknown Error in Login.getLoginPassword().Contact Supplier Group 11"
else case of (* Else a Syntactic Eror Ocurred *)
         :(User = NULL)
           error "NULL value passed to Login.getLoginPassword(). "
         :(Lengh(User) > 8)
           error "User Length must be 8 characters or less!"
         default
           error "Unknown Error in Login.getLoginPassword().Contact Supplier Group 11"
end (* Login.getLoginPassword()*)


Login.setLoginAccess()
Description:
This function allows the Access Level for a specific Login account to be set. It updates the Login Database with the new Access Level. This function is called by the Remote Operations Interface, by a User with the Appropriate Access Level.
Input: A string indicating the User of the Login account, and the new login access level.
Output: A boolean indicating success or failure of setting the Access level for the user specified.

Error Conditions :

1. Success - System successfully set the new  Password for User.
2. Syntactic Error - Some information passed to Login.setLoginAccess() was corrupt.
          * The User parameter specified was not of the type STRING.
          * The User parameter was greater than 8 characters.
          * The AccessLevel was not of specified the enumerated type. [ "Level 0" | " Level 1"]
          * There was no parameter passed to Login.setLoginAccess().
3. Database Error - (I/O) An error ocurred while accessing the Login Database.
          * Login Database is offline.
          * Write error occured while trying to set the new  AccessLevel .
          * Could not close database after Login.setLoginAccess() operation.

Modules Used :

NONE

Description :

if not(Syntactic Error)
    then if not(Database Error)
        then User.AccessLevel = New.AccessLevel
             
return TRUE    
    else case of (* Else a Database Error Ocurred *)
             :(Offline)
               error "Login Database offline in Login.setLoginAccess()."
             :(IO)
               error "Write Error ocurred while writting New.AccessLevel in                        Login.setLoginAccess()."
             :(General_Access_Error)
               error "Could not finish write operation when writting New.AccessLevel                to Login Database in Login.setLoginAccess(). Contact                Supplier Group 11"
             default
               error "Unknown Error in Login.setLoginAccess().Contact Supplier Group                       11"
          return FALSE
else case of (* Else a Syntactic Eror Ocurred *)
         :((AccessLevel not_of_type(ENUMERATED)) || (User not_of_type(STRING))
           error "Invalid AccessLevel or User type passed to Login.setLoginAccess()."
         :((AccessLevel = NULL) || (User = NULL))
           error "NULL value passed to Login.setLoginAccess(). "
         :(Lengh(User) > 8)
           error "User Length must be 8 characters or less!"
         :(AccessLevel not_of_(
[ "Level 0" | " Level 1"]))
           error "Invalid AccessLevel in Login.setLoginAccess()."
         default
           error "Unknown Error in Login.setLoginAccess().Contact Supplier Group 11"       return FALSE
end (* Login.setLoginAccess()*)


Login.getLoginAccess()
Description:
This function allows access to the Access Level for a specific Login account. It returns the current Access Level from the Login Database. This function is called by the Remote Operations Interface when a user attempts to log into the system.
Input: A string indicating the User of the Login account.
Output: A string indicating the Access Level that corresponds to the User's Login account.

Error Conditions :

1. Success - System successfully returned Access level for User.
2. Syntactic Error - Some information passed to Login.getLoginAccess() was corrupt.
          * The User parameter specified was not of the type STRING.
          * The User parameter was greater than 8 characters.
          * There was no parameter passed to Login.getLoginAccess() .
3. Database Error - (I/O) An error ocurred while accessing the Login Database.
          * Login Database is offline.
          * Read error occured while trying to read the Access level .
          * Could not open/close database after Login.getLoginAccess() operation.

Modules Used :

NONE

Description :

if not(Syntactic Error)
    then if not(Database Error)
        then return User.AccessLevel
    else case of (* Else a Database Error Ocurred *)
             :(Offline)
               error "Login Database offline in Login.
getLoginAccess()."
             :(IO)
               error "Read Error ocurred while reading User.AccessLevel in                        Login.
getLoginAccess()."
             :(General_Access_Error)
               error "Could not finish read operation when reading User.AccessLevel                        from Login Database in Login.
getLoginAccess(). Contact Supplier Group 11"
             default
               error "Unknown Error in Login.
getLoginAccess().Contact Supplier Group 11"
else case of (* Else a Syntactic Eror Ocurred *)
         :(User = NULL)
           error "NULL value passed to Login.
getLoginAccess(). "
         :(Lengh(User) > 8)
           error "User Length must be 8 characters or less!"
         default
           error "Unknown Error in Login.
getLoginAccess().Contact Supplier Group 11"
end (* Login.
getLoginAccess()*)


Statistics Module


Statistics.Report()
Description:
This is the only function in the Statistics module. This function generates a report on all the Automated Gas Station Statistics. This includes:

Input: None.
Output: A formatted report of all the Fuels, Pumps, Tank, and Tax settings of the Automated Gas Station.

Error Conditions:

  1. Success -- System successfully generates the Statistics report.
  2. Syntactical Errors: Data passed to the module is corrupt
  3. Database Errors:
    -- Database is off-line
    -- Write error occured
    -- Could not close database after module completed.

Modules Used: None

Description:

BEGIN

if (syntactical error) then
     mesg(#StatisticsReport_SyntaxError)
     return (#RESEND)
end if

OPEN RecordSet (Fuel, Tank, Pump, Tax)

LOCK database 

print HEADER

while (not END_OF_RECORDS) do
     print CURRENT_RECORD from Fuel
     if ERROR then
          set #ERROR
          break
     end if
end while

print HEADER

while (not END_OF_RECORDS) do
     print CURRENT_RECORD from Tank
     if ERROR then
          set #ERROR
          break
     end if
end while

print HEADER

while (not END_OF_RECORDS) do
     print CURRENT_RECORD from Pump
     if ERROR then
          set #ERROR
          break
     end if
end while

print HEADER

while (not END_OF_RECORDS) do
     print CURRENT_RECORD from Tax
     if ERROR then
          set #ERROR
          break
     end if
end while

RELEASE LOCK

if #ERROR then
     case (database offline)
          mesg(#DatabaseOffline_DatabaseError)
          return(#RESEND)
     case (write error)
          mesg(#WriteError_DatabaseError)
          return(#RESEND)
     case (close error)
          mesg(#CloseError_DatabaseError)
          return(#RESEND)

return (#OK)

END 


Report Module


Report.addReport()
Description:
This function is used when a new Report time is added to the system. It creates a Report time entry in the Report Database and allows reports to be generated at specific times. This function is called by the Remote Operations Interface, by a User with the appropriate Access Level.
Input: Adate/time indicating the Report Date, and an enumerated type indicating the report Type.
Output: A boolean indicating success or failure to add a new Login.

BEGIN

if (syntactical error) then
     mesg(#Report_SyntaxError)
     return (#ERROR)
end if

OPEN RecordSet (Report)

LOCK database 

[Report].APPEND(CurrentRecord)

RELEASE LOCK

if #ERROR then
     case (database offline)
          mesg(#DatabaseOffline_DatabaseError)
          return(#ERROR)
     case (write error)
          mesg(#WriteError_DatabaseError)
          return(#ERROR)
     case (close error)
          mesg(#CloseError_DatabaseError)
          return(#ERROR)

return (#OK)

END    


Report.deleteReport()
Description:
This function is used when a Report time is removed from the system. It removes the Report time from the Report Database. This function is called by the Remote Operations Interface, by a User with the appropriate Access Level.
Input: A date/time indicating the Report Date.
Output: A boolean indicating success or failure of removing the report time.

Error Conditions :

1. Success - System successfully removed the Report Date/Time.
2. Syntactic Error - Some information passed to Report.deleteReport() was corrupt.
          * The Report Date parameter specified was not of the type DATE/TIME.
          * There was no parameter passed to Report.deleteReport().
3. Database Error - (I/O) An error ocurred while accessing the Report Database.
          * Report Database is offline.
          * Write error occured while trying to remove the User.
          * Could not close Report Database after Report.deleteReport() operation.

Modules Used :

NONE

Description :

if not(Syntactic Error)
    then if not(Database Error)
        then delete Report Date
             
return TRUE    
    else case of (* Else a Database Error Ocurred *)
             :(Offline)
               error "Report Database offline in Report.deleteReport()."
             :(IO)
               error "Write Error ocurred while deleting Report Date in                        Report.deleteReport()."
             :(General_Access_Error)
               error "Could not finish write operation when deleting Report Date from                       Report Database in Report.deleteReport(). Contact Supplier Group                       11"
             default
               error "Unknown Error in Report.deleteReport().Contact Supplier Group                       11"
          return FALSE
else case of (* Else a Syntactic Eror Ocurred *)
         :( Report Date not_of_type(DATE/TIME))
           error "Invalid User type passed to Report.deleteReport()."
         :(Report Date = NULL)
           error "NULL value passed to Report.deleteReport(). "
         default
           error "Unknown Error in Report.deleteReport().Contact Supplier Group 11"       return FALSE
end (* Report.deleteReport()*)


Batch Processing System

Following is the speciication for the Batch Processing System. This system is completly self contained and performs all taks without user-input. Configuration of this system is done through the Remote Operations Interface


Data Flow Diagram

The DFD for the Batch Processing System is very simple. It consists of only two processes. The first process (1.1) continually checks the Reports database to see if it is time to generate a report. If it is it sends the Report information to the second process (1.2) which gathers to appropriate information, generates the report, and sends it to the Head Office.

Batch Processing System DFD


Process Specifications

These Process Specifications correspond with the above DFD for the Batch Processing System.


1.1 SendReport()
Description:
This function is continually polled once every minute. It checks to see if it is time for the Batch Processing System to send out a report.
Input: Transactions
Output: A boolean indicating it has sent a report

Error Conditions:

  1. Success -- System successfully generates the Transactions report.
  2. Database :
    -- Database is off-line
    -- Write error occured
    -- Could not close database after module completed.

Modules Used: Generate Report()

Description:

BEGIN

ON_TIMER _EVENT DO:

SWITCH
     case(timer.transaction = TRUE)
          GenerateReport(Transactions)
     case(timer.delivery = TRUE)
          GenerateReport(Deliveries)   
     case(timer.rejected = TRUE)
          GenerateReport(Rejected Credit Cards)
     case(timer.statistics = TRUE)
          GenerateReport(Statistics)
     case(timer.login = TRUE)
          GenerateReport(Logins)
     case(timer.report = TRUE)
          GenerateReport(Report)
END SWITCH

END   


1.2 GenerateReport()
Description:
This is the function that is called if SendReport() returned TRUE. It generates the appropriate report and sends it to the Head Office.
Input: The Report Tye to be generated.
Output: A boolean indicating success or failure to send the report to Head Office.

Error Conditions:

  1. Success -- System successfully generates the Transactions report.
  2. Syntactical Errors: Data passed to the module is corrupt
    -- Database is off-line
    -- Write error occured
    -- Could not close database after module completed.

Modules Used: None

Description:

BEGIN

SWITCH
     case(Transactions)
          Transaction.Report()
           SEND
     case(Deliveries)
          Delivery.Report()
          SEND
     case(Rejected Credit Card)
          RejectedCreditCard.Report()
          SEND
     case(Statisitcs)
          Statistics.Report()
          SEND
     case(Logins)
          Logins.Report()
          SEND
     case(Report)
          Report.Report()
          SEND
END SWITCH

ON_ERROR_EVENT DO
     RETURN #ERROR

RETURN #OK      

END


Authors: Paul Werbicki, Vlad Levin, Carey Bingham, and John Mozayani


Send Comments to Supplier Group 11

Back