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-2018 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: 2018-01-28 03:17:44 +0100 (Sun, 28 Jan 2018) $, @version $Revision: 256 $, 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 the key to the locale file for the long name of the unit
73       * @param abbreviationKey the key to the locale file for the abbreviation of the unit
74       * @param 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 if standardUnit: the key to the locale file for the long name of the unit, otherwise the name itself
84       * @param abbreviationOrAbbreviationKey if standardUnit: the key to the locale file for the abbreviation of the unit,
85       *            otherwise the abbreviation itself
86       * @param unitSystem the unit system, e.g. SI or Imperial
87       * @param referenceUnit the unit to convert to
88       * @param scaleFactorToReferenceUnit multiply a value in this unit by the factor to convert to the given reference unit
89       * @param standardUnit indicates whether it is a standard unit with a definition in the locale, or a user-defined unit
90       */
91      private ElectricalCurrentUnit(final String nameOrNameKey, final String abbreviationOrAbbreviationKey,
92              final UnitSystem unitSystem, final ElectricalCurrentUnit referenceUnit, final double scaleFactorToReferenceUnit,
93              final boolean standardUnit)
94      {
95          super(nameOrNameKey, abbreviationOrAbbreviationKey, unitSystem, referenceUnit, scaleFactorToReferenceUnit,
96                  standardUnit);
97      }
98  
99      /**
100      * Build a user-defined unit with a conversion factor to another unit.
101      * @param name the long name of the unit
102      * @param abbreviation the abbreviation of the unit
103      * @param unitSystem the unit system, e.g. SI or Imperial
104      * @param referenceUnit the unit to convert to
105      * @param scaleFactorToReferenceUnit multiply a value in this unit by the factor to convert to the given reference unit
106      */
107     public ElectricalCurrentUnit(final String name, final String abbreviation, final UnitSystem unitSystem,
108             final ElectricalCurrentUnit referenceUnit, final double scaleFactorToReferenceUnit)
109     {
110         this(name, abbreviation, unitSystem, referenceUnit, scaleFactorToReferenceUnit, false);
111     }
112 
113     /** {@inheritDoc} */
114     @Override
115     public final ElectricalCurrentUnit getStandardUnit()
116     {
117         return AMPERE;
118     }
119 
120     /** {@inheritDoc} */
121     @Override
122     public final String getSICoefficientsString()
123     {
124         return "A";
125     }
126 
127 }