import numpy as np

#Drum Dims
corediam = 12.75 #in
corewidth= 22.00 #in
flange   = 24.00 #in

#Tether
tether   = 0.390 #in

#Calc First Wrap Diam

c = np.pi*(corediam+tether/2)
nwraps = np.floor(corewidth/tether)

#Torque for Load Chart
pullbaredrum = 750 #lbs
torque = pullbaredrum*(corediam+tether/2)/2 #lb-in

firstwrap = nwraps*c
firstwrapm= firstwrap*0.0254
print("The first wrap has {:.2f}-m of tether and {:.0f} wraps.".format(firstwrapm,nwraps))

#Calc Drum max storage

layeff = 1.05;
nlayers = np.floor(((flange-2*tether)-corediam)/tether)
layers = nlayers.astype(int)
stored = 0

print("|Wrap | Tether (m) | Total Stored (m) | Line Pull (lbs)|")
print("|:--  |:--         |:--               |:--             |")

for x in range(layers):
    c = np.pi*((corediam+tether/2) + tether*x)
    lwrap = c*nwraps
    stored += lwrap
    linepull = torque / (c/(2*np.pi))
    print("| {} | {:.2f} | {:.2f} | {:.2f} |".format(x,lwrap*0.0254,stored*0.0254,linepull ))

print("The drum can store {:.2f}-m of tether".format(stored*0.0254))



