Changeset 778 in ETALON
- Timestamp:
- Jun 14, 2018, 5:19:55 PM (6 years ago)
- Location:
- BPM
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
BPM/bpm_constants.py
r762 r778 4 4 5 5 global data_dir 6 if os.path.exists(' home/alexandre/Bureau/stage/BPM/') :7 data_dir=' home/alexandre/Bureau/stage/BPM/'6 if os.path.exists('/home/alexandre/Bureau/stage/BPM/') : 7 data_dir='/home/alexandre/Bureau/stage/BPM/' 8 8 if os.path.exists('/Users/delerue/Downloads/'): 9 9 data_dir='/Users/delerue/Downloads/' -
BPM/initialise_motors.py
r777 r778 59 59 print('Be carful with disable vertical motor') 60 60 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) 61 72 msg = str(motor) + 'CD' 62 73 motor_send(msg, verbose) … … 266 277 while os.path.exists(data_name_and_path) : 267 278 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" 269 280 return(data_name_and_path) 270 281 271 282 272 def horizontal_a quisition(begin,end,pas,bpm_name):283 def horizontal_acquisition(begin,end,pas,bpm_name): 273 284 if pas == 0: #position test 274 285 motor_enable(1) … … 313 324 314 325 315 def vertical_a quisition(begin,end,pas,bpm_name):326 def vertical_acquisition(begin,end,pas,bpm_name): 316 327 if pas == 0: #position test 317 328 motor_enable(2) … … 354 365 motor_disable(2) 355 366 356 357 358 359 def aquisition(begin1,end1,pas2,begin2,end2,pas1,bpm_name): 360 if pas == 0: #position test 367 def 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 383 def acquisition(begin1,end1,pas1,begin2,end2,pas2,bpm_name): 384 if pas1 == 0 or pas2 == 0: #position test 361 385 motor_enable(1) 362 386 motor_enable(2) 363 387 move_motor_absolute(1,10000,begin1) 364 388 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'): 366 390 time.sleep(1) 367 391 print("position ok ?") … … 369 393 move_motor_absolute(1,10000,end1) 370 394 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'): 372 396 time.sleep(1) 373 397 print("position ok ?") … … 375 399 motor_disable(2) 376 400 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 379 405 data_name_and_path = path(bpm_name) 380 406 motor_enable(1) 381 407 motor_enable(2) 382 L = [[],[],[],[],[]]383 for i in range(begin1, end1, pas1):408 # L = [[],[],[],[],[],[]] 409 for i in range(begin1, end1, pas1): 384 410 move_motor_absolute(1,5000,i) 385 411 while motor_get(1, 'status') != 'READY': 386 412 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() 409 429 410 430 -
BPM/motor_control.py
r777 r778 10 10 # moteur 2 -> verticale 11 11 12 """ 12 13 motor_enable(2) 13 14 move_motor_absolute(2,5000,-50000) … … 15 16 time.sleep(1) 16 17 time.sleep(5) 18 """ 17 19 """ 18 20 move_motor_absolute(2,5000,0) … … 33 35 # creation graphique 34 36 37 #horizontal_acquisition(4000,0,-4000,"test") 38 39 acquisition(-10000,10000,10000,-50000,0,25000,"test") 40 41 #acquisition(-10000,10000,1000,-50000,0,5000,"test") 35 42 36 43 #turn_on() 37 44 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") 39 46 40 #vertical_a quisition(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") 41 48 42 #vertical_a quisition(0,-4000,2000,"test")43 #vertical_a quisition(4000,0,2000,"test2")49 #vertical_acquisition(0,-4000,2000,"test") 50 #vertical_acquisition(4000,0,2000,"test2") 44 51 45 #horizontal_a quisition(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") 46 53 47 54 #turn_off() 48 55 49 #fichier = open("24-05-2018_a quisition_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") 50 57 """ 51 58 A = fichier.read() -
BPM/motor_error.txt
r774 r778 43 43 Turn on alimentation to UDC motor voltage 44 44 under tension on UDC motor voltage 45 Issue may appear after a certain time, because motor need more current 45 46 46 47 Error No.: 1887 … … 64 65 What we have done : Turn on alimentation 65 66 67 Error No.: 1557 68 Designation : MCALC_PARA_MC3 69 Description :The movement calculator has received invalid parameters 70 Possible cause/Solution :Check all parameters acceleration, moving velocity, ramp time, ramp path, ramp type, starting position, target position 71 What we have done : Velocity to high (50000) 72 66 73 67 74 -
BPM/scope_function.py
r777 r778 83 83 84 84 85 def 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) 85 98 86 99 87
Note: See TracChangeset
for help on using the changeset viewer.