Index: tests/flow_sensor_data_processor.py =================================================================== diff -u -r2011b5c06793fc8e98f9e43113b15cff016024a1 -r43496ad886040327652f976a8796943f508cc764 --- tests/flow_sensor_data_processor.py (.../flow_sensor_data_processor.py) (revision 2011b5c06793fc8e98f9e43113b15cff016024a1) +++ tests/flow_sensor_data_processor.py (.../flow_sensor_data_processor.py) (revision 43496ad886040327652f976a8796943f508cc764) @@ -32,6 +32,8 @@ initial_fill_flow = 0.0 initial_fill_delay = 0 counter = 0 + initial_temp_flow = 0.0 + temp_flow_running_sum = 0.0 # Get the log file address without the extension file_name = os.path.splitext(log_file)[0] @@ -56,6 +58,8 @@ flow = float(data.split('Flow,', 1)[1].split(',')[0]) * 1000 load_cell = float(data.split('B1,', 1)[1].split(',')[0]) + temp_flow = float(0.0 if 'Temp_flow' not in data else data.split('Temp_flow,', 1)[1].split(',')[0])*1000 + # Check if the operation mode is fill and the VPo valve is set to fill if operation_mode == 'DG_OP_MODE_FILL' and vpo_status == 'VALVE_STATE_FILL_C_TO_NC': # Wait for the first 3 seconds of the data in the fill. This is to wait for the measured flow @@ -68,10 +72,12 @@ initial_fill_time = counter is_it_fill_time = True initial_fill_flow = flow + initial_temp_flow = temp_flow # If it is the fill time, keep adding the parsed flow to be averaged later as the average measured # flow of the fill if is_it_fill_time is True: flow_running_sum += flow + temp_flow_running_sum += temp_flow # Check if the operation mode is back to recirculate and the fill time flag is still true. This means # fill just ended and it is back to recirculate so the calculations can be done now @@ -86,9 +92,13 @@ # Calculate the error from load cell to the average measured flow in percent error = ((load_cell_flow - avg_measured_flow) / load_cell_flow) * 100 - info = ('{}, {:5.3f}, {:5.3f}, {:5.3f}, {:5.3f}, {:5.3f} '.format(duty_cycle, initial_fill_flow, - flow, avg_measured_flow, - load_cell_flow, error)) + avg_measured_temp_flow = temp_flow_running_sum / (counter - initial_fill_time) + + info = ('{}, {:5.3f}, {:5.3f}, {:5.3f}, {:5.3f}, {:5.3f}, {:5.3f} '.format(duty_cycle, + initial_fill_flow, + flow, avg_measured_flow, + load_cell_flow, error, + avg_measured_temp_flow)) w.write(info + '\r') # Done with this calculations, reset all the variables for the next fill @@ -97,6 +107,7 @@ is_it_fill_time = False flow_running_sum = 0 initial_fill_delay = 0 + temp_flow_running_sum = 0 elapsed_time = ('Elapsed Time: {} seconds!'.format(int(time() - start_time))) print(elapsed_time)