Mini Project: Hanoi University of Science and Technology EE3490E Fundamentals of Embedded Programming
Mini Project: Hanoi University of Science and Technology EE3490E Fundamentals of Embedded Programming
Mini project
I. Project description:
Design and write program(s) in C or C++ with proper functions and data structure to simulate a speed
sensor mounted on a DC motor with the following specification:
Measurement range: 0 ÷ 3000 rpm (revolution per minutes)
Resolution: 0.2 rpm
1
The program should be able to generate at least 1000 data points.
2. Task 2:
Write another program to process the data in “speed_data_TIMESTAMP.csv” with the content followed
the one generated in task 1. The program should be run by using a command-line as below:
C:\\speed_process [data_filename.csv]
Where:
speed_process: is the execution file name without extension.
[data_filename.csv] is the csv file which consists of the speed data set. If the user does not
provide the filename, the program will use the default name which is “speed_data.csv”.
For example: C:\\speed_sim speed_data_1653985800.csv
The program should be able to handle at least 1000 data points which may be included in the data file.
This program should implement the following sub-tasks:
a. Tasks 2.1:
Assuming that the speed of the motor in normal operation are varied within 900 ÷ 1600 rpm (lower
bound and upper bound are included). The program needs to validate the speed data in the data file, data
points with the speed values which are not in the valid range have to be filtered as outliers. The outlier data
points are stored in a file named “outlier_data.csv” which should follow the below format:
number of outliers: 4
id, time, values
1, 08:30:00,1700.6
3, 08:30:00,200.6
3, 08:30:03,1900.4
2, 08:30:03,100.2
The first line is “number of outliers: X” where X is the number of invalid data points, e.g. 4 in the above
example.
b. Tasks 2.2:
Identify the largest, smallest, and average speed for each sensor id (apply to the valid data points only),
and store the results in a file named “data_summary.csv”. The example is as the following:
The time of the max and min values in the file above are the earliest timestamps those values appear.
Meanwhile the time of the mean is the simulation interval.
c. Task 2.3:
We assume that the motor can change (increase or decrease) the speed by maximum 100 rpm per second.
Please count the number of times that speed increment and decrement between two consecutive data points
exceed 100 rpm per second for each speed sensor (motor). Hint: the acceleration/deceleration between two
consecutive data points should be calculated first.
2
The results should be stored in a csv file named “data_statistics.csv” with the following format:
id, direction, frequency
1, increment, 4
1, decrement, 0
2, increment, 10
2, decrement, 3
3, increment, 0
3, decrement, 5
…
3
error 2.1: non existing or not readable data file
error 2.2: wrong data file format
error 2.3: missing data in line 2
The error 2.1 means that the input file may not be presented or corrupted.
The error 2.2 means that the input file is readable, but the content of the file is not in proper format.
The error 2.3 means that there missing data in a particular line such as there is no id, no timestamp or no
value or nothing (just an empty line). The first is line 0 which is the header line, the data starts from line 1 or
second line in the data file. For example: in line 2 of the following file, the id is missing, thus the error
message written in the log file can be “error 2.3: missing data in line 2”. There may be multiple lines with
missing data, all error lines must be recorded in the log file, e.g.: there is missing data in line 4 in the below
sample csv file as well.
line speed_data_1653985800.csv
0 id,time,values
1 1,08:30:00,1500.6
2 ,08:30:00,1200.2
3 2,08:30:00,200.2
4 1, ,100.2
5 3,08:30:03,1200.4
6 2,08:30:03,1600.2
… …
III. Design:
Students can use top-down approach to design the program, i.e.: it is required to provide a diagram to
illustrate the functions developed and their relationship. If the program is written in multiple files, a diagram
needs to be provided to illustrate the relationship of the files as well. What the structure is and how the files
are designed and organized should also be introduced.
Flowchart diagrams should be provided for important and main functions. Description of the features,
inputs and outputs, pre-conditions, post-conditions of these functions should also be presented.
V. Tools:
Editor: Visual studio code (https://code.visualstudio.com/download)
Compiler: gcc or g++ in MinGW-w64 (https://sourceforge.net/projects/mingw-w64/)
Student should specify the operating system (Windows, Linux, MacOS) in the report as well.
4
The parent folder should be name as “groupdid_mini_project.zip” in which “groupid” is replaced by
the group id. There are two subfolders “task_1” and “task_2” which consist of the related files
(source codes, data file, results) for each task. An example of the project folder is given below
221234_222345_223456_mini_project\
task_1\
files of task 1
task_2\
files of task 2
report.docx
The whole project folder should be compressed in a zip file named as “groupdid_mini_project.zip”,
e.g.: “221234_222345_223456_mini_project.zip” then submitted via Team assignment. Please do
not use any other compressed file format like *.rar. Students can use 7zip to compress the file, it is
free.
The report.docx is the group report which should be in English, created with Microsoft Word. The
main content of the report must include:
o Introduction: The main idea and project file structure (if there are multiple source code files
in each task).
o Design: The design of the whole program and each function (if there are too many functions
then select a few most important ones). The flowcharts of the main program and important
functions (at least 1 flowchart) and brief description of this flow chart.
o Results: The results and discussion on the results.
o Conclusion: The conclusion which should mentioned what have been done and have not
been done in your work.
o Task allocations: The task allocation amongst the group and self-evaluate percentages of
each member contribution in the project (the total of all members is 100%).
o References: The references if any information in the report is referred in external sources.
The report should not exceed 4 pages (A4 size) and should strictly follow the attached template.
Do NOT put the source code in the report.
Each group must do the project yourself. Do NOT copy from any other groups. Each group should
keep the work confidential. If any two or more submissions are similar in source code or report, all
the groups will be considered that they do not submit the project, it does not matter who copies from
whom.
No late submission is allowed.
No submission results in 2 points will be deducted from the mid-term exams (total of the exams is 10
points).
The submission will be evaluated as below:
o Complete all the tasks with all the features (each optional task will be given 1 additional
point). (4 points)
o Good design and highly reusable. (2 points)
o Good coding style with proper naming convention for variables and functions, clean code,
meaningful comments. (2 points)
o The report content must be consistent with the source code, otherwise it will not be marked.
The report strictly follows the template. It should be well-organized, comprehensive and
easy to understand with minimum grammatical and spelling mistakes. (2 points)
o Time of submission. Amongst two groups who have the same score, the one who submits
earlier takes advantage.