View Javadoc
1   package org.djunits.unit;
2   
3   import static org.djunits.unit.unitsystem.UnitSystem.CGS_EMU;
4   import static org.djunits.unit.unitsystem.UnitSystem.CGS_ESU;
5   import static org.djunits.unit.unitsystem.UnitSystem.SI_BASE;
6   
7   import org.djunits.unit.unitsystem.UnitSystem;
8   
9   /**
10   * Standard units for electrical current.
11   * <p>
12   * Copyright (c) 2015-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
13   * BSD-style license. See <a href="http://djunits.org/docs/license.html">DJUNITS License</a>.
14   * <p>
15   * $LastChangedDate: 2019-01-18 00:35:01 +0100 (Fri, 18 Jan 2019) $, @version $Revision: 324 $, by $Author: averbraeck $,
16   * initial version May 15, 2014 <br>
17   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
18   */
19  public class ElectricalCurrentUnit extends LinearUnit<ElectricalCurrentUnit>
20  {
21      /** */
22      private static final long serialVersionUID = 20140607L;
23  
24      /** The SI unit for electrical current is Ampere. */
25      public static final ElectricalCurrentUnit SI;
26  
27      /** Ampere. */
28      public static final ElectricalCurrentUnit AMPERE;
29  
30      /** nanoampere. */
31      public static final ElectricalCurrentUnit NANOAMPERE;
32  
33      /** microampere. */
34      public static final ElectricalCurrentUnit MICROAMPERE;
35  
36      /** milliampere. */
37      public static final ElectricalCurrentUnit MILLIAMPERE;
38  
39      /** kiloampere. */
40      public static final ElectricalCurrentUnit KILOAMPERE;
41  
42      /** megaampere. */
43      public static final ElectricalCurrentUnit MEGAAMPERE;
44  
45      /** statampere (GCS ESU). */
46      public static final ElectricalCurrentUnit STATAMPERE;
47  
48      /** abampere (GCS EMU). */
49      public static final ElectricalCurrentUnit ABAMPERE;
50  
51      static
52      {
53          SI = new ElectricalCurrentUnit("ElectricalCurrentUnit.ampere", "ElectricalCurrentUnit.A", SI_BASE);
54          AMPERE = SI;
55          NANOAMPERE = new ElectricalCurrentUnit("ElectricalCurrentUnit.nanoampere", "ElectricalCurrentUnit.nA", SI_BASE, AMPERE,
56                  1.0E-9, true);
57          MICROAMPERE = new ElectricalCurrentUnit("ElectricalCurrentUnit.microampere", "ElectricalCurrentUnit.muA", SI_BASE,
58                  AMPERE, 1.0E-6, true);
59          MILLIAMPERE = new ElectricalCurrentUnit("ElectricalCurrentUnit.milliampere", "ElectricalCurrentUnit.mA", SI_BASE,
60                  AMPERE, 0.001, true);
61          KILOAMPERE = new ElectricalCurrentUnit("ElectricalCurrentUnit.kiloampere", "ElectricalCurrentUnit.kA", SI_BASE, AMPERE,
62                  1000.0, true);
63          MEGAAMPERE = new ElectricalCurrentUnit("ElectricalCurrentUnit.megaampere", "ElectricalCurrentUnit.MA", SI_BASE, AMPERE,
64                  1.0E6, true);
65          STATAMPERE = new ElectricalCurrentUnit("ElectricalCurrentUnit.statampere", "ElectricalCurrentUnit.statA", CGS_ESU,
66                  AMPERE, 3.335641E-10, true);
67          ABAMPERE = new ElectricalCurrentUnit("ElectricalCurrentUnit.abampere", "ElectricalCurrentUnit.abA", CGS_EMU, AMPERE,
68                  10.0, true);
69      }
70  
71      /**
72       * @param nameKey String; the key to the locale file for the long name of the unit
73       * @param abbreviationKey String; the key to the locale file for the abbreviation of the unit
74       * @param unitSystem UnitSystem; the unit system, e.g. SI or Imperial
75       */
76      private ElectricalCurrentUnit(final String nameKey, final String abbreviationKey, final UnitSystem unitSystem)
77      {
78          super(nameKey, abbreviationKey, unitSystem, true);
79      }
80  
81      /**
82       * Build a unit with a conversion factor to another unit, e.g., a milli Ampere is 0.001 Ampere.
83       * @param nameOrNameKey String; if standardUnit: the key to the locale file for the long name of the unit, otherwise the
84       *            name itself
85       * @param abbreviationOrAbbreviationKey String; if standardUnit: the key to the locale file for the abbreviation of the
86       *            unit, otherwise the abbreviation itself
87       * @param unitSystem UnitSystem; the unit system, e.g. SI or Imperial
88       * @param referenceUnit ElectricalCurrentUnit; the unit to convert to
89       * @param scaleFactorToReferenceUnit double; multiply a value in this unit by the factor to convert to the given reference
90       *            unit
91       * @param standardUnit boolean; indicates whether it is a standard unit with a definition in the locale, or a user-defined
92       *            unit
93       */
94      private ElectricalCurrentUnit(final String nameOrNameKey, final String abbreviationOrAbbreviationKey,
95              final UnitSystem unitSystem, final ElectricalCurrentUnit referenceUnit, final double scaleFactorToReferenceUnit,
96              final boolean standardUnit)
97      {
98          super(nameOrNameKey, abbreviationOrAbbreviationKey, unitSystem, referenceUnit, scaleFactorToReferenceUnit,
99                  standardUnit);
100     }
101 
102     /**
103      * Build a user-defined unit with a conversion factor to another unit.
104      * @param name String; the long name of the unit
105      * @param abbreviation String; the abbreviation of the unit
106      * @param unitSystem UnitSystem; the unit system, e.g. SI or Imperial
107      * @param referenceUnit ElectricalCurrentUnit; the unit to convert to
108      * @param scaleFactorToReferenceUnit double; multiply a value in this unit by the factor to convert to the given reference
109      *            unit
110      */
111     public ElectricalCurrentUnit(final String name, final String abbreviation, final UnitSystem unitSystem,
112             final ElectricalCurrentUnit referenceUnit, final double scaleFactorToReferenceUnit)
113     {
114         this(name, abbreviation, unitSystem, referenceUnit, scaleFactorToReferenceUnit, false);
115     }
116 
117     /** {@inheritDoc} */
118     @Override
119     public final ElectricalCurrentUnit getStandardUnit()
120     {
121         return AMPERE;
122     }
123 
124     /** {@inheritDoc} */
125     @Override
126     public final String getSICoefficientsString()
127     {
128         return "A";
129     }
130 
131 }