1 package org.djunits.unit;
2
3 import org.djunits.unit.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 PowerUnit extends Unit<PowerUnit>
17 {
18
19 private static final long serialVersionUID = 20140607L;
20
21
22 public static final Quantity<PowerUnit> BASE = new Quantity<>("Power", "kgm2/s3");
23
24
25 public static final PowerUnit SI =
26 new PowerUnit().build(new Unit.Builder<PowerUnit>().setQuantity(BASE).setId("W").setName("watt")
27 .setUnitSystem(UnitSystem.SI_DERIVED).setSiPrefixes(SIPrefixes.UNIT, 1.0).setScale(IdentityScale.SCALE));
28
29
30 public static final PowerUnit WATT = SI;
31
32
33 public static final PowerUnit MICROWATT = WATT.deriveSI(SIPrefixes.getUnit("mu"), 1.0);
34
35
36 public static final PowerUnit MILLIWATT = WATT.deriveSI(SIPrefixes.getUnit("m"), 1.0);
37
38
39 public static final PowerUnit KILOWATT = WATT.deriveSI(SIPrefixes.getUnit("k"), 1.0);
40
41
42 public static final PowerUnit MEGAWATT = WATT.deriveSI(SIPrefixes.getUnit("M"), 1.0);
43
44
45 public static final PowerUnit GIGAWATT = WATT.deriveSI(SIPrefixes.getUnit("G"), 1.0);
46
47
48 public static final PowerUnit TERAWATT = WATT.deriveSI(SIPrefixes.getUnit("T"), 1.0);
49
50
51 public static final PowerUnit PETAWATT = WATT.deriveSI(SIPrefixes.getUnit("P"), 1.0);
52
53
54 public static final PowerUnit FOOT_POUND_FORCE_PER_HOUR =
55 SI.deriveLinear(factorED(EnergyUnit.FOOT_POUND_FORCE, DurationUnit.HOUR), "ft.lbf/h", "foot pound-force per hour",
56 UnitSystem.IMPERIAL);
57
58
59 public static final PowerUnit FOOT_POUND_FORCE_PER_MINUTE =
60 SI.deriveLinear(factorED(EnergyUnit.FOOT_POUND_FORCE, DurationUnit.MINUTE), "ft.lbf/min",
61 "foot pound-force per minute", UnitSystem.IMPERIAL);
62
63
64 public static final PowerUnit FOOT_POUND_FORCE_PER_SECOND =
65 SI.deriveLinear(factorED(EnergyUnit.FOOT_POUND_FORCE, DurationUnit.SECOND), "ft.lbf/s",
66 "foot pound-force per second", UnitSystem.IMPERIAL);
67
68
69 public static final PowerUnit HORSEPOWER_METRIC =
70 WATT.deriveLinear(735.49875, "hp(M)", "horsepower (metric)", UnitSystem.OTHER);
71
72
73 public static final PowerUnit STHENE_METER_PER_SECOND = SI.deriveLinear(
74 factorED(EnergyUnit.STHENE_METER, DurationUnit.SECOND), "sn.m/s", "sthene-meter per second", UnitSystem.MTS);
75
76
77 public static final PowerUnit ERG_PER_SECOND =
78 SI.deriveLinear(factorED(EnergyUnit.ERG, DurationUnit.SECOND), "erg/s", "erg per second", UnitSystem.CGS);
79
80
81
82
83
84
85
86 private static double factorED(final EnergyUnit energy, final DurationUnit duration)
87 {
88 return energy.getScale().toStandardUnit(1.0) / duration.getScale().toStandardUnit(1.0);
89 }
90
91 }