chambertools

package module
v0.0.0-...-5c7e2c9 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: MPL-2.0 Imports: 11 Imported by: 0

README

chamber-tools

  • master:go-lint

  • master:go-staticcheck

  • master:go-vet

  • master:go-test

  • master:go-build

tools for go controller-* applications

see http://gitlab.org/appf-anu/controller-heliospectra2

Documentation

Index

Constants

View Source
const NullTargetFloat64 float64 = -math.MaxFloat32

NullTargetFloat64 exported see above

View Source
const NullTargetInt int = math.MinInt32

NullTargetInt exported see above

View Source
const NullTargetInt32 int32 = math.MinInt32

NullTargetInt32 exported see above

View Source
const NullTargetInt64 int64 = math.MinInt64

NullTargetInt64 exported see above

Variables

View Source
var (

	// ZoneName exported so that packages that use this package can refer to the current timezone
	ZoneName string
)

Functions

func Clamp

func Clamp(value, minimum, maximum int) int

Clamp clamps a value to between a minimum and maximum value

func DecodeStructFieldToMeasurement

func DecodeStructFieldToMeasurement(m *telegraf.Measurement, va reflect.Value, i int)

DecodeStructFieldToMeasurement turns a field of a struct into a measurement field and adds it to the measurment. doesnt support nested structs or maps, yet

func DecodeStructToLineProtocol

func DecodeStructToLineProtocol(metricName string, tags TelegrafTags, thing interface{}) string

DecodeStructToLineProtocol encodes a simple struct to an influxdb line protocol representation

func Max

func Max(value, limit int) int

Max returns a value clamped to an upper limit

func Min

func Min(value, limit int) int

Min returns a value clamped to a lower limit limit

func RunConditions

func RunConditions(errLog *log.Logger, runStuff func(point *TimePoint) bool, conditionsPath string, loopFirstDay bool)

RunConditions runs conditions for a file

func WriteMetricTCP

func WriteMetricTCP(metricName string, tags TelegrafTags, thing interface{}) error

WriteMetricTCP writes a metric a tcp telegraf host based on environment variables.

func WriteMetricUDP

func WriteMetricUDP(metricName string, tags TelegrafTags, thing interface{}) error

WriteMetricUDP writes a metric a udp telegraf host based on environment variables.

Types

type EnvironmentalStats

type EnvironmentalStats struct {
	VapourPressureDeficit   float64
	SaturatedVapourPressure float64
	ActualVapourPressure    float64
	//MixingRatio float64
	//SaturatedMixingRatio float64
	AbsoluteHumidity float64 //(in kg/m³)
}

EnvironmentalStats is a struct that contains the environmental values we calculate from temperature and relative humidity

func GetEnvironmentalStats

func GetEnvironmentalStats(temperatureCelsius, relativeHumidity float64) (values *EnvironmentalStats)

GetEnvironmentalStats calculates the environmental values from temperature in celsius and relative humidity as a percentage

type TelegrafTags

type TelegrafTags struct {
	Host   string
	Group  string
	DataID string
}

TelegrafTags convenient struct to store tags in

type TimePoint

type TimePoint struct {
	Datetime         time.Time `header:"datetime"`
	SimDatetime      time.Time `header:"datetime-sim"`
	Temperature      float64   `header:"temperature"`
	RelativeHumidity float64   `header:"humidity"`
	Light1           int       `header:"light1"`
	Light2           int       `header:"light2"`
	CO2              float64   `header:"co2"`
	TotalSolar       float64   `header:"totalsolar"`
	CoolWhite        float64   `header:"coolwhite"`
	Blue             float64   `header:"blue"`
	Green            float64   `header:"green"`
	Red              float64   `header:"red"`
	DeepRed          float64   `header:"deepred"`
	FarRed           float64   `header:"farred"`
	InfraRed         float64   `header:"infrared"`
	RoyalBlue        float64   `header:"royalblue"`
	Cyan             float64   `header:"cyan"`
	Wavelength370nm  float64   `header:"370nm"`
	Wavelength380nm  float64   `header:"380nm"`
	Wavelength400nm  float64   `header:"400nm"`
	Wavelength420nm  float64   `header:"420nm"`
	Wavelength450nm  float64   `header:"450nm"`
	Wavelength530nm  float64   `header:"530nm"`
	Wavelength620nm  float64   `header:"620nm"`
	Wavelength630nm  float64   `header:"630nm"`
	Wavelength660nm  float64   `header:"660nm"`
	Wavelength735nm  float64   `header:"735nm"`
	Wavelength850nm  float64   `header:"850nm"`
	Wavelength5700k  float64   `header:"5700k"`
	Wavelength6500k  float64   `header:"6500k"`
}

TimePoint type representation of a TimePoint in a control file (a row in xlsx sheet)

func NewTimePointPtr

func NewTimePointPtr() *TimePoint

NewTimePointPtr creates a new TimePoint and returns the pointer to it

func (TimePoint) NulledString

func (tp TimePoint) NulledString() string

NulledString replaces instances of nulltargets with the string "NULL"

Jump to

Keyboard shortcuts

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