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 LinearUnit<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 DurationUnit durationUnit;
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 = new PressureUnit(MassUnit.KILOGRAM, LengthUnit.METER, DurationUnit.SECOND, "PressureUnit.pascal",
92 "PressureUnit.Pa", SI_DERIVED, true);
93 PASCAL = SI;
94 HECTOPASCAL = new PressureUnit("PressureUnit.hectopascal", "PressureUnit.hPa", SI_DERIVED, PASCAL, 100.0, true);
95 KILOPASCAL = new PressureUnit("PressureUnit.kilopascal", "PressureUnit.kPa", SI_DERIVED, PASCAL, 1000.0, true);
96 ATMOSPHERE_STANDARD =
97 new PressureUnit("PressureUnit.atmosphere_(standard)", "PressureUnit.atm", OTHER, PASCAL, 101325.0, true);
98 TORR = new PressureUnit("PressureUnit.torr", "PressureUnit.Torr", OTHER, ATMOSPHERE_STANDARD, 1.0 / 760.0, true);
99 ATMOSPHERE_TECHNICAL = new PressureUnit(ForceUnit.KILOGRAM_FORCE, AreaUnit.SQUARE_CENTIMETER,
100 "PressureUnit.atmosphere_(technical)", "PressureUnit.at", OTHER, true);
101 BARYE = new PressureUnit(ForceUnit.DYNE, AreaUnit.SQUARE_CENTIMETER, "PressureUnit.barye", "PressureUnit.Ba", CGS,
102 true);
103 BAR = new PressureUnit("PressureUnit.bar_(full)", "PressureUnit.bar", OTHER, PASCAL, 1E5, true);
104 MILLIBAR = new PressureUnit("PressureUnit.millibar", "PressureUnit.mbar", OTHER, PressureUnit.BAR, 0.001, true);
105 CENTIMETER_MERCURY =
106 new PressureUnit("PressureUnit.centimeter_mercury", "PressureUnit.cmHg", OTHER, PASCAL, 1333.224, true);
107 MILLIMETER_MERCURY =
108 new PressureUnit("PressureUnit.millimeter_mercury", "PressureUnit.mmHg", OTHER, PASCAL, 133.3224, true);
109 FOOT_MERCURY = new PressureUnit("PressureUnit.foot_mercury", "PressureUnit.ftHg", IMPERIAL, PASCAL, 40.63666E3, true);
110 INCH_MERCURY = new PressureUnit("PressureUnit.inch_mercury", "PressureUnit.inHg", IMPERIAL, PASCAL, 3.386389E3, true);
111 KGF_PER_SQUARE_MM = new PressureUnit(ForceUnit.KILOGRAM_FORCE, AreaUnit.SQUARE_MILLIMETER,
112 "PressureUnit.kilogram-force_per_square_millimeter", "PressureUnit.kgf/mm^2", OTHER, true);
113 POUND_PER_SQUARE_FOOT = new PressureUnit(ForceUnit.POUND_FORCE, AreaUnit.SQUARE_FOOT,
114 "PressureUnit.pound_per_square_foot", "PressureUnit.lbf/ft^2", IMPERIAL, true);
115 POUND_PER_SQUARE_INCH = new PressureUnit(ForceUnit.POUND_FORCE, AreaUnit.SQUARE_INCH,
116 "PressureUnit.pound_per_square_inch", "PressureUnit.lbf/in^2", IMPERIAL, true);
117 PIEZE = new PressureUnit(MassUnit.TONNE, LengthUnit.METER, DurationUnit.SECOND, "PressureUnit.pieze", "PressureUnit.pz",
118 MTS, true);
119 }
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134 private PressureUnit(final MassUnit massUnit, final LengthUnit lengthUnit, final DurationUnit durationUnit,
135 final String nameOrNameKey, final String abbreviationOrAbbreviationKey, final UnitSystem unitSystem,
136 final boolean standardUnit)
137 {
138 super(nameOrNameKey, abbreviationOrAbbreviationKey, unitSystem, PASCAL,
139 massUnit.getScaleFactor()
140 / (lengthUnit.getScaleFactor() * durationUnit.getScaleFactor() * durationUnit.getScaleFactor()),
141 standardUnit);
142 this.massUnit = massUnit;
143 this.lengthUnit = lengthUnit;
144 this.durationUnit = durationUnit;
145 }
146
147
148
149
150
151
152
153
154
155
156 public PressureUnit(final MassUnit massUnit, final LengthUnit lengthUnit, final DurationUnit durationUnit,
157 final String name, final String abbreviation, final UnitSystem unitSystem)
158 {
159 this(massUnit, lengthUnit, durationUnit, name, abbreviation, unitSystem, false);
160 }
161
162
163
164
165
166
167
168
169
170
171
172
173
174 private PressureUnit(final ForceUnit forceUnit, final AreaUnit areaUnit, final String nameOrNameKey,
175 final String abbreviationOrAbbreviationKey, final UnitSystem unitSystem, final boolean standardUnit)
176 {
177 super(nameOrNameKey, abbreviationOrAbbreviationKey, unitSystem, PASCAL,
178 forceUnit.getScaleFactor() / areaUnit.getScaleFactor(), standardUnit);
179 this.massUnit = forceUnit.getMassUnit();
180 this.lengthUnit = areaUnit.getLengthUnit();
181 this.durationUnit = forceUnit.getDurationUnit();
182 }
183
184
185
186
187
188
189
190
191
192 public PressureUnit(final ForceUnit forceUnit, final AreaUnit areaUnit, final String name, final String abbreviation,
193 final UnitSystem unitSystem)
194 {
195 this(forceUnit, areaUnit, name, abbreviation, unitSystem, false);
196 }
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211 private PressureUnit(final String nameOrNameKey, final String abbreviationOrAbbreviationKey, final UnitSystem unitSystem,
212 final PressureUnit referenceUnit, final double scaleFactorToReferenceUnit, final boolean standardUnit)
213 {
214 super(nameOrNameKey, abbreviationOrAbbreviationKey, unitSystem, referenceUnit, scaleFactorToReferenceUnit,
215 standardUnit);
216 this.massUnit = referenceUnit.getMassUnit();
217 this.lengthUnit = referenceUnit.getLengthUnit();
218 this.durationUnit = referenceUnit.getDurationUnit();
219 }
220
221
222
223
224
225
226
227
228
229
230 public PressureUnit(final String name, final String abbreviation, final UnitSystem unitSystem,
231 final PressureUnit referenceUnit, final double scaleFactorToReferenceUnit)
232 {
233 this(name, abbreviation, unitSystem, referenceUnit, scaleFactorToReferenceUnit, false);
234 }
235
236
237
238
239 public final MassUnit getMassUnit()
240 {
241 return this.massUnit;
242 }
243
244
245
246
247 public final LengthUnit getLengthUnit()
248 {
249 return this.lengthUnit;
250 }
251
252
253
254
255 public final DurationUnit getDurationUnit()
256 {
257 return this.durationUnit;
258 }
259
260
261 @Override
262 public final PressureUnit getStandardUnit()
263 {
264 return PASCAL;
265 }
266
267
268 @Override
269 public final String getSICoefficientsString()
270 {
271 return "kg/ms2";
272 }
273
274 }