add sample c realtime code

This commit is contained in:
2019-01-15 11:34:00 +01:00
parent 5aacb85c8d
commit 29b6af46fe
8 changed files with 362 additions and 104 deletions

View File

@@ -616,7 +616,8 @@ class ShapePath(MotionBase):
hl += ax.plot(jitter*ts, 'b-',label='jitter')
ax.xaxis.set_label_text('position idx')
ax.yaxis.set_label_text('jitter motion (ms)')
print('scaling of DesTimeBase: %f'%(float(idxInPos[num-1])/idxTrigger[num-1]))
if num>0:
print('scaling of DesTimeBase: %f'%(float(idxInPos[num-1])/idxTrigger[num-1]))
plt.show()
def bode_plot(self,xy=(0,1),mode=25,db=True):
@@ -724,7 +725,7 @@ if __name__=='__main__':
def run_test(args):
args.host=None
#args.host=None
if args.host is None:
comm=gather=None
else:
@@ -767,7 +768,7 @@ if __name__=='__main__':
#sp.plot_gather()
#return
xy=False
sp.gen_rand_points(n=14, scale=1000);sp.sort_points(xy=xy)
#sp.gen_rand_points(n=14, scale=1000);sp.sort_points(xy=xy)
#print(sp.points[:,0])
#sp.gen_swissmx_points(width=1000, ofs=(-500, 0));
#sp.points=np.array([[0.,1.],[1.,0.],[0.,-1.],[-1.,0.]])
@@ -779,9 +780,15 @@ if __name__=='__main__':
[0., 1.], [1., 0.], [0., -1.], [-1., 0.], [0., 1.]])
#sp.gen_grid_points(w=10,h=10,pitch=100,rnd=0,ofs=(0,0));sp.sort_points(False);
#sp.gen_grid_points(w=1,h=10,pitch=100,rnd=0,ofs=(0,0))
sp.setup_motion(fnPrg=fn + '.prg', mode=1, pt2pt_time=40,scale=0)
sp.setup_motion(fnPrg=fn + '.prg', mode=1, pt2pt_time=40,scale=1)
#sp.setup_motion(fnPrg=fn + '.prg', mode=1, pt2pt_time=40,scale=0)
#sp.setup_motion(fnPrg=fn + '.prg', mode=1, pt2pt_time=40,scale=1)
sp.setup_gather(acq_per=2)
sp.setup_sync(mode=2) #sync with timing system and PLC to sync speed (PROG)
sp.setup_coord_trf() # reset to shape path system
sp.setup_motion(fnPrg=fn + '.prg', mode=3, pt2pt_time=40,scale=1)
sp.run()
sp.gather_upload(fnRec=fn+'.npz')
sp.plot_gather(mode=11)
exit(0)
# fn='/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python/data/'+time.strftime('%y-%m-%d-%H_%M_%S')