Copying Logic in CBAS
The basics of “If, Then, Else logic” used in CBAS is covered in the CBAS manual in Chapter 7, Advanced Programming. Here is some more interesting information about Logic that you may not know.
Copying Logic statements from one point to another in a different controller without having to manually change the points that are referenced has always been fairly easy to do. Let’s say you have similar AHUs and you wanted to use the same logic and sequence of operation. Previously, when you wanted to copy and change the point names you would use Relative Copy to Point, which is located at the bottom of the Logic Editor screen. You could select several points to copy to and it would attempt to change the names but would also give you a chance to check the points and manually change them before the logic copy is completed. The points would have to be identical except for the Prefix. Example: AHU-1 S/S and AHU-2 S/S. To just copy the logic without changing the point names, you would use Copy to Point and the point names don’t change. Then you would edit each line of the Logic and manually change the points. Here is an example of the Logic Editor.
Now in the most recent CBAS versions, the regular Copy to Point is more like Relative Copy. Here are the differences:
Regular Copy – This Logic copy NOW tries to replace points in the logic statement based on the names of the to and from points. So, if you are copying a logic statement from AHU12 Start/Stop to AHU13 Start/Stop, the logic copy would take the name of every point in the logic statement and replace 12 with 13. Then it would look in the database for a point with that same exact name. If a matching point is found, then it is used to replace the old point in the logic statement. If name matches are not found, then the original points will remain in the logic statement.
Relative Copy -This logic copy will copy logic from a point in 1 controller to the SAME point in the SAME type of another controller. It replaces the points in the logic statement based on their position in the controller. This works really well when copying a logic statement between controllers that were created from the same template, another good reason to use your own Template to create all of the AHUs in a building after the first AHU is completed. Program the first AHU and get it working like you want it to work before making the template.
Copy to Clipboard – This is a good way to make a copy of Logic and email it to someone as an example.
When you share a Peer-to-Peer point it only shares the VALUE of the point with other controllers when the connection to the CBAS Automation Server is not available. So, if you write Logic that references a Peer point and look at its Priority or Condition, then that logic will not work correctly. Priority is what the point was commanded by: OPER, LOG1, PID, SCHED. Condition is whether the point has Normal Communication, is Normal, Lost or Off-Scan.
For more information on Priorities and which priorities can override others in CBAS, go to Text View, then Priority Summary to see the list showing the lowest to highest priorities. See below. For instance, nothing can override Logic Level 4. Not even Logic 3 or Operator. Click any one of the Priority levels and you can see what points are currently being commanded by that Priority.
Generally, you will use Priority Logic 1 for your logic. This level will override all Schedules and PIDs. In the case of equipment failure, you might want to program a higher level Logic to override the normal Logic that starts a fan, pump or boiler in case one has failed. If you want to make a logic program that you don’t want any operator to override, use Priority Logic 3 or 4. Many times, these “fail safe” logic programs are programmed on separate Software Binary Output points, but there is also a way to program Mixed Priority so that each command can be at a different Priority Level. The Logic Editor will ask what Priority to use after each command. However, this can get complicated, so it might be best to separate the different Priorities by using multiple software points.
Why would you want your logic to download to the controller? Because in a case where CBAS is closed or in Editor Mode, the logic would still execute via the controller. This is also true if the controller is LOST (communication). The most common thing that can prevent the logic from downloading is referencing points hosted on other controllers. The reason is, when there is no connection to the CBAS program, the changing value of the point on the other controller is not known. So, CBAS doesn’t allow the download. But, if you share the point via Peer to Peer with the controller hosting the Logic, the value is known and the download is allowed. Peer to Peer is a feature that is set up in Editor Mode and basically allows you to pick any point and share it with another controller. This works with X and LX controllers as well as the Serial Connector, UNI-B and UNI-C controllers, but not VAV-B controllers. Peer to Peer setup can be found on the System Menu in CBAS and Chapter 5 of the CBAS Manual.
In order to know if the Logic has downloaded to the controller, go to the Point Program screen where the Logic is programmed, then click Show Point Relations. In the Type column on the left, you will see LOGIC or *LOGIC. If you see the *, then the Logic resides in the controller. You might see more than one Logic listed even though the point is only referenced in the Logic, not commanded by the Logic. You can click the Logic line and see how it is written even if it is on another controller. You can also edit the Logic right there.
At the bottom of the Logic Editor screen, you will see the 15 second “Evaluate Every” time, which is the default when you create a new Logic statement. This means that as long as the conditions in the IF part of the Logic statement are met, the command will go out every 15 seconds. If you only want the command to go out once, then add a Binary Output that is triggered On and Off by another condition and change the “Evaluate Every” to “Evaluate on Status Change” of the point where the Logic is written. The point could be using a Schedule and the Logic would command something when the point is On and Auto the same point when the point is Off, thus allowing a PID or lower Priority Logic to take over.
There are many examples of how Logic is written in the Template Database which comes with all CBAS installations. The Template Database backup file is found in the Backups folder in the CBAS20 directory and contains many examples of AHU and VAV/UNI-B applications. There is also a CBAS University backup that is also a good example and has sophisticated graphics. To restore either of those databases, close your current database and go to Database on the Main Menu, then Install Database. Point to the backup you want to restore. If you need help Installing a database, contact Tech Support at 504-529-1413 or email email@example.com. Step-by-step instructions on opening and closing databases can also be found in the CBAS Programming Manual which is available for download on our website:
https://www.computrols.com/resources/ (then check the box for Manuals).