In [23]:

```
from __future__ import division
d_m = 5500 # cost of direct material in Rs
d_l = 3000 # manufacturing wages in Rs
# factory overhead is 100% 0f manufacturing wages
f_o = (100*d_l)/100 # factory overheads in Rs
FC = d_m + d_l + f_o # factory cost in Rs
nm_o = 15*FC/100 # non-manufacturing overheads in Rs
tc = FC+nm_o # total cost in Rs
p = 12*tc/100 # profit in Rs
sp = tc+p # selling price in Rs
print " Total cost = Rs %d\n Selling price = Rs %d"%(tc,sp)
```

In [24]:

```
# given
OS_RM = 20000 # opening stock of raw materials in Rs
CS_RM = 30000 # closing stock of raw materials in Rs
TP_RM = 170000 # total purchase in year in Rs
OS_FG = 10000 # opening stock of finished goods in Rs
CS_FG = 15000 # closing stock of finished goods in Rs
sales = 489500 # sales of finished goods in Rs
D_W = 120000 # direct wages in Rs
F_E1 = 120000 # factory expenses in Rs
NM_E = 50000 # non-manufacturing expenses in Rs
DMC = OS_RM + TP_RM - CS_RM # direct material cost
FC = DMC + D_W + F_E1 # factory cost
TC = FC + NM_E # total cost
FG_S = OS_FG + TC - CS_FG # cost of finished goods sold in Rs
P = sales - FG_S # profit in Rs
F_E2 = (F_E1)/D_W*100 # factory expenses in percent
NM_C = (NM_E)/FC*100 # non-manufacturing expenses to factory cost
P_C = (P/FG_S)*100 # profit to cost of sales
dm = 20000 # direct material in Rs
dw = 30000 # direct wages in Rs
fe = dw # factory expenses
fc = dm+dw+fe # factory cost in Rs
nme = NM_C*fc/100 # non-manufacturing expenses in Rs
tc = fc+nme # total cost in Rs
p = (P_C*tc)/100 # profit in Rs
sp = tc+p # selling price in Rs
print "Selling price = Rs %d"%(sp)
```

In [25]:

```
from math import pi
d = 38 # diameter of bar in mm
l = 25 # length of bar in mm
p = 8.6 # density gm/cm**3
g = 9.81 # acceleration due to gravity in m/s**2
w = (pi*d**2*l*p*g)/(4*10**6) # weight of material in N
mc = w*1.625 # material cost in Rs
lc = (2*90)/60 # labour cost in Rs
fo = 0.5*lc # factory overheads in Rs
fc = mc + lc + fo # factory cost in Rs
print "factory cost = Rs %0.2f "%fc
# Answers vary due to round off error
```

In [26]:

```
sp = 65 # selling price in Rs
profit = 0.2*sp # profit in Rs
tc = sp - profit # total cost in Rs
P = (sp - profit)/1.4 # production cost in Rs
DM = 15 # cost of direct material in Rs
W = (P - DM)/ 1.4 # direct labour cost in Rs
tt = W/2 # time taken in hours
print "Time taken = %0.3f Hours"%(tt )
# Answers vary due to round off error
```

In [27]:

```
mp = 6000 # market price of machine in Rs
d = 0.2*mp # discount in Rs
sp = mp - d # selling price of factory in Rs
mc = 400 # material cost in Rs
lc = 1600 # labour cost in Rs
fo = 800 # factory overheads in Rs
F = mc + lc + fo # factory cost in Rs
se = 0.5*F # selling expenses in Rs
profit = sp - (F + se ) # Rs
print "profit = Rs %d"%(profit)
```

In [28]:

```
from math import sqrt
a = 1500 # requirements of components
s = 30 # cost of each set up in Rs
k = 0.2 # charge factor
c = 5 # cost of each part in Rs
N = 5*sqrt(a*s)/(k*c) # economic lot size
print "Economic lot size = %d pieces"%(N)
S = (N*s)/a # time for each set up in hours
print "Time for each set up = %0.2f hours"%(S )
# Answers vary due to round off error
```

In [29]:

```
Tc = 2 # time taken by cutter per cycle in minutes
Tk = 10 # time taken to change cutter in minutes
T = 240 # tool life in minutes
t = (Tc*Tk)/T # time to change the cutter in min.
print "Unit time to change the cutter = %0.3f min"%(t )
# Error in textbook
```

In [30]:

