Documentation

Overview

Package physic declares types for physical input, outputs and measurement units.

This includes temperature, humidity, pressure, tension, current, etc.

SI units

The supported S.I. units is a subset of the official ones.

T  	tera 	10¹²  	1000000000000
G  	giga 	10⁹   	1000000000
M  	mega 	10⁶   	1000000
k  	kilo 	10³   	1000
m  	milli	10⁻³  	0.001
µ,u	micro	10⁻⁶  	0.000001
n  	nano 	10⁻⁹  	0.000000001
p  	pico 	10⁻¹² 	0.000000000001

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Angle

type Angle int64

    Angle is the measurement of the difference in orientation between two vectors stored as an int64 nano radian.

    A negative angle is valid.

    The highest representable value is a bit over 9.223GRad or 500,000,000,000°.

    Example
    Output:
    
    1.000°
    180.0°
    360.0°
    
    Example (Flag)
    Output:
    
    
    Example (Float64)
    Output:
    
    45.00°
    45.0deg
    0.785398rad
    
    const (
    	NanoRadian  Angle = 1
    	MicroRadian Angle = 1000 * NanoRadian
    	MilliRadian Angle = 1000 * MicroRadian
    	Radian      Angle = 1000 * MilliRadian
    
    	// Theta is 2π. This is equivalent to 360°.
    	Theta  Angle = 6283185307 * NanoRadian
    	Pi     Angle = 3141592653 * NanoRadian
    	Degree Angle = 17453293 * NanoRadian
    )

      Well known Angle constants.

      func (*Angle) Set

      func (a *Angle) Set(s string) error

        Set sets the Angle to the value represented by s. Units are to be provided in "rad", "deg" or "°" with an optional SI prefix: "p", "n", "u", "µ", "m", "k", "M", "G" or "T".

        Example
        Output:
        
        2.000°
        90.00°
        57.296°
        

        func (Angle) String

        func (a Angle) String() string

          String returns the angle formatted as a string in degree.

          type Distance

          type Distance int64

            Distance is a measurement of length stored as an int64 nano metre.

            This is one of the base unit in the International System of Units.

            The highest representable value is 9.2Gm.

            Example
            Output:
            
            25.400mm
            304.800mm
            1.609km
            
            Example (Flag)
            Output:
            
            
            Example (Float64)
            Output:
            
            384.400Mm
            384400000m
            15133858268in
            
            const (
            	NanoMetre  Distance = 1
            	MicroMetre Distance = 1000 * NanoMetre
            	MilliMetre Distance = 1000 * MicroMetre
            	Metre      Distance = 1000 * MilliMetre
            	KiloMetre  Distance = 1000 * Metre
            	MegaMetre  Distance = 1000 * KiloMetre
            	GigaMetre  Distance = 1000 * MegaMetre
            
            	// Conversion between Metre and imperial units.
            	Thou Distance = 25400 * NanoMetre
            	Inch Distance = 1000 * Thou
            	Foot Distance = 12 * Inch
            	Yard Distance = 3 * Foot
            	Mile Distance = 1760 * Yard
            )

              Well known Distance constants.

              func (*Distance) Set

              func (d *Distance) Set(s string) error

                Set sets the Distance to the value represented by s. Units are to be provided in "m", "Mile", "Yard", "in", or "ft" with an optional SI prefix: "p", "n", "u", "µ", "m", "k", "M", "G" or "T".

                Example
                Output:
                
                304.800mm
                1m
                14.484km
                

                func (Distance) String

                func (d Distance) String() string

                  String returns the distance formatted as a string in metre.

                  type ElectricCurrent

                  type ElectricCurrent int64

                    ElectricCurrent is a measurement of a flow of electric charge stored as an int64 nano Ampere.

                    This is one of the base unit in the International System of Units.

                    The highest representable value is 9.2GA.

                    Example
                    Output:
                    
                    10.010A
                    10A
                    -10mA
                    
                    Example (Flag)
                    Output:
                    
                    
                    Example (Float64)
                    Output:
                    
                    51mA
                    0.051A
                    
                    const (
                    	NanoAmpere  ElectricCurrent = 1
                    	MicroAmpere ElectricCurrent = 1000 * NanoAmpere
                    	MilliAmpere ElectricCurrent = 1000 * MicroAmpere
                    	Ampere      ElectricCurrent = 1000 * MilliAmpere
                    	KiloAmpere  ElectricCurrent = 1000 * Ampere
                    	MegaAmpere  ElectricCurrent = 1000 * KiloAmpere
                    	GigaAmpere  ElectricCurrent = 1000 * MegaAmpere
                    )

                      Well known ElectricCurrent constants.

                      func (*ElectricCurrent) Set

                      func (c *ElectricCurrent) Set(s string) error

                        Set sets the ElectricCurrent to the value represented by s. Units are to be provided in "A" with an optional SI prefix: "p", "n", "u", "µ", "m", "k", "M", "G" or "T".

                        Example
                        Output:
                        
                        12.500mA
                        2.400kA
                        2A
                        

                        func (ElectricCurrent) String

                        func (c ElectricCurrent) String() string

                          String returns the current formatted as a string in Ampere.

                          type ElectricPotential

                          type ElectricPotential int64

                            ElectricPotential is a measurement of electric potential stored as an int64 nano Volt.

                            The highest representable value is 9.2GV.

                            Example
                            Output:
                            
                            10.010V
                            10V
                            -10mV
                            
                            Example (Flag)
                            Output:
                            
                            
                            Example (Float64)
                            Output:
                            
                            3.300V
                            3.3V
                            
                            const (
                            	// Volt is W/A, kg⋅m²/s³/A.
                            	NanoVolt  ElectricPotential = 1
                            	MicroVolt ElectricPotential = 1000 * NanoVolt
                            	MilliVolt ElectricPotential = 1000 * MicroVolt
                            	Volt      ElectricPotential = 1000 * MilliVolt
                            	KiloVolt  ElectricPotential = 1000 * Volt
                            	MegaVolt  ElectricPotential = 1000 * KiloVolt
                            	GigaVolt  ElectricPotential = 1000 * MegaVolt
                            )

                              Well known ElectricPotential constants.

                              func (*ElectricPotential) Set

                              func (p *ElectricPotential) Set(s string) error

                                Set sets the ElectricPotential to the value represented by s. Units are to be provided in "V" with an optional SI prefix: "p", "n", "u", "µ", "m", "k", "M", "G" or "T".

                                Example
                                Output:
                                
                                250µV
                                100kV
                                12V
                                

                                func (ElectricPotential) String

                                func (p ElectricPotential) String() string

                                  String returns the tension formatted as a string in Volt.

                                  type ElectricResistance

                                  type ElectricResistance int64

                                    ElectricResistance is a measurement of the difficulty to pass an electric current through a conductor stored as an int64 nano Ohm.

                                    The highest representable value is 9.2GΩ.

                                    Example
                                    Output:
                                    
                                    10.010Ω
                                    10Ω
                                    24MΩ
                                    
                                    Example (Flag)
                                    Output:
                                    
                                    
                                    Example (Float64)
                                    Output:
                                    
                                    4.700kΩ
                                    4700Ohm
                                    
                                    const (
                                    	// Ohm is V/A, kg⋅m²/s³/A².
                                    	NanoOhm  ElectricResistance = 1
                                    	MicroOhm ElectricResistance = 1000 * NanoOhm
                                    	MilliOhm ElectricResistance = 1000 * MicroOhm
                                    	Ohm      ElectricResistance = 1000 * MilliOhm
                                    	KiloOhm  ElectricResistance = 1000 * Ohm
                                    	MegaOhm  ElectricResistance = 1000 * KiloOhm
                                    	GigaOhm  ElectricResistance = 1000 * MegaOhm
                                    )

                                      Well known ElectricResistance constants.

                                      func (*ElectricResistance) Set

                                      func (r *ElectricResistance) Set(s string) error

                                        Set sets the ElectricResistance to the value represented by s. Units are to be provided in "Ohm", or "Ω" with an optional SI prefix: "p", "n", "u", "µ", "m", "k", "M", "G" or "T".

                                        Example
                                        Output:
                                        
                                        33.300kΩ
                                        1Ω
                                        5MΩ
                                        

                                        func (ElectricResistance) String

                                        func (r ElectricResistance) String() string

                                          String returns the resistance formatted as a string in Ohm.

                                          type ElectricalCapacitance

                                          type ElectricalCapacitance int64

                                            ElectricalCapacitance is a measurement of capacitance stored as a pico farad.

                                            The highest representable value is 9.2MF.

                                            Example
                                            Output:
                                            
                                            1F
                                            22pF
                                            
                                            Example (Flag)
                                            Output:
                                            
                                            
                                            Example (Float64)
                                            Output:
                                            
                                            4.700µF
                                            4.7µF
                                            
                                            const (
                                            	// Farad is a unit of capacitance. kg⁻¹⋅m⁻²⋅s⁴A²
                                            	PicoFarad  ElectricalCapacitance = 1
                                            	NanoFarad  ElectricalCapacitance = 1000 * PicoFarad
                                            	MicroFarad ElectricalCapacitance = 1000 * NanoFarad
                                            	MilliFarad ElectricalCapacitance = 1000 * MicroFarad
                                            	Farad      ElectricalCapacitance = 1000 * MilliFarad
                                            	KiloFarad  ElectricalCapacitance = 1000 * Farad
                                            	MegaFarad  ElectricalCapacitance = 1000 * KiloFarad
                                            )

                                              Well known ElectricalCapacitance constants.

                                              func (*ElectricalCapacitance) Set

                                                Set sets the ElectricalCapacitance to the value represented by s. Units are to be provided in "F" with an optional SI prefix: "p", "n", "u", "µ", "m", "k", "M", "G" or "T".

                                                Example
                                                Output:
                                                
                                                1F
                                                22pF
                                                

                                                func (ElectricalCapacitance) String

                                                func (c ElectricalCapacitance) String() string

                                                  String returns the energy formatted as a string in Farad.

                                                  type Energy

                                                  type Energy int64

                                                    Energy is a measurement of work stored as a nano joules.

                                                    The highest representable value is 9.2GJ.

                                                    Example
                                                    Output:
                                                    
                                                    1J
                                                    1J
                                                    3.600MJ
                                                    
                                                    Example (Flag)
                                                    Output:
                                                    
                                                    
                                                    Example (Float64)
                                                    Output:
                                                    
                                                    36.927MJ
                                                    36927100
                                                    
                                                    const (
                                                    	// Joule is a unit of work. kg⋅m²⋅s⁻²
                                                    	NanoJoule  Energy = 1
                                                    	MicroJoule Energy = 1000 * NanoJoule
                                                    	MilliJoule Energy = 1000 * MicroJoule
                                                    	Joule      Energy = 1000 * MilliJoule
                                                    	KiloJoule  Energy = 1000 * Joule
                                                    	MegaJoule  Energy = 1000 * KiloJoule
                                                    	GigaJoule  Energy = 1000 * MegaJoule
                                                    
                                                    	// BTU (British thermal unit) is the heat required to raise the temperature
                                                    	// of one pound of water by one degree Fahrenheit. This is the ISO value.
                                                    	BTU Energy = 1055060 * MilliJoule
                                                    
                                                    	WattSecond   Energy = Joule
                                                    	WattHour     Energy = 3600 * Joule
                                                    	KiloWattHour Energy = 3600 * KiloJoule
                                                    )

                                                      Well known Energy constants.

                                                      func (*Energy) Set

                                                      func (e *Energy) Set(s string) error

                                                        Set sets the Energy to the value represented by s. Units are to be provided in "J" with an optional SI prefix: "p", "n", "u", "µ", "m", "k", "M", "G" or "T".

                                                        Example
                                                        Output:
                                                        
                                                        2.600kJ
                                                        45mJ
                                                        

                                                        func (Energy) String

                                                        func (e Energy) String() string

                                                          String returns the energy formatted as a string in Joules.

                                                          type Env

                                                          type Env struct {
                                                          	Temperature Temperature
                                                          	Pressure    Pressure
                                                          	Humidity    RelativeHumidity
                                                          }

                                                            Env represents measurements from an environmental sensor.

                                                            type Force

                                                            type Force int64

                                                              Force is a measurement of interaction that will change the motion of an object stored as an int64 nano Newton.

                                                              A measurement of Force is a vector and has a direction but this unit only represents the magnitude. The orientation needs to be stored as a Quaternion independently.

                                                              The highest representable value is 9.2TN.

                                                              Example
                                                              Output:
                                                              
                                                              10mN
                                                              9.807N
                                                              4.448N
                                                              
                                                              Example (Flag)
                                                              Output:
                                                              
                                                              
                                                              Example (Float64)
                                                              Output:
                                                              
                                                              9.807N
                                                              9.806650N
                                                              2.204623lbf
                                                              
                                                              const (
                                                              	// Newton is kg⋅m/s².
                                                              	NanoNewton  Force = 1
                                                              	MicroNewton Force = 1000 * NanoNewton
                                                              	MilliNewton Force = 1000 * MicroNewton
                                                              	Newton      Force = 1000 * MilliNewton
                                                              	KiloNewton  Force = 1000 * Newton
                                                              	MegaNewton  Force = 1000 * KiloNewton
                                                              	GigaNewton  Force = 1000 * MegaNewton
                                                              
                                                              	EarthGravity Force = 9806650 * MicroNewton
                                                              
                                                              	// Conversion between Newton and imperial units.
                                                              	// Pound is both a unit of mass and weight (force). The suffix Force is added
                                                              	// to disambiguate the measurement it represents.
                                                              	PoundForce Force = 4448221615 * NanoNewton
                                                              )

                                                                Well known Force constants.

                                                                func (*Force) Set

                                                                func (f *Force) Set(s string) error

                                                                  Set sets the Force to the value represented by s. Units are to be provided in "N", or "lbf" (Pound force) with an optional SI prefix: "p", "n", "u", "µ", "m", "k", "M", "G" or "T".

                                                                  Example
                                                                  Output:
                                                                  
                                                                  9.800N
                                                                  88.964N
                                                                  

                                                                  func (Force) String

                                                                  func (f Force) String() string

                                                                    String returns the force formatted as a string in Newton.

                                                                    type Frequency

                                                                    type Frequency int64

                                                                      Frequency is a measurement of cycle per second, stored as an int64 micro Hertz.

                                                                      The highest representable value is 9.2THz.

                                                                      Example
                                                                      Output:
                                                                      
                                                                      10mHz
                                                                      101.010Hz
                                                                      10MHz
                                                                      1Hz
                                                                      
                                                                      Example (Flag)
                                                                      Output:
                                                                      
                                                                      
                                                                      Example (Float64)
                                                                      Output:
                                                                      
                                                                      3.580MHz
                                                                      3579545.454545Hz
                                                                      
                                                                      const (
                                                                      	// Hertz is 1/s.
                                                                      	MicroHertz Frequency = 1
                                                                      	MilliHertz Frequency = 1000 * MicroHertz
                                                                      	Hertz      Frequency = 1000 * MilliHertz
                                                                      	KiloHertz  Frequency = 1000 * Hertz
                                                                      	MegaHertz  Frequency = 1000 * KiloHertz
                                                                      	GigaHertz  Frequency = 1000 * MegaHertz
                                                                      	TeraHertz  Frequency = 1000 * GigaHertz
                                                                      
                                                                      	// RPM is revolutions per minute. It is used to quantify angular frequency.
                                                                      	RPM Frequency = 16667 * MicroHertz
                                                                      )

                                                                        Well known Frequency constants.

                                                                        func PeriodToFrequency

                                                                        func PeriodToFrequency(p time.Duration) Frequency

                                                                          PeriodToFrequency returns the frequency for a period of this interval.

                                                                          A 0s period returns a 0Hz frequency.

                                                                          Example
                                                                          Output:
                                                                          
                                                                          1MHz
                                                                          16.667mHz
                                                                          

                                                                          func (Frequency) Duration

                                                                          func (f Frequency) Duration() time.Duration

                                                                            Duration returns the duration of one cycle at this frequency.

                                                                            Deprecated: This method is removed in v4.0.0. Use Period() instead.

                                                                            func (Frequency) Period

                                                                            func (f Frequency) Period() time.Duration

                                                                              Period returns the duration of one cycle at this frequency.

                                                                              Frequency above GigaHertz cannot be represented as Duration.

                                                                              A 0Hz frequency returns a 0s period.

                                                                              Example
                                                                              Output:
                                                                              
                                                                              16m40s
                                                                              1µs
                                                                              

                                                                              func (*Frequency) Set

                                                                              func (f *Frequency) Set(s string) error

                                                                                Set sets the Frequency to the value represented by s. Units are to be provided in "Hz" or "rpm" with an optional SI prefix: "p", "n", "u", "µ", "m", "k", "M", "G" or "T".

                                                                                Unlike most Set() functions, "Hz" is assumed by default.

                                                                                Example
                                                                                Output:
                                                                                
                                                                                10MHz
                                                                                10mHz
                                                                                1kHz
                                                                                

                                                                                func (Frequency) String

                                                                                func (f Frequency) String() string

                                                                                  String returns the frequency formatted as a string in Hertz.

                                                                                  type LuminousFlux

                                                                                  type LuminousFlux int64

                                                                                    LuminousFlux is a measurement of total quantity of visible light energy emitted with wavelength power weighted by a luminosity function which represents a model of the human eye's response to different wavelengths. The CIE 1931 luminosity function is the standard for lumens.

                                                                                    LuminousFlux is stored as nano lumens.

                                                                                    The highest representable value is 9.2Glm.

                                                                                    Example
                                                                                    Output:
                                                                                    
                                                                                    18.282klm
                                                                                    
                                                                                    Example (Flag)
                                                                                    Output:
                                                                                    
                                                                                    
                                                                                    Example (Float64)
                                                                                    Output:
                                                                                    
                                                                                    450lm
                                                                                    450
                                                                                    
                                                                                    const (
                                                                                    	// Lumen is a unit of luminous flux. cd⋅sr
                                                                                    	NanoLumen  LuminousFlux = 1
                                                                                    	MicroLumen LuminousFlux = 1000 * NanoLumen
                                                                                    	MilliLumen LuminousFlux = 1000 * MicroLumen
                                                                                    	Lumen      LuminousFlux = 1000 * MilliLumen
                                                                                    	KiloLumen  LuminousFlux = 1000 * Lumen
                                                                                    	MegaLumen  LuminousFlux = 1000 * KiloLumen
                                                                                    	GigaLumen  LuminousFlux = 1000 * MegaLumen
                                                                                    )

                                                                                      Well known LuminousFlux constants.

                                                                                      func (*LuminousFlux) Set

                                                                                      func (f *LuminousFlux) Set(s string) error

                                                                                        Set sets the LuminousFlux to the value represented by s. Units are to be provided in "lm" with an optional SI prefix: "p", "n", "u", "µ", "m", "k", "M", "G" or "T".

                                                                                        Example
                                                                                        Output:
                                                                                        
                                                                                        25mlm
                                                                                        2.500Mlm
                                                                                        

                                                                                        func (LuminousFlux) String

                                                                                        func (f LuminousFlux) String() string

                                                                                          String returns the energy formatted as a string in Lumens.

                                                                                          type LuminousIntensity

                                                                                          type LuminousIntensity int64

                                                                                            LuminousIntensity is a measurement of the quantity of visible light energy emitted per unit solid angle with wavelength power weighted by a luminosity function which represents the human eye's response to different wavelengths. The CIE 1931 luminosity function is the SI standard for candela.

                                                                                            LuminousIntensity is stored as nano candela.

                                                                                            This is one of the base unit in the International System of Units.

                                                                                            The highest representable value is 9.2Gcd.

                                                                                            Example
                                                                                            Output:
                                                                                            
                                                                                            12cd
                                                                                            
                                                                                            Example (Flag)
                                                                                            Output:
                                                                                            
                                                                                            
                                                                                            Example (Float64)
                                                                                            Output:
                                                                                            
                                                                                            35.800cd
                                                                                            35.8
                                                                                            
                                                                                            const (
                                                                                            	// Candela is a unit of luminous intensity. cd
                                                                                            	NanoCandela  LuminousIntensity = 1
                                                                                            	MicroCandela LuminousIntensity = 1000 * NanoCandela
                                                                                            	MilliCandela LuminousIntensity = 1000 * MicroCandela
                                                                                            	Candela      LuminousIntensity = 1000 * MilliCandela
                                                                                            	KiloCandela  LuminousIntensity = 1000 * Candela
                                                                                            	MegaCandela  LuminousIntensity = 1000 * KiloCandela
                                                                                            	GigaCandela  LuminousIntensity = 1000 * MegaCandela
                                                                                            )

                                                                                              Well known LuminousIntensity constants.

                                                                                              func (*LuminousIntensity) Set

                                                                                              func (i *LuminousIntensity) Set(s string) error

                                                                                                Set sets the LuminousIntensity to the value represented by s. Units are to be provided in "cd" with an optional SI prefix: "p", "n", "u", "µ", "m", "k", "M", "G" or "T".

                                                                                                Example
                                                                                                Output:
                                                                                                
                                                                                                16cd
                                                                                                

                                                                                                func (LuminousIntensity) String

                                                                                                func (i LuminousIntensity) String() string

                                                                                                  String returns the energy formatted as a string in Candela.

                                                                                                  type MagneticFluxDensity

                                                                                                  type MagneticFluxDensity int64

                                                                                                    MagneticFluxDensity is a measurement of magnetic flux density, stored in Tesla.

                                                                                                    The highest representable value is 9.2GT.

                                                                                                    const (
                                                                                                    	// Tesla is a unit of magnetic flux density.
                                                                                                    	NanoTesla  MagneticFluxDensity = 1
                                                                                                    	MicroTesla MagneticFluxDensity = 1000 * NanoTesla
                                                                                                    	MilliTesla MagneticFluxDensity = 1000 * MicroTesla
                                                                                                    	Tesla      MagneticFluxDensity = 1000 * MilliTesla
                                                                                                    	KiloTesla  MagneticFluxDensity = 1000 * Tesla
                                                                                                    	MegaTesla  MagneticFluxDensity = 1000 * KiloTesla
                                                                                                    	GigaTesla  MagneticFluxDensity = 1000 * MegaTesla
                                                                                                    )

                                                                                                      Well known MagneticFluxDensity constants.

                                                                                                      func (*MagneticFluxDensity) Set

                                                                                                      func (c *MagneticFluxDensity) Set(s string) error

                                                                                                        Set sets the MagneticFluxDensity to the value represented by s. Units are to be provided in "T" with an optional SI prefix: "p", "n", "u", "µ", "m", "k", "M", "G" or "T".

                                                                                                        func (MagneticFluxDensity) String

                                                                                                        func (c MagneticFluxDensity) String() string

                                                                                                          String returns the energy formatted as a string in Farad.

                                                                                                          type Mass

                                                                                                          type Mass int64

                                                                                                            Mass is a measurement of mass stored as an int64 nano gram.

                                                                                                            This is one of the base unit in the International System of Units.

                                                                                                            The highest representable value is 9.2Gg.

                                                                                                            Example
                                                                                                            Output:
                                                                                                            
                                                                                                            10mg
                                                                                                            28.350g
                                                                                                            453.592g
                                                                                                            14.594kg
                                                                                                            
                                                                                                            Example (Flag)
                                                                                                            Output:
                                                                                                            
                                                                                                            
                                                                                                            Example (Float64)
                                                                                                            Output:
                                                                                                            
                                                                                                            6.270g
                                                                                                            6.27g
                                                                                                            
                                                                                                            const (
                                                                                                            	NanoGram  Mass = 1
                                                                                                            	MicroGram Mass = 1000 * NanoGram
                                                                                                            	MilliGram Mass = 1000 * MicroGram
                                                                                                            	Gram      Mass = 1000 * MilliGram
                                                                                                            	KiloGram  Mass = 1000 * Gram
                                                                                                            	MegaGram  Mass = 1000 * KiloGram
                                                                                                            	GigaGram  Mass = 1000 * MegaGram
                                                                                                            	Tonne     Mass = MegaGram
                                                                                                            
                                                                                                            	// Conversion between Gram and imperial units.
                                                                                                            	// Ounce is both a unit of mass, weight (force) or volume depending on
                                                                                                            	// context. The suffix Mass is added to disambiguate the measurement it
                                                                                                            	// represents.
                                                                                                            	OunceMass Mass = 28349523125 * NanoGram
                                                                                                            	// Pound is both a unit of mass and weight (force). The suffix Mass is added
                                                                                                            	// to disambiguate the measurement it represents.
                                                                                                            	PoundMass Mass = 16 * OunceMass
                                                                                                            
                                                                                                            	Slug Mass = 14593903 * MilliGram
                                                                                                            )

                                                                                                              Well known Mass constants.

                                                                                                              func (*Mass) Set

                                                                                                              func (m *Mass) Set(s string) error

                                                                                                                Set sets the Mass to the value represented by s. Units are to be provided in "g", "lb" or "oz" with an optional SI prefix: "p", "n", "u", "µ", "m", "k", "M", "G" or "T".

                                                                                                                Example
                                                                                                                Output:
                                                                                                                
                                                                                                                10mg
                                                                                                                16.500kg
                                                                                                                62.369g
                                                                                                                7.257kg
                                                                                                                

                                                                                                                func (Mass) String

                                                                                                                func (m Mass) String() string

                                                                                                                  String returns the mass formatted as a string in gram.

                                                                                                                  type Power

                                                                                                                  type Power int64

                                                                                                                    Power is a measurement of power stored as a nano watts.

                                                                                                                    The highest representable value is 9.2GW.

                                                                                                                    Example
                                                                                                                    Output:
                                                                                                                    
                                                                                                                    1W
                                                                                                                    16mW
                                                                                                                    1.210GW
                                                                                                                    
                                                                                                                    Example (Flag)
                                                                                                                    Output:
                                                                                                                    
                                                                                                                    
                                                                                                                    Example (Float64)
                                                                                                                    Output:
                                                                                                                    
                                                                                                                    2.500mW
                                                                                                                    0.0025
                                                                                                                    
                                                                                                                    const (
                                                                                                                    	// Watt is unit of power J/s, kg⋅m²⋅s⁻³
                                                                                                                    	NanoWatt  Power = 1
                                                                                                                    	MicroWatt Power = 1000 * NanoWatt
                                                                                                                    	MilliWatt Power = 1000 * MicroWatt
                                                                                                                    	Watt      Power = 1000 * MilliWatt
                                                                                                                    	KiloWatt  Power = 1000 * Watt
                                                                                                                    	MegaWatt  Power = 1000 * KiloWatt
                                                                                                                    	GigaWatt  Power = 1000 * MegaWatt
                                                                                                                    )

                                                                                                                      Well known Power constants.

                                                                                                                      func (*Power) Set

                                                                                                                      func (p *Power) Set(s string) error

                                                                                                                        Set sets the Power to the value represented by s. Units are to be provided in "W" with an optional SI prefix: "p", "n", "u", "µ", "m", "k", "M", "G" or "T".

                                                                                                                        Example
                                                                                                                        Output:
                                                                                                                        
                                                                                                                        25mW
                                                                                                                        1W
                                                                                                                        1.210GW
                                                                                                                        

                                                                                                                        func (Power) String

                                                                                                                        func (p Power) String() string

                                                                                                                          String returns the power formatted as a string in watts.

                                                                                                                          type Pressure

                                                                                                                          type Pressure int64

                                                                                                                            Pressure is a measurement of force applied to a surface per unit area (stress) stored as an int64 nano Pascal.

                                                                                                                            The highest representable value is 9.2GPa.

                                                                                                                            Example
                                                                                                                            Output:
                                                                                                                            
                                                                                                                            101.010kPa
                                                                                                                            101kPa
                                                                                                                            
                                                                                                                            Example (Flag)
                                                                                                                            Output:
                                                                                                                            
                                                                                                                            
                                                                                                                            Example (Float64)
                                                                                                                            Output:
                                                                                                                            
                                                                                                                            227.527Pa
                                                                                                                            227.526990
                                                                                                                            
                                                                                                                            const (
                                                                                                                            	// Pascal is N/m², kg/m/s².
                                                                                                                            	NanoPascal  Pressure = 1
                                                                                                                            	MicroPascal Pressure = 1000 * NanoPascal
                                                                                                                            	MilliPascal Pressure = 1000 * MicroPascal
                                                                                                                            	Pascal      Pressure = 1000 * MilliPascal
                                                                                                                            	KiloPascal  Pressure = 1000 * Pascal
                                                                                                                            	MegaPascal  Pressure = 1000 * KiloPascal
                                                                                                                            	GigaPascal  Pressure = 1000 * MegaPascal
                                                                                                                            )

                                                                                                                              Well known Pressure constants.

                                                                                                                              func (*Pressure) Set

                                                                                                                              func (p *Pressure) Set(s string) error

                                                                                                                                Set sets the Pressure to the value represented by s. Units are to be provided in "Pa" with an optional SI prefix: "p", "n", "u", "µ", "m", "k", "M", "G" or "T".

                                                                                                                                Example
                                                                                                                                Output:
                                                                                                                                
                                                                                                                                300kPa
                                                                                                                                16MPa
                                                                                                                                

                                                                                                                                func (Pressure) String

                                                                                                                                func (p Pressure) String() string

                                                                                                                                  String returns the pressure formatted as a string in Pascal.

                                                                                                                                  type RelativeHumidity

                                                                                                                                  type RelativeHumidity int32

                                                                                                                                    RelativeHumidity is a humidity level measurement stored as an int32 fixed point integer at a precision of 0.00001%rH.

                                                                                                                                    Valid values are between 0% and 100%.

                                                                                                                                    Example
                                                                                                                                    Output:
                                                                                                                                    
                                                                                                                                    50.6%rH
                                                                                                                                    20%rH
                                                                                                                                    
                                                                                                                                    Example (Flag)
                                                                                                                                    Output:
                                                                                                                                    
                                                                                                                                    
                                                                                                                                    Example (Float64)
                                                                                                                                    Output:
                                                                                                                                    
                                                                                                                                    80%rH
                                                                                                                                    80
                                                                                                                                    
                                                                                                                                    const (
                                                                                                                                    	TenthMicroRH RelativeHumidity = 1                 // 0.00001%rH
                                                                                                                                    	MicroRH      RelativeHumidity = 10 * TenthMicroRH // 0.0001%rH
                                                                                                                                    	MilliRH      RelativeHumidity = 1000 * MicroRH    // 0.1%rH
                                                                                                                                    	PercentRH    RelativeHumidity = 10 * MilliRH      // 1%rH
                                                                                                                                    
                                                                                                                                    )

                                                                                                                                      Well known RelativeHumidity constants.

                                                                                                                                      func (*RelativeHumidity) Set

                                                                                                                                      func (r *RelativeHumidity) Set(s string) error

                                                                                                                                        Set sets the RelativeHumidity to the value represented by s. Units are to be provided in "%rH" or "%" with an optional SI prefix: "p", "n", "u", "µ", "m", "k", "M", "G" or "T".

                                                                                                                                        Example
                                                                                                                                        Output:
                                                                                                                                        
                                                                                                                                        50.6%rH
                                                                                                                                        20%rH
                                                                                                                                        

                                                                                                                                        func (RelativeHumidity) String

                                                                                                                                        func (r RelativeHumidity) String() string

                                                                                                                                          String returns the humidity formatted as a string.

                                                                                                                                          type SenseEnv

                                                                                                                                          type SenseEnv interface {
                                                                                                                                          	conn.Resource
                                                                                                                                          
                                                                                                                                          	// Sense returns the value read from the sensor. Unsupported metrics are not
                                                                                                                                          	// modified.
                                                                                                                                          	Sense(env *Env) error
                                                                                                                                          	// SenseContinuous initiates a continuous sensing at the specified interval.
                                                                                                                                          	//
                                                                                                                                          	// It is important to call Halt() once done with the sensing, which will turn
                                                                                                                                          	// the device off and will close the channel.
                                                                                                                                          	SenseContinuous(interval time.Duration) (<-chan Env, error)
                                                                                                                                          	// Precision returns this sensor's precision.
                                                                                                                                          	//
                                                                                                                                          	// The env values are set to the number of bits that are significant for each
                                                                                                                                          	// items that this sensor can measure.
                                                                                                                                          	//
                                                                                                                                          	// Precision is not accuracy. The sensor may have absolute and relative
                                                                                                                                          	// errors in its measurement, that are likely well above the reported
                                                                                                                                          	// precision. Accuracy may be improved on some sensor by using oversampling,
                                                                                                                                          	// or doing oversampling in software. Refer to its datasheet if available.
                                                                                                                                          	Precision(env *Env)
                                                                                                                                          }

                                                                                                                                            SenseEnv represents an environmental sensor.

                                                                                                                                            type Speed

                                                                                                                                            type Speed int64

                                                                                                                                              Speed is a measurement of magnitude of velocity stored as an int64 nano Metre per Second.

                                                                                                                                              The highest representable value is 9.2Gm/s.

                                                                                                                                              Example
                                                                                                                                              Output:
                                                                                                                                              
                                                                                                                                              10mm/s
                                                                                                                                              299.792Mm/s
                                                                                                                                              277.778mm/s
                                                                                                                                              447.040mm/s
                                                                                                                                              304.800mm/s
                                                                                                                                              
                                                                                                                                              Example (Flag)
                                                                                                                                              Output:
                                                                                                                                              
                                                                                                                                              
                                                                                                                                              Example (Float64)
                                                                                                                                              Output:
                                                                                                                                              
                                                                                                                                              299.792Mm/s
                                                                                                                                              299792458m/s
                                                                                                                                              1079252847.9km/h
                                                                                                                                              670616629.4mph
                                                                                                                                              
                                                                                                                                              const (
                                                                                                                                              	// MetrePerSecond is m/s.
                                                                                                                                              	NanoMetrePerSecond  Speed = 1
                                                                                                                                              	MicroMetrePerSecond Speed = 1000 * NanoMetrePerSecond
                                                                                                                                              	MilliMetrePerSecond Speed = 1000 * MicroMetrePerSecond
                                                                                                                                              	MetrePerSecond      Speed = 1000 * MilliMetrePerSecond
                                                                                                                                              	KiloMetrePerSecond  Speed = 1000 * MetrePerSecond
                                                                                                                                              	MegaMetrePerSecond  Speed = 1000 * KiloMetrePerSecond
                                                                                                                                              	GigaMetrePerSecond  Speed = 1000 * MegaMetrePerSecond
                                                                                                                                              
                                                                                                                                              	LightSpeed Speed = 299792458 * MetrePerSecond
                                                                                                                                              
                                                                                                                                              	KilometrePerHour Speed = 277777778 * NanoMetrePerSecond
                                                                                                                                              	MilePerHour      Speed = 447040 * MicroMetrePerSecond
                                                                                                                                              	FootPerSecond    Speed = 304800 * MicroMetrePerSecond
                                                                                                                                              )

                                                                                                                                                Well known Speed constants.

                                                                                                                                                func (*Speed) Set

                                                                                                                                                func (sp *Speed) Set(s string) error

                                                                                                                                                  Set sets the Speed to the value represented by s. Units are to be provided in "mps"(meters per second), "m/s", "kph", "fps", or "mph" with an optional SI prefix: "p", "n", "u", "µ", "m", "k", "M", "G" or "T".

                                                                                                                                                  Example
                                                                                                                                                  Output:
                                                                                                                                                  
                                                                                                                                                  10m/s
                                                                                                                                                  27.778m/s
                                                                                                                                                  630.022m/s
                                                                                                                                                  24.587m/s
                                                                                                                                                  

                                                                                                                                                  func (Speed) String

                                                                                                                                                  func (sp Speed) String() string

                                                                                                                                                    String returns the speed formatted as a string in m/s.

                                                                                                                                                    type Temperature

                                                                                                                                                    type Temperature int64

                                                                                                                                                      Temperature is a measurement of hotness stored as a nano kelvin.

                                                                                                                                                      Negative values are invalid.

                                                                                                                                                      The highest representable value is 9.2GK.

                                                                                                                                                      Example
                                                                                                                                                      Output:
                                                                                                                                                      
                                                                                                                                                      -273.150°C
                                                                                                                                                      23.010°C
                                                                                                                                                      26.667°C
                                                                                                                                                      
                                                                                                                                                      Example (Flag)
                                                                                                                                                      Output:
                                                                                                                                                      
                                                                                                                                                      
                                                                                                                                                      Example (Float64)
                                                                                                                                                      Output:
                                                                                                                                                      
                                                                                                                                                      37°C
                                                                                                                                                      310.1K
                                                                                                                                                      
                                                                                                                                                      const (
                                                                                                                                                      	NanoKelvin  Temperature = 1
                                                                                                                                                      	MicroKelvin Temperature = 1000 * NanoKelvin
                                                                                                                                                      	MilliKelvin Temperature = 1000 * MicroKelvin
                                                                                                                                                      	Kelvin      Temperature = 1000 * MilliKelvin
                                                                                                                                                      	KiloKelvin  Temperature = 1000 * Kelvin
                                                                                                                                                      	MegaKelvin  Temperature = 1000 * KiloKelvin
                                                                                                                                                      	GigaKelvin  Temperature = 1000 * MegaKelvin
                                                                                                                                                      
                                                                                                                                                      	// Conversion between Kelvin and Celsius.
                                                                                                                                                      	ZeroCelsius  Temperature = 273150 * MilliKelvin
                                                                                                                                                      	MilliCelsius Temperature = MilliKelvin
                                                                                                                                                      	Celsius      Temperature = Kelvin
                                                                                                                                                      
                                                                                                                                                      	// Conversion between Kelvin and Fahrenheit.
                                                                                                                                                      	ZeroFahrenheit  Temperature = 255372222222 * NanoKelvin
                                                                                                                                                      	MilliFahrenheit Temperature = 555555 * NanoKelvin
                                                                                                                                                      	Fahrenheit      Temperature = 555555555 * NanoKelvin
                                                                                                                                                      )

                                                                                                                                                        Well known Temperature constants.

                                                                                                                                                        func (Temperature) Celsius

                                                                                                                                                        func (t Temperature) Celsius() float64

                                                                                                                                                          Celsius returns the temperature as a floating number of °Celsius.

                                                                                                                                                          Example
                                                                                                                                                          Output:
                                                                                                                                                          
                                                                                                                                                          37°C
                                                                                                                                                          37.0°C
                                                                                                                                                          

                                                                                                                                                          func (Temperature) Fahrenheit

                                                                                                                                                          func (t Temperature) Fahrenheit() float64

                                                                                                                                                            Fahrenheit returns the temperature as a floating number of °Fahrenheit.

                                                                                                                                                            Example
                                                                                                                                                            Output:
                                                                                                                                                            
                                                                                                                                                            37°C
                                                                                                                                                            98.6°F
                                                                                                                                                            

                                                                                                                                                            func (*Temperature) Set

                                                                                                                                                            func (t *Temperature) Set(s string) error

                                                                                                                                                              Set sets the Temperature to the value represented by s. Units are to be provided in "C", "°C", "F", "°F" or "K" with an optional SI prefix: "p", "n", "u", "µ", "m", "k", "M", "G" or "T".

                                                                                                                                                              Example
                                                                                                                                                              Output:
                                                                                                                                                              
                                                                                                                                                              0°C
                                                                                                                                                              1°C
                                                                                                                                                              5M°C
                                                                                                                                                              -17.778°C
                                                                                                                                                              0°C
                                                                                                                                                              

                                                                                                                                                              func (Temperature) String

                                                                                                                                                              func (t Temperature) String() string

                                                                                                                                                                String returns the temperature formatted as a string in °Celsius.