Loading…

方法名称: palmer_bowlus_flume_method_lin_table_generation

方法ID: 0x4467

方法标签: Generate Linearization Table

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


  • {
  • float pbbottomthroatconverted;
  • float pbthroatlenghtconverted;
  • float pbdisplacementthickness;
  • float pbthroatdiameterconverted;
  • float pbhumpheightconverted;
  • float pbnumericcalc;
  • float pbheadconverted;
  • float pbcrosssectionalcalc;
  • float pbthroatdiametercalc;
  • float pbvelocitycoefficientcalculation;
  • float pbanglecalc;
  • float pbdischargecalc;
  • float pb_numericcalc;
  • 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)
  • {
  • pbheadconverted = array_linpoints[i].inputpoint * 0.3048;
  • pbbottomthroatconverted = pb_bottom_throat_width * 0.3048;
  • pbthroatlenghtconverted = pb_throat_length * 0.3048;
  • pbthroatdiameterconverted = pb_approach_throat_diameter * 0.3048;
  • pbhumpheightconverted = pb_hump_height * 0.3048;
  • }
  • else
  • if (Distance_Obj_unit == 45)
  • {
  • pbheadconverted = array_linpoints[i].inputpoint * 1;
  • pbbottomthroatconverted = pb_bottom_throat_width * 1;
  • pbthroatlenghtconverted = pb_throat_length * 1;
  • pbthroatdiameterconverted = pb_approach_throat_diameter * 1;
  • pbhumpheightconverted = pb_hump_height * 1;
  • }
  • else
  • if (Distance_Obj_unit == 47)
  • {
  • pbheadconverted = array_linpoints[i].inputpoint * 0.0254;
  • pbbottomthroatconverted = pb_bottom_throat_width * 0.0254;
  • pbthroatlenghtconverted = pb_throat_length * 0.0254;
  • pbthroatdiameterconverted = pb_approach_throat_diameter * 0.0254;
  • pbhumpheightconverted = pb_hump_height * 0.0254;
  • }
  • else
  • if (Distance_Obj_unit == 48)
  • {
  • pbheadconverted = array_linpoints[i].inputpoint * 0.01;
  • pbbottomthroatconverted = pb_bottom_throat_width * 0.01;
  • pbthroatlenghtconverted = pb_throat_length * 0.01;
  • pbthroatdiameterconverted = pb_approach_throat_diameter * 0.01;
  • pbhumpheightconverted = pb_hump_height * 0.01;
  • }
  • else
  • if (Distance_Obj_unit == 49)
  • {
  • pbheadconverted = array_linpoints[i].inputpoint * 0.001;
  • pbbottomthroatconverted = pb_bottom_throat_width * 0.001;
  • pbthroatlenghtconverted = pb_throat_length * 0.001;
  • pbthroatdiameterconverted = pb_approach_throat_diameter * 0.001;
  • pbhumpheightconverted = pb_hump_height * 0.001;
  • }
  • pbnumericcalc = 1 + pb_throat_slope * pb_throat_slope;
  • pb_numericalcoefficient = sqrt(pbnumericcalc) - pb_throat_slope;
  • pbdisplacementthickness = 0.003 * pbthroatlenghtconverted;
  • pb_effectivewidth = pbbottomthroatconverted - 2 * pb_numericalcoefficient * pbdisplacementthickness;
  • pb_effectivehead = pbheadconverted - pbdisplacementthickness;
  • pbdischargecalc = 1 - 0.003 * pbthroatlenghtconverted / pbheadconverted;
  • pb_dischargecoefficient = pb_effectivewidth / pbbottomthroatconverted * pow(pbdischargecalc,1.5);
  • pbcrosssectionalcalc = pbheadconverted + pbhumpheightconverted;
  • pbthroatdiametercalc = 0.5 * pbthroatdiameterconverted;
  • if (pbcrosssectionalcalc < pbthroatdiametercalc)
  • {
  • pbanglecalc = acos(1 - pbcrosssectionalcalc / pbthroatdiameterconverted);
  • pb_crosssectionalarea = 0.25 * (pbthroatdiameterconverted * pbthroatdiameterconverted) * (pbanglecalc - sin(pbanglecalc) * cos(pbanglecalc));
  • }
  • else
  • {
  • pb_crosssectionalarea = -0.1073 * (pbthroatdiameterconverted * pbthroatdiameterconverted) + pbcrosssectionalcalc * pbthroatdiameterconverted;
  • }
  • pbshapecoefficientcalculation = pb_throat_slope * pbheadconverted / pb_effectivewidth;
  • if (pbshapecoefficientcalculation < 0.010)
  • {
  • pb_shapecoefficient = 1.007;
  • pbvelocitycoefficientcalculation = pb_shapecoefficient * pb_effectivewidth * pb_effectivehead / pb_crosssectionalarea;
  • if (pbvelocitycoefficientcalculation < 0.1)
  • {
  • pb_velocitycoefficient = 1.002;
  • flowratecalculated = 1.704599 * 1.007 * 1.002 * pb_dischargecoefficient * pbbottomthroatconverted * pow(pbheadconverted,1.5);
  • }
  • else
  • if (pbvelocitycoefficientcalculation >= 0.1 && pbvelocitycoefficientcalculation < 0.4)
  • {
  • pb_velocitycoefficient = 1.021;
  • flowratecalculated = 1.704599 * 1.007 * 1.021 * pb_dischargecoefficient * pbbottomthroatconverted * pow(pbheadconverted,1.5);
  • }
  • else
  • if (pbvelocitycoefficientcalculation >= 0.4 && pbvelocitycoefficientcalculation < 0.5)
  • {
  • pb_velocitycoefficient = 1.039;
  • flowratecalculated = 1.704599 * 1.007 * 1.039 * pb_dischargecoefficient * pbbottomthroatconverted * pow(pbheadconverted,1.5);
  • }
  • else
  • if (pbvelocitycoefficientcalculation >= 0.5 && pbvelocitycoefficientcalculation < 0.7)
  • {
  • pb_velocitycoefficient = 1.098;
  • flowratecalculated = 1.704599 * 1.007 * 1.098 * pb_dischargecoefficient * pbbottomthroatconverted * pow(pbheadconverted,1.5);
  • }
  • else
  • if (pbvelocitycoefficientcalculation >= 0.7 && pbvelocitycoefficientcalculation < 0.8)
  • {
  • pb_velocitycoefficient = 1.146;
  • flowratecalculated = 1.704599 * 1.007 * 1.146 * pb_dischargecoefficient * pbbottomthroatconverted * pow(pbheadconverted,1.5);
  • }
  • else
  • if (pbvelocitycoefficientcalculation >= 0.8 && pbvelocitycoefficientcalculation < 0.9)
  • {
  • pb_velocitycoefficient = 1.218;
  • flowratecalculated = 1.704599 * 1.007 * 1.218 * pb_dischargecoefficient * pbbottomthroatconverted * pow(pbheadconverted,1.5);
  • }
  • else
  • if (pbvelocitycoefficientcalculation == 0.9)
  • {
  • pb_velocitycoefficient = 1.340;
  • flowratecalculated = 1.704599 * 1.007 * 1.340 * pb_dischargecoefficient * pbbottomthroatconverted * pow(pbheadconverted,1.5);
  • }
  • }
  • else
  • if (pbshapecoefficientcalculation >= 0.010 && pbshapecoefficientcalculation < 0.16)
  • {
  • pb_shapecoefficient = 1.093;
  • pbvelocitycoefficientcalculation = pb_shapecoefficient * pb_effectivewidth * pb_effectivehead / pb_crosssectionalarea;
  • if (pbvelocitycoefficientcalculation < 0.1)
  • {
  • pb_velocitycoefficient = 1.002;
  • flowratecalculated = 1.704599 * 1.093 * 1.002 * pb_dischargecoefficient * pbbottomthroatconverted * pow(pbheadconverted,1.5);
  • }
  • else
  • if (pbvelocitycoefficientcalculation >= 0.1 && pbvelocitycoefficientcalculation < 0.4)
  • {
  • pb_velocitycoefficient = 1.021;
  • flowratecalculated = 1.704599 * 1.093 * 1.021 * pb_dischargecoefficient * pbbottomthroatconverted * pow(pbheadconverted,1.5);
  • }
  • else
  • if (pbvelocitycoefficientcalculation >= 0.4 && pbvelocitycoefficientcalculation < 0.5)
  • {
  • pb_velocitycoefficient = 1.039;
  • flowratecalculated = 1.704599 * 1.093 * 1.039 * pb_dischargecoefficient * pbbottomthroatconverted * pow(pbheadconverted,1.5);
  • }
  • else
  • if (pbvelocitycoefficientcalculation >= 0.5 && pbvelocitycoefficientcalculation < 0.7)
  • {
  • pb_velocitycoefficient = 1.098;
  • flowratecalculated = 1.704599 * 1.093 * 1.098 * pb_dischargecoefficient * pbbottomthroatconverted * pow(pbheadconverted,1.5);
  • }
  • else
  • if (pbvelocitycoefficientcalculation >= 0.7 && pbvelocitycoefficientcalculation < 0.8)
  • {
  • pb_velocitycoefficient = 1.146;
  • flowratecalculated = 1.704599 * 1.093 * 1.146 * pb_dischargecoefficient * pbbottomthroatconverted * pow(pbheadconverted,1.5);
  • }
  • else
  • if (pbvelocitycoefficientcalculation >= 0.8 && pbvelocitycoefficientcalculation < 0.9)
  • {
  • pb_velocitycoefficient = 1.218;
  • flowratecalculated = 1.704599 * 1.093 * 1.218 * pb_dischargecoefficient * pbbottomthroatconverted * pow(pbheadconverted,1.5);
  • }


请登录以获得完整内容