Example #1
0
        private void CreateDefaultUnit(string name, TemperatureUnitType temperature, PressureUnitType pressure,
                                       LiquidHeadUnitType liquidHead, MassFlowRateUnitType massFlowRate, VolumeFlowRateUnitType volumeFlowRate,
                                       VolumeRateFlowLiquidsUnitType volumeRateFlowLiquids, VolumeRateFlowGasesUnitType volumeRateFlowGases,
                                       MoistureContentUnitType moistureContent, FractionUnitType fraction, SpecificEnergyUnitType specificEnergy,
                                       SpecificEntropyUnitType specificEntropy, SpecificHeatUnitType specificHeat,
                                       EnergyUnitType energy, PowerUnitType power, DensityUnitType density,
                                       SpecificVolumeUnitType specificVolume, DynamicViscosityUnitType dynamicViscosity,
                                       KinematicViscosityUnitType kinematicViscosity, ThermalConductivityUnitType thermalConductivity,
                                       HeatTransferCoefficientUnitType heatTransferCoefficient, VolumeHeatTransferCoefficientUnitType volumeHeatTransferCoefficient,
                                       FoulingFactorUnitType foulingFactor,
                                       HeatFluxUnitType heatFluxDensity, DiffusivityUnitType diffusivity,
                                       SurfaceTensionUnitType surfaceTension, VelocityUnitType velocity, MassUnitType mass,
                                       LengthUnitType length, SmallLengthUnitType smallLength, MicroLengthUnitType microLength,
                                       AreaUnitType area, VolumeUnitType volume, MassVolumeConcentrationUnitType massVolumeConcentration,
                                       TimeUnitType time, PlaneAngleUnitType planeAngle)
        {
            UnitSystem us = new UnitSystem(name, true, temperature, pressure, liquidHead, massFlowRate,
                                           volumeFlowRate, volumeRateFlowLiquids, volumeRateFlowGases, moistureContent,
                                           fraction, specificEnergy, specificEntropy, specificHeat, energy, power,
                                           density, specificVolume, dynamicViscosity, kinematicViscosity, thermalConductivity,
                                           heatTransferCoefficient, volumeHeatTransferCoefficient, foulingFactor, heatFluxDensity,
                                           diffusivity, surfaceTension, velocity, mass, length, smallLength, microLength, area, volume,
                                           massVolumeConcentration, time, planeAngle);

            unitSystemList.Add(us);
            if (!us.IsReadOnly)
            {
                us.UnitSystemChanged += new UnitSystemChangedEventHandler(unitSystem_UnitSystemChanged);
            }
        }
Example #2
0
 public UnitSystem(string name, bool readOnly, TemperatureUnitType temperature,
                   PressureUnitType pressure, LiquidHeadUnitType liquidHead, MassFlowRateUnitType massFlowRate,
                   VolumeFlowRateUnitType volumeFlowRate, VolumeRateFlowLiquidsUnitType volumeRateFlowLiquids,
                   VolumeRateFlowGasesUnitType volumeRateFlowGases, MoistureContentUnitType moistureContent,
                   FractionUnitType fraction, SpecificEnergyUnitType enthalpy, SpecificEntropyUnitType entropy,
                   SpecificHeatUnitType specificHeat, EnergyUnitType energy, PowerUnitType power, DensityUnitType density,
                   SpecificVolumeUnitType specificVolume,
                   DynamicViscosityUnitType dynamicViscosity, KinematicViscosityUnitType kinematicViscosity,
                   ThermalConductivityUnitType conductivity, HeatTransferCoefficientUnitType heatTransferCoefficient,
                   VolumeHeatTransferCoefficientUnitType volumeHeatTransferCoefficient, FoulingFactorUnitType foulingFactor, HeatFluxUnitType heatFlux,
                   DiffusivityUnitType diffusivity, SurfaceTensionUnitType surfaceTension, VelocityUnitType velocity,
                   MassUnitType mass, LengthUnitType length, SmallLengthUnitType smallLength, MicroLengthUnitType microLength,
                   AreaUnitType area, VolumeUnitType volume, MassVolumeConcentrationUnitType massVolumeConcentration, TimeUnitType time,
                   PlaneAngleUnitType planeAngle, MoleFlowRateUnitType moleFlowRate)
 {
     this.name                          = name;
     this.temperature                   = temperature;
     this.pressure                      = pressure;
     this.liquidHead                    = liquidHead;
     this.massFlowRate                  = massFlowRate;
     this.volumeFlowRate                = volumeFlowRate;
     this.volumeRateFlowLiquids         = volumeRateFlowLiquids;
     this.volumeRateFlowGases           = volumeRateFlowGases;
     this.moistureContent               = moistureContent;
     this.fraction                      = fraction;
     this.enthalpy                      = enthalpy;
     this.entropy                       = entropy;
     this.specificHeat                  = specificHeat;
     this.energy                        = energy;
     this.power                         = power;
     this.density                       = density;
     this.specificVolume                = specificVolume;
     this.dynamicViscosity              = dynamicViscosity;
     this.kinematicViscosity            = kinematicViscosity;
     this.conductivity                  = conductivity;
     this.diffusivity                   = diffusivity;
     this.heatTransferCoefficient       = heatTransferCoefficient;
     this.volumeHeatTransferCoefficient = volumeHeatTransferCoefficient;
     this.foulingFactor                 = foulingFactor;
     this.heatFlux                      = heatFlux;
     this.surfaceTension                = surfaceTension;
     this.velocity                      = velocity;
     this.mass                          = mass;
     this.length                        = length;
     this.smallLength                   = smallLength;
     this.microLength                   = microLength;
     this.area                          = area;
     this.volume                        = volume;
     this.massVolumeConcentration       = massVolumeConcentration;
     this.time                          = time;
     this.planeAngle                    = planeAngle;
     this.moleFlowRate                  = moleFlowRate;
     this.readOnly                      = readOnly;
 }
