11package iot
22
33import (
4+ "time"
5+
46 "github.com/cnosdb/tsdb-comparisons/pkg/data"
57 "github.com/cnosdb/tsdb-comparisons/pkg/data/usecases/common"
6- "time"
78)
89
910const (
@@ -17,11 +18,16 @@ var (
1718 labelFuelState = []byte ("fuel_state" )
1819 labelCurrentLoad = []byte ("current_load" )
1920 labelStatus = []byte ("status" )
20- fuelUD = common .UD (- 0.001 , 0 )
21- loadUD = common .UD (0 , maxLoad )
22- loadSaddleUD = common .UD (0 , 1 )
23- statusND = common .ND (0 , 1 )
24-
21+
22+ labelLoadCapacity = []byte ("load_capacity" )
23+ labelFuelCapacity = []byte ("fuel_capacity" )
24+ labelNominalFuelConsumption = []byte ("nominal_fuel_consumption" )
25+
26+ fuelUD = common .UD (- 0.001 , 0 )
27+ loadUD = common .UD (0 , maxLoad )
28+ loadSaddleUD = common .UD (0 , 1 )
29+ statusND = common .ND (0 , 1 )
30+
2531 diagnosticsFields = []common.LabeledDistributionMaker {
2632 {
2733 Label : labelFuelState ,
5056 )
5157 },
5258 },
59+ {
60+ Label : labelLoadCapacity ,
61+ DistributionMaker : func () common.Distribution {
62+ return common .FP (
63+ common .CWD (statusND , 1500 , 5000 , 0 ),
64+ 0 ,
65+ )
66+ },
67+ },
68+ {
69+ Label : labelFuelCapacity ,
70+ DistributionMaker : func () common.Distribution {
71+ return common .FP (
72+ common .CWD (statusND , 150 , 300 , 0 ),
73+ 0 ,
74+ )
75+ },
76+ },
77+ {
78+ Label : labelNominalFuelConsumption ,
79+ DistributionMaker : func () common.Distribution {
80+ return common .FP (
81+ common .CWD (statusND , 12 , 29 , 0 ),
82+ 0 ,
83+ )
84+ },
85+ },
5386 }
5487)
5588
@@ -76,16 +109,19 @@ func (m *DiagnosticsMeasurement) ToPoint(p *data.Point) {
76109 p .SetMeasurementName (labelDiagnostics )
77110 copy := m .Timestamp
78111 p .SetTimestamp (& copy )
79-
112+
80113 p .AppendField (diagnosticsFields [0 ].Label , float64 (m .Distributions [0 ].Get ()))
81114 p .AppendField (diagnosticsFields [1 ].Label , float64 (m .Distributions [1 ].Get ()))
82115 p .AppendField (diagnosticsFields [2 ].Label , int64 (m .Distributions [2 ].Get ()))
116+ p .AppendField (diagnosticsFields [3 ].Label , float64 (m .Distributions [3 ].Get ()))
117+ p .AppendField (diagnosticsFields [4 ].Label , float64 (m .Distributions [4 ].Get ()))
118+ p .AppendField (diagnosticsFields [5 ].Label , float64 (m .Distributions [5 ].Get ()))
83119}
84120
85121// NewDiagnosticsMeasurement creates a DiagnosticsMeasurement with start time.
86122func NewDiagnosticsMeasurement (start time.Time ) * DiagnosticsMeasurement {
87123 sub := common .NewSubsystemMeasurementWithDistributionMakers (start , diagnosticsFields )
88-
124+
89125 return & DiagnosticsMeasurement {
90126 SubsystemMeasurement : sub ,
91127 }
0 commit comments