These are companion calculations for a blog post at https://partofthething.com/thoughts/?p=1327
import math
sidereal_day_hours = 23.9344699
rads_per_sec = 2*math.pi/sidereal_day_hours/3600
print(rads_per_sec)
import numpy as np
time = np.linspace(0,100*60,50)
length_in_cm = 20
def yt(length, ts):
return length * np.tan(rads_per_sec * ts)
def ypt(length, ts):
cm_per_sec = length/np.cos(rads_per_sec * ts)**2* rads_per_sec # chain rule
return cm_per_sec
import matplotlib.pyplot as plt
lengths_in_cm = [20,30,40]
# plot bolt length vs. time
for length in lengths_in_cm:
y = yt(length, time)
plt.plot(time/60.0, y, label=str(length))
plt.legend()
plt.grid(color='0.7')
plt.ylabel('Bolt insertion (cm)')
plt.xlabel('Time since start (min)')
plt.show()
for length in lengths_in_cm:
y = ypt(length, time)
plt.plot(time/60.0, y*60.0, label='Length={}cm'.format(length))
plt.legend()
plt.grid(color='0.7')
plt.ylabel('Bolt insertion rate (cm/min)')
plt.xlabel('Time since start (min)')
plt.show()
rotations_per_cm = 20/2.54 # -20 threads per inch
print(rotations_per_cm)
plt.rcParams.update({'font.size':16})
for length in lengths_in_cm:
rotations_per_second = rotations_per_cm * ypt(length, time)
plt.plot(time/60.0, rotations_per_second*60,label='Length={}cm'.format(length))
plt.legend()
plt.grid(color='0.7')
plt.ylabel('Required rotation rate (rotations/min)')
plt.xlabel('Time since start (min)')
plt.title('Rotation rate with 1/4-20 thread')
plt.show()
#plt.savefig('rotation_rate.png')
# real calculation for my apparatus
rotations_per_second = rotations_per_cm * ypt(29.113, time)
seconds_per_doublestep = 1.0/(rotations_per_second*2048)
plt.plot(time/60.0, seconds_per_doublestep)
plt.grid(color='0.7')
plt.ylabel('Seconds per doublestep')
plt.xlabel('Time since start (min)')
plt.show()
print(1/(rotations_per_second*60))
# My apparatus' theta_0 calculation
height_at_bolt = 1.347
height_at_hinge= 0.758
distance = 29.113-4.70
theta0_rad = math.atan((height_at_bolt-height_at_hinge)/distance)
print(theta0_rad)