DensityUnit.java

  1. package org.djunits.unit;

  2. import org.djunits.quantity.Quantity;
  3. import org.djunits.unit.scale.IdentityScale;
  4. import org.djunits.unit.si.SIPrefixes;
  5. import org.djunits.unit.unitsystem.UnitSystem;

  6. /**
  7.  * Standard density unit based on mass per volume.
  8.  * <p>
  9.  * Copyright (c) 2015-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
  10.  * BSD-style license. See <a href="https://djunits.org/docs/license.html">DJUNITS License</a>
  11.  * </p>
  12.  * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
  13.  */
  14. public class DensityUnit extends Unit<DensityUnit>
  15. {
  16.     /** */
  17.     private static final long serialVersionUID = 20140607L;

  18.     /** The base, with "kg/m3" as the SI signature. */
  19.     public static final Quantity<DensityUnit> BASE = new Quantity<>("Density", "kg/m3");

  20.     /** The SI unit for standard density is kg/m^3. */
  21.     public static final DensityUnit SI = new DensityUnit()
  22.             .build(new Unit.Builder<DensityUnit>().setQuantity(BASE).setId("kg/m^3").setName("kilogram per cubic meter")
  23.                     .setUnitSystem(UnitSystem.SI_DERIVED).setSiPrefixes(SIPrefixes.NONE, 1.0).setScale(IdentityScale.SCALE));

  24.     /** kg/m^3. */
  25.     public static final DensityUnit KG_PER_METER_3 = SI;

  26.     /** g/cm^3. */
  27.     public static final DensityUnit GRAM_PER_CENTIMETER_3 =
  28.             KG_PER_METER_3.deriveLinear(1.0E3, "g/cm^3", "gram per cubic centimeter");

  29. }