In this example, a customer had a point that was controlled by a schedule from 7 am to 7:15 pm. They wanted to delay turning on the point for another hour if the OAT was below 21 and shut if off 30 mins early. So basically turn the point on at 8 am and shut off at 6:45 pm. This can be accomplished with the below steps. Note: By default if not changed, schedules write at level 15. Programs write to level 14. If priority levels have changed, make sure that the program writes at higher priority than the schedule for this to work.
First add a scheduleRef on the equip the program will be running on.
Create a program and include the point to command (Occ Mode in our case), OAT, and schedule curVal and nextTime.
Then create the logic like in the below screenshot.
Then go to folio and query for "program" to see all the programs. Then select the one just created and tag it as 'useUnits' marker tag so that the dateTimeSub takes the units into consideration. Otherwise it'll just be minutes.
Logic Flow:
Set nowTime variable as now. This is a dateTime variable I created and just linked the now block to it. Should return current time.
Set earlyTime variable as now - time. This is a time variable to get the time from now (displays current time).
Set newTime variable as scheduleNextTime - 11.25 hr. This is a dateTime variable just for visual representation. Should return 8 am depending on scheduleNextTime. (.25 is % of 60 = 15 mins)
If earlyTime is greater than or equal to setTimeOne (6:59:00 am) AND earlyTime is less or equal to setTimeTwo (7:00:00 am) AND scheduleCurVal is false, set tempVar to be roomTemp value. (tempVar is just a number variable created, this part is to get the current value of OAT at 6:59 am before schedule kicks in at 7 am)
Continue from 4, else if nowTime is less than or equal to scheduleNextTime - 11.25 hr AND scheduleCurVal is true AND tempVar is less than or equal to 21, set occMode to false. (this part is control the occMode to off until 8 am, an hour after schedule kicked in. Then release it and let the schedule control it after.)
Continue from 5, else if nowTime is greater than or equal to scheduleNextTime - 30 mins AND scheduleCurVal is true AND tempVar is less than or equal to 21, set occMode to false, else null. (this part is to control the occMode and shut it off 30 mins earlier at 6:45 pm than the schedule at 7:15 pm. then release it and let the schedule control it after that time.)