Changeset 778 in ETALON


Ignore:
Timestamp:
Jun 14, 2018, 5:19:55 PM (6 years ago)
Author:
moutardier
Message:

Correction of path in bpm_constante.py + creation fonction acquisition for taking data along a matrice (work) and create new fonction for this

Location:
BPM
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • BPM/bpm_constants.py

    r762 r778  
    44
    55global data_dir
    6 if os.path.exists('home/alexandre/Bureau/stage/BPM/') :
    7         data_dir='home/alexandre/Bureau/stage/BPM/'
     6if os.path.exists('/home/alexandre/Bureau/stage/BPM/') :
     7        data_dir='/home/alexandre/Bureau/stage/BPM/'
    88if os.path.exists('/Users/delerue/Downloads/'):
    99        data_dir='/Users/delerue/Downloads/'
  • BPM/initialise_motors.py

    r777 r778  
    5959            print('Be carful with disable vertical motor')
    6060        else :
     61            move_motor_absolute(2,10000,-10000)
     62            while motor_get(2, 'status') != 'READY':
     63                time.sleep(1)
     64            print('Say ok when motor can be put in position 0')
     65            x = raw_input()
     66            while not (x == 'OK' or x == 'ok' or x == 'Ok'):
     67                print('Say ok when motor can be put in position 0')
     68                x = raw_input()
     69            move_motor_absolute(2,5000,0)
     70            while motor_get(2, 'status') != 'READY':
     71                time.sleep(1)
    6172            msg = str(motor) + 'CD'
    6273            motor_send(msg, verbose)
     
    266277    while os.path.exists(data_name_and_path) :
    267278        idata+=1
    268         data_name_and_path = data_dir+"position_vs_tension_"+bpm_name+start_time_str+"_"+str(idata)+".txt"
     279        data_name_and_path = data_dir+"data/position_vs_tension_"+bpm_name+"_"+start_time_str+"_"+str(idata)+".txt"
    269280    return(data_name_and_path)
    270281   
    271282   
    272 def horizontal_aquisition(begin,end,pas,bpm_name):
     283def horizontal_acquisition(begin,end,pas,bpm_name):
    273284    if pas == 0: #position test
    274285        motor_enable(1)
     
    313324
    314325
    315 def vertical_aquisition(begin,end,pas,bpm_name):
     326def vertical_acquisition(begin,end,pas,bpm_name):
    316327    if pas == 0: #position test
    317328        motor_enable(2)
     
    354365        motor_disable(2)
    355366
    356 
    357 
    358 
    359 def aquisition(begin1,end1,pas2,begin2,end2,pas1,bpm_name):
    360     if pas == 0: #position test
     367def acqui_column(begin, end, pas, data_path, other_position): # use in aquisition to read a column
     368    if (end - begin)*pas < 0 :
     369        pas = -pas
     370    for i in range(begin,end,pas):
     371        move_motor_absolute(2,5000,i)
     372        while motor_get(2, 'status') != 'READY':
     373            time.sleep(1)
     374        time.sleep(1)
     375        l = read_scope_and_write_2D(other_position, i, data_path)
     376    time.sleep(1)
     377    move_motor_absolute(2,5000,end) # pour assuré le dernier pas, en aller ou retour
     378    while motor_get(2, 'status') != 'READY':
     379        time.sleep(1)
     380    time.sleep(1)
     381    read_scope_and_write_2D(other_position, end, data_path)   
     382
     383def acquisition(begin1,end1,pas1,begin2,end2,pas2,bpm_name):
     384    if pas1 == 0 or pas2 == 0: #position test
    361385        motor_enable(1)
    362386        motor_enable(2)
    363387        move_motor_absolute(1,10000,begin1)
    364388        move_motor_absolute(2,10000,begin2)
    365         while (motor_get(1, 'status') != 'READY') and (motor_get(2, 'status') != 'READY'):
     389        while (motor_get(1, 'status') != 'READY') or (motor_get(2, 'status') != 'READY'):
    366390            time.sleep(1)
    367391        print("position ok ?")
     
    369393        move_motor_absolute(1,10000,end1)
    370394        move_motor_absolute(2,10000,end2)
    371         while (motor_get(1, 'status') != 'READY') and (motor_get(2, 'status') != 'READY'):
     395        while (motor_get(1, 'status') != 'READY') or (motor_get(2, 'status') != 'READY'):
    372396            time.sleep(1)
    373397        print("position ok ?")
     
    375399        motor_disable(2)
    376400    else:
    377         if (end - begin)*pas < 0 :
    378             pas = -pas
     401        if (end1 - begin1)*pas1 < 0 :
     402            pas1 = -pas1
     403        if (end2 - begin2)*pas2 < 0 :
     404            pas2 = -pas2
    379405        data_name_and_path = path(bpm_name)
    380406        motor_enable(1)
    381407        motor_enable(2)
    382         L = [[],[],[],[],[]]
    383         for i in range(begin1, end1,pas1):
     408#        L = [[],[],[],[],[],[]]
     409        for i in range(begin1, end1, pas1):           
    384410            move_motor_absolute(1,5000,i)
    385411            while motor_get(1, 'status') != 'READY':
    386412                time.sleep(1)
    387             time.sleep(1)
    388             for j in range(begin2, end2,pas2):
    389                 move_motor_absolute(2,5000,i)
    390                 while motor_get(2, 'status') != 'READY':
    391                     time.sleep(1)
    392                 time.sleep(1)
    393                 l = read_scope_and_write_2D(i, data_name_and_path)
    394                 for k in range(5):
    395                     L[k].append(l[k])
    396                 time.sleep(1)
    397         move_motor_absolute(1,5000,end1)   
    398         move_motor_absolute(2,5000,end2) # pour assuré le dernier pas, en aller ou retour
    399         while (motor_get(1, 'status') != 'READY') & (motor_get(2, 'status') != 'READY'):
    400             time.sleep(1)
    401         time.sleep(1)
    402         l = read_scope_and_write_2D(end, data_name_and_path)
    403         for j in range(5):
    404             L[j].append(l[j])
    405         time.sleep(1)
    406         for i in range(4):
    407             plt.plot(L[0],L[i+1])
    408         plt.show()
     413            acqui_column(begin2, end2, pas2, data_name_and_path, i)
     414            begin2,end2 = end2,begin2
     415        move_motor_absolute(1,5000,end1) # pour assuré le dernier pas, en aller ou retour
     416        while motor_get(1, 'status') != 'READY':
     417            time.sleep(1)
     418        time.sleep(1)
     419
     420        acqui_column(begin2, end2, pas2, data_name_and_path, end1)
     421       
     422        motor_disable(1)
     423        motor_disable(2)
     424#        for j in range(6):
     425#L[j].append(l[j])
     426#        for i in range(4):
     427#            plt.plot(L[0],L[i+2])
     428#        plt.show()
    409429
    410430
  • BPM/motor_control.py

    r777 r778  
    1010# moteur 2 -> verticale
    1111
     12"""
    1213motor_enable(2)
    1314move_motor_absolute(2,5000,-50000)
     
    1516    time.sleep(1)
    1617time.sleep(5)
     18"""
    1719"""
    1820move_motor_absolute(2,5000,0)
     
    3335#                                 creation graphique
    3436
     37#horizontal_acquisition(4000,0,-4000,"test")   
     38
     39acquisition(-10000,10000,10000,-50000,0,25000,"test")
     40
     41#acquisition(-10000,10000,1000,-50000,0,5000,"test")
    3542
    3643#turn_on()
    3744
    38 vertical_aquisition(-110000,90000,4000,"ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition")
     45#vertical_acquisition(-110000,90000,4000,"ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition")
    3946
    40 #vertical_aquisition(90000,-110000,4000,"ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition")
     47#vertical_acquisition(90000,-110000,4000,"ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition")
    4148
    42 #vertical_aquisition(0,-4000,2000,"test")
    43 #vertical_aquisition(4000,0,2000,"test2")
     49#vertical_acquisition(0,-4000,2000,"test")
     50#vertical_acquisition(4000,0,2000,"test2")
    4451
    45 #horizontal_aquisition(400000,0,-4000,"ch1-3_bpm_ref_ch2-4_bpm_impr")   
     52#horizontal_acquisition(400000,0,-4000,"ch1-3_bpm_ref_ch2-4_bpm_impr")   
    4653
    4754#turn_off()
    4855
    49 #fichier = open("24-05-2018_aquisition_from_0_to_400000_step_of_1000.txt", "r")
     56#fichier = open("24-05-2018_acquisition_from_0_to_400000_step_of_1000.txt", "r")
    5057"""
    5158A = fichier.read()
  • BPM/motor_error.txt

    r774 r778  
    4343                    Turn on alimentation to UDC motor voltage
    4444                    under tension on UDC motor voltage
     45                    Issue may appear after a certain time, because motor need more current
    4546
    4647Error No.: 1887
     
    6465What we have done : Turn on alimentation
    6566
     67Error No.: 1557
     68Designation : MCALC_PARA_MC3
     69Description :The movement calculator has received invalid parameters
     70Possible cause/Solution :Check all parameters acceleration, moving velocity, ramp time, ramp path, ramp type, starting position, target position
     71What we have done : Velocity to high (50000)
     72
    6673
    6774
  • BPM/scope_function.py

    r777 r778  
    8383       
    8484
     85def read_scope_and_write_2D(x ,y ,path):
     86    fichier  = open(path, "a")
     87    fichier.write(str(x)+' '+str(y)+' ')
     88    L = [x,y]
     89    for i in range(4):
     90        scpi_command('CURS1:SOUR CH'+str(i+1)+' \n CURS1:SOUR?')
     91        valeur = scpi_query('CURS1:FUNC UPE \n CURS:RES?')
     92        valeur = suppress_alignea(valeur)
     93        L.append(float(valeur))
     94        fichier.write(valeur+' ')
     95    fichier.write('\n')
     96    fichier.close()
     97    return(L)
    8598
    8699
    87 
Note: See TracChangeset for help on using the changeset viewer.