1 package org.djunits.unit;
2
3 import org.djunits.quantity.Quantity;
4 import org.djunits.unit.scale.IdentityScale;
5 import org.djunits.unit.si.SIPrefixes;
6 import org.djunits.unit.unitsystem.UnitSystem;
7
8
9
10
11
12
13
14
15
16 public class TorqueUnit extends Unit<TorqueUnit>
17 {
18
19 private static final long serialVersionUID = 20140607L;
20
21
22 public static final Quantity<TorqueUnit> BASE = new Quantity<>("Torque", "kgm2/s2");
23
24
25 public static final TorqueUnit SI =
26 new TorqueUnit().build(new Unit.Builder<TorqueUnit>().setQuantity(BASE).setId("N.m").setName("Newton meter")
27 .setUnitSystem(UnitSystem.SI_DERIVED).setSiPrefixes(SIPrefixes.NONE, 1.0).setScale(IdentityScale.SCALE));
28
29
30 public static final TorqueUnit NEWTON_METER = SI;
31
32
33 public static final TorqueUnit METER_KILOGRAM_FORCE = SI.deriveLinear(factorLF(LengthUnit.METER, ForceUnit.KILOGRAM_FORCE),
34 "m.kgf", "meter kilogram-force", UnitSystem.OTHER);
35
36
37 public static final TorqueUnit POUND_FOOT =
38 SI.deriveLinear(factorLF(LengthUnit.FOOT, ForceUnit.POUND_FORCE), "lbf.ft", "pound-foot", UnitSystem.IMPERIAL);
39
40
41 public static final TorqueUnit POUND_INCH =
42 SI.deriveLinear(factorLF(LengthUnit.INCH, ForceUnit.POUND_FORCE), "lbf.in", "pound-inch", UnitSystem.IMPERIAL);
43
44
45
46
47
48
49
50 private static double factorLF(final LengthUnit length, final ForceUnit force)
51 {
52 return length.getScale().toStandardUnit(1.0) * force.getScale().toStandardUnit(1.0);
53 }
54
55 }