ianmackenzie / elm-units-prefixed / Units.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 =
Power


type alias Watts =
Power.Watts

Metric

watts : Basics.Float -> Power

Construct a Power value from a number of watts.

inWatts : Power -> Basics.Float

Convert a Power value to a number of watts.

kilowatts : Basics.Float -> Power

Construct a Power value from a number of kilowatts.

inKilowatts : Power -> Basics.Float

Convert a Power value to a number of kilowatts.

megawatts : Basics.Float -> Power

Construct a Power value from a number of megawatts.

inMegawatts : Power -> Basics.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 : Basics.Float -> Power

Construct a Power value from an number of metric horsepower.

Power.metricHorsepower 1
--> Power.watts 735.49875

inMetricHorsepower : Power -> Basics.Float

Convert a Power value to a number of metric horsepower.

mechanicalHorsepower : Basics.Float -> Power

Construct a Power value from an number of mechanical horsepower.

Power.mechanicalHorsepower 1
--> Power.watts 745.6998715822702

inMechanicalHorsepower : Power -> Basics.Float

Convert a Power value to a number of mechanical horsepower.

electricalHorsepower : Basics.Float -> Power

Construct a Power value from an number of electrical horsepower.

Power.electricalHorsepower 1
--> Power.watts 746

inElectricalHorsepower : Power -> Basics.Float

Convert a Power value to a number of electrical horsepower.