RME40002讲解 、辅导 c/c++,Python程序
RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 1 of 21
School of Science, Computing and Engineering Technologies
RME40002
Mechatronics Systems Design
Portfolio Tasks Description
Semester 2, 2024
RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 2 of 21
Instructions
1. The portfolio is individual assessment. You must complete the tasks by your own.
Read the RME40002 Assessment Criteria document in Canvas for details.
2. You could get feedback from your tutor in class on your solution prior to the
submission due date.
3. Use the Portfolio Template provided in Canvas for your submission.
4. You do not need to copy the task questions into your portfolio, but clearly label
the task number you are answering.
5. For MATLAB questions, include all source codes and commands as text in the
portfolio. If a question asks you to plot or display something to the screen, also
include the screenshots of plot and screen output your code generates. Include
results and sufficient comments if required.
6. For LabVIEW questions, provide screenshots of both front panel and block diagram
with sufficient resolution for readability.
7. For non-programming questions, you may type in your answers or scan your
handwritten answers to include in the portfolio.
8. You should submit two separate portfolios for the tasks required in this document.
Each portfolio must be a single electronic file in PDF format or Word document.
9. The file name and deadline of your portfolio submission requirement:
First Portfolio – Answers to tasks from Week 1 to 4
File name [Your student ID]-[PF1]
For example, 12345678-PF1.pdf
Submission deadline Sunday, September 1, 2024 by 23.59pm
Second Portfolio – Answers to tasks from Week 5 to 8
File name [Your student ID]-[PF2]
For example, 12345678-PF2.pdf
Submission deadline Sunday, September 29, 2024 by 23.59pm
Penalty will be applied for late submission (see Unit Outline for details).
10. The only way to submit your portfolio for assessment is uploading through
Canvas>>Assignment>>Portfolio Submission. Submissions by using other
methods such as through Email would not be accepted.
11. Submissions failing to satisfy the above requirements would NOT be assessed!
12. You also need to keep a record of the source codes of your solution. You may be
asked to provide the source codes during the assessment period. RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 3 of 21
Week 1
1.1 LabVIEW Basics – Data types, math calculation, and display
1.1.1 Data types
This task is designed to help students get started with LabVIEW, which also helps to
familiarize the common data types.
1) Start a new file in the LabVIEW and save it as Week1p1p1.vi
2) Select Window>>Show Block Diagram (Ctrl+E)
3) Create controllers-indicator pairs for different variables such as
i. Name (strings),
ii. Age (doubles),
iii. LED (Booleans),
iv. Exam results (array)
v. A cluster that contains all variables above, bundle them, then unbundle and
show with a cluster indicator containing Name, Age and LED three items
only.
4) Organize components in your front panel and block diagram for readability
5) Provide screenshots of both the front panel and block diagram you have
designed in the portfolio report. Your results may be like below.
RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 4 of 21
1.1.2 Math calculation
This task practices how to program a math expression and calculate its result.
Calculate the value of y according to the following expression by using the blocks of
numeric palette, formula node and mathscript, respectively.
1) Start a new file in the LabVIEW and save it as Week1p1p2.vi
2) Select Window>>Show Block Diagram (Ctrl+E)
3) In the block diagram, right-click and select Functions>>Numeric.
i. Basic math operations can be found in Numeric such as Add, Subtract,
Multiply, Divide, Square, and Square root.
ii. Complete the calculation with basic math blocks.
4) In the block diagram, right-click and select Functions>>Structure>>
Mathscript. Complete the same calculation for y with mathscript.
5) In the block diagram, right-click and select Functions>>Structure>> Formula
node. Complete the same calculation for y with the formula node.
6) Create indicators to display the results as calculated by the above methods.
7) Organize components in your front panel and block diagram for readability
8) Provide screenshots of both the front panel and block diagram you have
designed in the portfolio report. Your results will be like below.
RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 5 of 21
1.2 Mechatronics Project – Literature review
Peruse the Mechatronics Project Guidelines document and complete a preliminary
review on how the pick-and-place robotic arms are used in reality. Briefly introduce
the working principles of at least two examples of such existing equipment and their
applications. You are suggested to use photo or diagram for clear explanation.
Approximately 300 words exclusive of photo and graph are required in this task.
RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 6 of 21
Week 2
2.1 MATLAB Basics – Script file, if, for, while
2.1.1 The if Construct
The unit price of a product changes according to the number of units purchased, a
10% discount is applied when purchasing over 30 units. A customer could enter the
number of units and original unit price in the command window. Then, the overall
price is calculated. You should use the if Construct in MATLAB to solve this task.
1) Write a program in a MATLAB script file named as Week2p1p1.m
2) The program asks the user to enter the number of units and the unit price in the
command window.
3) The program then displays the total price in the command window.
4) Copy & Paste both the script code in your edit window and the results in your
command window to the portfolio report.
Command window example:
Please enter the number of units: 31
Please enter the price per unit $: 10
The overall price is $XXXXX
2.1.2 The for Loop
Write a program to calculate the sum of the first 6 terms of the series:
and display the result. You should use the for Loop in MATLAB to solve this task.
1) Write a program in a MATLAB script file named as Week2p1p2.m
2) Calculate the sum for n = 6 and show the result in the command window.
3) Copy & Paste both the script code in your edit window and the results in your
command window to the portfolio report.
Command window example:
The result for n = 6 is XXXXX.
2.1.3 The while Loop
For sum = 1+2+… + n, create a MATLAB program to calculate the n value that
yields sum = 5050. The task can be represented by the following formula:
You should use the while Loop in MATLAB to solve this task. RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 7 of 21
1) Write a program in a MATLAB script file named Week2p1p3.m
2) Find the n value by using the while loop.
3) Copy & Paste both the script code in your edit window and the results in your
command window to the portfolio report.
Command window example:
For sum = 5050, n is XXX.
2.2 LabVIEW Further – Case, for-loop and while-loop
2.2.1 The case Structure (Do NOT use mathscript-node, formula-node or MATLABscript)
The problem is the same as 2.1.1. Whereas, students should use the case structure in
LabVIEW to calculate the total price. In addition, students should create two text
boxes such as “unit purchased” and “unit price” shown in the following. A user can
enter values in the text boxes and the corresponding total price is calculated.
1) Start a new file in the LabVIEW and save it as Week2p2p1.vi
2) Calculate the total price using the case structure.
3) Organize components in your front panel and block diagram for readability.
4) Provide screenshot of both the front panel and block diagram in the portfolio
report.
2.2.2 The for Loop (Do NOT use mathscript-node, formula-node or MATLAB-script)
The problem is the same as 2.1.2. students are asked to calculate the sum of the first 6
terms of the series:
and display the result. Moreover, students should make use of the for-loop structure in
LabVIEW and display the value of the sum.
1) Start a new file in the LabVIEW and save it as Week2p2p2.vi
2) Calculate the value of the sum by using “shift register” or “feedback node”
with for-loop. (Do NOT use “Add Array Elements” function in this task)
3) Organize components in your front panel and block diagram for readability. RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 8 of 21
4) Provide screenshot of both the front panel (with your calculated result clearly
displayed) and block diagram in the portfolio report.
2.2.3 The while Loop (Do NOT use mathscript-node, formula-node or MATLABscript).
The problem is the same as 2.1.3. Students are asked to create a LABVIEW program
to calculate the n value such that 1+2+… + n = 5050.
1) Start a new file in the LabVIEW and save it as Week2p2p3.vi
2) Use shift register or feedback node within the while-loop to calculate the
summation then determine the n value.
3) Organize components in your front panel and block diagram for readability.
4) Provide screenshot of both the front panel (with your calculated result clearly
displayed) and block diagram in the portfolio report.
2.3 Mechatronics Project – Design tasks
Refer to Appendix, Section 2: Task Elements in the Mechatronics Project Guidelines
document. Answer and explain the following questions:
1) What is the task you feel most confident to accomplish; and explain why based on
your prior knowledge or practice?
2) What are the most challenging tasks for you; and what is your plan to improve
yourself in those areas through this project development?
Approximately 200 words are required in this task.
RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 9 of 21
Week 3
3.1 Import MATLAB code in LabVIEW using Mathscript
Note: You must use Mathscript to solve this task.
Simulation of throwing a ball
Below are all the steps you need to follow, but you may also add your own
meaningful comments to the code as you write it.
1) Start a new file in LabVIEW and save it as Week3p1.vi
2) In the file, define some constants (label the constants for readability)
i. ℎ = 1.7, % Initial height of ball at release is 1.7 m
ii. = 9.8, % Gravitational acceleration is 9.8 m/s2
iii. = 4, %Velocity of ball at release is 4 m/s
iv. = 45, % Angle of the velocity vector at time of release is 45 degrees
3) Next, make a time vector , that has 1000 linearly spaced values
between 0 and 1, inclusive.
4) In the following figure, x denotes distance and y is height, the
equations below describe their dependence on time and all the other
parameters (initial height h, gravitational acceleration g, initial ball
velocity v, angle of velocity vector in degrees ). See the following
illustration:
Solve for x and y
5) Approximate when the ball hits the ground.
i. Find the index when the height first becomes negative.
ii. The distance at which the ball hits the ground is the value of x at that index
iii. Display the result in Front Panel: The ball hits the ground at a distance of
X meters. (where X is the distance you found in part ii above)
6) Plot the ball’s trajectory in Front Panel
i. Create a new XY graph which can be found in Modern >> XY Graph RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 10 of 21
ii. Plot the ball’s height on the y axis and the distance on the x axis using a
blue solid line.
iii. Label the axes meaningfully and give the figure a title.
iv. In the same graph, plot the ground as a dashed red line. This should be a
horizontal line going from 0 to the maximum value of x. The height of this
line should be 0.
7) Run the program and verify that the ball indeed hits the ground around the
distance you estimated in 5) and create messages in the form “The ball hits the
ground at a distance of x.xxxx meters.”
8) Organize components in your front panel and block diagram for readability.
9) Provide screenshot of both the front panel and block diagram in the portfolio
report.
Example (Note: the distance in below figure is just exemplary):
3.2 Mechatronics Project – Your individual project plan
You should have formed your project group by this week. In this task, address the
following questions:
1) Outline the task allocation among your group members.
2) Outline your individual project plan according to semester weeks. Use a Gantt
chart with a brief description of each week’s tasks.
Approximately 200 words exclusive of photo and graph are required in this task.
RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 11 of 21
Week 4
4.1 PLC control design for motors
A PLC control system contains two motors. When a main switch (normally open) is
on, motor A will start immediately. After 2 seconds, motor B should be started as
well. When the main switch is off, motor B must be stopped first, and after 2 seconds
motor A stops.
Design a program and use the following Input/Output ports to simulate the above
application:
I1: Main switch
Q1: Relay of the motor A control circuit
Q2: Relay of the motor B control circuit
1) Build and simulate your PLC program in the Siemens PLC LOGO! Software to
verify the design requirements.
2) In your portfolio report, provide the PLC ladder diagram of your design and the
screenshots of the simulation results from the bottom panel of the LOGO!
Software. In addition, explain your design solution and discuss the simulation
results.
4.2 PLC control design for automatic garage door
A PLC system is used to control an automatic garage door that can perform the
following tasks:
i. When a pushbutton switch (normally open) is pressed, the motor is started
clockwise to open the garage door. After 5 seconds the motor stops and a
lamp is turned on to indicate that the door is opened for the car to go
through.
ii. After 10 seconds, the lamp is turned off and the motor is started anticlockwise
to close the garage door.
iii. The motor stops after 5 seconds and the door is closed.
iv. The above operations can be repeated without the power reset.
Design a program and use the following Input/Output ports to simulate the above
application: RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 12 of 21
I1: Pushbutton switch
Q1: Relay of the motor clockwise control circuit
Q2: Relay of the motor anti-clockwise control circuit
Q3: Lamp
1) Build and simulate your PLC program in the Siemens PLC LOGO! Software to
verify the design requirements.
2) In your portfolio report, provide the PLC ladder diagram of your design and the
screenshots of the simulation results from the bottom panel of the LOGO!
Software. In addition, explain your design solution and discuss the simulation
results.
4.3 Mechatronics Project – Preliminary design concepts
It is expected that you have discussed with your group on the project development
details. This assessment is designed to help you clarify the specific design that your
group likes to achieve in the project.
1) Describe the initial design concepts as a result of your group discussion.
Recommend adding a sketch or drawing to visualize your desired prototype.
2) Describe the specific design work that you will complete for the project.
Approximately 200 words exclusive of photo and graph are required in this task.
First portfolio submission due by next week:
You should submit your first portfolio by the end of next week. Refer to the
Instructions in Page 2 of this document for details.
RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 13 of 21
Week 5
5.1 System modelling and simulation in LabVIEW
Suppose a DC motor mathematic model can be described by the following inputoutput
differential equation:
where ω(t) is the angular velocity of the motor shaft, u(t) is the input voltage, and a, b
are model parameters.
In order to find the values of the model parameters a and b, an experiment was carried
out by injecting a square wave voltage to the motor (i.e., u = 0-1Vpp). The angular
velocity of the motor is not directly measurable, however, the motor has an integral
angle sensor to measure the rotational angle of the motor shaft θ(t).
During the experiment, the input voltage and the rotational angle signals are collected
with a sampling period of 0.1 second, the curves of which are shown in the following
figure.
One dataset in the above figure is tabulated below, which is sufficient to solve the
problem in this task.
Time (second) Input voltage u (Vol) Output angle θ (radian)
Amplitude
Input voltage (Vol)
Angle (radian)RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 14 of 21
Assuming the following relationship
1) Use the above data to estimate the values of model parameters a and b. Provide
the details on your working step.
2) Build the model in LabVIEW (Do NOT use mathscript-node, formula-node or
MATLAB-script in this task) and simulate the response of the model to a 0-1Vpp
square wave input voltage with period=5 second and duty cycle=50% (refer to the
above figure) for 7 seconds. Display the simulated output angle and the square
wave input signals in the same graph (results are expected to be similar to the
above figure), and then discuss and justify the correctness of your results.
5.2 Mechatronics Project – Teamwork
This task is designed to reflect your group project activities. Research shows that
collaborative problem-solving leads to better outcomes. In this task, address your
teamwork involvement, group progress, digital tools used for collaboration, one latest
group meeting minutes. In addition, report any teamwork conflicts if any and how you
will manage to resolve it.
Approximately 200 words are required in this task.
RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 15 of 21
Week 6
6.1 LabVIEW – Create a square wave reference trajectory.
Students should create a square wave with an amplitude value switching between 0
and 1; and a frequency of 0.5 Hz in this task.
1) Start a new file in the LabVIEW and save it as Week6p1.vi
2) You may use the ‘simulate sig’ block in Signal Process>>Wfm
Generation; or may use the ‘square wave’ block in Signal Process>>Sig
Generation with proper parameters.
3) Display at least 2 periods of the waveform on a waveform chart.
4) Organize components in your front panel and block diagram for readability
5) Provide screenshot of both the front panel and block diagram in the
portfolio report.
Example:
RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 16 of 21
6.2 LabVIEW – Create trapezoidal wave reference trajectory
A periodical trapezoidal waveform has a period of 5 seconds. For the first 2 seconds,
the value gradually increases from 0 to 2 and remains at 2 for another 2 seconds.
Then, the value rapidly decreases back to 0 in 1 second.
To create this waveform signal with LabVIEW, you can use ‘Elapsed Time’ and
Mathscript node, its Front Panel and Block Diagram is shown below:
Please note that in the property of ‘Elapsed Time’, ‘Automatically rest after time
target’ is turned off. Following the steps below to complete this task:
1) Start a new file in the LabVIEW and save it as Week6p2.vi
2) Create a program as the above to display the trapezoidal waveform.
3) Replace the Mathscript node, with LabVIEW functions to build the relation
between the output ‘value’ and the inputs variables of the original Mathscript
node. (Do NOT use Mathscript, MATLAB script, or formula node in this task. RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 17 of 21
You may use multiple ‘select’ nodes for ‘case structure’).
4) Display at least 2 periods of the trapezoidal wave on a waveform chart.
5) Organize components in your front panel and block diagram for readability.
6) Provide screenshot of both the front panel and block diagram in the portfolio
report.
6.3 Circuit design
An analogue control circuit as shown in the following figure is used to implement the
controller output u according to the following equation:
= − 0.5
where r and are the input signals to the circuit.
Calculate the values of the resistors R1 and R2 such that the circuit can implement the
above controller equation. Provide your calculation steps in the portfolio report.
RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 18 of 21
Week 7
7.1 LabVIEW – Simulation of a PID control system
In this task, students are asked to create a control system simulation with a PID
controller in the ‘control and simulation loop’.
The following figure describes a simple mass-spring-damper system to be controlled,
where m is the mass of a moving object; u is the external control force; y is the
displacement, k is the spring constant; and b is the friction coefficient.
Based on Newton's second law, the equation of motion of the above system can be
described by the following differential equation
If the parameters are known as m=1, b=15, and k=25, then we have
Alternatively, you can equivalently convert the above equation as a transfer function:
1) Start a new file in the LabVIEW and save it as Week7p1.vi
2) Students should use Control & Simulation Loop in Control & Simulation >>
Simulation with the configuration shown in the following figure
RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 19 of 21
3) In the Control & Simulation Loop, students should create a PID controller,
plant and reference signal.
4) The requirement for the reference is the same as the square wave in Week 6
tasks. Students can reuse the program week6p1.vi.
5) Students can use PID blocks in Control & Simulation >> Simulation >>
Continuous Linear System or PID.vi in Control & Simulation >> PID or build
PID from integrator and derivative blocks.
6) Plant Model can be created by basic integrator blocks or Transfer function
block in Control & Simulation >> Simulation >> Continuous Linear System.
7) Tune the PID parameters until the design specifications are satisfied: the
steady-state error less than 5%; the settling time less than 0.25 second. (Settling
time is the time required for the response curve to reach and stay 5% of the
final value).
8) Organize components in your front panel and block diagram for readability
9) Provide screenshot of both the front panel and block diagram in the portfolio
report.
10) Discuss how the PID control parameters affect the settling time and steadystate
error in the portfolio report.
Example:
RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 20 of 21
Week 8
8.1 LabVIEW – Counter design (Do NOT use Mathscript-node, formula-node or
MATLAB-script in this task)
In this task, students will create a click speed test program by using LabVIEW.
1) Start a new file in the LabVIEW and save it as Week8p1.vi
2) The test lasts for 10 seconds and the time spent is shown in “Elapsed time”
3) A user can click a button with the label “Click Me”.
4) When a user clicked the button, the “Counter value” is incremented by 1, and
the last moment when the button is clicked is recorded in “Last time clicked”.
5) Students can use the ‘Count up’ block in Real-Time>>Function blocks.
6) The period is defined as the time difference between the last time clicked and
the second last time when the button was clicked.
7) Finally, the smallest period is shown in the “smallest period”.
8) Organize components in your front panel and block diagram for readability
9) Provide screenshot of both the front panel and block diagram in the portfolio
report.
Example:
8.2 Mechatronics Project – Progress reflection
By this week, your group should have made some progress on the project
development. Address the technical development your group have completed and
point out your main contributions. What are the gaps between your group’s current
progress and the initial plan? How to fill the gaps in the remaining weeks?
Provide reflection on your learning experience, time management, and teamwork
involvement.
Approximately 200 words are required in this task.
Second portfolio submission due by this week:
You should submit your second portfolio by the end of this week. Refer to the
Instructions in Page 2 of this document for details.
RME40002 Mechatronics Systems Design – Portfolio Tasks Description
Page 21 of 21
End of Portfolio Tasks Description