Documentation ¶
Index ¶
- Constants
- Variables
- func Clamp(value, minimum, maximum int) int
- func DecodeStructFieldToMeasurement(m *telegraf.Measurement, va reflect.Value, i int)
- func DecodeStructToLineProtocol(metricName string, tags TelegrafTags, thing interface{}) string
- func Max(value, limit int) int
- func Min(value, limit int) int
- func RunConditions(errLog *log.Logger, runStuff func(point *TimePoint) bool, ...)
- func WriteMetricTCP(metricName string, tags TelegrafTags, thing interface{}) error
- func WriteMetricUDP(metricName string, tags TelegrafTags, thing interface{}) error
- type EnvironmentalStats
- type TelegrafTags
- type TimePoint
Constants ¶
const NullTargetFloat64 float64 = -math.MaxFloat32
NullTargetFloat64 exported see above
const NullTargetInt int = math.MinInt32
NullTargetInt exported see above
const NullTargetInt32 int32 = math.MinInt32
NullTargetInt32 exported see above
const NullTargetInt64 int64 = math.MinInt64
NullTargetInt64 exported see above
Variables ¶
var ( // ZoneName exported so that packages that use this package can refer to the current timezone ZoneName string )
Functions ¶
func DecodeStructFieldToMeasurement ¶
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 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 ¶
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 ¶
NulledString replaces instances of nulltargets with the string "NULL"