We use an older version of Script basic, to which we added external 'C'
function libraries. These external function libraries implement commands used by the building automation system (BAS) at the University of Toronto.
(many millions of square feet).
Scriptbasic is used in the control of a large number of building environment systems on campus. A notable implementation is pressure control within a large atrium being served by 7 supply fans (60,000 CFM each) and 4 return fans(120,000 CFM each). This implementation can maintain a positive pressure in the building envelope of 0.03" wc.
Scriptbasic has also been extended to communicate with our BACnet server, for the purposes of monitoring third party implementations. BACnet is the ASHRAE standard for Building Automation and Control networks.
In doing so, we have added certain DB calls to Oracle, but they are application specific, not via ODBC or other standard.
What we also added was a novel use of gcc pre-compiler.
There were no macros, so I created 'C' macros that emit BASIC statements, and then pre-compiled our basic source code using "gcc -E".
The most important reason we chose Scriptbasic, was extensibility and portability. We chose Basic, because it was typeless, and did not require fixed array sizes.
We can code things like this (unrealistic, but a decent example):
DO_EVERY_INIT
DO_EVERY(300) {
On_status = get("080 AH01 VS1")
If ( isdefined(On_status)) then
If (On_status = "OFF" ) then
PAM("Air handler 1 is off in error")
else
supply_temp = get("080 AH01 SPT")
If ( isdefined(supply_temp)) then
If (supply_temp > 30 ) then
PAM("Air handler 1 supply temp is in alarm")
Endif
Endif
endif
} DO_EVERY_END;
... many more DO_EVERY blocks...
DO_INTERVAL
So, our macros enable the code within to be executed every X seconds.
The do-every macros are implemented using arrays. Since we do not have to
define array sizes, we can have as many as we like, as the macros manage the index.
The use of "is-defined" enables us to know if the "get" function was
successful: the result will be undefined on error. All errors detected are announced by the basic extension libraries, not the basic code, to improve readability.
The typelessness of basic allows us to use the return of the get as either a string (compare to off) or a number (compare to 30). The also improves readability and use. We do not need a special function for each return type.
In this example, PAM is the "print alarm message" function,that prints messages all over campus. The name was chosen as it is the same as an operator command.
This is a very BIG and responsible installation. Most programs in our installation are tiny control blocks similar to the above,that were implemented by parsing a report of all existing control blocks using perl, and auto-generating the scriptbasic code.
Scriptbasic was the tool that allowed us to abandon a very old Fortran based command line configured control engine. We now have approx. 50 scriptbasic programs running on Solaris,that centrally controls the building systems for most of the campus.
I guess scriptbasic is used in the control of perhaps 6 million sq ft, in Canada's largest University.Posted on the ScriptBasic mailing list