Skip to content

Commit

Permalink
Units of Energy Added
Browse files Browse the repository at this point in the history
  • Loading branch information
olifolkerd committed Dec 20, 2015
1 parent e175e74 commit e9a4319
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
20 changes: 13 additions & 7 deletions Convertor.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,19 @@ function defineUnits(){
"ns"=>array("base"=>"s", "conversion"=>0.000000001), //nanosecond

///////Units Of Power///////





///////Units Of Energy///////
);
"j"=>array("base"=>"j", "conversion"=>1), //joule - base unit for energy
"kj"=>array("base"=>"j", "conversion"=>1000), //kilojoule
"mj"=>array("base"=>"j", "conversion"=>1000000), //megajoule
"cal"=>array("base"=>"j", "conversion"=>4184), //calorie
"Nm"=>array("base"=>"j", "conversion"=>1), //newton meter
"ftlb"=>array("base"=>"j", "conversion"=>1.35582), //foot pound
"whr"=>array("base"=>"j", "conversion"=>3600), //watt hour
"kwhr"=>array("base"=>"j", "conversion"=>3600000), //kilowatt hour
"mwhr"=>array("base"=>"j", "conversion"=>3600000000), //megawatt hour
"mev"=>array("base"=>"j", "conversion"=>0.00000000000000016), //mega electron volt


);
}

//constructor
Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Convertor can handle a wide range of unit types including:
<li>Temperature</li>
<li>Pressure</li>
<li>Time</li>
<li>Energy/Power</li>
</ul>

See [Available Units](#available-units) for full list of units in Convertor.
Expand Down Expand Up @@ -239,4 +240,16 @@ Available Units
- min - Minute
- ms - Milisecond
- μs - Microsecond
- ns - Nanosecond
- ns - Nanosecond

###Energy/Power
- j - Joule
- kj - Kilojoule
- mj - Megajoule
- cal - Calorie
- Nm - Newton Meter
- ftlb - Foot Pound
- whr - Watt Hour
- kwhr - Kilowatt Hour
- mwhr - Megawatt Hour
- mev - Mega Electron Volt

0 comments on commit e9a4319

Please sign in to comment.