File indexing completed on 2024-12-22 05:36:51

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category  Zend
0016  * @package   Zend_Measure
0017  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0018  * @license   http://framework.zend.com/license/new-bsd     New BSD License
0019  * @version   $Id$
0020  */
0021 
0022 /**
0023  * Implement needed classes
0024  */
0025 // require_once 'Zend/Measure/Abstract.php';
0026 // require_once 'Zend/Locale.php';
0027 
0028 /**
0029  * Class for handling energy conversions
0030  *
0031  * @category   Zend
0032  * @package    Zend_Measure
0033  * @subpackage Zend_Measure_Energy
0034  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0035  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0036  */
0037 class Zend_Measure_Energy extends Zend_Measure_Abstract
0038 {
0039     const STANDARD = 'JOULE';
0040 
0041     const ATTOJOULE                  = 'ATTOJOULE';
0042     const BOARD_OF_TRADE_UNIT        = 'BOARD_OF_TRADE_UNIT';
0043     const BTU                        = 'BTU';
0044     const BTU_THERMOCHEMICAL         = 'BTU_TERMOCHEMICAL';
0045     const CALORIE                    = 'CALORIE';
0046     const CALORIE_15C                = 'CALORIE_15C';
0047     const CALORIE_NUTRITIONAL        = 'CALORIE_NUTRITIONAL';
0048     const CALORIE_THERMOCHEMICAL     = 'CALORIE_THERMOCHEMICAL';
0049     const CELSIUS_HEAT_UNIT          = 'CELSIUS_HEAT_UNIT';
0050     const CENTIJOULE                 = 'CENTIJOULE';
0051     const CHEVAL_VAPEUR_HEURE        = 'CHEVAL_VAPEUR_HEURE';
0052     const DECIJOULE                  = 'DECIJOULE';
0053     const DEKAJOULE                  = 'DEKAJOULE';
0054     const DEKAWATT_HOUR              = 'DEKAWATT_HOUR';
0055     const DEKATHERM                  = 'DEKATHERM';
0056     const ELECTRONVOLT               = 'ELECTRONVOLT';
0057     const ERG                        = 'ERG';
0058     const EXAJOULE                   = 'EXAJOULE';
0059     const EXAWATT_HOUR               = 'EXAWATT_HOUR';
0060     const FEMTOJOULE                 = 'FEMTOJOULE';
0061     const FOOT_POUND                 = 'FOOT_POUND';
0062     const FOOT_POUNDAL               = 'FOOT_POUNDAL';
0063     const GALLON_UK_AUTOMOTIVE       = 'GALLON_UK_AUTOMOTIVE';
0064     const GALLON_US_AUTOMOTIVE       = 'GALLON_US_AUTOMOTIVE';
0065     const GALLON_UK_AVIATION         = 'GALLON_UK_AVIATION';
0066     const GALLON_US_AVIATION         = 'GALLON_US_AVIATION';
0067     const GALLON_UK_DIESEL           = 'GALLON_UK_DIESEL';
0068     const GALLON_US_DIESEL           = 'GALLON_US_DIESEL';
0069     const GALLON_UK_DISTILATE        = 'GALLON_UK_DISTILATE';
0070     const GALLON_US_DISTILATE        = 'GALLON_US_DISTILATE';
0071     const GALLON_UK_KEROSINE_JET     = 'GALLON_UK_KEROSINE_JET';
0072     const GALLON_US_KEROSINE_JET     = 'GALLON_US_KEROSINE_JET';
0073     const GALLON_UK_LPG              = 'GALLON_UK_LPG';
0074     const GALLON_US_LPG              = 'GALLON_US_LPG';
0075     const GALLON_UK_NAPHTA           = 'GALLON_UK_NAPHTA';
0076     const GALLON_US_NAPHTA           = 'GALLON_US_NAPHTA';
0077     const GALLON_UK_KEROSENE         = 'GALLON_UK_KEROSINE';
0078     const GALLON_US_KEROSENE         = 'GALLON_US_KEROSINE';
0079     const GALLON_UK_RESIDUAL         = 'GALLON_UK_RESIDUAL';
0080     const GALLON_US_RESIDUAL         = 'GALLON_US_RESIDUAL';
0081     const GIGAELECTRONVOLT           = 'GIGAELECTRONVOLT';
0082     const GIGACALORIE                = 'GIGACALORIE';
0083     const GIGACALORIE_15C            = 'GIGACALORIE_15C';
0084     const GIGAJOULE                  = 'GIGAJOULE';
0085     const GIGAWATT_HOUR              = 'GIGAWATT_HOUR';
0086     const GRAM_CALORIE               = 'GRAM_CALORIE';
0087     const HARTREE                    = 'HARTREE';
0088     const HECTOJOULE                 = 'HECTOJOULE';
0089     const HECTOWATT_HOUR             = 'HECTOWATT_HOUR';
0090     const HORSEPOWER_HOUR            = 'HORSEPOWER_HOUR';
0091     const HUNDRED_CUBIC_FOOT_GAS     = 'HUNDRED_CUBIC_FOOT_GAS';
0092     const INCH_OUNCE                 = 'INCH_OUNCE';
0093     const INCH_POUND                 = 'INCH_POUND';
0094     const JOULE                      = 'JOULE';
0095     const KILOCALORIE_15C            = 'KILOCALORIE_15C';
0096     const KILOCALORIE                = 'KILOCALORIE';
0097     const KILOCALORIE_THERMOCHEMICAL = 'KILOCALORIE_THERMOCHEMICAL';
0098     const KILOELECTRONVOLT           = 'KILOELECTRONVOLT';
0099     const KILOGRAM_CALORIE           = 'KILOGRAM_CALORIE';
0100     const KILOGRAM_FORCE_METER       = 'KILOGRAM_FORCE_METER';
0101     const KILOJOULE                  = 'KILOJOULE';
0102     const KILOPOND_METER             = 'KILOPOND_METER';
0103     const KILOTON                    = 'KILOTON';
0104     const KILOWATT_HOUR              = 'KILOWATT_HOUR';
0105     const LITER_ATMOSPHERE           = 'LITER_ATMOSPHERE';
0106     const MEGAELECTRONVOLT           = 'MEGAELECTRONVOLT';
0107     const MEGACALORIE                = 'MEGACALORIE';
0108     const MEGACALORIE_15C            = 'MEGACALORIE_15C';
0109     const MEGAJOULE                  = 'MEGAJOULE';
0110     const MEGALERG                   = 'MEGALERG';
0111     const MEGATON                    = 'MEGATON';
0112     const MEGAWATTHOUR               = 'MEGAWATTHOUR';
0113     const METER_KILOGRAM_FORCE       = 'METER_KILOGRAM_FORCE';
0114     const MICROJOULE                 = 'MICROJOULE';
0115     const MILLIJOULE                 = 'MILLIJOULE';
0116     const MYRIAWATT_HOUR             = 'MYRIAWATT_HOUR';
0117     const NANOJOULE                  = 'NANOJOULE';
0118     const NEWTON_METER               = 'NEWTON_METER';
0119     const PETAJOULE                  = 'PETAJOULE';
0120     const PETAWATTHOUR               = 'PETAWATTHOUR';
0121     const PFERDESTAERKENSTUNDE       = 'PFERDESTAERKENSTUNDE';
0122     const PICOJOULE                  = 'PICOJOULE';
0123     const Q_UNIT                     = 'Q_UNIT';
0124     const QUAD                       = 'QUAD';
0125     const TERAELECTRONVOLT           = 'TERAELECTRONVOLT';
0126     const TERAJOULE                  = 'TERAJOULE';
0127     const TERAWATTHOUR               = 'TERAWATTHOUR';
0128     const THERM                      = 'THERM';
0129     const THERM_US                   = 'THERM_US';
0130     const THERMIE                    = 'THERMIE';
0131     const TON                        = 'TON';
0132     const TONNE_COAL                 = 'TONNE_COAL';
0133     const TONNE_OIL                  = 'TONNE_OIL';
0134     const WATTHOUR                   = 'WATTHOUR';
0135     const WATTSECOND                 = 'WATTSECOND';
0136     const YOCTOJOULE                 = 'YOCTOJOULE';
0137     const YOTTAJOULE                 = 'YOTTAJOULE';
0138     const YOTTAWATTHOUR              = 'YOTTAWATTHOUR';
0139     const ZEPTOJOULE                 = 'ZEPTOJOULE';
0140     const ZETTAJOULE                 = 'ZETTAJOULE';
0141     const ZETTAWATTHOUR              = 'ZETTAWATTHOUR';
0142 
0143     /**
0144      * Calculations for all energy units
0145      *
0146      * @var array
0147      */
0148     protected $_units = array(
0149         'ATTOJOULE'              => array('1.0e-18',           'aJ'),
0150         'BOARD_OF_TRADE_UNIT'    => array('3600000',           'BOTU'),
0151         'BTU'                    => array('1055.0559',         'Btu'),
0152         'BTU_TERMOCHEMICAL'      => array('1054.3503',         'Btu'),
0153         'CALORIE'                => array('4.1868',            'cal'),
0154         'CALORIE_15C'            => array('6.1858',            'cal'),
0155         'CALORIE_NUTRITIONAL'    => array('4186.8',            'cal'),
0156         'CALORIE_THERMOCHEMICAL' => array('4.184',             'cal'),
0157         'CELSIUS_HEAT_UNIT'      => array('1899.1005',         'Chu'),
0158         'CENTIJOULE'             => array('0.01',              'cJ'),
0159         'CHEVAL_VAPEUR_HEURE'    => array('2647795.5',         'cv heure'),
0160         'DECIJOULE'              => array('0.1',               'dJ'),
0161         'DEKAJOULE'              => array('10',                'daJ'),
0162         'DEKAWATT_HOUR'          => array('36000',             'daWh'),
0163         'DEKATHERM'              => array('1.055057e+9',       'dathm'),
0164         'ELECTRONVOLT'           => array('1.6021773e-19',     'eV'),
0165         'ERG'                    => array('0.0000001',         'erg'),
0166         'EXAJOULE'               => array('1.0e+18',           'EJ'),
0167         'EXAWATT_HOUR'           => array('3.6e+21',           'EWh'),
0168         'FEMTOJOULE'             => array('1.0e-15',           'fJ'),
0169         'FOOT_POUND'             => array('1.3558179',         'ft lb'),
0170         'FOOT_POUNDAL'           => array('0.04214011',        'ft poundal'),
0171         'GALLON_UK_AUTOMOTIVE'   => array('158237172',         'gal car gasoline'),
0172         'GALLON_US_AUTOMOTIVE'   => array('131760000',         'gal car gasoline'),
0173         'GALLON_UK_AVIATION'     => array('158237172',         'gal jet gasoline'),
0174         'GALLON_US_AVIATION'     => array('131760000',         'gal jet gasoline'),
0175         'GALLON_UK_DIESEL'       => array('175963194',         'gal diesel'),
0176         'GALLON_US_DIESEL'       => array('146520000',         'gal diesel'),
0177         'GALLON_UK_DISTILATE'    => array('175963194',         'gal destilate fuel'),
0178         'GALLON_US_DISTILATE'    => array('146520000',         'gal destilate fuel'),
0179         'GALLON_UK_KEROSINE_JET' => array('170775090',         'gal jet kerosine'),
0180         'GALLON_US_KEROSINE_JET' => array('142200000',         'gal jet kerosine'),
0181         'GALLON_UK_LPG'          => array('121005126.0865275', 'gal lpg'),
0182         'GALLON_US_LPG'          => array('100757838.45',      'gal lpg'),
0183         'GALLON_UK_NAPHTA'       => array('160831224',         'gal jet fuel'),
0184         'GALLON_US_NAPHTA'       => array('133920000',         'gal jet fuel'),
0185         'GALLON_UK_KEROSINE'     => array('170775090',         'gal kerosine'),
0186         'GALLON_US_KEROSINE'     => array('142200000',         'gal kerosine'),
0187         'GALLON_UK_RESIDUAL'     => array('189798138',         'gal residual fuel'),
0188         'GALLON_US_RESIDUAL'     => array('158040000',         'gal residual fuel'),
0189         'GIGAELECTRONVOLT'       => array('1.6021773e-10',     'GeV'),
0190         'GIGACALORIE'            => array('4186800000',        'Gcal'),
0191         'GIGACALORIE_15C'        => array('4185800000',        'Gcal'),
0192         'GIGAJOULE'              => array('1.0e+9',            'GJ'),
0193         'GIGAWATT_HOUR'          => array('3.6e+12',           'GWh'),
0194         'GRAM_CALORIE'           => array('4.1858',            'g cal'),
0195         'HARTREE'                => array('4.3597482e-18',     'Eh'),
0196         'HECTOJOULE'             => array('100',               'hJ'),
0197         'HECTOWATT_HOUR'         => array('360000',            'hWh'),
0198         'HORSEPOWER_HOUR'        => array('2684519.5',         'hph'),
0199         'HUNDRED_CUBIC_FOOT_GAS' => array('108720000',         'hundred ft� gas'),
0200         'INCH_OUNCE'             => array('0.0070615518',      'in oc'),
0201         'INCH_POUND'             => array('0.112984825',       'in lb'),
0202         'JOULE'                  => array('1',                 'J'),
0203         'KILOCALORIE_15C'        => array('4185.8',            'kcal'),
0204         'KILOCALORIE'            => array('4186','8',          'kcal'),
0205         'KILOCALORIE_THERMOCHEMICAL' => array('4184',          'kcal'),
0206         'KILOELECTRONVOLT'       => array('1.6021773e-16',     'keV'),
0207         'KILOGRAM_CALORIE'       => array('4185.8',            'kg cal'),
0208         'KILOGRAM_FORCE_METER'   => array('9.80665',           'kgf m'),
0209         'KILOJOULE'              => array('1000',              'kJ'),
0210         'KILOPOND_METER'         => array('9.80665',           'kp m'),
0211         'KILOTON'                => array('4.184e+12',         'kt'),
0212         'KILOWATT_HOUR'          => array('3600000',           'kWh'),
0213         'LITER_ATMOSPHERE'       => array('101.325',           'l atm'),
0214         'MEGAELECTRONVOLT'       => array('1.6021773e-13',     'MeV'),
0215         'MEGACALORIE'            => array('4186800',           'Mcal'),
0216         'MEGACALORIE_15C'        => array('4185800',           'Mcal'),
0217         'MEGAJOULE'              => array('1000000',           'MJ'),
0218         'MEGALERG'               => array('0.1',               'megalerg'),
0219         'MEGATON'                => array('4.184e+15',         'Mt'),
0220         'MEGAWATTHOUR'           => array('3.6e+9',            'MWh'),
0221         'METER_KILOGRAM_FORCE'   => array('9.80665',           'm kgf'),
0222         'MICROJOULE'             => array('0.000001',          '�J'),
0223         'MILLIJOULE'             => array('0.001',             'mJ'),
0224         'MYRIAWATT_HOUR'         => array('3.6e+7',            'myWh'),
0225         'NANOJOULE'              => array('1.0e-9',            'nJ'),
0226         'NEWTON_METER'           => array('1',                 'Nm'),
0227         'PETAJOULE'              => array('1.0e+15',           'PJ'),
0228         'PETAWATTHOUR'           => array('3.6e+18',           'PWh'),
0229         'PFERDESTAERKENSTUNDE'   => array('2647795.5',         'ps h'),
0230         'PICOJOULE'              => array('1.0e-12',           'pJ'),
0231         'Q_UNIT'                 => array('1.0550559e+21',     'Q unit'),
0232         'QUAD'                   => array('1.0550559e+18',     'quad'),
0233         'TERAELECTRONVOLT'       => array('1.6021773e-7',      'TeV'),
0234         'TERAJOULE'              => array('1.0e+12',           'TJ'),
0235         'TERAWATTHOUR'           => array('3.6e+15',           'TWh'),
0236         'THERM'                  => array('1.0550559e+8',      'thm'),
0237         'THERM_US'               => array('1.054804e+8',       'thm'),
0238         'THERMIE'                => array('4185800',           'th'),
0239         'TON'                    => array('4.184e+9',          'T explosive'),
0240         'TONNE_COAL'             => array('2.93076e+10',       'T coal'),
0241         'TONNE_OIL'              => array('4.1868e+10',        'T oil'),
0242         'WATTHOUR'               => array('3600',              'Wh'),
0243         'WATTSECOND'             => array('1',                 'Ws'),
0244         'YOCTOJOULE'             => array('1.0e-24',           'yJ'),
0245         'YOTTAJOULE'             => array('1.0e+24',           'YJ'),
0246         'YOTTAWATTHOUR'          => array('3.6e+27',           'YWh'),
0247         'ZEPTOJOULE'             => array('1.0e-21',           'zJ'),
0248         'ZETTAJOULE'             => array('1.0e+21',           'ZJ'),
0249         'ZETTAWATTHOUR'          => array('3.6e+24',           'ZWh'),
0250         'STANDARD'               => 'JOULE'
0251     );
0252 }