Logic Builder Examples
- 1 Basic Alarm - (Temp Overheat)
- 2 15 minutes delay
- 3 Alternate value weekly
- 4 Setting Point Value Before Schedule Time
- 5 Creating a Count Down
- 6 Compressor Staging
- 7 How to call a axon function via logicBuilder using invoke block
- 8 Executing an Axon query based on some value
- 9 Trigger alarm based on value change
- 9.1 Value mismatch
- 10 Find out if date is within date range period
- 11 Master Schedule
- 12 Delay and Advance Schedule Control
- 13 Days Passed
- 14 Unit Staging Type 1
- 15 Unit Staging Type 2
- 16 Capturing Schedule Time
- 17 Heating and Cooling Degree Days with weatherRefs
Basic Alarm - (Temp Overheat)
Navigate down to the equip you want to create an alarm for
Open Logic Builder tab and hit "new"
Bring in your variables (in this case room temp)
15 minutes delay
scheduleNextTime is the dateTime of the next event
scheduleNextVal is the value of what the schedule will do for the next event.
boolTest was only made so you can have a bool value that will be true during the period you want. In this case it will only be true when the current site time is greater than the next time minus 15 minutes.
This will allow you to figure out how to do something 15 minutes before the schedule. Notice, I added an andGate too, cause you also want to make sure the next event is turning on, and not turning off.
Alternate value weekly
Create program on equip and select to add point being commanded
Then drag out the following blocks: siteDateTime, dateToNumber, isOdd or isEven (depending what you prefer)
Then set up the logic like below.
Basically, in our example, we are saying if the current week of the year is odd, set the SF point to true. If not, it will be false.
Setting Point Value Before Schedule Time
Here is an example of how you can set the value of a fan to ON just 20 minutes before the schedule starts. You can download an example below made with variables and actual scheduleRefs.
The variables that need to be created aside from your points to create this are:
now (dateTime) - you need to create a dateTime variable that will be used to get the current time.
newTime (dateTime) - this variable is needed so that we can subtract the start of the schedule time with however minutes we want the difference to be
The rest are found by creating a scheduleRef to the equip you wish to use this on and adding it either through "Tags" option when creating program or through Add Variable in right menu with program open.
Download the below program file.
Creating a Count Down
Here is an example of a count down created in Logic Builder. You can download an example below.
The variables needed are below and they can be either a virtual point or property tag from one of your available objects you are running this on. We just created variables in the program not live points.
haystack (dateTime) - this variable is the date of the event we are counting down to.
now (dateTime) - this is to get the current date and time
haystackDay (numeric) - this is so that we convert the haystack variable to a number and based on days
nowDay (numeric) - this is to covert now variable to a number and to make it based on days
countDown (numeric) - this is where we subtract haystackDay from nowDay to get the remaining days to the event
Make sure you set the "DateToNumber" block and select the TimeSpan to "day" like below.
Download the below program file.
Compressor Staging
Here is an example where we want a particular compressor point to be switched on/off based on the value of a numeric point. You can download an example below.
The points the will need to be created unless the user already has points they wish to use are the four boolean points.
Download the below program file.
How to call a axon function via logicBuilder using invoke block
There are two ways and you'll need a newer version that contains either invokeBlock or codeMacroBlock. (Maybe v1832, for sure v2012).
First way is using an invokeBlock. As you can see we created a simple function that adds two parameters. In logicBuilder, we added the name on the function and two parameters and returned the same result as if we were to run it in folio/axon.
The second way is using a codeMacroBlock.
It can also be done without creating a variable like below. "foo" variable is define in the codeMacroBlock only and you can see that once the program is saved, it appears in the variables in them right menu. Only thing here is you need some other real variable there.
Executing an Axon query based on some value
Here is an example on how to execute a query based on a boolean value. A customer wanted to be able to disable the alarms extension if a point was true, else if false, enable it.
"alarmSetting" is a boolean property tag I used, but it can be a tag or a point. Then use the "jobRun" block to run the query that enables and disables the alarmsExt. If true (meaning disable), then it'll run "finSettingsAction(`alarm`.toStr,true,true)" else runs "finSettingsAction(`alarm`.toStr,false,true)", which enables it.
Trigger alarm based on value change
So the below logic does two things. Both can be used or use one of the two options.
1. If the curVal don't match, then it'll trigger an alarm.
2. OR If the writeLevel changes, which happens when commanding the point, then it'll trigger an alarm.
Value mismatch
The logic below is for when the fan status and fan command don't match after 10 seconds.
Logic Flow: If fanStatus and fanCommand don't match after 10 seconds, set alarmVar variable to true, else false.
Find out if date is within date range period
Below is an example setup to check if a certain date is within some date range period.
Below is an example similar to the above, with a dynamic endDate. Created a simple function that adds 30 days to the startDate. Then used an invoke block to write to the endDate.
Master Schedule
If the user would like to use a master schedule to control the points based on holidays so that they don't have to change them on all schedules, they can do so with example below.
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.
Create a new schedule that will be the master and has no default value. Configure schedule with holidays how you want. Note: No points are linked to this schedule, leave them in their respective schedules.
Go to folio and query for "schedule" and select the master schedule to tag it as "masterSchedule"
Add "masterScheduleRef" tag that references this new master schedule to all your equips you want to apply this to
Create a new program that uses the curVal of the masterSchedule to write to the schedule point. Below is an example logic.
Logic Flow: If masterScheduleCurVal is false, set occMode (schedule point) to false else set to null.
Reason we say if its false is because normally thats when the building is unoccupied and holiday values are set to false. This can be changed for different scenarios or create different program for different logic.
Thats it, now if there is a holiday event, it would control the point and set it to off else it'll let the schedule control it.