```
Tk = 360 # time taken by tool to cut before sharpening in min.
Tc = 20 # time taken to change the tool in min.
T = 4320 # time taken before it is discarded in min.
t = (Tc*Tk)/T # tool change time per cycle in min.
print "Unit tool change time per cycle = %0.2f min"%(t )
```

In [31]:

```
Tc = 10 # time taken to check hole in secs
F = 2 # frequency of checking dimension
tc = Tc*F # time taken to check one piece in secs
N = 200 # number of pieces
Tc = tc*(N + 1) # Total time in sec
print "Total time taken to check dimensions = %d min"%(Tc/60)
```

In [32]:

```
forgings = 40
setup = 4
Tc = 12 # machining time in min. per forging
nmt = 21 # non-machining in min. per forging
st = 45 # set up time per set up
ts = 5 # total sharpening in min. per forging
f = 20 # fatigue in percent
f = f/100
pn = 5 # personal needs in percent
pn = pn/100
Tk = 10 # tool chanhe time in min.
T = 8 # tool life in hours
ct = 15 # checking time with 5 checks in 15 secs
R = 1.4 # performance factor
dlc = 5 # direct labour cost in Rs per hour
tt = Tc+nmt # machining and non-machining time in min.
ft = f*tt # fatigue time in min.
pnt = pn*tt # personal needs in min.
t = (Tc*Tk)/(T*60) # total sharpening time in min. per forging
mct = (ts*ct)/60 # measuring and checking time in min.per forging
su = Tc + nmt+ pnt + ft + t + mct # sum of times in min.
tf = su*forgings # time for 40 forgings in min.
tst = st*setup # total set up time in min.
Te = tf+tst # total estimated time in min.
Ta = Te*R # total actual time in min.
lc = (Ta*dlc)/60 # direct labour cost in Rs
print "Direct labour cost = Rs %0.1f"%(lc)
```

In [33]:

```
# from figure 4.4
v = 100 # cutting speed in m/min
D = 50 # mm
l1 = 76 # mm
f = 7.5 # feed in mm/rev.
# Case 1 , time to turn 38 mm diameter by 76 mm length of cut
N1 = (1000*v)/(pi*D)# r.p.m
tm1 = l1*10/(f*N1) # min.
# Case 2 , time to turn 25 mm by 38 mm length
N2 = (1000*v)/(pi*38) # r.p.m
l2 = 38 # mm
tm2 = l2*10/(f*N2) # min
tt = tm1 + tm2 # total time in min
print "Total time = %0.2f min."%(tt)
```

In [34]:

```
# from figure 4.5
v = 60 # cutting speed m/min.
f = 0.375 # feed in mm/rev
D = 38 # mm
N = (1000*60)/(pi*D) # rev/min
l = 32 # mm
Tm = l/(f*N) # min
print "Time to turn external relief = %0.2f min."%(Tm )
```

In [35]:

```
from math import pi
# from figure 4.11
l = 7.5 # cm
Dave = (25+ 10)/2 # average diameter in cm
v = 27 # cutting speed in m/min
f = 0.8 # feed in mm/rev
N = (1000*v)/(pi*Dave*10) # r.p.m.
tm = l*10/(f*N) # min.
print "The machining time to face on lathe = %0.2f min."%(tm)
```

In [36]:

```
from math import pi
D = 12.7 # diameter in mm
d = 50 # depth in mm
v = 75 # cutting speed in m/min.
f = 0.175 # feed in mm/rev
l = d + 2*0.29*D # lemgth of drill travel in mm
N = (1000*v)/(pi*D) # r.p.m.
tm = l/(f*N) # min
print "Time taken to drill hole = %0.3f min."%(tm)
```

In [37]:

```
k = 1/4 # return time to cutting ratio
l = 900 + 2*75 # length of stroke in mm
v = 6 # cutting stroke in m/min
f = 2 # feed mm/stroke
w = 600 # breadth in mm
N = (v*1000)/(l*1.25) # r.p.m
N = round(N)
time = w/(f*N) # min
print "Time required for shaper to complete one cut = %d min"%(time )
```

In [38]:

```
l = 70 # length of stroke in cm
cs = 11 # cutting speed in m/min
rs = 24 # return speed in m/min
tm = (l/(100*cs)) + (l/(100*rs)) # min
print "Time taken to broach a four spline brass = %0.4f min"%(tm)
# Answers vary due to round off error
```

In [39]:

