Skip to content

Commit

Permalink
#43 Fetch data for ALL trend signals. Added & modified json keys for …
Browse files Browse the repository at this point in the history
…TrendSignal.
  • Loading branch information
eidekrist committed Dec 21, 2018
1 parent 56fd099 commit ad9139a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
10 changes: 6 additions & 4 deletions cse/cse.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,12 @@ func findVariableIndex(fmu structs.FMU, signalName string, causality string, val
func TrendLoop(sim *Simulation, status *structs.SimulationStatus) {
for {
if len(status.TrendSignals) > 0 {
var trend = &status.TrendSignals[0]
switch trend.Type {
case "Real":
observerGetRealSamples(sim.Observer, sim.MetaData, trend, status.TrendSpec)
for i, _ := range status.TrendSignals {
var trend = &status.TrendSignals[i]
switch trend.Type {
case "Real":
observerGetRealSamples(sim.Observer, sim.MetaData, trend, status.TrendSpec)
}
}
}
time.Sleep(500 * time.Millisecond)
Expand Down
14 changes: 7 additions & 7 deletions structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ type JsonResponse struct {
Modules []string `json:"modules"`
Module Module `json:"module,omitempty"`
Memory *mem.VirtualMemoryStat
TrendSignals []TrendSignal `json:"trendSignals,omitempty"`
TrendSignals []TrendSignal `json:"trend-values"`
}

type TrendSignal struct {
Module string
Signal string
Causality string
Type string
TrendValues []float64
TrendTimestamps []float64
Module string `json:"module"`
Signal string `json:"signal"`
Causality string `json:"causality"`
Type string `json:"type"`
TrendValues []float64 `json:"values,omitempty"`
TrendTimestamps []float64 `json:"labels,omitempty"`
}

type TrendSpec struct {
Expand Down

0 comments on commit ad9139a

Please sign in to comment.