#Input data
d=0.08 #The diameter of bore in m
L=0.075 #The length of the stroke in m
l=0.152 #The connecting rod length in m
h=0.062 #Skirt length of the piston in m
Fr=8000 #Compressive force in the connecting rod in N
p=3000 #The pressure in the cylinder kPa
y=0.004*10**-3 #The clearence between piston and cylinder wall in m
U=0.006 #The dynamic viscosity of the lubricating oil in pa.s
u=8.2 #The piston speed in m/s
#Calculations
import math
ts=(U*u)/y #The shear stress in N/m**2
A=pi*d*h #Contact area between the piston and the cylinder in m**2
Ff=ts*A #Friction force on the piston inN
r=L/2.0 #Crank length in m
A=math.atan(r/l) #The angle made by the crank in radians
Ft=Fr*sin(A) #The side thrust in N
#Output
print"The friction force on the piston ",round(Ff,0),"N"
print"The thrust force on the cylinder wall is",round(Ft,0),"N"
#Input data
d=0.065 #The cylinder bore diameter in m
L=6.0 #The length of the stroke in cm
l=12.0 #The length of the connecting rod in cm
p=50.0 #The pressure in the cylinder in bar
q=90.0 #The crank position in power stroke of the cycle for one cylinder in degrees
Ff=900.0 #Friction force in N
o=0.2 #Wrist pin off set in cm
#Calculations
r=L/2.0 #The crank length in cm
sineA=r/l
cosA=(1-(sineA)**2)**(1/2.0)
Fr=(((p*10**5*(pi/4.0)*d**2)-Ff)/cosA)/1000.0
Ft=Fr*sineA #The side thrust on the piston in kN
sineA1=(r-o)/l #The value of sine
cosA1=(1-(sineA1)**2)**(1/2.0)
Fr1=(((p*10**5*(pi/4.0)*d**2)-Ff)/cosA1)/1000.0
Ft1=Fr1*sineA1 #The side thrust in kN
#Output
print"(a) The force in the connecting rod ",round(Fr,3)," kN"
print"The side thrust on the piston =",round(Ft,2),"kN"
print"(b) The side thrust on the piston =",round(Ft1,3)," kN"