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 private PressureUnit(final MassUnit massUnit, final LengthUnit lengthUnit, final DurationUnit durationUnit,
133 final String nameOrNameKey, final String abbreviationOrAbbreviationKey, final UnitSystem unitSystem,
134 final boolean standardUnit)
135 {
136 super(nameOrNameKey, abbreviationOrAbbreviationKey, unitSystem, PASCAL,
137 massUnit.getScaleFactor()
138 / (lengthUnit.getScaleFactor() * durationUnit.getScaleFactor() * durationUnit.getScaleFactor()),
139 standardUnit);
140 this.massUnit = massUnit;
141 this.lengthUnit = lengthUnit;
142 this.durationUnit = durationUnit;
143 }
144
145
146
147
148
149
150
151
152
153
154 public PressureUnit(final MassUnit massUnit, final LengthUnit lengthUnit, final DurationUnit durationUnit,
155 final String name, final String abbreviation, final UnitSystem unitSystem)
156 {
157 this(massUnit, lengthUnit, durationUnit, name, abbreviation, unitSystem, false);
158 }
159
160
161
162
163
164
165
166
167
168
169
170 private PressureUnit(final ForceUnit forceUnit, final AreaUnit areaUnit, final String nameOrNameKey,
171 final String abbreviationOrAbbreviationKey, final UnitSystem unitSystem, final boolean standardUnit)
172 {
173 super(nameOrNameKey, abbreviationOrAbbreviationKey, unitSystem, PASCAL,
174 forceUnit.getScaleFactor() / areaUnit.getScaleFactor(), standardUnit);
175 this.massUnit = forceUnit.getMassUnit();
176 this.lengthUnit = areaUnit.getLengthUnit();
177 this.durationUnit = forceUnit.getDurationUnit();
178 }
179
180
181
182
183
184
185
186
187
188 public PressureUnit(final ForceUnit forceUnit, final AreaUnit areaUnit, final String name, final String abbreviation,
189 final UnitSystem unitSystem)
190 {
191 this(forceUnit, areaUnit, name, abbreviation, unitSystem, false);
192 }
193
194
195
196
197
198
199
200
201
202
203
204 private PressureUnit(final String nameOrNameKey, final String abbreviationOrAbbreviationKey, final UnitSystem unitSystem,
205 final PressureUnit referenceUnit, final double scaleFactorToReferenceUnit, final boolean standardUnit)
206 {
207 super(nameOrNameKey, abbreviationOrAbbreviationKey, unitSystem, referenceUnit, scaleFactorToReferenceUnit,
208 standardUnit);
209 this.massUnit = referenceUnit.getMassUnit();
210 this.lengthUnit = referenceUnit.getLengthUnit();
211 this.durationUnit = referenceUnit.getDurationUnit();
212 }
213
214
215
216
217
218
219
220
221
222 public PressureUnit(final String name, final String abbreviation, final UnitSystem unitSystem,
223 final PressureUnit referenceUnit, final double scaleFactorToReferenceUnit)
224 {
225 this(name, abbreviation, unitSystem, referenceUnit, scaleFactorToReferenceUnit, false);
226 }
227
228
229
230
231 public final MassUnit getMassUnit()
232 {
233 return this.massUnit;
234 }
235
236
237
238
239 public final LengthUnit getLengthUnit()
240 {
241 return this.lengthUnit;
242 }
243
244
245
246
247 public final DurationUnit getDurationUnit()
248 {
249 return this.durationUnit;
250 }
251
252
253 @Override
254 public final PressureUnit getStandardUnit()
255 {
256 return PASCAL;
257 }
258
259
260 @Override
261 public final String getSICoefficientsString()
262 {
263 return "kg/ms2";
264 }
265
266 }