View Javadoc
1   package org.djunits.unit;
2   
3   import org.djunits.quantity.Quantity;
4   import org.djunits.unit.scale.OffsetLinearScale;
5   import org.djunits.unit.si.SIPrefixes;
6   import org.djunits.unit.unitsystem.UnitSystem;
7   
8   /**
9    * AbsoluteTemperature units.
10   * <p>
11   * Copyright (c) 2015-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
12   * BSD-style license. See <a href="https://djunits.org/docs/license.html">DJUNITS License</a>
13   * </p>
14   * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
15   */
16  public class AbsoluteTemperatureUnit extends AbsoluteLinearUnit<AbsoluteTemperatureUnit, TemperatureUnit>
17  {
18      /** */
19      private static final long serialVersionUID = 20140605L;
20  
21      /** The base, with "K" as the SI signature. */
22      public static final Quantity<AbsoluteTemperatureUnit> BASE = new Quantity<>("AbsoluteTemperature", "K");
23  
24      /** The default unit for temperature is Kelvin. */
25      public static final AbsoluteTemperatureUnit KELVIN = new AbsoluteTemperatureUnit()
26              .build(new AbsoluteLinearUnit.Builder<AbsoluteTemperatureUnit, TemperatureUnit>().setQuantity(BASE).setId("K")
27                      .setName("Kelvin").setUnitSystem(UnitSystem.SI_BASE).setSiPrefixes(SIPrefixes.UNIT, 1.0)
28                      .setRelativeUnit(TemperatureUnit.KELVIN).setScale(new OffsetLinearScale(1.0, 0.0)));
29  
30      /** The default unit for temperature is Kelvin. */
31      public static final AbsoluteTemperatureUnit DEFAULT = KELVIN;
32  
33      /** Degree Celsius. */
34      public static final AbsoluteTemperatureUnit DEGREE_CELSIUS =
35              KELVIN.deriveLinearOffset(1.0, 273.15, TemperatureUnit.DEGREE_CELSIUS, "dgC", "degree Celsius",
36                      UnitSystem.SI_DERIVED, "\u00B0C", "degC", new String[] {"C"});
37  
38      /** Degree Fahrenheit. */
39      public static final AbsoluteTemperatureUnit DEGREE_FAHRENHEIT =
40              KELVIN.deriveLinearOffset(5.0 / 9.0, 459.67, TemperatureUnit.DEGREE_FAHRENHEIT, "dgF", "degree Fahrenheit",
41                      UnitSystem.SI_DERIVED, "\u00B0F", "degF", new String[] {"F"});
42  
43      /** Degree Rankine. */
44      public static final AbsoluteTemperatureUnit DEGREE_RANKINE =
45              KELVIN.deriveLinearOffset(5.0 / 9.0, 0.0, TemperatureUnit.DEGREE_RANKINE, "dgR", "degree Rankine",
46                      UnitSystem.SI_DERIVED, "\u00B0R", "degR", new String[] {"R"});
47  
48      /** Degree Reaumur. */
49      public static final AbsoluteTemperatureUnit DEGREE_REAUMUR =
50              KELVIN.deriveLinearOffset(4.0 / 5.0, 273.15, TemperatureUnit.DEGREE_REAUMUR, "dgRe", "degree Reaumur",
51                      UnitSystem.SI_DERIVED, "\u00B0R\u00E9", "degRe", new String[] {"Re", "R\u00E9"});
52  }