Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Describe predicted datapoint window switching (#2298)

Koen806503efcaa0
diff --git a/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java
index 51b12bb8b..5d63244df 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java
@@ -213,6 +213,9 @@ public class SimulatorProtocol extends AbstractProtocol<SimulatorAgent, Simulato
} catch (Exception e) {
LOG.log(Level.SEVERE, "Exception thrown when updating value: %s", e);
}
+ // Determine what predicted datapoint windows to be calculated next
+ // Initially calculate BOTH the current- and next occurrence window,
+ // afterward only calculate the NEXT window after switching to the next window.
if (status.equals(PredictedDatapointWindow.BOTH) || status.equals(PredictedDatapointWindow.NEXT)) {
predictedDatapointWindowMap.put(attributeRef, PredictedDatapointWindow.NONE);
} else if (simulatorReplayDatapoints[simulatorReplayDatapoints.length - 1] == nextDatapoint) {