MEC104 Experimental, Computer Skills and Sustainability: MATLAB Assignment
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
MEC104 Experimental, Computer Skills and Sustainability: MATLAB Assignment
Assignment Regulations
This is an individual assignment. Every student MUST submit one soft copy of the
assignment via the Learning Mall before the due date.
A coversheet can be created in your own way, but the following information MUST be
included: student ID number, full name and email address.
In your answer sheet, all the formula, derivations, completed MATLAB scripts and
functions with original highlighted text format in MATLAB editor, computational results in the command window, and plotted figures, should be part of the answers. For each question, you can use screen shots to provide 1) your coding in MATLAB editor, 2) prompts in command window, 3) results in command window, 4) results shown by plots/figures.
There is no hard requirement on how the answer sheet must be organized. You can organize
your report question by question (i.e. give one section for each question). Then, for each section, you can organize it in your own way. However, the contents and information required by each individual question MUST be provided. You may follow a template on the next page to decide what information to be presented for each question.
You may refer to textbooks and lecture notes to discover approaches to problems, however,
the assignment should be your own work.
Where you do make use of other reference, please cite them in your work. Students are
reminded to refer and adhere to plagiarism policy and regulations set by XJTLU. References, in IEEE style can be attached as an appendix.
Assignments may be accepted up to 5 working days after the deadline has passed; a late
penalty of 5% will be applied for each working day late without an extension being granted. Submissions over 5 working days late will not be marked. Emailed submissions will NOT be accepted without exceptional circumstances.
A Suggestion on Information to be Presented for Each Question
For each problem:
1. Equation derivations:
1) What equation do you use in your coding?
2) Also give all the coefficients, and source terms (e.g. external force/voltage), as necessary.
2. What initial conditions, boundary conditions, time periods, domain size, etc., (computational conditions) are used? Provide schematic diagrams as necessary.
3. Main programme:
Provide the coding below, with necessary comments.
4. Functions
1) Give information on what is this function used for, and what equation is solved, related to point 1.
2) Provide the coding below, with necessary comments.
5. Results
1) Present the results required by each question, which can be numbers, data tables, figures, as appropriate.
2) Comments and analysis of the results:
If required by a question, then you need to do this.
If not required, you can still do this if you wish, which is great!
If you think it is necessary to clarify your results and methods used, then please provide your comments.
6. Flow charts of your programme (if applicable).
Problem 1 (15 Marks)
Consider a hydradulic system as shown in Figure 4. The model is this system is given below which solves for the height of the fluid, h, in the tank:
= + ( − ) − ( − )
where
: the fluid mass density
A: the bottom area of the tank
q: the mass flow rate of the flow source
p: the bottom pressure in the tank
pl : supply pressure from the left-hand side tube
pr : supply pressure from the right-hand side tube
pa : atmospheric pressure
Rl : flow resistance from the left-hand side tube
Rr : flow resistance from the right-hand side tube
: gravitational acceleration
and
(∆) = −
∆ > 0
∆ < 0
with ∆ the pressure difference across the flow resistances.
The mass flow rates out of left and right outlets are, respectively:
=
=
Figure 4. A hydraulic system with a flow source and two pumps
Now, we have a hydraulic flow system as shown in Figure 5. The parameters are: 1 = 3 2 , 2 = 5 2 , 1 = 30 −1 ∙ −1 , 2 = 40 −1 ∙ −1 , = 1.94 / 3 , = 0.5 / , = 9.8m/2 . The initial fluid heights in the two tanks are, respectively, ℎ1 (0) = 2 and ℎ2 (0) = 5 .
Figure 5. The hydraulic flow system for Problem 4.
Question: Obtain the plots of ℎ1 () and ℎ2 ().
Note: In this question, any approach is possible; direct programming or Simulink.
Problem 2 (35 Marks)
With simplicity, we consider 5 irrigation area connected as in Figure 1. Our goal is to maintain water level with properly. Water levels denote as 1 (), 2 (), .. , 5 (). We let the water level variable as 1 , 2, .. , 5 for simplicitly afterward.
2
1
5
3 4
Figure 1. Five irrigation area
With the level sensor of IoT device, it is assumed the multiple watering area as agents, and each water level information is transferred by IoT sensor. And, the highest water level is considered as a leader agent for the consideration of conservative point of view. In irrigation area, we categorize the water level a maximum, minimum as level boundary. And initial levels (0) are placed inbetween two boundaries.
|
level 1
|
Follower level Minimum level |
Figure 1. Water level description of irrigation areas.
Now, we do consider highest level 1 as leader and others are followers. Network system with
consensus protocol is proposed in Eq’s ( 1) and (2). Eq. ( 1) is follower and (2) represents leader.
= − + ∑=1 ( − ) + , = 1, , (2)
= −
where ’s are water level for each irrigation area, and is the water level command.
Then, Leader-Follower model is proposed for the first area as the leader;
̇1 = − 1 + | 1 − 2 | + | 1 − 4 | + (() − 1)
And other followers are;
̇2 = − 2 + | 2 − 1 | + | 2 − 5 |
3(̇) = − 3 + | 3 − 4 |
̇4 = −4 + |4 − 1 | + |4 − 3 | + |4 − 5 |
̇5 = − 5 + | 5 − 2 | + | 5 − 4 |
is assumed as 0.005 for slow level decrease. Initial levels of each area are assumed as 1 (0) = 0.58, 2 (0) = 0.55, 3 (0) = 0.52, 4 (0) = 0.50, and 5 (0) = 0.48. = 0.5 is the scale factors. Minimum level is 0.3m, and maximum level is 1m. And | ∙ | is considered by the absolute value. Command on the water level is defined as;
0.8 , 0 < < 1000
0.85 , 1001 < < 2500
In the simulation, time interval is recommend to use 0.01 s.
Question: Illustrate the 1 to 5 under the water level command (). Put every information including all levels: 1 to 5 , into one figure.
2022-04-11