Issue
There is a need to compare two temperature readings taken at different times—for example, at 10:00 AM and 4:00 PM. The goal is to determine whether the temperature has increased or decreased over that period. If the 4:00 PM temperature is higher, the output should be TRUE; if lower, FALSE.
Product Line
Satchwell BAS & SigmaEnvironment
Satchwell Sigma
Cause
Users require guidance on how to implement a programmable object that performs this time-based temperature comparison.
Resolution
The following Sigma programmable object logic fulfills the requirement:
10 IF TIME = 10:00 THEN XINT = 1
20 IF TIME = 16:00 THEN XINT = 2
30 IF XINT UP THEN GOTO 50
40 GOTO 100
50 IF XINT = 1 THEN XFLO = POINT 1
60 IF XINT = 2 THEN YFLO = POINT 2
70 IF XINT <> 2 THEN GOTO 90
80 IF XFO > FLO THEN YINT = 1 ELSE YINT = 0
90 XINT = 0
100 IF YINT = 1 THEN RETURN TRUE "Higher" ELSE RETURN FALSE "Lower"
- Lines 10–20: Set a flag (
XINT) based on the current time. - Line 30: Checks if the time flag has incremented.
- Lines 50–60: Store the temperature readings at the respective times.
- Line 70: Ensures comparison only occurs after both readings are captured.
- Line 80: Compares the two temperatures and sets the result flag (
YINT). - Line 100: Returns the final result:
TRUEif the temperature increased,FALSEif it decreased.