Testdata: add basic tank simulation (#47990)

This commit is contained in:
Ryan McKinley
2022-04-20 12:01:09 -07:00
committed by GitHub
parent ce89d7e874
commit 72b5af8d9b
3 changed files with 158 additions and 1 deletions
+5 -1
View File
@@ -66,6 +66,7 @@ func NewSimulationEngine() (*SimulationEngine, error) {
initializers := []simulationInitializer{
newFlightSimInfo,
newSinewaveInfo,
newTankSimInfo,
}
for _, init := range initializers {
@@ -155,7 +156,10 @@ func (s *SimulationEngine) QueryData(ctx context.Context, req *backend.QueryData
maxPoints := q.MaxDataPoints * 2
for i := int64(0); i < maxPoints && timeWalkerMs < to; i++ {
t := time.UnixMilli(timeWalkerMs).UTC()
appendFrameRow(frame, sim.GetValues(t))
vals := sim.GetValues(t)
if vals != nil { // nil is returned when you ask for an invalid time
appendFrameRow(frame, vals)
}
timeWalkerMs += stepMillis
}
}