View Javadoc
1   package org.djunits.unit;
2   
3   import org.djunits.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    * Standard density unit based on mass per volume.
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 DensityUnit extends Unit<DensityUnit>
17  {
18      /** */
19      private static final long serialVersionUID = 20140607L;
20  
21      /** The base, with "kg/m3" as the SI signature. */
22      public static final Quantity<DensityUnit> BASE = new Quantity<>("Density", "kg/m3");
23  
24      /** The SI unit for standard density is kg/m^3. */
25      public static final DensityUnit SI = new DensityUnit()
26              .build(new Unit.Builder<DensityUnit>().setQuantity(BASE).setId("kg/m^3").setName("kilogram per cubic meter")
27                      .setUnitSystem(UnitSystem.SI_DERIVED).setSiPrefixes(SIPrefixes.NONE, 1.0).setScale(IdentityScale.SCALE));
28  
29      /** kg/m^3. */
30      public static final DensityUnit KG_PER_METER_3 = SI;
31  
32      /** g/cm^3. */
33      public static final DensityUnit GRAM_PER_CENTIMETER_3 =
34              KG_PER_METER_3.deriveLinear(1.0E3, "g/cm^3", "gram per cubic centimeter");
35  
36  }