ianmackenzie/elm-units-prefixed/1.0.0

NOTE: the latest version is 2.8.0

Units.Current

A Current value represents an electrical current in amperes.

Note that since Amperes is defined as Rate Coulombs Seconds (charge per unit time), you can construct a Current value using Quantity.per:

current =
    charge |> Quantity.per duration

You can also do rate-related calculations with Current values to compute Charge or Duration:

charge =
    current |> Quantity.times duration


alsoCharge =
    duration |> Quantity.at current


duration =
    charge |> Quantity.at_ current
type alias Current =
Current
type alias Amperes =
Amperes
amperes : Float -> Current

Construct a current from a number of amperes.

inAmperes : Current -> Float

Convert a current to a number of amperes.

Charge.coulombs 10
    |> Quantity.per (Duration.seconds 2)
    |> Current.inAmperes
--> 5
milliamperes : Float -> Current

Construct a current from a number of milliamperes.

Current.milliamperes 500
--> Current.amperes 0.5
inMilliamperes : Current -> Float

Convert a current to number of milliamperes.

Current.amperes 2 |> Current.inMilliamperes
--> 2000