Math.Units


Voltage Module

A Voltage value represents a voltage (electric potential difference, if we're being picky) in volts.

Note

Since Volts is defined as Rate Watts Amperes (power per unit current), you can do rate-related calculations with Voltage values to compute Power or Current:


     // elm-units version of 'P = V * I'
     power =
         current |> Quantity.at voltage
     // I = P / V
     current =
         power |> Quantity.at_ voltage

Just for fun, note that since you can also express Voltage in terms of Current and Resistance, you could rewrite the second example above as


     // P = I^2 * R
     let power =
         current
             |> Quantity.at
                 (current
                     |> Quantity.at resistance
                 )

Functions and values

Function or value Description

inVolts numVolts

Full Usage: inVolts numVolts

Parameters:
Returns: float

Convert a voltage to a number of volts.

numVolts : Voltage
Returns: float

volts numVolts

Full Usage: volts numVolts

Parameters:
    numVolts : float

Returns: Voltage

Construct a voltage from a number of volts.

numVolts : float
Returns: Voltage