1 package org.djunits.unit;
2
3 import static org.djunits.unit.unitsystem.UnitSystem.CGS;
4 import static org.djunits.unit.unitsystem.UnitSystem.IMPERIAL;
5 import static org.djunits.unit.unitsystem.UnitSystem.MTS;
6 import static org.djunits.unit.unitsystem.UnitSystem.OTHER;
7 import static org.djunits.unit.unitsystem.UnitSystem.SI_DERIVED;
8
9 import org.djunits.unit.unitsystem.UnitSystem;
10
11
12
13
14
15
16
17
18
19
20
21 public class PressureUnit extends Unit<PressureUnit>
22 {
23
24 private static final long serialVersionUID = 20140607L;
25
26
27 private final MassUnit massUnit;
28
29
30 private final LengthUnit lengthUnit;
31
32
33 private final TimeUnit timeUnit;
34
35
36 public static final PressureUnit SI;
37
38
39 public static final PressureUnit PASCAL;
40
41
42 public static final PressureUnit HECTOPASCAL;
43
44
45 public static final PressureUnit KILOPASCAL;
46
47
48 public static final PressureUnit ATMOSPHERE_STANDARD;
49
50
51 public static final PressureUnit TORR;
52
53
54 public static final PressureUnit ATMOSPHERE_TECHNICAL;
55
56
57 public static final PressureUnit BARYE;
58
59
60 public static final PressureUnit BAR;
61
62
63 public static final PressureUnit MILLIBAR;
64
65
66 public static final PressureUnit CENTIMETER_MERCURY;
67
68
69 public static final PressureUnit MILLIMETER_MERCURY;
70
71
72 public static final PressureUnit FOOT_MERCURY;
73
74
75 public static final PressureUnit INCH_MERCURY;
76
77
78 public static final PressureUnit KGF_PER_SQUARE_MM;
79
80
81 public static final PressureUnit POUND_PER_SQUARE_FOOT;
82
83
84 public static final PressureUnit POUND_PER_SQUARE_INCH;
85
86
87 public static final PressureUnit PIEZE;
88
89 static
90 {
91 SI =
92 new PressureUnit(MassUnit.KILOGRAM, LengthUnit.METER, TimeUnit.SECOND, "PressureUnit.pascal",
93 "PressureUnit.Pa", SI_DERIVED, true);
94 PASCAL = SI;
95 HECTOPASCAL = new PressureUnit("PressureUnit.hectopascal", "PressureUnit.hPa", SI_DERIVED, PASCAL, 100.0, true);
96 KILOPASCAL = new PressureUnit("PressureUnit.kilopascal", "PressureUnit.kPa", SI_DERIVED, PASCAL, 1000.0, true);
97 ATMOSPHERE_STANDARD =
98 new PressureUnit("PressureUnit.atmosphere_(standard)", "PressureUnit.atm", OTHER, PASCAL, 101325.0, true);
99 TORR =
100 new PressureUnit("PressureUnit.torr", "PressureUnit.Torr", OTHER, ATMOSPHERE_STANDARD, 1.0 / 760.0, true);
101 ATMOSPHERE_TECHNICAL =
102 new PressureUnit(ForceUnit.KILOGRAM_FORCE, AreaUnit.SQUARE_CENTIMETER,
103 "PressureUnit.atmosphere_(technical)", "PressureUnit.at", OTHER, true);
104 BARYE =
105 new PressureUnit(ForceUnit.DYNE, AreaUnit.SQUARE_CENTIMETER, "PressureUnit.barye", "PressureUnit.Ba", CGS,
106 true);
107 BAR = new PressureUnit("PressureUnit.bar_(full)", "PressureUnit.bar", OTHER, PASCAL, 1E5, true);
108 MILLIBAR = new PressureUnit("PressureUnit.millibar", "PressureUnit.mbar", OTHER, PressureUnit.BAR, 0.001, true);
109 CENTIMETER_MERCURY =
110 new PressureUnit("PressureUnit.centimeter_mercury", "PressureUnit.cmHg", OTHER, PASCAL, 1333.224, true);
111 MILLIMETER_MERCURY =
112 new PressureUnit("PressureUnit.millimeter_mercury", "PressureUnit.mmHg", OTHER, PASCAL, 133.3224, true);
113 FOOT_MERCURY =
114 new PressureUnit("PressureUnit.foot_mercury", "PressureUnit.ftHg", IMPERIAL, PASCAL, 40.63666E3, true);
115 INCH_MERCURY =
116 new PressureUnit("PressureUnit.inch_mercury", "PressureUnit.inHg", IMPERIAL, PASCAL, 3.386389E3, true);
117 KGF_PER_SQUARE_MM =
118 new PressureUnit(ForceUnit.KILOGRAM_FORCE, AreaUnit.SQUARE_MILLIMETER,
119 "PressureUnit.kilogram-force_per_square_millimeter", "PressureUnit.kgf/mm^2", OTHER, true);
120 POUND_PER_SQUARE_FOOT =
121 new PressureUnit(ForceUnit.POUND_FORCE, AreaUnit.SQUARE_FOOT, "PressureUnit.pound_per_square_foot",
122 "PressureUnit.lbf/ft^2", IMPERIAL, true);
123 POUND_PER_SQUARE_INCH =
124 new PressureUnit(ForceUnit.POUND_FORCE, AreaUnit.SQUARE_INCH, "PressureUnit.pound_per_square_inch",
125 "PressureUnit.lbf/in^2", IMPERIAL, true);
126 PIEZE =
127 new PressureUnit(MassUnit.TONNE, LengthUnit.METER, TimeUnit.SECOND, "PressureUnit.pieze",
128 "PressureUnit.pz", MTS, true);
129 }
130
131
132
133
134
135
136
137
138
139
140
141
142 private PressureUnit(final MassUnit massUnit, final LengthUnit lengthUnit, final TimeUnit timeUnit,
143 final String nameOrNameKey, final String abbreviationOrAbbreviationKey, final UnitSystem unitSystem,
144 final boolean standardUnit)
145 {
146 super(nameOrNameKey, abbreviationOrAbbreviationKey, unitSystem, PASCAL, massUnit
147 .getConversionFactorToStandardUnit()
148 / (lengthUnit.getConversionFactorToStandardUnit() * timeUnit.getConversionFactorToStandardUnit() * timeUnit
149 .getConversionFactorToStandardUnit()), standardUnit);
150 this.massUnit = massUnit;
151 this.lengthUnit = lengthUnit;
152 this.timeUnit = timeUnit;
153 }
154
155
156
157
158
159
160
161
162
163
164 public PressureUnit(final MassUnit massUnit, final LengthUnit lengthUnit, final TimeUnit timeUnit,
165 final String name, final String abbreviation, final UnitSystem unitSystem)
166 {
167 this(massUnit, lengthUnit, timeUnit, name, abbreviation, unitSystem, false);
168 }
169
170
171
172
173
174
175
176
177
178
179
180 private PressureUnit(final ForceUnit forceUnit, final AreaUnit areaUnit, final String nameOrNameKey,
181 final String abbreviationOrAbbreviationKey, final UnitSystem unitSystem, final boolean standardUnit)
182 {
183 super(nameOrNameKey, abbreviationOrAbbreviationKey, unitSystem, PASCAL, forceUnit
184 .getConversionFactorToStandardUnit()
185 / areaUnit.getConversionFactorToStandardUnit(), standardUnit);
186 this.massUnit = forceUnit.getMassUnit();
187 this.lengthUnit = forceUnit.getLengthUnit();
188 this.timeUnit = forceUnit.getTimeUnit();
189 }
190
191
192
193
194
195
196
197
198
199 public PressureUnit(final ForceUnit forceUnit, final AreaUnit areaUnit, final String name,
200 final String abbreviation, final UnitSystem unitSystem)
201 {
202 this(forceUnit, areaUnit, name, abbreviation, unitSystem, false);
203 }
204
205
206
207
208
209
210
211
212
213
214
215 private PressureUnit(final String nameOrNameKey, final String abbreviationOrAbbreviationKey,
216 final UnitSystem unitSystem, final PressureUnit referenceUnit, final double conversionFactorToReferenceUnit,
217 final boolean standardUnit)
218 {
219 super(nameOrNameKey, abbreviationOrAbbreviationKey, unitSystem, referenceUnit, conversionFactorToReferenceUnit,
220 standardUnit);
221 this.massUnit = referenceUnit.getMassUnit();
222 this.lengthUnit = referenceUnit.getLengthUnit();
223 this.timeUnit = referenceUnit.getTimeUnit();
224 }
225
226
227
228
229
230
231
232
233
234 public PressureUnit(final String name, final String abbreviation, final UnitSystem unitSystem,
235 final PressureUnit referenceUnit, final double conversionFactorToReferenceUnit)
236 {
237 this(name, abbreviation, unitSystem, referenceUnit, conversionFactorToReferenceUnit, false);
238 }
239
240
241
242
243 public final MassUnit getMassUnit()
244 {
245 return this.massUnit;
246 }
247
248
249
250
251 public final LengthUnit getLengthUnit()
252 {
253 return this.lengthUnit;
254 }
255
256
257
258
259 public final TimeUnit getTimeUnit()
260 {
261 return this.timeUnit;
262 }
263
264
265 @Override
266 public final PressureUnit getStandardUnit()
267 {
268 return PASCAL;
269 }
270
271
272 @Override
273 public final String getSICoefficientsString()
274 {
275 return "kg/ms2";
276 }
277
278 }