7
* This source file is subject to the new BSD license that is bundled
8
* with this package in the file LICENSE.txt.
9
* It is also available through the world-wide-web at this URL:
10
* http://framework.zend.com/license/new-bsd
11
* If you did not receive a copy of the license and are unable to
12
* obtain it through the world-wide-web, please send an email
13
* to license@zend.com so we can send you a copy immediately.
16
* @package Zend_Measure
17
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
18
* @license http://framework.zend.com/license/new-bsd New BSD License
19
* @version $Id: Density.php 13209 2008-12-13 22:34:06Z thomas $
23
* Implement needed classes
25
require_once 'Zend/Measure/Abstract.php';
26
require_once 'Zend/Locale.php';
29
* Class for handling density conversions
32
* @package Zend_Measure
33
* @subpackage Zend_Measure_Density
34
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
35
* @license http://framework.zend.com/license/new-bsd New BSD License
37
class Zend_Measure_Density extends Zend_Measure_Abstract
39
const STANDARD = 'KILOGRAM_PER_CUBIC_METER';
41
const ALUMINIUM = 'ALUMINIUM';
42
const COPPER = 'COPPER';
44
const GRAIN_PER_CUBIC_FOOT = 'GRAIN_PER_CUBIC_FOOT';
45
const GRAIN_PER_CUBIC_INCH = 'GRAIN_PER_CUBIC_INCH';
46
const GRAIN_PER_CUBIC_YARD = 'GRAIN_PER_CUBIC_YARD';
47
const GRAIN_PER_GALLON = 'GRAIN_PER_GALLON';
48
const GRAIN_PER_GALLON_US = 'GRAIN_PER_GALLON_US';
49
const GRAM_PER_CUBIC_CENTIMETER = 'GRAM_PER_CUBIC_CENTIMETER';
50
const GRAM_PER_CUBIC_DECIMETER = 'GRAM_PER_CUBIC_DECIMETER';
51
const GRAM_PER_CUBIC_METER = 'GRAM_PER_CUBIC_METER';
52
const GRAM_PER_LITER = 'GRAM_PER_LITER';
53
const GRAM_PER_MILLILITER = 'GRAM_PER_MILLILITER';
55
const KILOGRAM_PER_CUBIC_CENTIMETER = 'KILOGRAM_PER_CUBIC_CENTIMETER';
56
const KILOGRAM_PER_CUBIC_DECIMETER = 'KILOGRAM_PER_CUBIC_DECIMETER';
57
const KILOGRAM_PER_CUBIC_METER = 'KILOGRAM_PER_CUBIC_METER';
58
const KILOGRAM_PER_CUBIC_MILLIMETER = 'KILOGRAM_PER_CUBIC_MILLIMETER';
59
const KILOGRAM_PER_LITER = 'KILOGRAM_PER_LITER';
60
const KILOGRAM_PER_MILLILITER = 'KILOGRAM_PER_MILLILITER';
62
const MEGAGRAM_PER_CUBIC_CENTIMETER = 'MEGAGRAM_PER_CUBIC_CENTIMETER';
63
const MEGAGRAM_PER_CUBIC_DECIMETER = 'MEGAGRAM_PER_CUBIC_DECIMETER';
64
const MEGAGRAM_PER_CUBIC_METER = 'MEGAGRAM_PER_CUBIC_METER';
65
const MEGAGRAM_PER_LITER = 'MEGAGRAM_PER_LITER';
66
const MEGAGRAM_PER_MILLILITER = 'MEGAGRAM_PER_MILLILITER';
67
const MICROGRAM_PER_CUBIC_CENTIMETER = 'MICROGRAM_PER_CUBIC_CENTIMETER';
68
const MICROGRAM_PER_CUBIC_DECIMETER = 'MICROGRAM_PER_CUBIC_DECIMETER';
69
const MICROGRAM_PER_CUBIC_METER = 'MICROGRAM_PER_CUBIC_METER';
70
const MICROGRAM_PER_LITER = 'MICROGRAM_PER_LITER';
71
const MICROGRAM_PER_MILLILITER = 'MICROGRAM_PER_MILLILITER';
72
const MILLIGRAM_PER_CUBIC_CENTIMETER = 'MILLIGRAM_PER_CUBIC_CENTIMETER';
73
const MILLIGRAM_PER_CUBIC_DECIMETER = 'MILLIGRAM_PER_CUBIC_DECIMETER';
74
const MILLIGRAM_PER_CUBIC_METER = 'MILLIGRAM_PER_CUBIC_METER';
75
const MILLIGRAM_PER_LITER = 'MILLIGRAM_PER_LITER';
76
const MILLIGRAM_PER_MILLILITER = 'MILLIGRAM_PER_MILLILITER';
77
const OUNCE_PER_CUBIC_FOOT = 'OUNCE_PER_CUBIC_FOOT';
78
const OUNCR_PER_CUBIC_FOOT_TROY = 'OUNCE_PER_CUBIC_FOOT_TROY';
79
const OUNCE_PER_CUBIC_INCH = 'OUNCE_PER_CUBIC_INCH';
80
const OUNCE_PER_CUBIC_INCH_TROY = 'OUNCE_PER_CUBIC_INCH_TROY';
81
const OUNCE_PER_CUBIC_YARD = 'OUNCE_PER_CUBIC_YARD';
82
const OUNCE_PER_CUBIC_YARD_TROY = 'OUNCE_PER_CUBIC_YARD_TROY';
83
const OUNCE_PER_GALLON = 'OUNCE_PER_GALLON';
84
const OUNCE_PER_GALLON_US = 'OUNCE_PER_GALLON_US';
85
const OUNCE_PER_GALLON_TROY = 'OUNCE_PER_GALLON_TROY';
86
const OUNCE_PER_GALLON_US_TROY = 'OUNCE_PER_GALLON_US_TROY';
87
const POUND_PER_CIRCULAR_MIL_FOOT = 'POUND_PER_CIRCULAR_MIL_FOOT';
88
const POUND_PER_CUBIC_FOOT = 'POUND_PER_CUBIC_FOOT';
89
const POUND_PER_CUBIC_INCH = 'POUND_PER_CUBIC_INCH';
90
const POUND_PER_CUBIC_YARD = 'POUND_PER_CUBIC_YARD';
91
const POUND_PER_GALLON = 'POUND_PER_GALLON';
92
const POUND_PER_KILOGALLON = 'POUND_PER_KILOGALLON';
93
const POUND_PER_MEGAGALLON = 'POUND_PER_MEGAGALLON';
94
const POUND_PER_GALLON_US = 'POUND_PER_GALLON_US';
95
const POUND_PER_KILOGALLON_US = 'POUND_PER_KILOGALLON_US';
96
const POUND_PER_MEGAGALLON_US = 'POUND_PER_MEGAGALLON_US';
97
const SILVER = 'SILVER';
98
const SLUG_PER_CUBIC_FOOT = 'SLUG_PER_CUBIC_FOOT';
99
const SLUG_PER_CUBIC_INCH = 'SLUG_PER_CUBIC_INCH';
100
const SLUG_PER_CUBIC_YARD = 'SLUG_PER_CUBIC_YARD';
101
const SLUG_PER_GALLON = 'SLUG_PER_GALLON';
102
const SLUG_PER_GALLON_US = 'SLUG_PER_GALLON_US';
103
const TON_PER_CUBIC_FOOT_LONG = 'TON_PER_CUBIC_FOOT_LONG';
104
const TON_PER_CUBIC_FOOT = 'TON_PER_CUBIC_FOOT';
105
const TON_PER_CUBIC_INCH_LONG = 'TON_PER_CUBIC_INCH_LONG';
106
const TON_PER_CUBIC_INCH = 'TON_PER_CUBIC_INCH';
107
const TON_PER_CUBIC_YARD_LONG = 'TON_PER_CUBIC_YARD_LONG';
108
const TON_PER_CUBIC_YARD = 'TON_PER_CUBIC_YARD';
109
const TON_PER_GALLON_LONG = 'TON_PER_GALLON_LONG';
110
const TON_PER_GALLON_US_LONG = 'TON_PER_GALLON_US_LONG';
111
const TON_PER_GALLON = 'TON_PER_GALLON';
112
const TON_PER_GALLON_US = 'TON_PER_GALLON_US';
113
const TONNE_PER_CUBIC_CENTIMETER = 'TONNE_PER_CUBIC_CENTIMETER';
114
const TONNE_PER_CUBIC_DECIMETER = 'TONNE_PER_CUBIC_DECIMETER';
115
const TONNE_PER_CUBIC_METER = 'TONNE_PER_CUBIC_METER';
116
const TONNE_PER_LITER = 'TONNE_PER_LITER';
117
const TONNE_PER_MILLILITER = 'TONNE_PER_MILLILITER';
118
const WATER = 'WATER';
121
* Calculations for all density units
125
protected $_units = array(
126
'ALUMINIUM' => array('2643', 'aluminium'),
127
'COPPER' => array('8906', 'copper'),
128
'GOLD' => array('19300', 'gold'),
129
'GRAIN_PER_CUBIC_FOOT' => array('0.0022883519', 'gr/ft³'),
130
'GRAIN_PER_CUBIC_INCH' => array('3.9542721', 'gr/in³'),
131
'GRAIN_PER_CUBIC_YARD' => array('0.000084753774', 'gr/yd³'),
132
'GRAIN_PER_GALLON' => array('0.014253768', 'gr/gal'),
133
'GRAIN_PER_GALLON_US' => array('0.017118061', 'gr/gal'),
134
'GRAM_PER_CUBIC_CENTIMETER' => array('1000', 'g/cm³'),
135
'GRAM_PER_CUBIC_DECIMETER' => array('1', 'g/dm³'),
136
'GRAM_PER_CUBIC_METER' => array('0.001', 'g/m³'),
137
'GRAM_PER_LITER' => array('1', 'g/l'),
138
'GRAM_PER_MILLILITER' => array('1000', 'g/ml'),
139
'IRON' => array('7658', 'iron'),
140
'KILOGRAM_PER_CUBIC_CENTIMETER' => array('1000000', 'kg/cm³'),
141
'KILOGRAM_PER_CUBIC_DECIMETER' => array('1000', 'kg/dm³'),
142
'KILOGRAM_PER_CUBIC_METER' => array('1', 'kg/m³'),
143
'KILOGRAM_PER_CUBIC_MILLIMETER' => array('1000000000', 'kg/l'),
144
'KILOGRAM_PER_LITER' => array('1000', 'kg/ml'),
145
'KILOGRAM_PER_MILLILITER' => array('1000000', 'kg/ml'),
146
'LEAD' => array('11370', 'lead'),
147
'MEGAGRAM_PER_CUBIC_CENTIMETER' => array('1.0e+9', 'Mg/cm³'),
148
'MEGAGRAM_PER_CUBIC_DECIMETER' => array('1000000', 'Mg/dm³'),
149
'MEGAGRAM_PER_CUBIC_METER' => array('1000', 'Mg/m³'),
150
'MEGAGRAM_PER_LITER' => array('1000000', 'Mg/l'),
151
'MEGAGRAM_PER_MILLILITER' => array('1.0e+9', 'Mg/ml'),
152
'MICROGRAM_PER_CUBIC_CENTIMETER' => array('0.001', 'µg/cm³'),
153
'MICROGRAM_PER_CUBIC_DECIMETER' => array('1.0e-6', 'µg/dm³'),
154
'MICROGRAM_PER_CUBIC_METER' => array('1.0e-9', 'µg/m³'),
155
'MICROGRAM_PER_LITER' => array('1.0e-6', 'µg/l'),
156
'MICROGRAM_PER_MILLILITER' => array('0.001', 'µg/ml'),
157
'MILLIGRAM_PER_CUBIC_CENTIMETER' => array('1', 'mg/cm³'),
158
'MILLIGRAM_PER_CUBIC_DECIMETER' => array('0.001', 'mg/dm³'),
159
'MILLIGRAM_PER_CUBIC_METER' => array('0.000001', 'mg/m³'),
160
'MILLIGRAM_PER_LITER' => array('0.001', 'mg/l'),
161
'MILLIGRAM_PER_MILLILITER' => array('1', 'mg/ml'),
162
'OUNCE_PER_CUBIC_FOOT' => array('1.001154', 'oz/ft³'),
163
'OUNCE_PER_CUBIC_FOOT_TROY' => array('1.0984089', 'oz/ft³'),
164
'OUNCE_PER_CUBIC_INCH' => array('1729.994', 'oz/in³'),
165
'OUNCE_PER_CUBIC_INCH_TROY' => array('1898.0506', 'oz/in³'),
166
'OUNCE_PER_CUBIC_YARD' => array('0.037079776', 'oz/yd³'),
167
'OUNCE_PER_CUBIC_YARD_TROY' => array('0.040681812', 'oz/yd³'),
168
'OUNCE_PER_GALLON' => array('6.2360233', 'oz/gal'),
169
'OUNCE_PER_GALLON_US' => array('7.4891517', 'oz/gal'),
170
'OUNCE_PER_GALLON_TROY' => array('6.8418084', 'oz/gal'),
171
'OUNCE_PER_GALLON_US_TROY' => array('8.2166693', 'oz/gal'),
172
'POUND_PER_CIRCULAR_MIL_FOOT' => array('2.9369291', 'lb/cmil ft'),
173
'POUND_PER_CUBIC_FOOT' => array('16.018463', 'lb/in³'),
174
'POUND_PER_CUBIC_INCH' => array('27679.905', 'lb/in³'),
175
'POUND_PER_CUBIC_YARD' => array('0.59327642', 'lb/yd³'),
176
'POUND_PER_GALLON' => array('99.776373', 'lb/gal'),
177
'POUND_PER_KILOGALLON' => array('0.099776373', 'lb/kgal'),
178
'POUND_PER_MEGAGALLON' => array('0.000099776373', 'lb/Mgal'),
179
'POUND_PER_GALLON_US' => array('119.82643', 'lb/gal'),
180
'POUND_PER_KILOGALLON_US' => array('0.11982643', 'lb/kgal'),
181
'POUND_PER_MEGAGALLON_US' => array('0.00011982643', 'lb/Mgal'),
182
'SILVER' => array('10510', 'silver'),
183
'SLUG_PER_CUBIC_FOOT' => array('515.37882', 'slug/ft³'),
184
'SLUG_PER_CUBIC_INCH' => array('890574.6', 'slug/in³'),
185
'SLUG_PER_CUBIC_YARD' => array('19.088104', 'slug/yd³'),
186
'SLUG_PER_GALLON' => array('3210.2099', 'slug/gal'),
187
'SLUG_PER_GALLON_US' => array('3855.3013', 'slug/gal'),
188
'TON_PER_CUBIC_FOOT_LONG' => array('35881.358', 't/ft³'),
189
'TON_PER_CUBIC_FOOT' => array('32036.927', 't/ft³'),
190
'TON_PER_CUBIC_INCH_LONG' => array('6.2202987e+7', 't/in³'),
191
'TON_PER_CUBIC_INCH' => array('5.5359809e+7', 't/in³'),
192
'TON_PER_CUBIC_YARD_LONG' => array('1328.9392', 't/yd³'),
193
'TON_PER_CUBIC_YARD' => array('1186.5528', 't/yd³'),
194
'TON_PER_GALLON_LONG' => array('223499.07', 't/gal'),
195
'TON_PER_GALLON_US_LONG' => array('268411.2', 't/gal'),
196
'TON_PER_GALLON' => array('199522.75', 't/gal'),
197
'TON_PER_GALLON_US' => array('239652.85', 't/gal'),
198
'TONNE_PER_CUBIC_CENTIMETER' => array('1.0e+9', 't/cm³'),
199
'TONNE_PER_CUBIC_DECIMETER' => array('1000000', 't/dm³'),
200
'TONNE_PER_CUBIC_METER' => array('1000', 't/m³'),
201
'TONNE_PER_LITER' => array('1000000', 't/l'),
202
'TONNE_PER_MILLILITER' => array('1.0e+9', 't/ml'),
203
'WATER' => array('1000', 'water'),
204
'STANDARD' => 'KILOGRAM_PER_CUBIC_METER'