units

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package units contains float64 wrappers with unit semantics relevant to the CX34 heat pump (flow rate, temperature, etc).

Index

Constants

View Source
const (
	CubicMeter = underlying.CubicMeter
	Liter      = underlying.Liter
)

Volume values.

View Source
const Ampere = underlying.Ampere
View Source
const (
	Kilogram = underlying.Kilogram
)

Mass values.

View Source
const Volt = underlying.Volt

Variables

This section is empty.

Functions

This section is empty.

Types

type CoefficientOfPerformance

type CoefficientOfPerformance float64

CoefficientOfPerformance is the ratio of useful heat supplied or removed from the water stream divided by the amount of electrical energy energy being used by the heat pump.

func (CoefficientOfPerformance) Float64

func (s CoefficientOfPerformance) Float64() float64

Float64 returns the COP as a floating point number.

type Current

type Current = underlying.ElectricCurrent

Current represents electric current.

type Density

type Density float64

Density is a the density of a material (mass/volume).

The materialized value is kg/m^3.

func DensityFromRatio

func DensityFromRatio(m Mass, v Volume) Density

DensityFromRatio returns a density value that is the ratio of a given mass and volume.

func (Density) TimesVolume

func (p Density) TimesVolume(v Volume) Mass

TimesVolume returns the mass taken up by a given volume of material with density p.

type Energy

type Energy = underlying.Energy

Energy is a floating point energy value.

type FlowRate

type FlowRate float64

FlowRate is measured in units of volume over duration, such as liters per minute. The materialized value is liters/minute.

const (
	LiterPerMinute FlowRate = FlowRate(Liter)
)

Flow rate values.

func (FlowRate) LitersPerMinute

func (v FlowRate) LitersPerMinute() float64

LitersPerMinute returns the flow rate in liters per minute as a float64.

func (FlowRate) LitersPerSecond

func (v FlowRate) LitersPerSecond() float64

LitersPerSecond returns the flow rate in liters per minute as a float64.

func (FlowRate) Scale

func (v FlowRate) Scale(f float64) FlowRate

Scale scales the value by a floating point multiplier.

func (FlowRate) TimesDuration

func (v FlowRate) TimesDuration(dur time.Duration) Volume

TimesDuration returns the volume of flow over the course of a given duration.

type Mass

type Mass = underlying.Mass

Mass is a floating point mass value.

type Power

type Power = underlying.Power

Power represents energy over time.

const (
	Watt     Power = underlying.Watt
	Kilowatt Power = underlying.Kilowatt
)

Power constants.

func PowerFromIV

func PowerFromIV(i Current, v Voltage) Power

PowerFromIV multiples current and voltage to get power.

type PumpSpeed

type PumpSpeed uint8

PumpSpeed is the speed of the pump. The value should be between 0 (for off) and 10 (for 100% on).

func (PumpSpeed) String

func (s PumpSpeed) String() string

String returns the pump speed as a fraction of full power.

type SpecificHeat

type SpecificHeat float64

SpecificHeat is measured in kJ/(kg * K).

const KilojoulePerKilogramKelvin SpecificHeat = 1

KilojoulePerKilogramKelvin is the standard unit used for recording specific heat in tables.

func (SpecificHeat) KilojoulesPerKilogramKelvin

func (sh SpecificHeat) KilojoulesPerKilogramKelvin() float64

KilojoulesPerKilogramKelvin returns the specific heat in kJ/(kg * Kelvin).

func (SpecificHeat) Scale

func (sh SpecificHeat) Scale(f float64) SpecificHeat

Scale scales the specific heat value by a multiplier.

func (SpecificHeat) TimesMassDeltaTemp

func (sh SpecificHeat) TimesMassDeltaTemp(m Mass, t Temperature) Energy

TimesMassDeltaTemp multiplies the specific heat value by mass and delta T to arrive at an energy value.

type Temperature

type Temperature = underlying.Temperature

Temperature contains a temperature value in kelvin.

func FromCelsius

func FromCelsius(t float64) Temperature

FromCelsius returns a temperature from a value in degrees celcius.

type Voltage

type Voltage = underlying.Voltage

Voltage represents electric Voltage.

type Volume

type Volume = underlying.Volume

Volume is a floating point volume value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL