ianmackenzie/elm-units/2.3.0

NOTE: the latest version is 2.10.0

Power

A Power value represents power in watts or horsepower. It is stored as a number of watts.

Note that since Watts is defined as Rate Joules Seconds (energy per unit time), you can construct a Power value using Quantity.per:

power =
    energy |> Quantity.per duration

You can also do rate-related calculations with Power values to compute Energy or Duration:

energy =
    power |> Quantity.for duration


alsoEnergy =
    duration |> Quantity.at power


duration =
    energy |> Quantity.at_ power
type alias Power =
Quantity Float Watts
type alias Watts =
Rate Joules Seconds

Metric

watts : Float -> Power

Construct a Power value from a number of watts.

inWatts : Power -> Float

Convert a Power value to a number of watts.

kilowatts : Float -> Power

Construct a Power value from a number of kilowatts.

inKilowatts : Power -> Float

Convert a Power value to a number of kilowatts.

megawatts : Float -> Power

Construct a Power value from a number of megawatts.

inMegawatts : Power -> Float

Convert a Power value to a number of megawatts.

Horsepower

Who knew that there were not one, not two, but three possible interpretations of "one horsepower"? (Actually there are more than that, but these three seemed the most reasonable.)

metricHorsepower : Float -> Power

Construct a Power value from an number of metric horsepower.

Power.metricHorsepower 1
--> Power.watts 735.49875
inMetricHorsepower : Power -> Float

Convert a Power value to a number of metric horsepower.

mechanicalHorsepower : Float -> Power

Construct a Power value from an number of mechanical horsepower.

Power.mechanicalHorsepower 1
--> Power.watts 745.6998715822702
inMechanicalHorsepower : Power -> Float

Convert a Power value to a number of mechanical horsepower.

electricalHorsepower : Float -> Power

Construct a Power value from an number of electrical horsepower.

Power.electricalHorsepower 1
--> Power.watts 746
inElectricalHorsepower : Power -> Float

Convert a Power value to a number of electrical horsepower.