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 FlowVolumeUnit extends Unit<FlowVolumeUnit>
17 {
18
19 private static final long serialVersionUID = 20140607L;
20
21
22 public static final Quantity<FlowVolumeUnit> BASE = new Quantity<>("FlowVolume", "m3/s");
23
24
25 public static final FlowVolumeUnit SI = new FlowVolumeUnit().build(new Unit.Builder<FlowVolumeUnit>().setQuantity(BASE)
26 .setId("m^3/s").setName("cubic meter per second").setUnitSystem(UnitSystem.SI_DERIVED)
27 .setSiPrefixes(SIPrefixes.NONE, 1.0).setScale(IdentityScale.SCALE).setAdditionalAbbreviations("m^3/sec"));
28
29
30 public static final FlowVolumeUnit CUBIC_METER_PER_SECOND = SI;
31
32
33 public static final FlowVolumeUnit CUBIC_METER_PER_MINUTE = SI.deriveLinear(
34 factorVD(VolumeUnit.CUBIC_METER, DurationUnit.MINUTE), "m^3/min", "cubic meter per minute", UnitSystem.SI_ACCEPTED);
35
36
37 public static final FlowVolumeUnit CUBIC_METER_PER_HOUR =
38 SI.deriveLinear(factorVD(VolumeUnit.CUBIC_METER, DurationUnit.HOUR), "m^3/h", "cubic meter per hour",
39 UnitSystem.SI_ACCEPTED, "m^3/h", "m^3/h", "m^3/hr", "m^3/hour");
40
41
42 public static final FlowVolumeUnit CUBIC_METER_PER_DAY = SI.deriveLinear(factorVD(VolumeUnit.CUBIC_METER, DurationUnit.DAY),
43 "m^3/day", "cubic meter per day", UnitSystem.SI_ACCEPTED);
44
45
46 public static final FlowVolumeUnit LITER_PER_SECOND = SI.deriveLinear(factorVD(VolumeUnit.LITER, DurationUnit.SECOND),
47 "L/s", "liter per second", UnitSystem.SI_ACCEPTED, "L/s", "L/s", "L/sec");
48
49
50 public static final FlowVolumeUnit LITER_PER_MINUTE = SI.deriveLinear(factorVD(VolumeUnit.LITER, DurationUnit.MINUTE),
51 "L/min", "liter per minute", UnitSystem.SI_ACCEPTED);
52
53
54 public static final FlowVolumeUnit LITER_PER_HOUR = SI.deriveLinear(factorVD(VolumeUnit.LITER, DurationUnit.HOUR), "L/h",
55 "liter per hour", UnitSystem.SI_ACCEPTED, "L/h", "L/h", "L/hr", "L/hour");
56
57
58 public static final FlowVolumeUnit LITER_PER_DAY =
59 SI.deriveLinear(factorVD(VolumeUnit.LITER, DurationUnit.DAY), "L/day", "liter per day", UnitSystem.SI_ACCEPTED);
60
61
62 public static final FlowVolumeUnit CUBIC_FEET_PER_SECOND =
63 SI.deriveLinear(factorVD(VolumeUnit.CUBIC_FOOT, DurationUnit.SECOND), "ft^3/s", "cubic foot per second",
64 UnitSystem.IMPERIAL, "ft^3/s", "ft^3/s", "ft^3/sec");
65
66
67 public static final FlowVolumeUnit CUBIC_FEET_PER_MINUTE = SI.deriveLinear(
68 factorVD(VolumeUnit.CUBIC_FOOT, DurationUnit.MINUTE), "ft^3/min", "cubic foot per minute", UnitSystem.IMPERIAL);
69
70
71 public static final FlowVolumeUnit CUBIC_INCH_PER_SECOND =
72 SI.deriveLinear(factorVD(VolumeUnit.CUBIC_INCH, DurationUnit.SECOND), "in^3/s", "cubic inch per second",
73 UnitSystem.IMPERIAL, "in^3/s", "in^3/s", "in^3/sec");
74
75
76 public static final FlowVolumeUnit CUBIC_INCH_PER_MINUTE = SI.deriveLinear(
77 factorVD(VolumeUnit.CUBIC_INCH, DurationUnit.MINUTE), "in^3/min", "cubic inch per minute", UnitSystem.IMPERIAL);
78
79
80 public static final FlowVolumeUnit GALLON_US_PER_SECOND =
81 SI.deriveLinear(factorVD(VolumeUnit.GALLON_US, DurationUnit.SECOND), "gal(US)/s", "US gallon per second",
82 UnitSystem.US_CUSTOMARY, "gal(US)/s", "gal(US)/s", "gal(US)/sec");
83
84
85 public static final FlowVolumeUnit GALLON_US_PER_MINUTE =
86 SI.deriveLinear(factorVD(VolumeUnit.GALLON_US, DurationUnit.MINUTE), "gal(US)/min", "US gallon per minute",
87 UnitSystem.US_CUSTOMARY);
88
89
90 public static final FlowVolumeUnit GALLON_US_PER_HOUR = SI.deriveLinear(factorVD(VolumeUnit.GALLON_US, DurationUnit.HOUR),
91 "gal(US)/h", "US gallon per hour", UnitSystem.US_CUSTOMARY, "gal(US)/h", "gal(US)/h", "gal(US)/hr", "gal(US)/hour");
92
93
94 public static final FlowVolumeUnit GALLON_US_PER_DAY = SI.deriveLinear(factorVD(VolumeUnit.GALLON_US, DurationUnit.DAY),
95 "gal(US)/day", "US gallon per day", UnitSystem.US_CUSTOMARY);
96
97
98
99
100
101
102
103 private static double factorVD(final VolumeUnit volume, final DurationUnit duration)
104 {
105 return volume.getScale().toStandardUnit(1.0) / duration.getScale().toStandardUnit(1.0);
106 }
107
108 }