Example #3
0
        public virtual void SetObjectData(SerializationInfo info, StreamingContext context)
        {
            int persistedClassVersion = (int)info.GetValue("ClassPersistenceVersionUnitSystem", typeof(int));

            if (persistedClassVersion >= 1)
            {
                this.name                          = (string)info.GetValue("Name", typeof(string));
                this.readOnly                      = (bool)info.GetValue("IsReadOnly", typeof(bool));
                this.area                          = (AreaUnitType)info.GetValue("AreaUnit", typeof(AreaUnitType));
                this.density                       = (DensityUnitType)info.GetValue("DensityUnit", typeof(DensityUnitType));
                this.diffusivity                   = (DiffusivityUnitType)info.GetValue("DiffusivityUnit", typeof(DiffusivityUnitType));
                this.dynamicViscosity              = (DynamicViscosityUnitType)info.GetValue("DynamicViscosityUnit", typeof(DynamicViscosityUnitType));
                this.energy                        = (EnergyUnitType)info.GetValue("EnergyUnit", typeof(EnergyUnitType));
                this.foulingFactor                 = (FoulingFactorUnitType)info.GetValue("FoulingFactorUnit", typeof(FoulingFactorUnitType));
                this.fraction                      = (FractionUnitType)info.GetValue("FractionUnit", typeof(FractionUnitType));
                this.heatFlux                      = (HeatFluxUnitType)info.GetValue("HeatFluxUnit", typeof(HeatFluxUnitType));
                this.heatTransferCoefficient       = (HeatTransferCoefficientUnitType)info.GetValue("HeatTransferCoefficientUnit", typeof(HeatTransferCoefficientUnitType));
                this.volumeHeatTransferCoefficient = (VolumeHeatTransferCoefficientUnitType)info.GetValue("VolumeHeatTransferCoefficientUnit", typeof(VolumeHeatTransferCoefficientUnitType));
                this.kinematicViscosity            = (KinematicViscosityUnitType)info.GetValue("KinematicViscosityUnit", typeof(KinematicViscosityUnitType));
                this.length                        = (LengthUnitType)info.GetValue("LengthUnit", typeof(LengthUnitType));
                this.liquidHead                    = (LiquidHeadUnitType)info.GetValue("LiquidHeadUnit", typeof(LiquidHeadUnitType));
                this.massFlowRate                  = (MassFlowRateUnitType)info.GetValue("MassFlowRateUnit", typeof(MassFlowRateUnitType));
                this.mass                          = (MassUnitType)info.GetValue("MassUnit", typeof(MassUnitType));
                this.massVolumeConcentration       = (MassVolumeConcentrationUnitType)info.GetValue("MassVolumeConcentrationUnit", typeof(MassVolumeConcentrationUnitType));
                this.microLength                   = (MicroLengthUnitType)info.GetValue("MicroLengthUnit", typeof(MicroLengthUnitType));
                this.moistureContent               = (MoistureContentUnitType)info.GetValue("MoistureContentUnit", typeof(MoistureContentUnitType));
                this.planeAngle                    = (PlaneAngleUnitType)info.GetValue("PlaneAngleUnit", typeof(PlaneAngleUnitType));
                this.power                         = (PowerUnitType)info.GetValue("PowerUnit", typeof(PowerUnitType));
                this.pressure                      = (PressureUnitType)info.GetValue("PressureUnit", typeof(PressureUnitType));
                this.smallLength                   = (SmallLengthUnitType)info.GetValue("SmallLengthUnit", typeof(SmallLengthUnitType));
                this.enthalpy                      = (SpecificEnergyUnitType)info.GetValue("SpecificEnergyUnit", typeof(SpecificEnergyUnitType));
                this.entropy                       = (SpecificEntropyUnitType)info.GetValue("SpecificEntropyUnit", typeof(SpecificEntropyUnitType));
                this.specificHeat                  = (SpecificHeatUnitType)info.GetValue("SpecificHeatUnit", typeof(SpecificHeatUnitType));
                this.specificVolume                = (SpecificVolumeUnitType)info.GetValue("SpecificVolumeUnit", typeof(SpecificVolumeUnitType));
                this.surfaceTension                = (SurfaceTensionUnitType)info.GetValue("SurfaceTensionUnit", typeof(SurfaceTensionUnitType));
                this.temperature                   = (TemperatureUnitType)info.GetValue("TemperatureUnit", typeof(TemperatureUnitType));
                this.conductivity                  = (ThermalConductivityUnitType)info.GetValue("ThermalConductivityUnit", typeof(ThermalConductivityUnitType));
                this.time                          = (TimeUnitType)info.GetValue("TimeUnit", typeof(TimeUnitType));
                this.velocity                      = (VelocityUnitType)info.GetValue("VelocityUnit", typeof(VelocityUnitType));
                this.volumeFlowRate                = (VolumeFlowRateUnitType)info.GetValue("VolumeFlowRateUnit", typeof(VolumeFlowRateUnitType));
                this.volumeRateFlowGases           = (VolumeRateFlowGasesUnitType)info.GetValue("VolumeRateFlowGasesUnit", typeof(VolumeRateFlowGasesUnitType));
                this.volumeRateFlowLiquids         = (VolumeRateFlowLiquidsUnitType)info.GetValue("VolumeRateFlowLiquidsUnit", typeof(VolumeRateFlowLiquidsUnitType));
                this.volume                        = (VolumeUnitType)info.GetValue("VolumeUnit", typeof(VolumeUnitType));
            }
            if (persistedClassVersion >= 2)
            {
                this.moleFlowRate = (MoleFlowRateUnitType)info.GetValue("MoleFlowRateUnit", typeof(MoleFlowRateUnitType));
            }
        }
