#Given values
m=10;#mass in lbm
Po=60;#steam oressure in psia
T1=320;#intial temp in F
T2=400;#final temp in F
#from Table A–6E
v1=7.4863;#at 60 psia and 320 F
v2=8.3548;#at 60 psia and 400 F
#calculations
#W = P dV which on integrating gives W = m * P * (V2 - V1)
W=m*Po*(v2-v1)/5.404;#coverting into Btu from psia-ft^3
print'work done by the steam during this process %f Btu'%round(W,1)
from math import log
#given data
P1=100;#pressure in kPa
V1=0.4;#intial vol in m^3
V2=0.1;#final vol in m^3
#calculations
#for isothermal W = P1*V1* ln(V2/V1)
W=P1*V1*log(V2/V1);
print'the work done during this process %f kJ'%round(W,1)
#given data
V1=0.05;#Volumne of gas in m^3
P1=200;#Pressure in kPa
k=150;#Spring constant in kN/m
A=0.25;#Cross-sectional area in m^2
#calculations
#Part - a
V2=2*V1;
x2=(V2-V1)/A;#printlacement of spring
F=k*x2;#compression force
P2=P1+F/A;#additional pressure is equivalent the compression of spring
print'the final pressure inside the cylinder %i kPa'%P2;
#Part - b
#work done is equivalent to the area of the P-V curve of Fig 4-10
W=(P1+P2)/2*(V2-V1);#area of trapezoid = 1/2 * sum of parallel sides * dist. b/w them
print'the total work done by the gas %i kJ'%W;
#Part - c
x1=0;#intial compression of spring
Wsp=0.5*k*(x2**2-x1**2);
print'the fraction of this work done against the spring to compress it %i kJ'%Wsp
#given values
m=0.025;#mass of saturated water vapor in kg
V=120;#rated voltage of heater in V
I=0.2;#rated current in A
t=300;#total time taken in sec
P1=300;#constant pressure in kPa
Qout=3.7;#heat lost in kJ
#from Table A–5
#at P1 the conditon is sat. vap
h1=2724.9;
#Calculations
#Part - a
#therotical proving
#Part - b
We=V*I*t/1000;#electrical work in kJ
#from eqn 4 -18 i.e derived in earler part
#it states it Ein - Eout = Esystem
# it applies as Win - Qout = H = m (h2 - h1)
h2=(We-Qout)/m+h1;
##from Table A–5
#at h2 we get
P2=300;
T=200;
print'the final temperature of the steam %i C'%T
#given data
m=5.0;#mass of water in kg
P1=200;#pressure on one side in kPa
T=25;#temperature in C
#from Table A–4
#the liq. is in compressed state at 200 kPa and 25 C
vf=0.001;
vg=43.340;
uf=104.83;
ufg=2304.3;
v1=vf;
u1=uf;
#calculations
#Part - a
V1=m*v1;
Vtank=2*V1;
print'the volume of the tank %f m^3'%round(Vtank,2);
#Part - b
V2=Vtank;
v2=V2/m;
#from Table A–4
# at T=25 vf=0.101003 m^3/kg and vg=43.340 m^3/kg
# vf<v2<vg therefore it is saturated liquid–vapor mixture
P2=3.1698;
print'the final pressure %f kPa'%round(P2,4);
#Part - c
#Ein - Eout = Esystem
#Qin= dU = m(u2 - u1)
x2=(v2-vf)/(vg-vf);
u2=uf+x2*ufg;
Qin=m*(u2-u1);
print'the heat transfer for this process %f kJ'%Qin
import math
from scipy.integrate import quad
from pylab import *
#given data
T1=300;#intial temp of air in K
P=200;#pressure in kPa
T2=600;#final temp in K
M=28.97;#molecular weight in kg/kmol
Ru=8.314;
#Part - a
#from Table A–17
u1=214.07;
u2=434.78;
du=u2-u1;#change in internal energy
print'change in internal energy from data from the air table %f kJ/kg'%round(du,2);
#Part - b
#from Table A–2c
a=28.11;
b=0.1967*10**-2;
c=0.4802*10**-5;
d=-1.966*10**-9;
# by equation Cp(T)=a+bT+cT^2+dT^3
def intgrnd1(T):
return ((a-Ru)+b*T+c*T**2+d*T**3)
dU, err = quad(intgrnd1, T1, T2)
du=dU/M;
print'change in internal energy the functional form of the specific heat %f kJ/kg'%round(du,1);
#Part - c
#from Table A–2b
Cavg=0.733;
du=Cavg*(T2-T1);
print'change in internal energy the functional form the average specific heat value %i kJ/kg'%round(du,0);
#given data
m=1.5;#mass in lbm
T1=80;#temperature in F
P1=50;#pressure in psia
W=0.02;#power rating in hp
t=30.0/60;#converting into hrs from min
#from Table A–2Ea
Cv=0.753;
#calculations
#part a
Wsh=W*t*2545;#in Btu
#Ein - Eout = Esystem
#Wsh = dU = m (u2 - u1) = m * Cv * (T2 - T1)
T2= Wsh/(m*Cv)+T1;
print'the final temperature %f F'%round(T2,1);
#part b
#using ideal gas eqn
# P1 * V1 / T1 = P2 * T2 /V2
P2= 50 * (T2 +460)/ (T1+460);
# temp should in R therefore + 460
print'the final pressure %f psia'%round(P2,1)
#given data
V1=0.5;#volumne of nitrogen gas in m^3
P=400;#pressure in kPa
T1=27;#temp in C
I=2;#rated current in A
t=5*60;#converting into s from min
V=120;#rated voltage in V
Qout=2800/1000;#in kJ
R=0.297;
#from Table A–2a
Cp=1.039;
#calculations
P1=P;
We=V*I*t/1000;#in kJ
m=P1*V1/(R*(T1+273));
#Ein - Eout = Esystem
# We,in - Qout = dH = m (h2 - h1) = m * Cp * (T2 - T1)
T2=(We-Qout)/(m*Cp)+T1;
print'the final temperature of nitrogen in %i C'%T2
#given data
P1=150;#initially air pressure in kPa
P2=350;#final pressure in kPa
T1=27+273;#temperatuere in K
V1=400.0/1000;#volumne in m^3
R=0.287;
#from Table A–17
u1=214.07;
u2=1113.52;
#calculations
#part a
V2=2*V1;
#using ideal gas eqn
# P1 * V1 / T1 = P2 * T2 /V2
T2=P2*V2*T1/(P1*V1);
print'the final temperature %i K'%T2;
#part b
# Work done is Pdv
W=P2*(V2-V1);
print'the work done by the air %i kJ'%W;
#part c
#Ein - Eout = Esystem
#Qin - Wout = dU = m(u2 - u1)
m= P1* V1 /(T1 * R);
Q= m*(u2 - u1)+ W;
print'the total heat transferred to the air %i kJ'%round(Q)
#given data
T=100;#twmperature of liquid water in C
P=15;#pressure in MPa
#from Table A–7
#at P=15 mPa and T = 100 C
hg=430.39;
hf=419.17
vf=0.001;
Psat=101.42;#in kPa
#calculations
#part a
h=hg;
print'enthalpy of liquid water by using compressed liquid tables %f kJ/kg'%round(h,2);
#part b
#Approximating the compressed liquid as a saturated liquid at 100°C
h=hf;
print'enthalpy of liquid water by approximating it as a saturated liquid %f kJ/kg'%round(h,2);
#part c
h=hf + vf*(P*1000 - Psat );
print'enthalpy of liquid water by using the correction given by Eq. 4–38 %f kJ/kg'%round(h,2);
#suffix i for iron
#suffix w for water
#given data
mi=50;#mass in Kg
T1i=80;#temperature in C
Vw=0.5;#volumne in m^3
T1w=25;#temperature in C
v=0.001;#specific volume of liquid water at or about room temperature
#from Table A–3
ci=0.45;
cw=4.18;
#calculations
mw=Vw/v;
#Ein - Eout = Esystem
# du = 0 i.e (mcdT)iron + (mcdT)water = 0
# mi * ci * (T - T1i) + mw *cw * (T-T1w)
#on rearranging above equn
T= (mi*ci*T1i + mw*cw*T1w)/(mi*ci+mw*cw);
print'the temperature when thermal equilibrium is reached %f C'%round(T,1)
from math import sqrt
#given data
maf=0.15;#mass of affected tissue in kg
caf=3.8;#specific heat of the tissue in kJ/Kg C
dTaf=1.8;#suffix af for affected tissue
mh=1.2;#suffix h for hand ; mass of hand in kg
#calculations
#Ein - Eout = Esystem
#dUaffected tissue - KEhand = 0
#from above equation we can deduce that
Vhand= sqrt(2*maf*caf*dTaf*1000/mh);#for conversion factor mutiplying by 1000 to get m^2/s^2
print'the velocity of the hand just before impact %f m/s'%round(Vhand,1);
#given data
m=90;#mass of man in kg
#from Tables 4–1 and 4–2
Ehb=275;#hamburger
Ef=250;#fries
Ec=87;#cola
#calculation
#part a
Ein=2*Ehb+Ef+Ec;
#The rate of energy output for a 68-kg man watching TV is to be 72 Calories/h
Eout=m*72.0/68;
t=Ein/Eout;
print'by watching TV %f hours'%round(t,1);
#part b
#The rate of energy output for a 68-kg man watching TV is to be 860 Calories/h
Eout=m*860.0/68;
t=Ein/Eout*60#converting in min
t=ceil(t);
print'by fast swimming %f mins'%t;
#for last question
print('answers be for a 45-kg man energy takes twice as long in each case');
#given data
E=75;#in Cal/day
#calculation
Ereduced=E*365.0;
#The metabolizable energy content of 1 kg of body fat is 33,100 kJ
Ec=33100.0;
mfat=Ereduced/Ec*4.1868;
print'weight this person will lose in one year %f kg'%round(mfat,2)