Ejemplo n.º 1
0
        public string GetUnitAsString(PhysicalQuantity varType)
        {
            //Type myType = pqTypeTable[varType] as Type;
            //return myType.InvokeMember("GetUnitAsString", BindingFlags.Static, null, null, new object[] {varType}) as String;

            string unitString = "";

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

            return(unitString);
        }
Ejemplo n.º 2
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);
        }