Beispiel #1
0
        public double ConvertFromSIValue(PhysicalQuantity varType, double toBeConverted)
        {
            ///Type myType = pqTypeTable[varType] as Type;
            //return (double) myType.InvokeMember("ConvertFromSIValue", BindingFlags.Static, null, null, new object[] {varType, toBeConverted});

            double convertedValue = 0;

            if (varType == PhysicalQuantity.Temperature)
            {
                convertedValue = TemperatureUnit.ConvertFromSIValue(currentUnitSystem.TemperatureUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.Pressure)
            {
                convertedValue = PressureUnit.ConvertFromSIValue(currentUnitSystem.PressureUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.MassFlowRate)
            {
                convertedValue = MassFlowRateUnit.ConvertFromSIValue(currentUnitSystem.MassFlowRateUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.VolumeFlowRate)
            {
                convertedValue = VolumeFlowRateUnit.ConvertFromSIValue(currentUnitSystem.VolumeFlowRateUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.VolumeRateFlowGases)
            {
                convertedValue = VolumeRateFlowGasesUnit.ConvertFromSIValue(currentUnitSystem.VolumeRateFlowGasesUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.VolumeRateFlowLiquids)
            {
                convertedValue = VolumeRateFlowLiquidsUnit.ConvertFromSIValue(currentUnitSystem.VolumeRateFlowLiquidsUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.MoistureContent)
            {
                convertedValue = MoistureContentUnit.ConvertFromSIValue(currentUnitSystem.MoistureContentUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.SpecificEnergy)
            {
                convertedValue = SpecificEnergyUnit.ConvertFromSIValue(currentUnitSystem.SpecificEnergyUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.SpecificHeat)
            {
                convertedValue = SpecificHeatUnit.ConvertFromSIValue(currentUnitSystem.SpecificHeatUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.Energy)
            {
                convertedValue = EnergyUnit.ConvertFromSIValue(currentUnitSystem.EnergyUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.Power)
            {
                convertedValue = PowerUnit.ConvertFromSIValue(currentUnitSystem.PowerUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.Density)
            {
                convertedValue = DensityUnit.ConvertFromSIValue(currentUnitSystem.DensityUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.SpecificVolume)
            {
                convertedValue = SpecificVolumeUnit.ConvertFromSIValue(currentUnitSystem.SpecificVolumeUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.DynamicViscosity)
            {
                convertedValue = DynamicViscosityUnit.ConvertFromSIValue(currentUnitSystem.DynamicViscosityUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.KinematicViscosity)
            {
                convertedValue = KinematicViscosityUnit.ConvertFromSIValue(currentUnitSystem.KinematicViscosityUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.ThermalConductivity)
            {
                convertedValue = ThermalConductivityUnit.ConvertFromSIValue(currentUnitSystem.ThermalConductivityUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.HeatTransferCoefficient)
            {
                convertedValue = HeatTransferCoefficientUnit.ConvertFromSIValue(currentUnitSystem.HeatTransferCoefficientUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.VolumeHeatTransferCoefficient)
            {
                convertedValue = VolumeHeatTransferCoefficientUnit.ConvertFromSIValue(currentUnitSystem.VolumeHeatTransferCoefficientUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.FoulingFactor)
            {
                convertedValue = FoulingFactorUnit.ConvertFromSIValue(currentUnitSystem.FoulingFactorUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.Diffusivity)
            {
                convertedValue = DiffusivityUnit.ConvertFromSIValue(currentUnitSystem.DiffusivityUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.Velocity)
            {
                convertedValue = VelocityUnit.ConvertFromSIValue(currentUnitSystem.VelocityUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.Mass)
            {
                convertedValue = MassUnit.ConvertFromSIValue(currentUnitSystem.MassUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.Length)
            {
                convertedValue = LengthUnit.ConvertFromSIValue(currentUnitSystem.LengthUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.SmallLength)
            {
                convertedValue = SmallLengthUnit.ConvertFromSIValue(currentUnitSystem.SmallLengthUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.MicroLength)
            {
                convertedValue = MicroLengthUnit.ConvertFromSIValue(currentUnitSystem.MicroLengthUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.Area)
            {
                convertedValue = AreaUnit.ConvertFromSIValue(currentUnitSystem.AreaUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.Volume)
            {
                convertedValue = VolumeUnit.ConvertFromSIValue(currentUnitSystem.VolumeUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.Time)
            {
                convertedValue = TimeUnit.ConvertFromSIValue(currentUnitSystem.TimeUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.Fraction)
            {
                convertedValue = FractionUnit.ConvertFromSIValue(currentUnitSystem.FractionUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.LiquidHead)
            {
                convertedValue = LiquidHeadUnit.ConvertFromSIValue(currentUnitSystem.LiquidHeadUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.MassVolumeConcentration)
            {
                convertedValue = MassVolumeConcentrationUnit.ConvertFromSIValue(currentUnitSystem.MassVolumeConcentrationUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.PlaneAngle)
            {
                convertedValue = PlaneAngleUnit.ConvertFromSIValue(currentUnitSystem.PlaneAngleUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.HeatFlux)
            {
                convertedValue = HeatFluxUnit.ConvertFromSIValue(currentUnitSystem.HeatFluxUnitType, toBeConverted);
            }
            else if (varType == PhysicalQuantity.Unknown)
            {
                convertedValue = toBeConverted;
            }

            return(convertedValue);
        }