Loading…

方法名称: u_throated_flume_method_lin_table_generation

方法ID: 0x4464

方法标签: Generate Linearization Table

方法描述: Generate linearization table with 32 input and 32 output points.


  • {
  • float utapproachdiameterconverted;
  • float utthroatdiameterconverted;
  • float utthroatheightconverted;
  • float utthroatlengthconverted;
  • float utheadconverted;
  • float utdischangecalc1;
  • float utdischangecalc2;
  • float approachchanneldiametercalc;
  • float utshapecoefficientcalc;
  • float utvelocitycoefficientcalculation;
  • float flowratecalculated;
  • int i;
  • double Factor;
  • char disp_string1[135];
  • int slen1;
  • slen1 = 135;
  • _set_device_status(0xFF,0);
  • _set_xmtr_device_status(0xFF,0);
  • _set_all_resp_code(0);
  • _set_xmtr_all_resp_code(0);
  • _get_dictionary_string(19726337,disp_string1,slen1);
  • ACKNOWLEDGE(disp_string1);
  • _add_abort_method(4118);
  • ACKNOWLEDGE(literal_string(1546));
  • PUT_MESSAGE(literal_string(1547));
  • activateLineariser = 0;
  • send_command(213);
  • index_linpoints = 0;
  • lin_input_0 = 0.0;
  • lin_output_0 = 0.0;
  • send_command(211);
  • index_linpoints = 31;
  • lin_input_31 = span_Obj_value_0;
  • lin_output_31 = 100.00;
  • send_command(211);
  • for (i = 1; i < 31; i = i + 1)
  • {
  • index_linpoints = i;
  • Factor = i * 1.0 / 31.0;
  • array_linpoints[i].inputpoint = span_Obj_value_0 * Factor;
  • if (Distance_Obj_unit == 44)
  • {
  • utheadconverted = array_linpoints[i].inputpoint * 0.3048;
  • utapproachdiameterconverted = ut_approach_channel_diameter * 0.3048;
  • utthroatdiameterconverted = ut_throat_diameter * 0.3048;
  • utthroatheightconverted = ut_throat_height * 0.3048;
  • utthroatlengthconverted = ut_throat_length * 0.3048;
  • }
  • else
  • if (Distance_Obj_unit == 45)
  • {
  • utheadconverted = array_linpoints[i].inputpoint * 1;
  • utapproachdiameterconverted = ut_approach_channel_diameter * 1;
  • utthroatdiameterconverted = ut_throat_diameter * 1;
  • utthroatheightconverted = ut_throat_height * 1;
  • utthroatlengthconverted = ut_throat_length * 1;
  • }
  • else
  • if (Distance_Obj_unit == 47)
  • {
  • utheadconverted = array_linpoints[i].inputpoint * 0.0254;
  • utapproachdiameterconverted = ut_approach_channel_diameter * 0.0254;
  • utthroatdiameterconverted = ut_throat_diameter * 0.0254;
  • utthroatheightconverted = ut_throat_height * 0.0254;
  • utthroatlengthconverted = ut_throat_length * 0.0254;
  • }
  • else
  • if (Distance_Obj_unit == 48)
  • {
  • utheadconverted = array_linpoints[i].inputpoint * 0.01;
  • utapproachdiameterconverted = ut_approach_channel_diameter * 0.01;
  • utthroatdiameterconverted = ut_throat_diameter * 0.01;
  • utthroatheightconverted = ut_throat_height * 0.01;
  • utthroatlengthconverted = ut_throat_length * 0.01;
  • }
  • else
  • if (Distance_Obj_unit == 49)
  • {
  • utheadconverted = array_linpoints[i].inputpoint * 0.001;
  • utapproachdiameterconverted = ut_approach_channel_diameter * 0.001;
  • utthroatdiameterconverted = ut_throat_diameter * 0.001;
  • utthroatheightconverted = ut_throat_height * 0.001;
  • utthroatlengthconverted = ut_throat_length * 0.001;
  • }
  • waterdepth = utheadconverted + utthroatheightconverted;
  • utdischangecalc1 = 1 - 0.006 * utthroatlengthconverted / utthroatdiameterconverted;
  • utdischangecalc2 = 1 - 0.003 * utthroatlengthconverted / utheadconverted;
  • ut_dischargecoefficient = utdischangecalc1 * pow(utdischangecalc2,1.5);
  • approachchanneldiametercalc = 0.5 * utapproachdiameterconverted;
  • if (waterdepth < approachchanneldiametercalc)
  • {
  • utangle = acos(1 - 2 * waterdepth / utapproachdiameterconverted);
  • ut_approach_channel_area = 0.25 * (utapproachdiameterconverted * utapproachdiameterconverted) * (utangle - sin(utangle) * cos(utangle));
  • }
  • else
  • {
  • ut_approach_channel_area = 0.39269 * (utapproachdiameterconverted * utapproachdiameterconverted) + (waterdepth - approachchanneldiametercalc);
  • }
  • utshapecoefficientcalc = utheadconverted / utthroatdiameterconverted;
  • if (utshapecoefficientcalc < 0.1)
  • {
  • ut_shapecoefficient = 0.350;
  • utvelocitycoefficientcalculation = ut_shapecoefficient * utthroatdiameterconverted * utheadconverted / ut_approach_channel_area;
  • if (utvelocitycoefficientcalculation < 0.04)
  • {
  • flowratecalculated = 1.704599 * 1.000 * 0.350 * ut_dischargecoefficient * utthroatdiameterconverted * pow(utheadconverted,1.5);
  • }
  • else
  • if (utvelocitycoefficientcalculation >= 0.04 && utvelocitycoefficientcalculation < 0.20)
  • {
  • flowratecalculated = 1.704599 * 1.008 * 0.350 * ut_dischargecoefficient * utthroatdiameterconverted * pow(utheadconverted,1.5);
  • }
  • else
  • if (utvelocitycoefficientcalculation >= 0.2 && utvelocitycoefficientcalculation < 0.3)
  • {
  • flowratecalculated = 1.704599 * 1.018 * 0.350 * ut_dischargecoefficient * utthroatdiameterconverted * pow(utheadconverted,1.5);
  • }
  • else
  • if (utvelocitycoefficientcalculation >= 0.3 && utvelocitycoefficientcalculation < 0.38)
  • {
  • flowratecalculated = 1.704599 * 1.030 * 0.350 * ut_dischargecoefficient * utthroatdiameterconverted * pow(utheadconverted,1.5);
  • }
  • else
  • if (utvelocitycoefficientcalculation >= 0.38 && utvelocitycoefficientcalculation < 0.440)
  • {
  • flowratecalculated = 1.704599 * 1.044 * 0.350 * ut_dischargecoefficient * utthroatdiameterconverted * pow(utheadconverted,1.5);
  • }
  • else
  • if (utvelocitycoefficientcalculation >= 0.440 && utvelocitycoefficientcalculation < 0.500)
  • {
  • flowratecalculated = 1.704599 * 1.058 * 0.350 * ut_dischargecoefficient * utthroatdiameterconverted * pow(utheadconverted,1.5);
  • }
  • else
  • if (utvelocitycoefficientcalculation >= 0.500 && utvelocitycoefficientcalculation < 0.540)
  • {
  • flowratecalculated = 1.704599 * 1.068 * 0.350 * ut_dischargecoefficient * utthroatdiameterconverted * pow(utheadconverted,1.5);
  • }
  • else
  • if (utvelocitycoefficientcalculation >= 0.540 && utvelocitycoefficientcalculation < 0.560)
  • {
  • flowratecalculated = 1.704599 * 1.075 * 0.350 * ut_dischargecoefficient * utthroatdiameterconverted * pow(utheadconverted,1.5);
  • }
  • else
  • if (utvelocitycoefficientcalculation >= 0.560 && utvelocitycoefficientcalculation < 0.620)
  • {
  • flowratecalculated = 1.704599 * 1.098 * 0.350 * ut_dischargecoefficient * utthroatdiameterconverted * pow(utheadconverted,1.5);
  • }
  • else
  • if (utvelocitycoefficientcalculation >= 0.620 && utvelocitycoefficientcalculation < 0.720)
  • {
  • flowratecalculated = 1.704599 * 1.146 * 0.350 * ut_dischargecoefficient * utthroatdiameterconverted * pow(utheadconverted,1.5);
  • }
  • else
  • if (utvelocitycoefficientcalculation >= 0.720 && utvelocitycoefficientcalculation < 0.780)
  • {
  • flowratecalculated = 1.704599 * 1.185 * 0.350 * ut_dischargecoefficient * utthroatdiameterconverted * pow(utheadconverted,1.5);
  • }
  • else
  • if (utvelocitycoefficientcalculation >= 0.780 && utvelocitycoefficientcalculation <= 0.833)
  • {
  • flowratecalculated = 1.704599 * 1.250 * 0.350 * ut_dischargecoefficient * utthroatdiameterconverted * pow(utheadconverted,1.5);
  • }
  • }
  • else
  • if (utshapecoefficientcalc >= 0.1 && utshapecoefficientcalc < 0.2)
  • {
  • ut_shapecoefficient = 0.350;
  • utvelocitycoefficientcalculation = ut_shapecoefficient * utthroatdiameterconverted * utheadconverted / ut_approach_channel_area;
  • if (utvelocitycoefficientcalculation < 0.04)
  • {
  • flowratecalculated = 1.704599 * 1.000 * 0.350 * ut_dischargecoefficient * utthroatdiameterconverted * pow(utheadconverted,1.5);
  • }
  • else
  • if (utvelocitycoefficientcalculation >= 0.04 && utvelocitycoefficientcalculation < 0.20)
  • {
  • flowratecalculated = 1.704599 * 1.008 * 0.350 * ut_dischargecoefficient * utthroatdiameterconverted * pow(utheadconverted,1.5);
  • }
  • else
  • if (utvelocitycoefficientcalculation >= 0.2 && utvelocitycoefficientcalculation < 0.3)
  • {
  • flowratecalculated = 1.704599 * 1.018 * 0.350 * ut_dischargecoefficient * utthroatdiameterconverted * pow(utheadconverted,1.5);
  • }
  • else
  • if (utvelocitycoefficientcalculation >= 0.3 && utvelocitycoefficientcalculation < 0.38)
  • {
  • flowratecalculated = 1.704599 * 1.030 * 0.350 * ut_dischargecoefficient * utthroatdiameterconverted * pow(utheadconverted,1.5);
  • }
  • else
  • if (utvelocitycoefficientcalculation >= 0.38 && utvelocitycoefficientcalculation < 0.440)
  • {
  • flowratecalculated = 1.704599 * 1.044 * 0.350 * ut_dischargecoefficient * utthroatdiameterconverted * pow(utheadconverted,1.5);
  • }
  • else
  • if (utvelocitycoefficientcalculation >= 0.440 && utvelocitycoefficientcalculation < 0.500)
  • {
  • flowratecalculated = 1.704599 * 1.058 * 0.350 * ut_dischargecoefficient * utthroatdiameterconverted * pow(utheadconverted,1.5);
  • }
  • else
  • if (utvelocitycoefficientcalculation >= 0.500 && utvelocitycoefficientcalculation < 0.540)
  • {
  • flowratecalculated = 1.704599 * 1.068 * 0.350 * ut_dischargecoefficient * utthroatdiameterconverted * pow(utheadconverted,1.5);
  • }
  • else
  • if (utvelocitycoefficientcalculation >= 0.540 && utvelocitycoefficientcalculation < 0.560)
  • {
  • flowratecalculated = 1.704599 * 1.075 * 0.350 * ut_dischargecoefficient * utthroatdiameterconverted * pow(utheadconverted,1.5);


请登录以获得完整内容