import math
# Variables
Force = 180 #in N #horizontal force
theta = 30 #in degrees #angle of inclination
distance = 12 #in m #distance moved by block along inclined plane.
# Calculations and Results
Work = Force * (distance * math.cos(math.radians(theta))) #in J # Work done
Work = 0.001 * Work # Work done in KJ
print "Work done by block = %.4f KJ"%(Work);
# Variables
mass_body = 2 #in kg #mass of body
L = 5 #in m #vertical distance
g = 9.8 #in m/s**2 #acceleration due to gravity
# Calculations and Results
Work_done_by_agent = mass_body * g * L #in Nm #work done by agent
Work_done_by_body = -1*Work_done_by_agent
print "Work done by agent = %.0f Nm"%(Work_done_by_agent);
print "Work done by body = %.0f Nm"%(Work_done_by_body);
import math
from scipy.integrate import quad
# Variables
p1 = 1.5 * 10**(5) #N/m**2 #initial pressure in ballon
d1 = 0.25 #m #initial diameter of balloon
d2 = 0.3 #m #final diameter of balloon
p_atm = 10**(5) #N/m**2 #atmospheric pressure
# Calculations and Results
#Part (a)
print "Part a";
print "As p is proportional to d, p = k*d, where k is proportionality constant"
print "Therefore,";
k = p1/d1;
print "p1 = k*d1 => k = p1/d1 = %.2f/%.2f) = %.1e N/m**3"%(p1,d1,k);
p2 = k*d2; #N/m**2 #final pressure in balloon
print "p2 = k*d2 = %.2f*%.2f) = %.1e N/m**2"%(k,d2,p2);
def f0(d):
return k*(math.pi/2)*(d**3)
W_air = quad(f0,d1,d2)[0]
print "Work done by balloon on air = %.0f Nm"%(W_air);
#Part (b)
print "Part b";
def f1(d):
return p_atm*(0.5*math.pi*(d**2))
W_atm = quad(f1,d2,d1)[0]
print "Work done by atmosphere on balloon = %.2f Nm"%(W_atm);
W_balloon = -1*(W_air+W_atm);
print "Work done by balloon = -Work done by air + Work done by atmosphere = -%.0f %.0f = %.0f Nm"%(W_air,W_atm,W_balloon);
import math
# Variables
p1 = 10 #bar #initial pressure
V1 = 0.1 #m**3 #initial volume
p2 = 2 #bar #final pressure
V2 = 0.35 #m**3 #final volume
# Calculations and Results
print "Let the expansion process follow the path pV**n = constant";
print "Therefore "
n = (math.log(p1/p2))/(math.log(V2/V1));
print "n = lnp1/p2/lnV2/V1 = ln%.2f/%.2f/ln %.2f/%.2f = %.4f"%(p1,p2,V2,V1,n);
W_d = (p1*V1 - p2*V2)*10**5/(n-1) #J #Work interaction for pure substance
print "Work interaction for pure substance = p1V1 - p2V2)/n-1) = %.2f kJ"%(W_d*.001)
import math
# Variables
p1 = 1.0 #bar #initial pressure
V1 = 0.1 #m**3 #initial volume
p2 = 6 #bar #final pressure
#and p1*(V1**1.4) = p2*(V2**1.4)
# Calculations and Results
#Part (a)
print "Part a";
V2 = V1*(p1/p2)**(1/1.4) #m**3 #final volume
print "Final Volume = %.4f m**3"%(V2);
W_d = (10**5)*(p1*V1 - p2*V2)/(1.4-1); #J #Work of compression for air
print "Work of compression for air = %.1f KJ"%(W_d*.001);
#Part (b)
print "Part b";
V2 = (p1/p2)*V1; #m**3 #final volume
print "Final Volume = %.4f m**3"%(V2);
W_d = (10**5)*p1*V1*math.log(V2/V1); #J #Work done on air
print "Work done on air = %.1f KJ"%(W_d*.001);
import math
# Variables
#four-stroke engine
x = 3. #number of cylinders
y = 1. #engine is math.single-acting
n = 500. #rev/min
N = n/2 #cycles/min
D = 0.075 #m #bore length
L = 0.1 #m #stroke length
a = 6.*10**(-4) #m**2 #area
l = 0.05 #m #length
S = 2.*10**8 #N/m**3 #spring constant
# Calculations and Results
p_m = (a/l)*S #Pa #mep
print "Mean effective pressure, mep{Pm} = %.2f kPa"%(p_m*.001)
A = (math.pi/4)*D**2 #m**2
print "Indicated power{P_ind} = %.2f kW"%(x*y*p_m*L*A*N/60000)
import math
from numpy import *
# Variables
N = poly1d([.5,0]) #n is engine speed
x = 6 #six cylinders
y = 1 #assumed
d = 0.1 #m #bore length
A = math.pi*(0.1)**2/4 #m**2 #Area
L = 0.15 #m #stroke length
P_shaft = 24.78 #KW #Power of shaft
T = 474.9 #Nm #Torque in the crank shaft
l = 0.05 #m #length of indicator diagram
a = 9.37*10**(-4) #cm**2 #area of indicator diagram
S = 0.5*(10**8) #N/m**3 #spring constant
# Calculations and Results
p_m = a*S/l #mean pressure difference
print "Mean pressure difference = %.2f N/m**2"%(p_m);
P_ind = (x*y)*p_m*(L*A*N/60000) #indicated power
#C = coeff(P_ind)
C = poly(P_ind)
print "Indicated Power = %.6f n kW"%(C[1])
P_shaft = 2*math.pi*poly([1,0])*T/60000 #shaft power output
print "Shaft power output in KW)= %.5f n kW"%(P_shaft[0])
#Mechanical_efficiency = poly(P_shaft,1)/coeff(P_ind,1)*100
Mechanical_efficiency = poly(P_shaft[1])/poly(P_ind[1])*100
print "Mechanical Efficiency = %.0f %%"%(-Mechanical_efficiency[1])
import math
# Variables
d = 0.4 #m #cylinder diameter
t = 10. #min #Time taken for stirring
L = 0.49 #m #distance moved by the piston
p_atm = 1. #bar #atmospheric pressure
W_net = -1965. #Nm #net work done
n = 750. #rev/min #rotational velocity of electric motor
I = 0.9 #A #current
V = 24. #V #voltage
# Calculations and Results
#Part(a)
print "Part a";
W_d = 10**5*p_atm * (math.pi/4) * d**2 * L; #Nm #work done by fluid on piston
print "Work done by fluid on the piston = %.1f Nm"%(W_d);
W_str = W_net - W_d; #Nm #Work done by stirrer
print "Work done by stirrer on the fluid = %.1f Nm"%(W_str);
P_shaft = abs(W_str)/(t*60); #W #shaft power output
print "Shaft power output = %.2f W"%(P_shaft);
T = (P_shaft*60)/(2*math.pi*n); #Nm #Torque in the driving shaft
print "Torque in the driving shaft = %.3f Nm"%( T);
#Part(b)
print "Part b";
W_bat = I*V*t*60; #Nm #work done by battery
print "Work done by battery = %.1f Nm"%(W_bat);
W_motor = -1*(W_bat+W_str) #Nm #work done by motor
print "Work done by motor = %.1f Nm"%(W_motor);