View Javadoc
1   package org.djunits.unit;
2   
3   import org.djunits.unit.quantity.Quantity;
4   import org.djunits.unit.scale.IdentityScale;
5   import org.djunits.unit.si.SIPrefixes;
6   import org.djunits.unit.unitsystem.UnitSystem;
7   
8   /**
9    * Temperature units.
10   * <p>
11   * Copyright (c) 2015-2023 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 TemperatureUnit extends Unit<TemperatureUnit>
17  {
18      /** */
19      private static final long serialVersionUID = 20140605L;
20  
21      /** The base, with "m2" as the SI signature. */
22      public static final Quantity<TemperatureUnit> BASE = new Quantity<>("Temperature", "K");
23  
24      /** The SI unit for temperature is Kelvin. */
25      public static final TemperatureUnit SI =
26              new TemperatureUnit().build(new Unit.Builder<TemperatureUnit>().setQuantity(BASE).setId("K").setName("Kelvin")
27                      .setUnitSystem(UnitSystem.SI_BASE).setSiPrefixes(SIPrefixes.UNIT, 1.0).setScale(IdentityScale.SCALE));
28  
29      /** Kelvin. */
30      public static final TemperatureUnit KELVIN = SI;
31  
32      /** Degree Celsius. */
33      public static final TemperatureUnit DEGREE_CELSIUS =
34              KELVIN.deriveLinear(1.0, "dgC", "degree Celcius", UnitSystem.SI_DERIVED, "\u00B0C", "degC", new String[] {"C"});
35  
36      /** Degree Fahrenheit. */
37      public static final TemperatureUnit DEGREE_FAHRENHEIT = KELVIN.deriveLinear(5.0 / 9.0, "dgF", "degree Fahrenheit",
38              UnitSystem.SI_DERIVED, "\u00B0F", "degF", new String[] {"F"});
39  
40      /** Degree Rankine. */
41      public static final TemperatureUnit DEGREE_RANKINE = KELVIN.deriveLinear(5.0 / 9.0, "dgR", "degree Rankine",
42              UnitSystem.SI_DERIVED, "\u00B0R", "degR", new String[] {"R"});
43  
44      /** Degree Reaumur. */
45      public static final TemperatureUnit DEGREE_REAUMUR = KELVIN.deriveLinear(4.0 / 5.0, "dgRe", "degree Reaumur",
46              UnitSystem.SI_DERIVED, "\u00B0R\u00E9", "degRe", new String[] {"Re", "R\u00E9"});
47  
48  }