import math
print('MACHINE DESIGN \n Timothy H. Wentzell, P.E. \n EXAMPLE-2.1 Page 26 ')
##Example 2.1
T=1080.*12.; ##[in*lb] Torque in axle
d=30.; ##[in] Diameter of tire
F=T/(d/2.); ##[lb] Force exerted on the road surface
print'%s %.2f %s '%('\n\n The tire exerts ',F,'lb force on the road surface');
import math
print('MACHINE DESIGN \n Timothy H. Wentzell, P.E. \n EXAMPLE-2.2 Page 28 ')
##Example 2.2
G=3.6; ##Diffential ratio
N=3500./G; ##[rpm] Axle rotational speed
d=30.; ##[in] Diameter of tire
dist=N/(60.)*(math.pi*d) ##[in] Distance traveled in 1 sec
dist=dist/12.; ##[ft] Distance traveled in 1 sec
t=1.; ##[sec] Time period
F=864.; ##[lb] Force exerted by tire on road surface
W=F*dist; ##[ft*lb] Workdone in 1 sec
P=F*dist/t; ##[ft*lb/sec] Power
hp=P/550.; ##[hp] Power in horse power 1hp=550 ft*lb/sec
print'%s %.2f %s '%('\n\n Power to do work ',hp,' hp');
##Comparing it to motor output:
Tm=300.*12.; ##[in*lb] Engine torque
Nm=3500.; ##[rpm] Engine speed
Pm=Tm*Nm/63000.;
print'%s %.2f %s '%('\n Motor output ',Pm,' hp');
print('\n The power output equaled the power at tire/road surface.');
##Note: The deviation of answer from the answer given in the book is due to round off error.(In the book values are rounded while in scilab actual values are taken)
import math
print('MACHINE DESIGN \n Timothy H. Wentzell, P.E. \n EXAMPLE-2.3 Page 29 ')
##Example 2.3
T=300.*12.; ##[in*lb] Engine torque
d=8.; ##[in] Crankshaft effective diameter
F=T/(d/2.); ##[lb] Force exerted by piston
A=math.pi*(2**2.)/4.; ##[in^2] Area of cross section of piston
P=F/A; ##[lb/in^2] Pressure in cylinder
print'%s %.2f %s '%('\n\n Pressure inside cylinder ',P,' lb/in^2');