コード例 #1
0
        /// <summary>
        /// Calculate pressure drop with the input data .
        /// </summary>
        /// <param name="data">
        /// The input for the pressure drop calculation. The result is also return through the data to the caller.
        /// </param>
        public void Calculate(PipePressureDropData data)
        {
            double        dRelRoughness     = 0.0;
            double        dVelocity         = 0.0;
            double        dFrictionFactor   = 0.0;
            double        dFriction         = 0.0;
            double        dReynolds         = 0.0;
            double        dCoefficient      = 0.0;
            double        dVelocityPressure = 0.0;
            double        dPressureDrop     = 0.0;
            PipeFlowState eFlowState        = PipeFlowState.LaminarState;

            if (data.KLevel != Autodesk.Revit.DB.Mechanical.SystemCalculationLevel.None)
            {
                dVelocity  = CalcVelocity(data.InsideDiameter, data.Flow);
                dReynolds  = CalcReynoldsNumber(data.InsideDiameter, dVelocity, data.Density, data.Viscosity);
                eFlowState = CalcFlowState(dReynolds);
            }
            dRelRoughness = CalcRelRoughness(data.InsideDiameter, data.Roughness);

            if (data.KLevel == Autodesk.Revit.DB.Mechanical.SystemCalculationLevel.All)
            {
                dFrictionFactor   = CalcFrictionFactor(dReynolds, dRelRoughness, eFlowState);
                dFriction         = CalcFriction(data.InsideDiameter, dFrictionFactor, data.Density, dVelocity);
                dPressureDrop     = data.Length * dFriction;
                dVelocityPressure = CalcVelocityPressure(dVelocity, data.Density);
                if (!AlmostZero(dVelocityPressure))
                {
                    dCoefficient = dPressureDrop / dVelocityPressure;
                }
            }

            data.Velocity          = dVelocity;
            data.ReynoldsNumber    = dReynolds;
            data.FlowState         = eFlowState;
            data.RelativeRoughness = dRelRoughness;
            data.FrictionFactor    = dFrictionFactor;
            data.Friction          = dFriction;
            data.PressureDrop      = dPressureDrop;
            data.VelocityPressure  = dVelocityPressure;
            data.Coefficient       = dCoefficient;
        }
コード例 #2
0
        /// <summary>
        /// Calculate pressure drop with the input data .
        /// </summary>
        /// <param name="data">
        /// The input for the pressure drop calculation. The result is also return through the data to the caller. 
        /// </param>
        public void Calculate( PipePressureDropData data )
        {
            double dRelRoughness = 0.0;
              double dVelocity = 0.0;
              double dFrictionFactor = 0.0;
              double dFriction = 0.0;
              double dReynolds = 0.0;
              double dCoefficient = 0.0;
              double dVelocityPressure = 0.0;
              double dPressureDrop = 0.0;
              PipeFlowState eFlowState = PipeFlowState.LaminarState;
              if( data.KLevel != Autodesk.Revit.DB.Mechanical.SystemCalculationLevel.None )
              {
            dVelocity = CalcVelocity( data.InsideDiameter, data.Flow );
            dReynolds = CalcReynoldsNumber( data.InsideDiameter, dVelocity, data.Density, data.Viscosity );
            eFlowState = CalcFlowState( dReynolds );
              }
              dRelRoughness = CalcRelRoughness( data.InsideDiameter, data.Roughness );

              if( data.KLevel == Autodesk.Revit.DB.Mechanical.SystemCalculationLevel.All )
              {
            dFrictionFactor = CalcFrictionFactor( dReynolds, dRelRoughness, eFlowState );
            dFriction = CalcFriction( data.InsideDiameter, dFrictionFactor, data.Density, dVelocity );
            dPressureDrop = data.Length * dFriction;
            dVelocityPressure = CalcVelocityPressure( dVelocity, data.Density );
            if( !AlmostZero( dVelocityPressure ) )
              dCoefficient = dPressureDrop / dVelocityPressure;
              }

              data.Velocity = dVelocity;
              data.ReynoldsNumber = dReynolds;
              data.FlowState = eFlowState;
              data.RelativeRoughness = dRelRoughness;
              data.FrictionFactor = dFrictionFactor;
              data.Friction = dFriction;
              data.PressureDrop = dPressureDrop;
              data.VelocityPressure = dVelocityPressure;
              data.Coefficient = dCoefficient;
        }