University of Southern Queensland
University of Southern Queensland
Faculty of Health, Engineering and Sciences
Unit No : ELE3307
Unit Name : REAL-TIME SYSTEMS
Assessment No : 2
Internal [ X ]
External
[ X ]
This assessment ca
ies 200 of the 1000 total
marks for this unit.
Examiner : Jason Brown
Signature of
Moderator :
Assignment : Real-time multiple process software design – Passenger Lift Control
Date Given : 3rd September 2018
Date Due :
11th October 2018
Penalty for Late Submission :
5% per working day late
Special Instructions :
STUDENTS ARE EXPECTED TO WORK INDIVIDUALLY ON THIS ASSIGNMENT.
This is a design and programming assessment, designed to test the students understanding of
Real-time software design using C programming
Students are required to submit both source code and executables, plus a design report.
Students may discuss approaches to solving the problem but sharing of code is fo
idden.
No assessment will be accepted without this facing page duly completed and attached.
Student Declaration
I hereby certify that the attached submission is entirely my own work and that no part has been
plagiarised or copied without appropriate citation.
Student Number ................................. XXXXXXXXXXStudent Name .........................................................
Signature ............................................ XXXXXXXXXXDate .........................................................................
Any student who
eaches this declaration may be disciplined in accordance with University and Faculty Regulations.
Any non USQ copyright material used herein is reproduced under the provision of Section XXXXXXXXXXb) of the Copyright
Amendment Act 1980.
Assignment 2
Real-Time Multiple Process Software Design
NOTE: This assignment looks very similar to Assignment 1, but is different as it requires you
to design and implement multiple processes. Specifically, note the changes and the
additional requirements (underlined and bolded) for this second assignment.
Outline of task
You are required to design, implement and document a multiple process program for a
Passenger Lift Control System to execute on a PC. The assignment does not involve any
hardware connections to the PC, as the operation of the lift’s sensors and controls are
simulated by a program provided for this purpose.
To complete this assessment you must, by the due date:
1. submit a text readable Word or PDF report documenting your system design to
include a state chart and/or other suitable design diagram(s), a
ief explanation
of the design choices you have made (particularly with respect to inter-process
communication and synchronization) and a source code listing in an appendix
2. submit your individual source code (i.e. .c and .h) files in a zip package
Do not submit the report in the zip package, it must be submitted as an individual file.
System specification
Design
The application to be designed must monitor and safely control the operation of a passenger
lift. The lift configuration is detailed below. You are required to write a multiple process
state driven implementation for a Real-Time control system to meet the following
equirements (which are the same set of requirements as for Assignment 1):
1. Control the lift and doors in a safe manner at all times: in particular do not allow
doors to be open unless the lift is stopped, and do not start the winch unless the doors
are closed.
2. The program must check the call button input(s) A, B, C and D and move the lift to
that floor as soon as practical. Cu
ent direction of travel should be accounted for. Eg.
Do not stop at floor 2 on the way up if a passenger pushed button C to go down.
3. The program must check the level button input(s) 1, 2 and 3 and move the lift to that
floor as soon as practical.
4. For design and implementation purposes, you may make the simplifying assumption
that only one call button or lift button will be pressed at any one time (for example,
you do not need to account for the case where call button D and lift button 2 are
pressed simultaneously). This is not a realistic scenario, but the lift simulator program
that will be used together with your program accepts keyboard input to emulate the
call and lift buttons, so only one button can be pressed at a time.
5. On reaching a floor, the time between the lift door starting to open and starting to
close must be at least 7 seconds.
6. Control the lift position to ±0.04m when it stops at each floor (at 0.0, 4.0 and 8.0m)
7. Do not allowing the lift to reach its limits of travel (-0.5m or 8.5m) as equipment
damage will occur.
8. There is a key control input K to disable the lift in the event of an emergency. When
the lift is on floor 1, if the key control input K is activated, your program must ensure
the lift remains on floor 1 (even if other buttons are subsequently pressed) with its
doors open until a key control input L moves the lift back to normal operation. Note
the key control input K should have no effect if it is activated when the lift is moving
or stopped at floors other than floor 1.
Figure 1: Lift configuration
The lift
ï‚· The lift is as shown in Figure 1. It is comprised of a lift with doors, the winch, a position
sensor, 4 call buttons and 3 in-lift buttons.
ï‚· The door control input is used to open and close the lift doors. (+1 for open, 0 for close)
Winch
Floor 1
Call buttons
Floor 2
Floor 3
1
2
3
In Lift buttons
Position
Sensor
8m
0m
4m
Winch control input
Lift
with
doors
Level
Door control input
D
C
B
A
Door ajar sensor
ï‚· The winch control input is used to raise or lower the lift at 0.5 m/s. (+1 for raise, -1 for
lower, 0 for stop) {Ignore acceleration and deceleration}.
ï‚· The position sensor measures the location of the lift to 0.01m resolution. (Its range is -0.5
to 8.5 m)
ï‚· The door ajar sensor measures the amount the doors are open to 0.01m resolution. (Its
ange is 0.0 to 1.0 m)
ï‚· The four call buttons A, B, C and D allow passengers to call the lift to their floor. (Up
only when called from floor 1 (D), up and down when called from floor 2 (B and C
espectively), and down only when called from floor 3 (A))
ï‚· The three level buttons 1, 2 and 3 in the lift allow passengers to enter the floor they wish
to travel to when in the lift.
ï‚· The key control input K disables the lift (with doors open) in the event of an emergency
if and only if the lift is on floor 1 until a key control input L is activated to re-enable the
lift.
Implementation
You are required to implement a multiple process real time control program in C using the
cygwin64 environment if using a Windows PC. You will be provided with the source code
of ‘LiftSim.exe’ as part of a software package, this is a separate program which you run at
the same time as your control program (and probably in the same directory as they share
memory). This program will simulate the lift hardware (buttons etc) and the movement of the
lift, based on your keyboard input.
You will also be provided with the header file ‘lift.h’ and the source file ‘liftInt.c’ (these are
the same as for Assignment 1) in the software package which provides a set of su
outines
that interface with the lift simulation program. A summary of the function of each su
outine
is provided below. You should incorporate these files in your program compilation.
The first three su
outines control the connection to the lift simulator program.
void liftopen(void);
Call this routine once at the top of your program to initialize the link to the lift
simulator program and reset the lift conditions to their initial states: lift stopped at
floor 1, no buttons pressed.
void liftclose(void);
Call this routine once at the end of your program to close the link to the lift simulator
program.
void liftreset(void);
You may call this routine during your program to re-initialize the lift conditions to
their initial states: lift stopped at floor 1, no buttons pressed.
The next four su
outines control the winch and the doors, and read the lift position and door
ajar sensors.
void winch(int onoff);
Call this routine with +1, -1 or 0 as a parameter to control the winch.
void doors(int onoff);
Call this routine with +1 or 0 as a parameter to control the doors.
double position(void);
Call this routine to determine the instantaneous position of the lift.
double doorajar(void);
Call this routine to determine the instantaneous position of the doors. It returns the
amount the lift door is open/ajar: 0.0 to 1