讲解P21410编程设计、辅导C/C++程序、c++程序调试

- 首页 >> Matlab编程
Academic Year 2020/21
P21410 - Real-Time Embedded Systems
Coursework
Deadline For Submission: 15/05/2021, 23:00
Submission Instructions You will demonstrate your code and discuss the results in the last
timetabled online session for this module
You should submit your report and associated C code via Moodle.
Report should be in the “pdf” format, and the code should be in “.c”
format, ready to be executed.
Instructions for completing the
assessment:
See attached pages for further details
Control System
Real-Time Embedded Systems
1
Conveyer Belt Control System |
1/ Introduction
You are required to develop an embedded real-time control system for a parts sorting facility
on a factory assembly line. The sorting facility consists of two conveyors that operate
concurrently. The computing platform used for the controller is an embedded PC104 single
board computer, running the VxWorks real-time operating system. The controller software
should be implemented using the WindRiver Workbench software development tools and be
written in the C programming language (though C++ may be used if so preferred).
2/ System Details
The handling system consists of 2 conveyor belts, each allowing for the concurrent sorting of
objects (parts). The system interfaces with the controller using the PC’s parallel port.
Figure 1// Hardware layout
Each conveyor features two sets of sensors and a sorting gate. The first sensor set allows for
the detection of the object size. There are two types of parts presented to the conveyor:
▪ Small parts can only trigger one of the size sensors at a time.
▪ Large parts are long enough to trigger both size sensors simultaneously.
The second sensor set features just one object detection sensor, and is used to count the
parts collected at the end of each conveyor for quality control purposes.
Your task is to develop the controller software to sort parts into the correct categories.
3/ Basic Controller Requirements
The basic requirements for operation of the controller software are as follows:
1. The controller should be able to detect and distinguish between small and large
objects present on each conveyor belt.
2. When a large object is detected on a conveyor, the respective gate should remain
open to allow the large object to pass to the end of the conveyor.
3. When a small object is detected on a conveyor, the respective gate should close to
route the small object off the conveyor.
Real-Time Embedded Systems
2
Conveyer Belt Control System |
4. The sorting gate should be opened once a small object
has been routed off to allow for the correct routing of subsequent objects on the
conveyor.
5. The controller should maintain a separate count of the number of small and large
objects detected on each conveyor.
6. The controller should maintain a count of large objects collected at the end of each
conveyor.
7. The controller should provide a simple text based user interface that allows the user
to perform the following actions:
i) Display the total number of small objects detected for each conveyor.
ii) Display the total number of large objects detected for each conveyor.
iii) Display the total number of large objects collected for each conveyor.
iv) Reset the counter values for each conveyor.
v) Shutdown the controller application and free up any memory used by it.
8. When shutting down the controller following a user prompt, the sorting gates should
be opened. The application should also delete all created data structures (including
semaphores, queues, etc.) and OS tasks.
4/ Conveyor timing parameters
To fulfil successfully the requirements of Section 3, you will need to know the timing
parameters of the conveyor unit and the objects used on the conveyor:
Figure 2// Detection and timing zones
The values of these parameters will be provided in a separate appendix downloadable from
the module Moodle site.
5/ Possible Extensions
There are a number of possible extensions to the basic functionality that you can implement
for higher marks:
▪ Hardware testing. You can implement code to test that all conveyor hardware
components (sensors, gates, motor) are operational. For instance, you can prompt
user to place an object in front of different sensors and verify readings, or operate the
gates/motor and ask user for visual feedback.
Real-Time Embedded Systems
3
Conveyer Belt Control System |
▪ Automatic calibration of the system timing parameters. Some timing parameters in
the previous Section can vary from one physical conveyor unit to another. Instead of
using hardcoded values obtained from prior measurements, you can implement code
that will carry out necessary measurements within your application and automatically
configure it for a given conveyor unit.
▪ Load monitoring. You can monitor the CPU load to detect when the system becomes
overloaded. The current load measurements (e.g. the amount of idle time) can be
displayed in the user interface.
▪ Overload protection. You can further enhance the automatic calibration functionality
to detect when the determined timing parameters can result in the system missing
scheduling deadlines. In such cases, an overload alarm message can be displayed to
the user.
▪ You can think of your own extensions to the system functionality.
6/ Simulation Task
The system uses a C library that enables the interaction with the conveyer. You need to do
the following:
▪ You should simulate the library mimicking functionality, naming convention and
output.
▪ To gain extra marks, you should create your own simulation library.
▪ You should create a test scenario for the new library.
▪ Finally, you should create a Text-based user interface for your scenario. Extra marks
can be gained by the introduction of system calibration and debugging.
7/ Coding Guidelines
In your code, you should adhere to the following coding standards:
▪ You should use descriptive names for all of your variables and functions.
▪ You should use symbolic identifiers for all non-trivial numerical constants in your code
(i.e. for everything except 0 and 1).
▪ You should include comments in the code detailing its functions where necessary.
▪ You should use a consistent and readable scheme for indentation, spacing and blank
lines
8/ Assessment method
The exercise will be assessed using a CODE DEMONSTRATION and a REPORT.
The CODE DEMONSTRATION will take place during timetabled online session and will consist
of a demonstration of the working system. Your assessor will put your system through a
number of test situations to see how your system reacts/handles them. You must also be
Real-Time Embedded Systems
4
Conveyer Belt Control System |
ready to explain and discuss your program design and to
demonstrate your familiarity with the code.
Please note! If you do not demonstrate your work by the deadline, your working system will
be assessed from the submitted source code and the report using the same approach as above.
However, your assessor will not be able to deal with any issues appearing during tests and this
will likely result in loss of marks. Therefore, it is in your very best interest to make sure that
you demonstrate your system in the lab yourself before the deadline.
The REPORT should be submitted via the unit Moodle site and should include the following:
▪ A description of your application explaining key software components (functions, data
structures, etc.) as well as the tasks that your system is running, their purpose,
functioning details (i.e. what each task does and how), and justification for the design
decisions made.
▪ Detailed scheduling parameters of your system including details of task periods, their
computational requirements, blocking dependencies, and determined priorities – the
analysis must match the actual system design and operation!
▪ Scheduling analysis of your system to determine whether the tasks can be scheduled
using relevant Rate/Deadline Monotonic Theorems.
▪ Analysis of schedulability thresholds. The timing of your system largely depends on the
speed of the conveyor belts. In this part of the report, you should analyse what
maximum possible belt speed increase your system could tolerate. For instance, you
could show with your analysis, that the tasks could still be scheduled, if the belt speed
increases by up to 10%
▪ Alternatively, if you have not managed to prove in the previous section that the tasks
can be scheduled, you could analyse here by how much the conveyor would need to
be slowed down to prove schedulability.
▪ Reflection on how ongoing feedback from the lecturer helped you with the
assignment.
▪ Breakdown of individual contributions from team members (these will be taken into
account when allocating the individual student marks).
▪ Complete source code of your application. This must be submitted in a separate file as
explained on the unit Moodle site. If your source code consists of a single C file, then
just submit this C file. If you have more than one C file, then submit a ZIP archive
containing your C files.
The report must include a cover sheet available from the unit Moodle site.

站长地图