ianmackenzie / elm-units-prefixed / Units.Energy

An Energy value represents an amount of energy (or work) in joules, kilowatt hours etc. It is stored as a number of joules.

Note that since Joules is defined as Product Newtons Meters, you can compute energy directly as a product of force and distance:

Force.newtons 5 |> Quantity.times (Length.meters 4)
--> Energy.joules 20


type alias Energy =
Energy


type alias Joules =
Energy.Joules

Conversions

joules : Basics.Float -> Energy

Construct an energy value from a number of joules.

inJoules : Energy -> Basics.Float

Convert an energy value to a number of joules.

kilojoules : Basics.Float -> Energy

Construct an energy value from a number of kilojoules.

inKilojoules : Energy -> Basics.Float

Convert an energy value to a number of kilojoules.

megajoules : Basics.Float -> Energy

Construct an energy value from a number of megajoules.

inMegajoules : Energy -> Basics.Float

Convert an energy value to a number of megajoules.

kilowattHours : Basics.Float -> Energy

Construct an energy value from a number of kilowatt hours.

Energy.kilowattHours 1
--> Energy.megajoules 3.6

inKilowattHours : Energy -> Basics.Float

Convert an energy value to a number of kilowatt hours.