towards measure the mass of the stage
This commit is contained in:
61
logbook.md
61
logbook.md
@@ -401,3 +401,64 @@ Y(lower stage): 1N max 0.1N min.. depends on the magnetic poles
|
|||||||
#2out20 -> Force 2.5N iqCmd=402
|
#2out20 -> Force 2.5N iqCmd=402
|
||||||
#2out30 -> Force 3N iqCmd=603 (changes in torque at poles)
|
#2out30 -> Force 3N iqCmd=603 (changes in torque at poles)
|
||||||
Weight: ca 750g
|
Weight: ca 750g
|
||||||
|
|
||||||
|
*** 27.1.2017 ***
|
||||||
|
==================
|
||||||
|
|
||||||
|
Friction force of Parker stage: see blue logbook.
|
||||||
|
Calculate the current at a given force:
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
import plt as matplotlib.pyplot
|
||||||
|
|
||||||
|
F=np.array([+300, +100, 0.,-50,-100,-150,-200,-250,-300])
|
||||||
|
i=np.array([+625, 214, 38.,-104,-207,-300,-400,-500,-600])
|
||||||
|
|
||||||
|
plt.plot(i,F,'.-')
|
||||||
|
|
||||||
|
average Motor[3].iqMeas -610.949923065
|
||||||
|
average Motor[3].iaMeas 432.573485303
|
||||||
|
average Motor[3].ibMeas -699.459308138
|
||||||
|
-> icMeas 432.573485303-699.459308138=-266.885822835
|
||||||
|
|
||||||
|
|
||||||
|
Check cur_bits to current
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
Block motor 4
|
||||||
|
set current to 10%: #4out10
|
||||||
|
Measure current with amp meter and ./move_record.py
|
||||||
|
|
||||||
|
Motor[4].PhasePos=313
|
||||||
|
|
||||||
|
gelb 293 mA
|
||||||
|
idCmd=0
|
||||||
|
average Motor[4].iqMeas 452.897308732
|
||||||
|
average Motor[4].iaMeas -274.830633873
|
||||||
|
average Motor[4].ibMeas 523.056988602
|
||||||
|
-> icMeas 248.226
|
||||||
|
|
||||||
|
rot 560 mA
|
||||||
|
average Motor[4].iqMeas 452.719438794
|
||||||
|
average Motor[4].iaMeas -264.325534893
|
||||||
|
average Motor[4].ibMeas 523.057788442
|
||||||
|
-> icMeas 258.73
|
||||||
|
|
||||||
|
schwarz 290mA
|
||||||
|
average Motor[4].iqMeas 453.042713114
|
||||||
|
average Motor[4].iaMeas -252.726254749
|
||||||
|
average Motor[4].ibMeas 523.302539492
|
||||||
|
-> icMeas 270.57
|
||||||
|
|
||||||
|
PhasePos=0 ia=-512 ib=260 ic=240
|
||||||
|
PhasePos=682 ia=250 ib=250 ic=500
|
||||||
|
PhasePos=1364 ia=320 ib=-500 ic=180
|
||||||
|
|
||||||
|
https://de.wikipedia.org/wiki/D/q-Transformation
|
||||||
|
ia=-sin(phi)*iq
|
||||||
|
ib=-sin(phi-120deg)*iq
|
||||||
|
ic=-sin(phi-240deg)*iq
|
||||||
|
|
||||||
|
...cant yet figure out the scaling...
|
||||||
|
|
||||||
|
measure the mass of the stage... c ant figure it out...
|
||||||
@@ -66,6 +66,8 @@ class MoveRecord:
|
|||||||
self.fnNpz=fn+'.npz'
|
self.fnNpz=fn+'.npz'
|
||||||
#cfg = {"sequencer": ['prog_1(host="SAROP11-CPPM-MOT6871",acq_per=10)', 'plot_1()']}
|
#cfg = {"sequencer": ['prog_1(host="SAROP11-CPPM-MOT6871",acq_per=10)', 'plot_1()']}
|
||||||
cfg = {"sequencer": ['plot_1()']}
|
cfg = {"sequencer": ['plot_1()']}
|
||||||
|
#cfg = {"sequencer": ['prog_2(host="SAROP11-CPPM-MOT6871",acq_per=10)', 'plot_2()']}
|
||||||
|
#cfg = {"sequencer": ['plot_2()']}
|
||||||
self.cfg=dotdict(cfg)
|
self.cfg=dotdict(cfg)
|
||||||
self.args=args
|
self.args=args
|
||||||
|
|
||||||
@@ -159,7 +161,8 @@ class MoveRecord:
|
|||||||
prg.append('jog3=1000')
|
prg.append('jog3=1000')
|
||||||
prg.append('dwell 100')
|
prg.append('dwell 100')
|
||||||
prg.append('Gather.Enable=2')
|
prg.append('Gather.Enable=2')
|
||||||
for spd in (5,10,20,30,40):
|
#for spd in (5,10,20,30,40):
|
||||||
|
for spd in (20,20,20,20,20,20,20,20,20,20):
|
||||||
prg.append('Motor[3].JogSpeed=%d'%spd)
|
prg.append('Motor[3].JogSpeed=%d'%spd)
|
||||||
prg.append('jog3=27000')
|
prg.append('jog3=27000')
|
||||||
prg.append('dwell 100')
|
prg.append('dwell 100')
|
||||||
@@ -182,12 +185,14 @@ class MoveRecord:
|
|||||||
meta['HomePos']=-223.8 #Motor[3].HomePos
|
meta['HomePos']=-223.8 #Motor[3].HomePos
|
||||||
meta['PhasePos']=1200 #Motor[3].PhasePos
|
meta['PhasePos']=1200 #Motor[3].PhasePos
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def onclick(event):
|
def onclick(event):
|
||||||
print 'button=%s, x=%d, y=%d, xdata=%f, ydata=%f'%(
|
print 'button=%s, x=%d, y=%d, xdata=%f, ydata=%f'%(
|
||||||
event.button, event.x, event.y, event.xdata, event.ydata)
|
event.button, event.x, event.y, event.xdata, event.ydata)
|
||||||
obj=event.canvas.figure.obj
|
obj=event.canvas.figure.obj
|
||||||
|
|
||||||
|
|
||||||
def plot_1(self):
|
def plot_1(self):
|
||||||
try:
|
try:
|
||||||
rec=self.rec
|
rec=self.rec
|
||||||
@@ -230,9 +235,133 @@ class MoveRecord:
|
|||||||
legend = ax.legend(loc='upper right', shadow=True)
|
legend = ax.legend(loc='upper right', shadow=True)
|
||||||
print 'abs average ',channels[4], np.abs(rec[:, 4]).mean()
|
print 'abs average ',channels[4], np.abs(rec[:, 4]).mean()
|
||||||
|
|
||||||
|
fig=plt.figure();
|
||||||
|
fig.obj=self; cid=fig.canvas.mpl_connect('button_press_event', self.onclick)
|
||||||
|
fig.canvas.set_window_title('overlay')
|
||||||
|
ax = fig.add_subplot(1,1,1)
|
||||||
|
hl=[]
|
||||||
|
sz=10; weights = np.repeat(1.0, sz) / sz
|
||||||
|
|
||||||
|
v = np.convolve(rec[:,4], weights, 'same')
|
||||||
|
hl+=ax.plot(rec[:,1],v,'r-',label=channels[4])
|
||||||
|
ax.xaxis.set_label_text(channels[1])
|
||||||
|
ax.yaxis.set_label_text('current in bits: '+channels[4])
|
||||||
|
legend = ax.legend(loc='upper right', shadow=True)
|
||||||
|
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
def prog_2(self,prgId=2,host=None,acq_per=1):
|
||||||
|
'''
|
||||||
|
kwargs:
|
||||||
|
acq_per : acquire period: acquire data all acq_per servo loops (default=1)
|
||||||
|
prgId : used program number
|
||||||
|
file : used filename to save if None, not saved
|
||||||
|
host : host to send and execute program, if None, nothing is executed
|
||||||
|
'''
|
||||||
|
ServoPeriod= .2 #0.2ms Sys.ServoPeriod is dependent of !common() macro
|
||||||
|
|
||||||
|
self.prgId=prgId
|
||||||
|
self.file=file
|
||||||
|
self.host=host
|
||||||
|
self.gather={"MaxSamples":1000000, "Period":acq_per}
|
||||||
|
self.channels=["Motor[3].ActPos","Motor[3].DesPos","Motor[3].PhasePos","Motor[3].idMeas","Motor[3].iqMeas"]
|
||||||
|
self.meta=meta = {'timebase': ServoPeriod*self.gather['Period']}
|
||||||
|
|
||||||
|
self.prg=prg=[]
|
||||||
|
#prg.append('#1..3$')
|
||||||
|
#prg.append('#1..3j/')
|
||||||
|
|
||||||
|
self.prg_prolog()
|
||||||
|
prg=self.prg
|
||||||
|
|
||||||
|
prg.append(' linear abs')
|
||||||
|
prg.append('Motor[3].JogTs=0')
|
||||||
|
prg.append('Motor[3].JogSpeed=40')
|
||||||
|
|
||||||
|
prg.append('jog3=10000')
|
||||||
|
prg.append('dwell 100')
|
||||||
|
prg.append('Gather.Enable=2')
|
||||||
|
for acc in (-2.5,-1.25,-.5,-.25):
|
||||||
|
prg.append('Motor[3].JogTa=%g'%acc)
|
||||||
|
prg.append('jog3=17000')
|
||||||
|
prg.append('dwell 100')
|
||||||
|
prg.append('jog3=10000')
|
||||||
|
prg.append('dwell 100')
|
||||||
|
prg.append('Gather.Enable=0')
|
||||||
|
|
||||||
|
self.prg_epilog()
|
||||||
|
# &1 #1->0
|
||||||
|
# &1 #2->0
|
||||||
|
# #3$
|
||||||
|
# an anschlag (kabel) bewegen
|
||||||
|
# #3hmz
|
||||||
|
# Motor[3].PhasePos=1200
|
||||||
|
# #3j/
|
||||||
|
# &1p
|
||||||
|
|
||||||
|
|
||||||
|
#folgende parameter setzen: Motor[3].HomePos
|
||||||
|
meta['HomePos']=-223.8 #Motor[3].HomePos
|
||||||
|
meta['PhasePos']=1200 #Motor[3].PhasePos
|
||||||
|
|
||||||
|
|
||||||
|
def plot_2(self):
|
||||||
|
try:
|
||||||
|
rec=self.rec
|
||||||
|
prg=self.prg
|
||||||
|
channels=self.channels
|
||||||
|
meta=self.meta
|
||||||
|
except AttributeError:
|
||||||
|
fh=np.load(self.fnNpz)
|
||||||
|
rec=fh['rec']
|
||||||
|
prg=list(fh['prg'])
|
||||||
|
channels=list(fh['channels'])
|
||||||
|
meta=fh['meta'].item()
|
||||||
|
|
||||||
|
time=np.arange(0,rec.shape[0])*meta['timebase']
|
||||||
|
|
||||||
|
fig=plt.figure();
|
||||||
|
fig.obj=self; cid=fig.canvas.mpl_connect('button_press_event', self.onclick)
|
||||||
|
fig.canvas.set_window_title('position')
|
||||||
|
ax = fig.add_subplot(1,1,1)
|
||||||
|
hl=[]
|
||||||
|
p_avg=rec[:,1].mean();
|
||||||
|
p=rec[:,0]-p_avg
|
||||||
|
hl+=ax.plot(time,p,'r-',label=channels[0])
|
||||||
|
#d=np.diff(p)*100
|
||||||
|
#hl+=ax.plot(time[1:],d,'r-',label='vel of '+channels[0])
|
||||||
|
#a=np.diff(d)*100
|
||||||
|
#hl+=ax.plot(time[2:],a,'r-',label='acc of '+channels[0])
|
||||||
|
|
||||||
|
p=rec[:,1]-p_avg
|
||||||
|
hl+=ax.plot(time,p,'g-',label=channels[1])
|
||||||
|
d=np.diff(p)*100
|
||||||
|
hl+=ax.plot(time[1:],d,'g-',label='vel of '+channels[0])
|
||||||
|
a=np.diff(d)*100
|
||||||
|
hl+=ax.plot(time[2:],a,'g-',label='acc of '+channels[0])
|
||||||
|
|
||||||
|
#hl+=ax.plot(time,rec[:,2],'b-',label=channels[2])
|
||||||
|
ax.xaxis.set_label_text('ms')
|
||||||
|
ax.yaxis.set_label_text('um')
|
||||||
|
legend = ax.legend(loc='upper right', shadow=True)
|
||||||
|
|
||||||
|
fig=plt.figure();
|
||||||
|
fig.obj=self; cid=fig.canvas.mpl_connect('button_press_event', self.onclick)
|
||||||
|
fig.canvas.set_window_title('current')
|
||||||
|
ax = fig.add_subplot(1,1,1)
|
||||||
|
hl=[]
|
||||||
|
sz=100; weights = np.repeat(1.0, sz) / sz
|
||||||
|
v = np.convolve(rec[:,3], weights, 'same')
|
||||||
|
hl+=ax.plot(time,v,'r-',label=channels[3])
|
||||||
|
v = np.convolve(rec[:, 4], weights, 'same')
|
||||||
|
hl+=ax.plot(time,v,'g-',label=channels[4])
|
||||||
|
ax.xaxis.set_label_text('ms')
|
||||||
|
ax.yaxis.set_label_text('current in bits')
|
||||||
|
legend = ax.legend(loc='upper right', shadow=True)
|
||||||
|
print 'abs average ',channels[4], np.abs(rec[:, 4]).mean()
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
if __name__=='__main__':
|
if __name__=='__main__':
|
||||||
from optparse import OptionParser, IndentedHelpFormatter
|
from optparse import OptionParser, IndentedHelpFormatter
|
||||||
class MyFormatter(IndentedHelpFormatter):
|
class MyFormatter(IndentedHelpFormatter):
|
||||||
|
|||||||
Reference in New Issue
Block a user