Esempio n. 1
0
        public static double ToJoule(double srcValue, EnergyRepresentation srcUnit)
        {
            switch (srcUnit)
            {
            case EnergyRepresentation.Joule:
                return(srcValue);

            case EnergyRepresentation.JoulePerMole:
                return(srcValue / SIConstants.AVOGADROS_CONSTANT);

            case EnergyRepresentation.CalorieInternational:
                return(srcValue * SIConstants.CALORIE);

            case EnergyRepresentation.CalorieInternationalPerMole:
                return(srcValue * SIConstants.CALORIE / SIConstants.AVOGADROS_CONSTANT);

            case EnergyRepresentation.ElectronVolt:
                return(srcValue * SIConstants.ELECTRON_VOLT);

            case EnergyRepresentation.KilowattHours:
                return(srcValue * 3600000);

            case EnergyRepresentation.AsTemperatureKelvin:
                return(srcValue * SIConstants.BOLTZMANN);

            default:
                throw new ArgumentOutOfRangeException("EnergyUnit unknown: " + srcUnit.ToString());
            }
        }
Esempio n. 2
0
        public string ParameterName(int i)
        {
            switch (i)
            {
            case 0:
                return("y0");

            case 1:
                return("E_" + _paramEnergyUnit.ToString());

            default:
                throw new ArgumentOutOfRangeException("i");
            }
        }
Esempio n. 3
0
		public static double ToJoule(double srcValue, EnergyRepresentation srcUnit)
		{
			switch (srcUnit)
			{
				case EnergyRepresentation.Joule:
					return srcValue;

				case EnergyRepresentation.JoulePerMole:
					return srcValue / SIConstants.AVOGADROS_CONSTANT;

				case EnergyRepresentation.CalorieInternational:
					return srcValue * SIConstants.CALORIE;

				case EnergyRepresentation.CalorieInternationalPerMole:
					return srcValue * SIConstants.CALORIE / SIConstants.AVOGADROS_CONSTANT;

				case EnergyRepresentation.ElectronVolt:
					return srcValue * SIConstants.ELECTRON_VOLT;

				case EnergyRepresentation.KilowattHours:
					return srcValue * 3600000;

				case EnergyRepresentation.AsTemperatureKelvin:
					return srcValue * SIConstants.BOLTZMANN;

				default:
					throw new ArgumentOutOfRangeException("EnergyUnit unknown: " + srcUnit.ToString());
			}
		}