Example #1
0
 public void NumberToWattHoursPerKilogramTest() =>
 Assert.Equal(SpecificEnergy.FromWattHoursPerKilogram(2), 2.WattHoursPerKilogram());
Example #2
0
 public void NumberToBtuPerPoundTest() =>
 Assert.Equal(SpecificEnergy.FromBtuPerPound(2), 2.BtuPerPound());
Example #3
0
 public void NumberToTerawattDaysPerShortTonTest() =>
 Assert.Equal(SpecificEnergy.FromTerawattDaysPerShortTon(2), 2.TerawattDaysPerShortTon());
Example #4
0
 public void NumberToWattDaysPerTonneTest() =>
 Assert.Equal(SpecificEnergy.FromWattDaysPerTonne(2), 2.WattDaysPerTonne());
Example #5
0
 /// <inheritdoc cref="SpecificEnergy.FromWattHoursPerKilogram(UnitsNet.QuantityValue)" />
 public static SpecificEnergy WattHoursPerKilogram <T>(this T value) =>
 SpecificEnergy.FromWattHoursPerKilogram(Convert.ToDouble(value));
 /// <summary>Get <see cref="SpecificEnergy"/> from <paramref name="value"/> divided by <see cref="BrakeSpecificFuelConsumption"/>.</summary>
 public static SpecificEnergy operator /(double value, BrakeSpecificFuelConsumption bsfc)
 {
     return(SpecificEnergy.FromJoulesPerKilogram(value / bsfc.KilogramsPerJoule));
 }
Example #7
0
 /// <inheritdoc cref="SpecificEnergy.FromKilocaloriesPerGram(UnitsNet.QuantityValue)" />
 public static SpecificEnergy KilocaloriesPerGram <T>(this T value) =>
 SpecificEnergy.FromKilocaloriesPerGram(Convert.ToDouble(value));
Example #8
0
 /// <inheritdoc cref="SpecificEnergy.FromMegajoulesPerKilogram(UnitsNet.QuantityValue)" />
 public static SpecificEnergy MegajoulesPerKilogram <T>(this T value) =>
 SpecificEnergy.FromMegajoulesPerKilogram(Convert.ToDouble(value));
Example #9
0
 /// <inheritdoc cref="SpecificEnergy.FromBtuPerPound(UnitsNet.QuantityValue)" />
 public static SpecificEnergy BtuPerPound <T>(this T value) =>
 SpecificEnergy.FromBtuPerPound(Convert.ToDouble(value));
Example #10
0
        public void PowerDividedBySpecificEnergyEqualsMassFlow()
        {
            MassFlow massFlow = Power.FromWatts(15.0) / SpecificEnergy.FromJoulesPerKilogram(3);

            Assert.Equal(massFlow, MassFlow.FromKilogramsPerSecond(5));
        }
Example #11
0
        public void PowerDividedByMassFlowEqualsSpecificEnergy()
        {
            SpecificEnergy specificEnergy = Power.FromWatts(15.0) / MassFlow.FromKilogramsPerSecond(3);

            Assert.Equal(specificEnergy, SpecificEnergy.FromJoulesPerKilogram(5));
        }
 protected void SetScalarValue(DependencyProperty property, SpecificEnergy? quantity)
 {
     // we set this flag to prevent from setting scalar value changing quantity values.
     this.isUpdatingScalarValue = true;
     var value = quantity != null
         ? this.Unit.GetScalarValue(quantity.Value)
         : (double?)null;
     this.SetCurrentValue(property, value);
     this.isUpdatingScalarValue = false;
 }
 protected virtual void OnMaxValueChanged(SpecificEnergy? oldValue, SpecificEnergy? newValue)
 {
     this.SetScalarValue(ScalarMaxValueProperty, newValue);
 }