```
from math import sqrt
v = 50 # cutting speed in m/min
D = 150 # diameter of face cutter in mm
N = (1000*v)/(pi*D) # r.p.m.
f = 0.25 # feed mm/tooth
n = 10 #number of tooth
tf = N*f*n # table feed in mm/min
l = 200 # length of work piece in mm
d = 25 # depth of slot in mm
tot = sqrt(D*d - d**2) # total overtravel in mm
tct = l + tot # total cutter travel in mm
time = tct/tf # min.
print " Table feed = %d mm/min. \n Total cutter travel = %0.1f mm\n Time required to machine the slot = %0.3f min."%(tf , tct ,time )
```

In [40]:

```
from math import sqrt
D = 63.5 # diameter of plain milling cutter in mm
w = 30 # width of block in mm
l = 180 # length of block in mm
f = 0.125 # feed in mm/tooth
n = 6 # no. of teeth
N = 1500 # spindle speed in r.p.m
tot = (D - sqrt(D**2 - w**2))/2 # total over travel in mm
tct = l + tot # total cutter travel in mm
Tm = tct/(f*n*N) # cutting time in min
print " Cutting time = %0.3f min."%(Tm)
# Answers vary due to round off error
```

In [41]:

```
from math import sqrt, pi
# from figure 4.17
d = 19 # depth of cut in mm
D1 = 5 # diameter of round bar in cm
v = 50 # cutting speed in m/min
n = 8 # number of teeth
f = 0.2 # feed in mm/tooth
l = 2*sqrt(d*D1*10 - d**2) # length of chord in mm
D2 = 10 # daimeter of cutter in cm
overrun = sqrt(D2*10*d+D1*10*d-d**2) - sqrt(D1*10*d-d**2)# mm
tt = l + overrun # table travel in mm
N = (1000*v)/(pi*D2*10) # r.p.m
tm = tt/(f*n*N) # time in min.
print "The milling time = %0.2f min."%(tm )
```

In [42]:

```
from math import pi
w = 50 # width of grinding wheep in mm
f = w/2 # feed in mm
t = 0.25 # toatal stock in mm
d = 0.025 # depth of cut in mm
n = t/d # number of cuts
v = 15 # cutting speed in m/min
D = 38 # diameter in mm
N = (1000*v)/(pi*D) # r.p.m.
l = 200 # length of part in mm
Tm = (l*10)/(f*N) # min.
print "Time required to grind the shaft = %0.2f min."%(Tm)
```

In [43]:

```
v = 6 # cutting speed in m/min
n = 5 # number of cuts
D = 44 # diameter in mm
N = (1000*v)/(pi*D) # r.p.m
f = 0.5 # feed in cm
l = 8.9 # length of cut in cm
Tm = (l*n)/(f*N) # time in min
print "Time to cut the threads = %0.2f min"%(Tm)
# Answers vary due to round off error
```

In [44]:

```
from math import pi
vt = 40 # cutting speed for turning in m/min
vs = 8 # cutting speed for cutting and knurling in m/min
ft = 0.4 # feed for turning in mm/rev.
ff = 0.2 # feed for forming in mm/rev
d1 = 25 # diameter in mm
l1 = 50 # mm
N1 = 1000*vt/(pi*d1) # spindle speed in rev./min.
time1 = l1/(ft*N1) # min.
tt = 2*time1 # total time in min.
d2 = 15 # mm
N2 = 1000*vt/(pi*d2)# rev/min.
l2 = 30 # mm
time2 = l2/(ft*N2) # min.
eft = 0.15 # end forming time in min.
d3 = 10 # mm
N3 = 1000*vs/(pi*d3) # rev./min.
l3 = 15 # mm
f = 1.5 # feed in min.
time3 = l3/(f*N3) # min.
N4 = 1000*vs/(pi*d1) # rev./min.
l4 = 10 # mm
time4 = l4/(ft*N4) # min.
time5 = 0.15 # time for chamfering in min.
Dave = d1/2 # mm
N5 = 1000*vt/(pi*Dave) # r.p.m.
time6 = Dave/(N5*ff) # min,
tmt = tt+time2+time3+time4+time5+time6+eft # total machining time in min.
t = 0.05 # min.
ht = time5+6*time6+4*t+3*t # handling time in min.
tot = ht+tmt # total handling time in min.
ct = 15*tot/100 # contingency in min.
tct = tot+ct # total cycle time in min.
st = 60 # set up time for turret lathe
p = 100 # total pieces
stp = st/p # set up time per piece in min.
tpt = tct+stp # Total production timr per piece in min.
print "Total production timr per piece = %0.2f min"%(tpt)
#Answers vary due to round off error
```