Support Board
Date/Time: Fri, 31 Jan 2025 22:53:34 +0000
Post From: Calculation triggered by Time Value == comparison continues calculating after Time Values !=
[2019-06-01 09:15:40] |
User907968 - Posts: 825 |
Hi, You could use a persistent variable to store a flag that is set when the calculation has been run. sc.GetPersistentInt() for example - int& triggerFlag = sc.GetPersistentInt(1); if (sc.IsFullRecalculation && sc.Index == 0) triggerFlag = 0; // set flag to 0 during initialization int RangeCloseTime = HMS_TIME(7, 1, 0); Time_Value: int CurrentTime = sc.BaseDateTimeIn[sc.Index].GetTime(); Calculation: if (RangeCloseTime == CurrentTime && triggerFlag == 0) { triggerFlag = 1; // set during calculation SCString actualtime; actualtime.Format("actualtime is: %i", CurrentTime); sc.AddMessageToLog(actualtime, 0); SCString Rangetime; Rangetime.Format("RangeClosetime is: %i", RangeCloseTime); sc.AddMessageToLog(Rangetime, 0); CurrentTime = 0; } if (triggerFlag == 1 && RangeCloseTime != CurrentTime) triggerFlag = 0; // reset flag to 0 once times are no longer equal |