Why discuss line-base code?
Right after I started my work at IBC I was assigned to the Dealer Certification Program at Reliable Controls Corporation. Before the course, I researched a little into what Reliable Controls (RC) had to offer and the solutions they used in their boxes. So, come with me to find out about Reliable Controls line base code, is it not so scary?
Once I realised that the RC Controllers programming method is done by line-based code instead of Object-oriented, as I know from other well-known Building Automation Systems Manufacturers, I became very sceptical.
I think most BMS Engineers have very similar feelings when they hear about line-based code nowadays. These feelings create a major obstacle that is big enough to prevent technical staff from investigating the topic deeper and check if it is worthy to invest or not.
In this article I would like to discover and present what is hidden just around the corner of the wall.
Introduction to Control-BASIC
Control-BASIC is a line executed language conceptually similar to the Dartmouth BASIC (Beginner’s All-purpose Symbolic Instruction Code). It differs from Dartmouth BASIC in that there are many statements, functions, and operators that relate specifically to the control industry (for instance, START, STOP, OPEN, CLOSE, SENSOR-ON, SENSOR-OFF, LIMIT, FLOAT,
Each logical line of code is identified with a discrete line number. The whole program is executed line by line from the line with minimum number to the END.
The language allows the programmer to create control logic in a quick and efficient manner and provides all the tools necessary to accomplish virtually any control strategy. Code can be copied from one program and pasted into any other program (just by ctrl+C ctrl+V, also to the other controllers).
The Control-BASIC compiler and de-compiler reside in the BACnet® Advanced Workstation RC-Studio®.
The editor is also used to send compiled code to a controller, restore a complied program from a controller, save, store, and restore Control-BASIC programs to RC-Studio for building program libraries, and editing and monitoring Control-BASIC programs in an operational controller.
The Control-BASIC editor can be used while connected to a live system or in the RC-Studio Simulator mode.
- templates and libraries of ready applications
- help with custom application from RC Technical Support
- can realise any sequence of operation
- automatic integration with Trends, PID loops, Alarms Console
- extended and comprehensive help files
- built-in tools which keep the programming and commissioning clear and easy
Features which make life with line base code easier
Easy way to renumber the lines
When the RC-Studio Control-BASIC editor is used to automatically renumber the logical lines of a program, it will number the lines in increments of 10, beginning with 10 for the first logical line. The gaps between the lines are used for the future purposes in case of any program modifications.
Physical Outputs controlled at the very end
The controller’s physical outputs are not assigned until after the very last line in the very last program has been executed. This prevents accidental short-cycling of an output in the event that different values are assigned to an output by subsequent programs.
Watch list of the local variables
In Local/Vars mode the current values of any local variables used in the program are uploaded and displayed in the left pane of the Program worksheet. Hovering the cursor over an object or local variable will result in a value feedback box that displays the present value of the object.
Full control over program execution
In Show Trace mode the program execution trace is uploaded and the trace bits are displayed in the left pane of the Program worksheet. The program lines with a T displayed to the left are the program lines that have been executed by the interpreter. Program lines without a T displayed were not interpreted due to directions within the code.
User-friendly way of displaying BACnet Object references
Toggles between two modes that determine how object references are displayed in the Program worksheet. In the Desc/Label mode system points are displayed with their descriptor or label, depending on which name is selected in the Preferences dialog box.
In Mnemonic mode system points are displayed with their mnemonic.
Global functions for a text edition
Opens the Replace dialog box used to initiate a search for the first text string entered, and replacing each occurrence with
the second text string entered. The search begins at the current cursor location.
The RC-Studio 3 Program worksheet features configurable, color-coded, syntax highlighting, The programmer can configure the color code from the CBAS Editor Options dialog. The feature allows to have a control over f.ex.correctness of entering BACnet references.
Different font color can be set for various things such a functions, inputs, outputs, line numbers etc.
Intuitive access to help files
The syntax for each individual element is discussed and available in RC Studio by pressing F1 what I found very useful during the programming.
Not everything in code
PID loops are defined in separated section – in your program code you need to just make a reference to the particular PID.
Alarms can be defined with different priority and behavior (popup, alarm messages, alarm console, hyperlink to graphics, send an email or open a file)
Trend logs can be defined as a single or multipoint. It is possible to log all the values which exist in the controller.
COV (Change of Value) log type is possible only in a single Trend Log type. Multipoint Trend Logs support triggered and polled type with configurable interval, precision (bytes) and length.
You can dynamically copy whole programs and automatically change controller device instance and BACnet object IDs. Reliable Controls provide wide libraries of ready applications ready to deploy or you can edit them adjust to your needs and use as your own template. Additionally, the RC Tech Support offers a great help with creating custom applications. It is also possible to create templates of whole controllers – including programs, alarms configuration, variables etc. It is really helpful when there is a large number of controllers on the project with similar configuration (FCU units). Templates are dynamic – it means that all the BACnet references can be automatically changed to particular Device ID of the controller during the template uploading process.
The dynamic flexibility of Control-BASIC allows the programmer to develop programs and functional implementations that can be simple or complex,succinct or convoluted. Control-BASIC syntactic elements have been developed to provide this adaptable environment through inter-operation and simple programming techniques. The core principle behind Control-BASIC is to provide a comprehensive programming language that does not require a comprehensive programmer.