1 package org.opentrafficsim.core.unit;
2
3 import static org.opentrafficsim.core.unit.unitsystem.UnitSystem.IMPERIAL;
4 import static org.opentrafficsim.core.unit.unitsystem.UnitSystem.OTHER;
5 import static org.opentrafficsim.core.unit.unitsystem.UnitSystem.SI_DERIVED;
6
7 import org.opentrafficsim.core.unit.unitsystem.UnitSystem;
8
9
10
11
12
13
14
15
16
17
18 public class TorqueUnit extends Unit<TorqueUnit>
19 {
20
21 private static final long serialVersionUID = 20140607L;
22
23
24 private final MassUnit massUnit;
25
26
27 private final LengthUnit lengthUnit;
28
29
30 private final TimeUnit timeUnit;
31
32
33 public static final TorqueUnit SI;
34
35
36 public static final TorqueUnit NEWTON_METER;
37
38
39 public static final TorqueUnit METER_KILOGRAM_FORCE;
40
41
42 public static final TorqueUnit FOOT_POUND_FORCE;
43
44
45 public static final TorqueUnit INCH_POUND_FORCE;
46
47 static
48 {
49 SI =
50 new TorqueUnit(MassUnit.KILOGRAM, LengthUnit.METER, TimeUnit.SECOND, "TorqueUnit.Newton_meter",
51 "TorqueUnit.N.m", SI_DERIVED);
52 NEWTON_METER = SI;
53 METER_KILOGRAM_FORCE =
54 new TorqueUnit(ForceUnit.KILOGRAM_FORCE, LengthUnit.METER, "TorqueUnit.meter_kilogram-force",
55 "TorqueUnit.m.kgf", OTHER);
56 FOOT_POUND_FORCE =
57 new TorqueUnit(ForceUnit.POUND_FORCE, LengthUnit.FOOT, "TorqueUnit.foot_pound-force",
58 "TorqueUnit.ft.lbf", IMPERIAL);
59 INCH_POUND_FORCE =
60 new TorqueUnit(ForceUnit.POUND_FORCE, LengthUnit.INCH, "TorqueUnit.inch_pound-force",
61 "TorqueUnit.in.lbf", IMPERIAL);
62 }
63
64
65
66
67
68
69
70
71
72
73 public TorqueUnit(final MassUnit massUnit, final LengthUnit lengthUnit, final TimeUnit timeUnit,
74 final String nameKey, final String abbreviationKey, final UnitSystem unitSystem)
75 {
76 super(nameKey, abbreviationKey, unitSystem, NEWTON_METER, massUnit.getConversionFactorToStandardUnit()
77 * lengthUnit.getConversionFactorToStandardUnit() * lengthUnit.getConversionFactorToStandardUnit()
78 / (timeUnit.getConversionFactorToStandardUnit() * timeUnit.getConversionFactorToStandardUnit()), true);
79 this.massUnit = massUnit;
80 this.lengthUnit = lengthUnit;
81 this.timeUnit = timeUnit;
82 }
83
84
85
86
87
88
89
90
91
92 public TorqueUnit(final ForceUnit forceUnit, final LengthUnit lengthUnit, final String nameKey,
93 final String abbreviationKey, final UnitSystem unitSystem)
94 {
95 super(nameKey, abbreviationKey, unitSystem, NEWTON_METER, forceUnit.getConversionFactorToStandardUnit()
96 * lengthUnit.getConversionFactorToStandardUnit(), true);
97 this.massUnit = forceUnit.getMassUnit();
98 this.lengthUnit = forceUnit.getLengthUnit();
99 this.timeUnit = forceUnit.getTimeUnit();
100 }
101
102
103
104
105
106
107
108
109
110
111 public TorqueUnit(final String nameKey, final String abbreviationKey, final UnitSystem unitSystem,
112 final TorqueUnit referenceUnit, final double conversionFactorToReferenceUnit)
113 {
114 super(nameKey, abbreviationKey, unitSystem, referenceUnit, conversionFactorToReferenceUnit, true);
115 this.massUnit = referenceUnit.getMassUnit();
116 this.lengthUnit = referenceUnit.getLengthUnit();
117 this.timeUnit = referenceUnit.getTimeUnit();
118 }
119
120
121
122
123 public final MassUnit getMassUnit()
124 {
125 return this.massUnit;
126 }
127
128
129
130
131 public final LengthUnit getLengthUnit()
132 {
133 return this.lengthUnit;
134 }
135
136
137
138
139 public final TimeUnit getTimeUnit()
140 {
141 return this.timeUnit;
142 }
143
144
145 @Override
146 public final TorqueUnit getStandardUnit()
147 {
148 return NEWTON_METER;
149 }
150
151
152 @Override
153 public final String getSICoefficientsString()
154 {
155 return "kgm2/s2";
156 }
157
158 }