1 MA1008 Introduction to Computational Thinking Mini Project: A Cam Design System Semester 1, AY 2021/2022, Week 10 – Week 13 1. Introduction The objective of the mini project is for you to produce a...

1 answer below »
Python Programming for this



1 MA1008 Introduction to Computational Thinking Mini Project: A Cam Design System Semester 1, AY 2021/2022, Week 10 – Week 13 1. Introduction The objective of the mini project is for you to produce a program of a moderate size and depth that will require you to utilise what you have learned in this course, and more, to do something interesting. Through this, you would learn to design, manage and execute a sizable program. 2. The Project Disc cam is a common mechanism used in many machines, including car engines. It converts the rotational motion of the cam to a translational motion in the follower. This website shows some examples: https://www.creativemechanisms.com/blog/common-mechanisms-explained-with-animation.-part-1. This project requires you to write a program in Python for designing disc cams. A cam system has two main components: the cam and the roller follower, with the follower always in contact with the circumference of the cam. Its shape (also called profile) is a smooth closed curve determined by the motion of the follower. This motion is periodic, repeated over a revolution of the cam, with three basic parts: rise, dwell and return, which you can observe in the animation in the above website. Rise is where the follower goes up, dwell is where it remains stationery and return is where it falls. The follower motion is defined in a displacement graph, as shown in Figure 1. The dwell is a horizontal straight line in the displacement graph, the rise and return curves are smooth mathematical curves that connect tangentially with the dwell line at their end points. For different dynamic behaviours, the rise and fall curves may take different forms. The mathematical formulae of the curves are given in Appendix 1. Figure 2 shows a cam with its constituting elements. There is always a base circle whose circumference provides the lowest position for the follower. The pitch circle is the circle on which the centre of the follower lies at this lowest position. As the cam rotates, this follower centre traces out the pitch curve, which is basically the displacement curve wrapped around the pitch circle. The cam profile is formed by offsetting the pitch curve by the radius of the follower in the direction perpendicular to the pitch curve towards the centre of the cam. Therefore, this profile is dependent on three things: the radius of the base circle, the displacement curve and the radius of the follower. The mathematical formulae for the cam profile are given in Appendix 2. Figure 2: A cam with its elements. The pitch curve is the curve traced by the centre of the follower whose displacement is the desired displacement. Figure 1: Displacement graph; α, β, γ are the angles at which one motion changes to another https://www.creativemechanisms.com/blog/common-mechanisms-explained-with-animation.-part-1 2 The Program You are to write a program for designing disc cams. Your program should do the following: i. Obtain inputs from the user for defining the displacement curve over one revolution of the cam. This requires the number of motion segments, the angular range for each segment, and the type of motion for each segment. Note that the number of segments is variable. ii. Display the displacement graph. iii. Obtain inputs from the user for the radius of the base circle and the radius of the follower. iv. Generate the cam profile, display it together with the base circle and the follower. Your display only needs to be in 2D. v. (Optional) Create an animation showing the cam in rotation with the follower moving accordingly. To create the animation, you also need the speed of rotation of the cam. vi. For testing purposes, you need to provide a data file that contains the input data required for the definition of a cam system. When the data is read in by your program, the displacement curve and the cam system are displayed. vii. Provide at least four sets of test data in your file. Make sure that upon the execution with one set of data, your program pauses for the user to examine the output. Only upon a user command that the program moves on to the next set of data. Here are some points you should note: i. The size of a cam depends on the radius of the base circle and the maximum follower displacement. They can be any size. But as a rough guide, the maximum displacement should be no more than the diameter of the base circle. ii. The number of motion segments is variable, but typically no more than six. iii. Your screen size is fixed, but your cam size is variable. Therefore, you should scale your display such that the graph and the cam fit nicely in the display window. iv. You may choose to have the displacement graph and the cam displayed side by side in the same window or in separate windows. v. Your display should be properly annotated, especially the graph. The axes should have tick marks marking the values in incremental steps and correctly labelled. 3. Resources The main extra resource that you will need for this project is for the graphical display, for which you need the graphics library provided with Python, called Turtle. Turtle capabilities and functions are described fully in Section 24.1 of the Python documentation, which you can access via the IDLE interactive shell by clicking Help > Python Docs and then search for “Turtle”. Appendix 3 provides some guidance on the use of Turtle. 4. Prohibitions Apart from the graphics library, everything you need for this project can be done through what you have learnt in this course. To allow you to exercise what you have learned and to prevent you from veering wildly beyond the scope of this project, your program should: i. Not use the class construct to define objects you require in your program ii. Only use the Turtle library for graphics. You cannot use tkinter or matplotlib. iii. Not use the library numpy. You may use the standard Python libraries like math. 5. Submission You need to submit the following: i. A working Python program that gets the relevant inputs from the user or from a file and displays the displacement graph and the resulting cam. ii. A data file containing the required data for four different cams which your program can read. iii. A report in a Word file, providing • A guide on how to run your program 3 • Pictures of your graphics window, with displays of the displacement curve and the resulting cam, together with the input data for generating the cam. You should provide pictures for at least two different cams. • Highlights of the key strengths and limitations of the program. The deadline for project submission is 23:59 hours, Friday 12 November. Please submit all your files through the course site using the same link to the project file. 6. Grading Rubrics Here are what the graders will be looking for when grading: i. The quality and correctness of the outputs, especially the graphics display. ii. The ease in interacting with the program, which includes specifying the input data and working with the input files. iii. The quality and correctness of your program, which includes: • How easy it is to read and understand your program. This means your program should be adequately commented with good choice of variable and function names. • Modularisation of the program including appropriate use of functions. • The design of the functions which include the appropriateness of parameters in the functions. 7. Epilogue You should start working on the program immediately. Do not wait till the last week. What you produce depends on the time you spend on the project and your ability in creating good algorithms and writing good code. This is an individual project. You may consult the tutors and discuss with your classmates, but everyone must write their own program. Any programs deemed to have been copies of each other will be penalised heavily, regardless of who is doing the copying. If in doubt or in difficulty, always ask. And ask early! There is a great deal more to the science and engineering of cams than what you are required to do in this project. We have trimmed the project requirements so that it is doable for a first-year engineering computing project. For more information on cams, you may refer to books on engineering mechanisms, such as Mechanisms and Mechanical Devices Sourcebook by Sclater and Chironis. 4 Appendix 1: Displacement curves The follower displacement, y, is a function of the angle of rotation of the cam, θ. Hence, y = f(θ), 0 ≤ θ < 2π="" (1)="" for="" the="" displacement="" curve,="" the="" 2π="" range="" is="" divided="" into="" consecutive="" segments="" with="" each="" segment="" between="" two="" angles="" thus:="" θi1="" ≤="" θ="">< θi2, i = 1 … n, where n is the number of segments, θi2 = θ(i+1)1, θ11 = 0 and θn2 = 2π. there are three different types of motion: rise, dwell and return, each with its own curve type on the displacement graph. the dwell curve on the displacement graph is a horizontal straight line. for rise and return, there are different choices of curve depending on the dynamic characteristics the designer wishes to achieve with the cam. for this project, we limit the choices to three: constant acceleration, simple harmonic and cycloidal. 1.1 constant acceleration this is a polynomial curve that ensures that the acceleration of the follower is constant. the plot of the curve over its period is shown in figure 3. θi2,="" i="1" …="" n,="" where="" n="" is="" the="" number="" of="" segments,="" θi2="θ(i+1)1," θ11="0" and="" θn2="2π." there="" are="" three="" different="" types="" of="" motion:="" rise,="" dwell="" and="" return,="" each="" with="" its="" own="" curve="" type="" on="" the="" displacement="" graph.="" the="" dwell="" curve="" on="" the="" displacement="" graph="" is="" a="" horizontal="" straight="" line.="" for="" rise="" and="" return,="" there="" are="" different="" choices="" of="" curve="" depending="" on="" the="" dynamic="" characteristics="" the="" designer="" wishes="" to="" achieve="" with="" the="" cam.="" for="" this="" project,="" we="" limit="" the="" choices="" to="" three:="" constant="" acceleration,="" simple="" harmonic="" and="" cycloidal.="" 1.1="" constant="" acceleration="" this="" is="" a="" polynomial="" curve="" that="" ensures="" that="" the="" acceleration="" of="" the="" follower="" is="" constant.="" the="" plot="" of="" the="" curve="" over="" its="" period="" is="" shown="" in="" figure="">
Answered 6 days AfterOct 24, 2021