Example #4
0
        public static MassFlowRateUnitType GetUnitAsEnum(string unitString)
        {
            IDictionaryEnumerator myEnumerator = unitStringTable.GetEnumerator();
            String name;
            MassFlowRateUnitType type = MassFlowRateUnitType.KgPerSec;

            while (myEnumerator.MoveNext())
            {
                name = myEnumerator.Value as String;
                if (name.Equals(unitString))
                {
                    type = (MassFlowRateUnitType)myEnumerator.Key;
                    break;
                }
            }
            return(type);
        }
Example #5
0
        public void Commit(UnitSystem us)
        {
            this.name                          = us.Name; //ep
            this.temperature                   = us.temperature;
            this.pressure                      = us.pressure;
            this.liquidHead                    = us.liquidHead;
            this.massFlowRate                  = us.massFlowRate;
            this.volumeFlowRate                = us.volumeFlowRate;
            this.volumeRateFlowLiquids         = us.volumeRateFlowLiquids;
            this.volumeRateFlowGases           = us.volumeRateFlowGases;
            this.moistureContent               = us.moistureContent;
            this.fraction                      = us.fraction;
            this.enthalpy                      = us.enthalpy;
            this.entropy                       = us.entropy;
            this.specificHeat                  = us.specificHeat;
            this.energy                        = us.energy;
            this.power                         = us.power;
            this.density                       = us.density;
            this.specificVolume                = us.specificVolume;
            this.dynamicViscosity              = us.dynamicViscosity;
            this.kinematicViscosity            = us.kinematicViscosity;
            this.conductivity                  = us.conductivity;
            this.diffusivity                   = us.diffusivity;
            this.heatTransferCoefficient       = us.heatTransferCoefficient;
            this.volumeHeatTransferCoefficient = us.volumeHeatTransferCoefficient;
            this.foulingFactor                 = us.foulingFactor;
            this.heatFlux                      = us.heatFlux;
            this.surfaceTension                = us.surfaceTension;
            this.velocity                      = us.velocity;
            this.mass                          = us.mass;
            this.length                        = us.length;
            this.smallLength                   = us.smallLength;
            this.microLength                   = us.microLength;
            this.area                          = us.area;
            this.volume                        = us.volume;
            this.massVolumeConcentration       = us.massVolumeConcentration;

            this.time         = us.time;
            this.planeAngle   = us.planeAngle;
            this.moleFlowRate = us.moleFlowRate;

            this.OnUnitSystemChanged(this);
        }
