代写Mechanical Engineering and Practice Skills I – MECH0004代做Python编程
- 首页 >> WebMechanical Engineering and Practice Skills I – MECH0004
Coursework
Release Date: 08th March 2024
Submission Deadline: 26th April 2024 at 14:00.
Topics Covered: Applied Programming
I. Submit:
1. A single Jupyter Notebook document (with format .ipynb) with questions in ascending order. Explain in detail the physics and the mathematical steps behind each question in Markdown cells and write the code in Code cells that
solves them. Remember to comment on your code, explaining your steps.
2. The (.csv) dataset file you collected during the Stirling Engine Data collection
lab session.
II. Do not write down your name, or student number, or any information that might help identify you in any part of the coursework. Do not write your name or student number in the title of your coursework document file. Do not copy and paste the coursework questions into your submission – Simply rewrite information where necessary for the sake of your argument.
III. For writing mathematical equations in Markdown cells, the linkherecould help.
IV. Aside from the data collection sessions, this is an individual report and you should work individually on each question and submit a single Jupyter Notebook document that has all your attempts for all questions.
V. For downloading your completed Jupyter file, use the “File” tab from Jupyter Notebook’s navigation bar, choose “Download As” option and then choose the “.ipunb” type of format to download your submission.
VI. AI tools can be used in an assistive role. You are not permitted to use AI tools to write the code of your coursework. However, you can use these tools to receive feedback on or proofread your code. If you use any of these tools, you need to state the output and how you used these tools within your submission.
This coursework counts towards 15% of your final MECH0004 grades and comprises of one problem with two questions that add up to 15 marks.
The Problem: Stirling Engine
A Stirling engine, formulated by Robert Stirling in 1816, is a heat engine that uses cyclic compression and expansion of a gas at different temperatures to convert heat energy into mechanical work at a certain frequency. An external heat source is used to vary the temperature of the gas and create a thermal difference, e.g., a hot cup of water or ice cubes. The gas expands when heated and compresses when cooled, thus generating motion through the changing temperature of the piston, which would in turn triggers the flywheel to start rotating.
A full cycle of the engine is shown in Figure 1. It can be noticed that the engine goes through four main states; state 1, state 2, state 3, state 4, until it starts again from state 1.
Figure 1: The full cycle of Stirling engine. Here we have: P(Pa) is the pressure, (m3) is the volume, Tc (K) is the temperature of the cold surface, and Tℎ (K) is the temperature of the hot surface. The main parts of the Stirling engine are: Flywheel, piston, air-tight cylinder filled with gas, and the displacer.
Question 1: Ideal Stirling Engine [5 marks]
The ideal Stirling engine represents an engine with an ideal gas filled in the air-tight cylinder. In this question, you will analyse the dynamics of the ideal gas inside the air-tight cylinder and explain the physics and mathematics at each state of the engine’scycle.
a) Suppose the gas inside the air-tight cylinder is an ideal gas, then the state variables are related by the ideal gas equation given by: Pv = nRT. Here, we have: v (m3) is the volume of the gas, P (Pa) is the pressure, T (K) is the temperature, R = 8.314 is the gas constant, and n (mole) is the number of gas moles.
Assuming that n = 1 mole for simplicity, discuss, in a Markdown cell, the gas’s pressures (P1, P2, P3, P4), volumes (v1, v2, v3, v4), and temperatures (T1, T2, T3, T4) at each state of the engine’s cycle, and write down theirrelevant equations. (1 Mark)
b) Using the equations derived in (a), and assuming that P1 = 1 bar, v1 = 0.0005 m3, v2 = 0.0004 m3, Tc = 200 c, and Tℎ = 700 c, write a code that does the following:
i. Create two lists for the gas pressure and volume within one engine cycle,i.e., state 1 → state 2 → state 3 → state 4 → state 1. (1 Mark)
ii. Plot of the P − v dynamics per one cycle. Remember to put all necessary information on the figure. (1 Mark)
iii. In a Markdown cell, discuss the plot and explain in detail the cycle’s thermodynamics in each state. (0.5 Mark)
c) The work done by/on a gas changing from an initial volume vi to a final volume vf is given by the general formula:
i. In a Markdown cell, show that the work done by/on the gas in each state of the engine’s cycle is given by the following equations:
Discuss the values and signs of each equation. (1 Mark)
ii. Write a code that computes the total work, wTot, done by the gas per engine’s cycle where: wTot = w1→2 + w2→3 + w3→4 + w4→1 . (0.5 Mark)
Question 2: Real Stirling Engine [10 marks]
All the values you have obtained in the previous question are for an ideal Stirling cycle with an ideal gas exists in its air-tight cylinder. However, the data you collected during your data collection session at MechSpace, was taken from a real engine that produces an approximate output.
After inserting different sensors into the Stirling engine and connecting them to an Arduino microcontroller, a dataset of four different physical quantities, similar to the below table, should have been collected during a certain period of time.
In this question, you will be analysing this dataset and its features and explaining the physics behind them using Python programming language.
a) Explanatory Data Analysis:
To explore the dataset, perform. the following data explanatory steps in your Jupyter notebook:
i. The code below does part of the required explanatory data analysis of your dataset. Copy this code and paste it in a Code cell into your Jupyter Notebook.
In a Markdown cell:
1. List two best coding practices you can see in the code written above. (0.5 Mark: 0.25 Mark each)
2. List three changes (or additions) you believe you should do in the code above to improve its quality. (1.5 Marks: 0.25 Mark each)
ii. The code below does another part of the required explanatory data analysis of your dataset. Copy this code, paste it in a Code cell into your Jupyter Notebook, and fill in the missing code lines. (1.5 Marks)
iii. Visualise in subplots, using plot command, the behaviour of trigger, upper temperature, lower temperature, and the temperature difference as a function of time. Remember to add all relevant information to the plots. (0.25 Mark)
iv. In a Markdown cell, explain in two sentences the pattern each plot exhibits. (0.25 Mark)
b) Flywheel Kinematics:
The Stirling engine flywheel hasn = 6 equally spaced spokes with length T(mm) and width d(mm) each. Once the thermal difference between the cold and hot surfaces of the air-tight cylinder exists, the flywheel is triggered and starts rotating about its fixed axis with an angular velocity 幼rad(rad. sec−1). One of the features you collected of the Stirling engine is the “trigger” data, which corresponds to the infrared beam being broken by one of the spokes as it turns one complete revolution (say the red spoke in the figure on the right). Answer the following questions to analyse the dynamics of the flywheel:
i. Write a code that computes the time each revolution takes and store the results in a list. (1 Mark)
ii. How many revolutions your Stirling engine had done? (0.25 Mark)
iii. Compute the instantaneous angular velocity 幼rad(rad. sec−1) at each revolution which is given by:
and store the results in a list. (0.25 Mark)
iv. Plot the instantaneous angular velocity 幼rad(rad . sec−1). In a Markdown cell, explain its overall trend. (1 Mark)
v. Convert the angular velocity 幼rad(rad. sec−1) to RPM (rev. min−1) data and plot it. Explain the trend shown in the plot. (1 Mark)
vi. Assume the spoke is reduced to its half-length. How does this affect the engine’sangular velocity (or the RPM)? (0.25 Mark)
vii. Assume the spoke’s width is doubled. How does this affect the engine’s angular velocity (or the RPM)? (0.25 Mark)
c) Heat Engine Efficiency
A cornerstone in thermodynamics is the analysis of the performance of heat engines. In the case of Stirling engine, heat is transferred from the hot surface to the engine. Some of this energy leaves the engine as a useful mechanical work that rotates the flywheel, and some of it leaves as heat transfer to the cold surface of the engine. Based on the first law of thermodynamics, the amount of heat emerging from the hot surface should equal to the sum of the resulting mechanical work and the heat transfer to the cold surface. If this heat is transferred fully to a mechanical work without any heat transfer to the cold surface, we say that the engine has an efficiency of 1. Similarly, if the amount of heat is transferred fully to the cold surface without any mechanical work, then the engine’sefficiency is 0.
To calculate the efficiency of your Stirling engine, you will be computing two efficiency values:
. Carnot efficiency: which represents the theoretical maximum possible efficiency which can be obtained by a given thermodynamic cycle. Carnot efficiency is given by:
Where Tc(k) and Th(k) are the cold and hot surface temperatures, respectively.
. Chambadal–Novikov efficiency: which gives a much more realistic estimate of what can be attained from a given thermodynamic cycle. Chambadal–Novikov efficiency is given by:
In your Jupyter notebook:
i. Create one function that has two inputs: Tc(k) and Th(k) and does the following:
1. Calculates the Carnot efficiency, and prints its maximum value.
2. Calculates the Chambadal–Novikov, and prints its maximum value.
3. Visualises, using Scatter plot, both efficiencies as a function of the thermal difference: ΔT = Th− Tc in a subplot figure. (1.5 Marks)
ii. In a Markdown cell:
1. Explain the patterns seen in the efficiency plots.
2. Suggest two ideas to increase the Stirling engine efficiency.
3. Propose two ideas tooptimise the engine’sdesign. (1.5 Marks)