Answer To: 1 MA1008 Introduction to Computational Thinking Mini Project: A Cam Design System Semester 1, AY...

Sathishkumar answered on Oct 31 2021
111 Votes
Solution/disp_set1.py
import math
def displacement1():
beta1=int(input('Enter rise angle'))
dwell1=int(input('Enter dwell angle'))
beta2=int(input('Enter return angle'))
dwell2=int(input('Enter dwell angle'))
if (dwell1+beta1+beta2)>360:
print('Angle exceeds 360!
')
else:
h=int(input("Enter h value:"))
target_motion=int(input('''Enter the type of angular motion:
1-> Constant Acceleration,
2-> Simple harmonic Motion,
3-> Cycloidal Motion: '''))
pi2=360
pi=math.pi
b1=int(beta1/2)
b2=int(beta2/2)
y=[]
x=[]
if target_motion==1:
for i in range(0,b1):
y_e=2*h*((i/beta1)**2)
y.append(y_e)
x.append(i)

for i in range(b1,beta1):
y_e=h*(1-2*(1-i/beta1)**2)
y.append(y_e)
x.append(i)

for i in range(beta1,beta1+dwell1):
y_e=h
y.append(y_e)
x.append(i)
for i in range(0,b2):
y_e=h*(1-2*(i/beta2)**2)
y.append(y_e)
x.append(i+beta1+dwell1)
for i in range(b2,beta2):
y_e=2*h*((1-i/beta2)**2)
y.append(y_e)
x.append(i+(beta1+dwell1))
l=i+(beta1+dwell1)

if i!=pi:
for i in range(l,pi2):
y_e=0
y.append(y_e)
x.append(i)

if target_motion==2:
for i in range(0,beta1):
y_e=(h*(1-math.cos((pi*i)/beta1)))/2
y.append(y_e)
x.append(i)
for i in range(beta1,beta1+dwell1):
y_e=h
y.append(y_e)
x.append(i)

for i in range(0,beta2):
y_e=(h*(1+math.cos((pi*i)/beta2)))/2
y.append(y_e)
x.append(i+beta1+dwell1)
l=i+(beta1+dwell1)
if i!=pi:
for i in range(l,pi2):
y_e=0
y.append(y_e)
x.append(i)
if target_motion==3:
for i in range(0,beta1):

u=((i/beta1)-math.sin((pi2*i)/beta1)/pi2)
y_e=h*u
y.append(y_e)
x.append(i)

for i in range(beta1,beta1+dwell1):
y_e=h
y.append(y_e)
x.append(i)

for i in range(0,beta2):
u=((1-(i/beta2))+math.sin((pi2*i)/beta2)/pi2)
y_e=h*u
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here