Example #6
0
 public UnitSystem()
 {
     this.name                          = "SI"; //ep
     this.temperature                   = TemperatureUnitType.Kelvin;
     this.pressure                      = PressureUnitType.Kilopascal;
     this.liquidHead                    = LiquidHeadUnitType.Meter;
     this.massFlowRate                  = MassFlowRateUnitType.KgPerHour;
     this.volumeFlowRate                = VolumeFlowRateUnitType.CubicMeterPerHour;
     this.volumeRateFlowLiquids         = VolumeRateFlowLiquidsUnitType.CubicMeterPerHour;
     this.volumeRateFlowGases           = VolumeRateFlowGasesUnitType.CubicMeterPerHour;
     this.moistureContent               = MoistureContentUnitType.KgPerKg;
     this.fraction                      = FractionUnitType.Percent;
     this.enthalpy                      = SpecificEnergyUnitType.KilojoulePerKg;
     this.entropy                       = SpecificEntropyUnitType.KilojoulePerKgKelvin;
     this.specificHeat                  = SpecificHeatUnitType.KilojoulePerKgKelvin;
     this.energy                        = EnergyUnitType.Kilojoule;
     this.power                         = PowerUnitType.Kilowatt;
     this.density                       = DensityUnitType.KgPerCubicMeter;
     this.specificVolume                = SpecificVolumeUnitType.CubicMeterPerKg;
     this.dynamicViscosity              = DynamicViscosityUnitType.PascalSecond;
     this.kinematicViscosity            = KinematicViscosityUnitType.SquareMeterPerSec;
     this.conductivity                  = ThermalConductivityUnitType.WattPerMeterKelvin;
     this.diffusivity                   = DiffusivityUnitType.SquareMeterPerSec;
     this.velocity                      = VelocityUnitType.MeterPerSec;
     this.mass                          = MassUnitType.Kilogram;
     this.length                        = LengthUnitType.Meter;
     this.smallLength                   = SmallLengthUnitType.Centimeter;
     this.microLength                   = MicroLengthUnitType.Micrometer;
     this.heatTransferCoefficient       = HeatTransferCoefficientUnitType.WattPerSquareMeterKelvin;
     this.volumeHeatTransferCoefficient = VolumeHeatTransferCoefficientUnitType.WattPerCubicMeterKelvin;
     this.foulingFactor                 = FoulingFactorUnitType.SquareMeterKelvinPerWatt;
     this.surfaceTension                = SurfaceTensionUnitType.NewtonPerMeter;
     this.area                          = AreaUnitType.SquareMeter;
     this.volume                        = VolumeUnitType.CubicMeter;
     this.massVolumeConcentration       = MassVolumeConcentrationUnitType.KgPerCubicMeter;
     this.time                          = TimeUnitType.Second;
     this.heatFlux                      = HeatFluxUnitType.WattPerSquareMeter;
     this.planeAngle                    = PlaneAngleUnitType.Radian;
     this.moleFlowRate                  = MoleFlowRateUnitType.KmolePerSec;
     this.readOnly                      = true;
 }
Example #7
0
 public static string GetUnitAsString(MassFlowRateUnitType unitType)
 {
     return(unitStringTable[unitType] as String);
 }
Example #8
0
        public static double ConvertFromSIValue(MassFlowRateUnitType unitType, double kgPerSecValue)
        {
            double convertionCoeff = (double)coeffTable[unitType];

            return(kgPerSecValue / convertionCoeff);
        }
Example #9
0
        public static double ConvertToSIValue(MassFlowRateUnitType unitType, double toBeConvertedValue)
        {
            double convertionCoeff = (double)coeffTable[unitType];

            return(convertionCoeff * toBeConvertedValue);
        }