scale.calibrate() scale.zero() else: print("Unknown answer: '" + str(answer) + "', expected 'y' or 'n'") print("Proceeding with assumed answer 'n'") f_c = False desired_flow = 10 measured_flow = None if f_c: pressure, delay, measured_flow = delay_and_flow_regulation( machiene, scale, scale_pos, init_pressure, desired_flow, precision=5, mass_limit=150, threshold=20, show_data=True, init=True ) machiene.up() print('Drawing with delay of ' + str(delay) + ' s, and pressure of ' + str(pressure) + ' mbar') print("Finding flow took " + str(time.time() - start_flow) + "s") # Prepare drawings total_line_length_mm = 2*90. + 12. total_mass_mg = 20. if measured_flow is None: measured_flow = desired_flow speed_mmPmin = total_line_length_mm/((total_mass_mg/measured_flow)/60.)
f_c = True init_pressure = 100 scale = scale_handler() scale.calibrate() scale.zero() else: print("Unknown answer: '" + str(answer) + "', expected 'y' or 'n'") print("Proceeding with assumed answer 'n'") f_c = False desired_flow = 30 if f_c: pressure, delay = delay_and_flow_regulation( machiene, scale, [350, 200], init_pressure, desired_flow, precision=(desired_flow / 10 + 1), duration=5, threshold=40) print('Drawing with delay of ' + str(delay) + ' s, and pressure of ' + str(pressure) + ' mbar') # Prepare drawings sen_list = [] n_sen = 4 dx_sen = 0 dy_sen = 40.25 jig_offset = [20.5, 16.75] for isen in range(n_sen): table_offset = sum_offsets(JIG_OFFSET_CFG["sensor"], jig_offset) sen_offset = sum_offsets(table_offset, [dx_sen * isen, dy_sen * isen])
# Water pressure = 900 desired_flow = 0.5 #scale_pos = [0, 0, 0] scale_pos = [350, 200, 0] #delay, delay_up, delay_dn, press_guess, data = measure_delay(machiene, scale, [0, 0, 0], pressure, duration=3, threshold=30, desired_flow=desired_flow) #print('Delay is ' + str(delay) + ', uncert window: [' + str(delay_dn) + ', ' + str(delay_up) + ']' ) #scale.plot_data(data) #raw_input('Starting flow reg') #init_pressure = pressure #if press_guess is not None: init_pressure = press_guess scale.zero() scale.calibrate() desired_press, delay_t, flow = delay_and_flow_regulation(machiene, scale, scale_pos, pressure, desired_flow, precision=0.1, mass_limit=150, threshold=20, show_data=True, low_flow=True) print('Desired pressure is ' + str(desired_press) + ' mbar, delay is ' + str(delay_t) + ' s')
0.) / (measured_flow + 0.) factor = min(max(factor_tmp, 0.2), 5) init_pressure = factor * DRAWING_CFG[layer]['init_pressure'] # Do measurement if f_c: mass_lim = 150 if 'SY186' in glue_type: mass_lim = 250 if 'WATER' in glue_type: mass_lim = 500 print(glue_type) pressure, delay, measured_flow = delay_and_flow_regulation( machiene, scale, scale_pos, init_pressure, DRAWING_CFG[layer]['desired_flow'], precision=DRAWING_CFG[layer]['flow_precision'], mass_limit=mass_lim, threshold=20, show_data=True, init=True) # Load flow and pressure else: #init_pressure = None #pressure = DRAWING_CFG[layer]['init_pressure'] #measured_flow = DRAWING_CFG[layer]['desired_flow'] measured_flow, pressure = load_f_and_p(prev_flow_file) # Set pressure and flow flow_dict[layer] = measured_flow pressure_dict[layer] = pressure