MicroSCADA Programming Language SCIL is a high-level language designed for the application engineering of the supervisory control system MicroSCADA. This manual provides technical information about the language, including topics like data types, objects, variables, commands, functions, graphics primitives, and using Motif Widgets.
advertisement
1MRS751250-MEN
Issue date: 29.02.00
Program revision: 8.4.3
Documentation version: A
Copyright © 2000 ABB Substation Automation Oy
All rights reserved.
MicroSCADA
Programming Language
SCIL
Notice 1
The information in this document is subject to change without notice and should not be construed as a commitment by ABB. ABB assumes no responsibility for any error that may occur in this document.
Notice 2
This document version complies with the program revision 8.4.3.
Notice 3
Additional information such as Release Notes and Last Minute Remarks can be found on the program distribution media.
Trademarks
Microsoft is a trademark of Microsoft Corporation.
Windows NT is a trademark of Microsoft Corporation.
L
ON
W
ORKS
is a registered trademark of Echelon Corporation.
Other brand or product names are trademarks or registered trademarks of their respective holders
All Microsoft products referenced in this document are either trademarks or registered trademarks of Microsoft.
MicroSCADA
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Related SYS 500 and MicroSCADA Technology Manuals
The following SYS 500 manuals are published with this software release:
Installation
Picture Editing
Visual SCIL User Interface Design
Visual SCIL Objects
System Management
1MRS751254-MEN
1MRS751255-MEN
1MRS751256-MEN
1MRS751257-MEN
1MRS751258-MUM
The following MicroSCADA technology manuals are published with this software release:
Connecting L
ON
W
ORKS
Devices to MicroSCADA
System Configuration
System Objects
Application Objects
Programming Language SCIL
Status Codes
1MRS751249-MEN
1MRS751248-MEN
1MRS751252-MEN
1MRS751253-MEN
1MRS751250-MEN
1MRS751251-MEN
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
Contents
Page
1 Introduction ....................................................................................... 1
1.1 Presentation of SCIL ..............................................................................1
1.2 SCIL Programs .......................................................................................4
1.3 SCIL Statements ....................................................................................5
1.4 Organization of this Manual ....................................................................6
2 Programming in SCIL ....................................................................... 9
2.1 SCIL Programming Environment ............................................................9
2.2 SCIL Programming Rules .....................................................................15
3 Data Types....................................................................................... 19
3.1 General ................................................................................................19
3.2 Integer ..................................................................................................19
3.3 Real......................................................................................................20
3.4 Boolean ................................................................................................21
3.5 Time .....................................................................................................21
3.6 Text ......................................................................................................22
3.7 Bit String...............................................................................................22
3.8 Byte String............................................................................................23
3.9 Vector...................................................................................................23
3.10 List .....................................................................................................24
4 Objects............................................................................................. 25
4.1 General ................................................................................................25
4.2 System Objects ....................................................................................26
4.2.1General ..........................................................................................26
4.2.2Base System Objects (B) ...............................................................28
4.2.3Communication System Objects ....................................................29
4.3 Application Objects...............................................................................30
4.3.1General ..........................................................................................30
ABB Automation
MicroSCADA
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
4.3.2Process Objects (P)....................................................................... 32
4.3.3Scales (X) ...................................................................................... 34
4.3.4Data Objects (D)............................................................................ 35
4.3.5Command Procedures (C) ............................................................. 36
4.3.6Time Channels (T) ......................................................................... 37
4.3.7Event Channels (A)........................................................................ 38
4.3.8Event Objects (E) .......................................................................... 39
4.3.9Variable Objects (V)....................................................................... 40
4.4 User Interface Objects ......................................................................... 41
4.4.1Pictures ......................................................................................... 41
4.4.2Visual SCIL Objects....................................................................... 45
5 Variables .......................................................................................... 49
5.1 General Rules ...................................................................................... 49
5.2 Using Variables .................................................................................... 50
5.3 Predefined Picture Variables................................................................ 53
6 Expressions..................................................................................... 57
6.1 General Principles................................................................................ 57
6.2 Arithmetical Operators ......................................................................... 58
6.3 Relational Operators ............................................................................ 63
6.4 Logical Operators................................................................................. 64
7 SCIL Commands ............................................................................. 67
7.1 General ................................................................................................ 67
7.2 Picture Handling Commands................................................................ 69
7.2.1General Picture Handling Commands............................................ 70
7.2.2Window Handling Commands........................................................ 74
7.2.3Input Commands ........................................................................... 81
7.2.4Miscellaneous Picture Commands................................................. 84
7.3 Control Commands .............................................................................. 85
7.3.1Program Execution Commands ..................................................... 85
7.3.2General Object Handling Commands ............................................ 92
7.3.3Object Query Commands .............................................................. 97
7.3.4Printout Commands ..................................................................... 100
7.3.5Error Handling Commands .......................................................... 102
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7.3.6Path Commands ..........................................................................104
7.3.7File Handling Commands .............................................................107
7.3.8Miscellaneous Commands ...........................................................113
7.4 Visual SCIL Commands......................................................................113
7.4.1Loading, Creating and Deleting Visual SCIL Objects....................114
7.4.2Handling Visual SCIL Attributes ...................................................116
7.5 VS Object, Window and Picture Function Methods.............................117
7.6 VS Object, Window and Picture Function Attributes ...........................118
8 Functions....................................................................................... 121
8.1 General ..............................................................................................122
8.2 Arithmetical Functions ........................................................................128
8.3 Time Functions ...................................................................................131
8.4 String Functions..................................................................................135
8.5 Bit Functions.......................................................................................143
8.6 Vector Handling Functions..................................................................146
8.7 Database and List Functions ..............................................................155
8.8 Functions for Reading and Writing Files .............................................174
8.9 Functions Related to Program Execution............................................179
8.10 Communication Functions ................................................................184
8.11 File and Directory Handling Functions ..............................................186
8.12 File and Directory Management Functions .......................................201
8.13 DDE Client Functions .......................................................................207
8.14 DDE Server Functions......................................................................212
8.15 ODBC Functions ..............................................................................213
8.16 RTU Functions .................................................................................219
8.17 Printout Functions ............................................................................223
8.18 Error Tracing Functions....................................................................227
8.19 Data Type Handling Functions .........................................................228
8.20 Miscellaneous Functions ..................................................................231
9 Graphics Primitives ...................................................................... 241
9.1 Introduction.........................................................................................241
9.2 Full Graphics SCIL Commands ..........................................................242
9.2.1Drawing Graphical Elements ........................................................242
9.3 Graphics Contexts ..............................................................................248
ABB Automation
MicroSCADA
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
9.3.1General........................................................................................ 248
9.3.2Defining Graphics Contexts ......................................................... 249
9.3.3Components of Graphics Contexts .............................................. 250
9.3.4Colors and Fonts ......................................................................... 256
9.3.5Reading Graphics Contexts ......................................................... 260
9.4 Graphics Canvas ............................................................................... 260
9.5 Miscellaneous Graphical Commands ................................................. 265
9.5.1Storing and Restoring Selections................................................. 265
9.5.2Display Handling Commands....................................................... 265
10Using Motif Widgets in SCIL ....................................................... 267
10.1 General............................................................................................ 267
10.2 Widget Handling Commands ........................................................... 268
10.3 Widget Methods............................................................................... 270
10.4 Widget Resources ........................................................................... 271
10.4.1 General ..................................................................................... 271
10.4.2 Resources in SCIL .................................................................... 271
10.4.3 Resource Data Types ............................................................... 272
10.4.4 Writing Widget Resources......................................................... 274
10.4.5 Reading Widget Resources ...................................................... 275
10.4.6 Auxiliary Functions .................................................................... 275
11SCIL Programming Guide ........................................................... 277
11.1 Picture Handling .............................................................................. 277
11.2 Visual SCIL Object Handling............................................................ 278
11.3 Program Execution .......................................................................... 279
11.4 Process Supervision and Control ..................................................... 280
11.5 Alarm and Event Handling ............................................................... 280
11.6 Calculations and Reports ................................................................. 281
11.7 System Configuration and Communication ...................................... 281
11.8 Application Database Management ................................................. 281
11.9 Error Handling.................................................................................. 282
12SCIL Editor ................................................................................... 285
12.1 General............................................................................................ 285
12.2 Menus.............................................................................................. 285
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
12.3 Toolbar.............................................................................................289
12.4 Opening and Closing the SCIL Editor...............................................289
12.5 Typing and Editing Programs and Texts...........................................291
13The SCIL Compiler....................................................................... 299
13.1 General ............................................................................................299
13.2 Performance Improvement...............................................................299
13.3 Impact on SCIL Programs ................................................................299
13.3.1 Programs that do not Compile ...................................................300
13.3.2 Programs that Generate Run-time Error....................................300
13.3.3 Programs that Produce Wrong Results .....................................301
13.3.4 Recommendations ....................................................................301
ABB Automation
1MRS751250-MEN
1
1.1
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
1 Introduction
Introduction
This chapter introduces the SCIL programming language, the MicroSCADA application engineering, and the SCIL program structure.
Presentation of SCIL
What is SCIL?
SCIL, Supervisory Control Implementation Language, is a high level language especially designed for the application engineering of the supervisory control system MicroSCADA. All MicroSCADA application programs as well as most system configuration programs are built in SCIL.
What is Application Engineering?
In MicroSCADA, ’application engineering’ means the composition of customized, process specific supervisory control software. The result is an application software package adapted for the user’s needs regarding control functions, communicating process devices, user interface, level of information, etc. A base system contains one or more application software packages named applications. The application engineering comprises:
•
Functional design, i.e. the programming and definition of the SCADA functions as well as other supervisory control and calculation functions.
•
User interface design.
The functional design involves the definition of databases (a database = a set of connected data stored in a structured form) and the creation of SCIL programs. Each application has a process database for handling process supervision and a report database for data storage, calculations, automatic activation, etc. The databases are composed of objects named application objects.
The user interface design involves the composition of pictures and dialogs. See Figure
1. Pictures are dynamic illustrations containing a static background, dynamic windows and user activated function keys. Dialogs are independent windows which may contain a wide range of user interface items, such as menus, buttons, images, notebooks, and pictures. Pictures and dialogs represent two different user interface design methods. The design and programming of dialogs and dialog systems is named “Visual SCIL”.
These two portions of an application are interwoven with each others, and the user interface design and the functional design generally occur in parallel.
Application engineering is simplified by using the standard application software library, LIB 500, which requires a minimum of object definitions and SCIL programming. In any case, SCIL is found in all MicroSCADA applications, even in those
1
MicroSCADA
1 Introduction
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN which are built with LIB 500, because the LIB 500 standard application software is built with SCIL.
Figure 1.
A MicroSCADA screen view showing three dialogs, one containing a picture.
The application engineering using LIB 500 is discussed in the LIB 500 User’s Guide.
The user interface design is described in the Visual SCIL User Interface Design and the Picture Editing manuals.
What You Can Do with SCIL
By means of SCIL you can control the entire MicroSCADA system, not only the features related to the application, but also features related to the system configuration and communication. With SCIL as your tool you can for instance (as shown in Figure
2):
•
Program the user interface portion of the application, e.g. define the dynamic changes in pictures and dialogs, and program operator activated function keys and buttons.
•
Design various forms of process control, such as manual control, sequential control, time control, event control, etc.
•
Define routines for calculation and updating in databases to be started automatically or manually.
•
Design reports for presentation on monitor screens or for paper printout.
2
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
1 Introduction
•
Configure, supervise and handle system components, for example printers and monitors.
•
Build process simulations.
•
Exchange data with other MicroSCADA applications and with external (not MicroSCADA) applications (e.g. office applications).
Learning SCIL requires no previous knowledge of "conventional" programming.
ABB Automation
Figure 2.
Features controlling the SCIL program execution and features controlled by SCIL
3
MicroSCADA
1 Introduction
1.2
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
SCIL Programs
Composition
A SCIL program is composed of one or more textual statements. Each statement represents an instruction to the system about a task to be carried out, e.g. the presentation of a picture or the assignment of a variable value. Consecutive statements mean a sequence of instructions, which are carried out in the prescribed order.
Occurrence
SCIL programs appear in pictures, in command procedures (objects for automatic or
SCIL activated program execution), and in the dialogs and dialog items (Visual SCIL objects). More information about this will be given in Chapter 2.
Activation of SCIL Programs
The SCIL programs can be started manually or automatically, for example:
•
The function keys in pictures and the buttons in dialogs contain SCIL programs which are started manually by the operator.
•
The pictures and dialogs can contain programs which are started automatically when a picture is entered or exited, periodically with a certain time interval, and on the occurrence of a process event.
•
The command procedures can start automatically by real or simulated process events, by time, from other SCIL programs, etc.
•
SCIL programs can be started by a SCIL command or a program call.
Example
The example in Figure 3 gives an insight into what a SCIL program can look like. The program could be placed under a function key in a picture, which means that it is executed each time the key is pressed. The purpose of the program is to bring a new picture called MENU on screen provided that a password is given correctly (999).
4
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
1 Introduction
1.3
ABB Automation
Figure 3. A SCIL program for the input and control of a password
SCIL Statements
Components
Each line in the program example in Figure 3 is a SCIL statement. (A statement could also be continued on several lines.) A SCIL statement may consist of the following main components:
•
Commands. These are words with a pre-declared meaning constituting orders to the system about steps to be taken. In the example in Figure 3 each program line starts with a command.
•
Objects. Object is a broad concept which may correspond to physical parts of the system or the process, database items, user interface objects, or abstract functions specific to the MicroSCADA system.
•
Variables. Variables are facilities for the temporary storage and use of changing data. In the example in Figure 3, WORD is a variable.
•
Function calls. SCIL has a large number of pre-defined functions for various purposes.
•
Expressions. Expressions are formulas which can contain constants, object notations, variables, function calls and operators (e.g. +, - , /, *).
Statement Format
The components above can be combined into statements according to one of the following three formats : command {arguments} variable = expression name.program {arguments}
(1)
(2)
(3)
Type (1) (described in Chapters 7, 9 and 10) implies that an action is performed on or by means of the arguments. The arguments may be object references, expressions,
5
MicroSCADA
1 Introduction
1.4
6
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN variables, names, etc. Some commands do not require any arguments, they are as such complete statements. In some cases the arguments may contain statements. The command names start with a ! (picture commands), # (control commands) or . (Visual
SCIL, full graphics and Motif commands).
Type (2) (described in Chapter 5) implies that a variable gets a value. The variable assignment starts with an @-sign.
Type (3) is a program call which starts a program execution in a picture, dialog or dialog item. This type is described in Chapter 4.
Organization of this Manual
This manual is composed of 13 chapters, which have the following contents:
Chapter 1. This introduction.
Chapter 2.
Chapter 3.
Describes the tools for SCIL programming, the rules concerning the structure of SCIL programs, SCIL characters and naming SCIL elements.
Describes the different SCIL data types allowed for data and expressions included in SCIL programs and expressions.
Chapter 4.
Chapter 5.
Chapter 6.
Chapter 7.
Chapter 8.
Describes briefly the different object types - system objects, application objects, user interface objects - and how they are handled in
SCIL.
Describes the use of variables in SCIL: how to assign values to variables and how to use them, how to handle vector variables, pre-defined picture variables.
Describes the construction of SCIL expressions.
Describes the SCIL commands - picture handling commands, control commands and Visual SCIL commands.
Describes the pre-declared SCIL functions which can be included in expressions.
Chapter 9.
Chapter 10.
Chapter 11.
Chapter 12.
Chapter 13.
Describes the lowest level of the full graphics handling (generally not needed for ordinary application engineering).
Describes the handling of Motif Widgets (not needed for ordinary application engineering).
Provides a programmer’s quick guide.
Describes the SCIL Program Editor.
Describes the SCIL Compiler.
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
1 Introduction
After chapter 13, you will find a list of subject indices.
Appendix A contains a collection of new SCIL features in MicroSCADA 8.4.
Appendix B contains a list of ODBC error codes.
Appendix C lists Parameter Files.
At the end of the manual, you will find the customer feedback instructions.
ABB Automation
7
1MRS751250-MEN
2
2.1
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
2 Programming in SCIL
Programming in SCIL
This chapter describes the SCIL programming environment and the rules for programming in SCIL:
2.1
The programming environment: the MicroSCADA objects where SCIL programs and expressions are found, the programming tools in brief, the use of
SCIL expressions in external applications via DDE.
2.2
Programming rules: The structure of the SCIL programs, SCIL characters,
SCIL names.
SCIL Programming Environment
General
SCIL programs appear in:
•
Pictures.
•
Dialogs and dialog items (Visual SCIL objects).
•
Command procedures.
In addition, SCIL expressions appear in window, data object and time channel. SCIL expressions can also be entered in external Windows based applications and executed through DDE (Dynamic Data Exchange).
SCIL programming is carried out while the MicroSCADA system is running. During program editing the system does not perform any SCIL syntax error control. To test
SCIL programs, statements and expressions, use the test tool accessed from the Tool
Manager.
The subsequent presentation of the programming environment assumes that you use a
MicroSCADA monitor (application session) of type “VS”. In other monitor types
(semi-graphic monitors or “X” type monitors) the programming tools are semigraphic. “X” type monitors are required if the application contains Motif Widgets. In all other cases, use “VS” type monitors. You choose monitor type when you open a
MicroSCADA monitor or screen.
SCIL Program Editor
SCIL programs are written in the SCIL Program Editor which is accessed from tool pictures and from the Tool Manager. The SCIL Program Editor is opened from the
Picture Editor, the Dialog Editor and the Command Procedure object definition tool.
The SCIL Program Editor is described in Chapter 12 of this manual.
9
MicroSCADA
2 Programming in SCIL
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Picture Programs
A dynamic picture is composed of a static background, windows, function keys,
SCIL-programs and picture functions. Windows are the dynamic parts of the picture.
They can present data fields, graphs, figures or complete pictures. The picture functions are complete pictures which are integrated in the total picture. Picture functions and window pictures (pictures shown in a window) are commonly called "part pictures" or "sub-pictures", while the total picture is called “main picture”.
Pictures are built and programmed in the Picture Editor where they can be named freely. The pictures and picture editing are described in the manual " MicroSCADA
Picture Editing".
A picture may contain the following types of picture programs (none of them is obligatory):
•
A draw program executed every time the picture is loaded on screen, immediately after the background has been produced on screen but before the start program is executed. It can, e.g., be used for adding context specific graphics to the background by means of graphics commands.
•
A start program executed after the draw program. The start program is used for basic definitions such as initial variable values, update interval, and program blocks.
•
An update program, which is executed repeatedly at intervals defined by a SCIL command (the !UPDATE command, see Chapter 7) as long as the picture is displayed on screen. The update program should be kept as small as possible.
•
An exit program, which is executed each time the picture is exited (even at exit by clicking three times in the upper left corner of the picture).
•
Function key programs executed at each click on the function keys to which they belong.
•
Named programs executed by program calls. A SCIL picture may contain any number of named SCIL programs. The named programs are started by program calls as described in section 4.4. The named program names may be up to 63 characters long. Each picture may contain a named program with a predefined name, ERROR_HANDLER, where the programmer can define the error handling to be used in the picture. The ERROR_HANDLER program is described in
Chapter 11.
Besides these programs, the picture contains a background program which is created automatically by the picture editor. The background program contains graphics commands. Normally, it should not be edited manually.
10
Window Definitions
The window definitions, see Figure 4, may contain expressions which specify what is to be shown in the windows. The expression of a window is evaluated each time the
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
2 Programming in SCIL window is shown. The window definitions may also contain conditions for the display of different representations. Both the expressions and the conditions follow the rules of SCIL.
ABB Automation
Figure 4.
An example of a window definition
Methods
Each dialog and dialog item can have a number of methods most of which are SCIL programs. (There are also predefined methods which are programmed in C, but these are not editable).
A dialog or a dialog item may contain the following SCIL programs (methods):
•
Methods started at the creation and deletion of the object.
•
Cyclically activated methods.
•
Event activated methods started by a process event or an event activated by
SCIL (through event objects, see section 4.3.).
•
Action methods started on an operator intervention (for example, a click on a button).
•
A help method started when help is requested.
•
An error handling method.
11
MicroSCADA
2 Programming in SCIL
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
In addition, each dialog and dialog item may have an arbitrary number of user defined methods which are executed by a method call (see section 4.4.).
The methods of the dialogs and dialog items are programmed in the Dialog Editor.
The composition and programming of dialogs is described in the manual Visual SCIL
User Interface Design.
Command Procedures
A command procedure is an independent SCIL program consisting of up to 10000 lines (see Figure 5). A command procedure can be started from a picture program, a time channel (see below), an event channel (controller of event-bound activities) or a
SCIL program.
Command procedures are described in the manual “ MicroSCADA, Application Objects".
12
Figure 5.
An example of a command procedure
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
2 Programming in SCIL
Data Objects
The data objects (datalog objects) are objects for the registration and storage of data.
The object definition, see Figure 6, contains a SCIL expression which states how the data is to be calculated.
Data objects are described in the manual "Application Objects".
ABB Automation
Figure 6.
An example of a data object definition
Time Channels
The time channels control the execution of time-bound activities. By conditions which are SCIL expressions, see Figure 7, the initialization times and execution times can be restricted, so that an initialization or an execution can only occur when the conditions are fulfilled.
Time channels are described in the manual "Application Objects".
13
MicroSCADA
2 Programming in SCIL
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
14
Figure 7.
An example of a time channel definition
Using SCIL in External Applications
MicroSCADA applications can be accessed from external Windows applications using the DDE protocol, so that the MicroSCADA application works as a DDE server and the other application works as a DDE client.
The DDE identifiers service, topic and item have the following meanings when accessing a MicroSCADA application:
MicroSCADA Service =
Topic = MicroSCADA application number (APL object number, see the
System Configuration manual)
Item, data = Item and data depends on the DDE transaction as follows:
REQUEST:
POKE: item = SCIL expression item = SCIL object notation
EXECUTE: data = SCIL expression item = SCIL statement.
ABB Automation
1MRS751250-MEN
2.2
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
2 Programming in SCIL
The DDE Server function in MicroSCADA supports the following SCIL data types
(see Chapter 3): integer, real, text, boolean. There are some SCIL functions which can be used in the composition of the expressions used via DDE. See the DDE Server
Functions in Chapter 8.
When handling data using DDE Server, occurred SCIL errors are preserved, so that the user can read afterwards the last SCIL status code of each DDE conversation by doing a request transaction giving "DDE_SCIL_STATUS_CODE" as Item value.
Accessing a MicroSCADA application using the DDE Server requires that the DDE
Server has been enabled in the base-system configuration (the SYS:BDE attribute).
For more information about using DDE, refer to the DDE documentation of the Windows Application you are using.
SCIL Test Tool
The test dialog accessed from the Tool Manager allows the programmer to enter individual SCIL statements and expressions as well as programs. It also provides means for detailed examination of the SCIL expressions. The SCIL Test tool is described in the System Management manual.
SCIL Programming Rules
Program Structure
A SCIL program can contain up to 10000 lines, and each line up to 255 characters
(including spaces). A SCIL statement comprises one or more lines. A minus sign (-) at the end of a SCIL line, before a possible comment, indicates that the statement continues on the next line. A line may be divided anywhere where spaces are allowed, but not within text constants. The statements are not numbered and empty lines are allowed anywhere in the programs.
Spaces are allowed anywhere in the program except within numbers, words, names, object notations and composed symbols. These elements, disregarding operators, must be adjacent to at least one space at each side. Also the operators DIV and MOD (see
Chapter 6) must be adjacent to spaces.
Upper and lower case letters may be freely intermixed. When the program is executed, lower case letters are converted into upper case, except for lower case letters within text constants (see Chapter 3).
The SCIL programs do not demand any initiating or terminating statements, neither any kind of declarations.
Comments can be placed anywhere in the program. They are preceded by a semicolon
(;), which indicates that the rest of the line is a comment. However, if the semicolon is enclosed in quotation marks (";"), it is regarded as a text (see Chapter 3).
ABB Automation 15
MicroSCADA
2 Programming in SCIL
Programming Language
SCIL
Technical Reference Manual
Examples
The following two SCIL-programs are functionally equivalent:
Example 1:
@T = TEMP:PAI1
#IF %T> 90 #THEN #BLOCK
#SET C:PBO2=0
#PRINT 2 OVERHEAT
#BLOCK_END
#ELSE_IF %T< 70 #THEN #SET C:PBO2=1
16
1MRS751250-MEN
Example 2:
@T = TEMP:PAI1; READ THE TEMPERATURE
#IF %T > 90 #THEN #BLOCK; IF WARMED OVER 90
#SET C:PBO2 0; STOP HEATING
#PRINT 2 OVERHEAT; PRINT OVERHEAT MESSAGE
#BLOCK_END;
#ELSE_IF %T < 70 #THEN #SET C:PBO2=1
; RESTART HEATING IF T<70
The following statement is divided on two lines. As a text constant cannot be divided it is necessary to type it as a sum of two texts.
@A = "IN THIS EXAMPLE, A LONG TEXT VALUE IS " - ; Comments allowed
+ "ASSIGNED TO VARIABLE A" ; like this
SCIL Characters
SCIL uses an extended ASCII character set (ASCII = American Standard Code for Information Interchange). This character set contains 256 characters, each of which corresponds to a numeric value in the range 0 . . . 255.
Some of these characters have a special meaning in SCIL. They symbolize punctuation marks, operators, messages to the system, etc. These special symbols and their meanings are listed below. When the symbols are composed of more than one character, the characters can not be separated by spaces.
Symbol
’
#
@
%
.
,
..
"
:
!
;
=
= =
\
/
)
(
-
+
*
**
Meaning in SCIL
minus sign, continuation of program line plus sign multiplication exponential operator division, separator in picture paths separator in Visual SCIL object paths left bracket right bracket marks an enumeration decimal point, marks a graphics or Motif command marks an index interval encloses a text precedes a variable name by assignment precedes a variable name by use indicates variable expansion precedes a control command precedes a picture command follows an object name starts a comment assignment equal to
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
2 Programming in SCIL
>
> =
<
< =
< >
^ greater than greater than or equal to less than less than or equal to not equal to marks an octal number
SCIL Names
Most user interface objects (picture and Visual SCIL objects, see Chapter 4) and application objects (see Chapter 4) are identified by logical names (identifiers), which can be chosen freely. Likewise, the names of variables, named programs, user defined methods, logical library representation files and directory paths can be named freely.
As a rule, the names may be up to 63 characters long. However, the names of pictures, windows, application objects (except variable objects), and logical paths may be only
10 characters long.
Allowed characters are the letters A-Z, all digits and underscore (_). In application object names periods (.) are allowed as well. As a rule, the first character of a name must be a letter. Application object names may also start with a digit, but this is not recommended.
SCIL supports blanks in Windows NT directory- and filenames.
Upper case and lower case letters are not distinct. For example, OBJ_NAME and
Obj_name are one and the same name.
Examples:
Below are some examples on valid and invalid SCIL names:
Valid names:
RELAY
RELAY_STN
RELAY_1234
Invalid names:
4TH_RELAY (starts with a digit, not valid as a name on
a picture, window or variable)
RELÄ (contains a special character)
RELAY_STATION (too long)
ABB Automation 17
1MRS751250-MEN
3
3.1
3.2
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
3 Data Types
Data Types
This chapter describes the SCIL data types: integer, real, boolean, time, text, bit string, byte string, vector and list.
General
Data Types
In SCIL there are six types of simple data (data constituted of single values): integer, real, boolean, time, text, bit string and byte string. As distinguished from these, the data type vector represents a string of data items, and the data type list represents a list of attributes and attribute values. An additional data type none exists, if e.g. the list attribute name has been defined, but its attribute value has no definition.
Meaning
Every SCIL expression (see Chapter 6) is associated with one of these eight data types. The data type of an expression determines both the range of values the expression can yield and the operations that can be carried out upon it.
Integer
Description
The integer data type denotes positive and negative integer values ranging from
-2.147.483.648 through +2.147.483.647. Numbers outside these limits are automatically regarded as real numbers.
Integer constants can be typed in decimal or octal form. In decimal form integers are written by means of digits and signs. No commas or decimal points are allowed, nor are exponents. Integer values without any sign are regarded as positive.
Octal numbers have 8 as their base, unlike the decimal numbers (ordinary numbers), which have 10 as their base. Integers written in octal form (max. +- 65535) are marked with a final up arrow (^).
Internally integer values are represented by 32 bits.
Example
Examples of some valid integer constants:
256
0
000123
-5
777^
19
MicroSCADA
3 Data Types
3.3
20
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
The four first ones are in decimal form, the last one in octal form. The last one represents integer value 511 in decimal form.
Real
Description
The real data type expresses, with limited precision, continuous quantities within a large range of values. The accuracy of real numbers is limited to about seven digits, if initial zeroes are not counted.
Table 1. shows the value ranges of the real numbers. All numbers between the smallest negative and the smallest positive numbers yield the value 0. The ranges are determined by the processor of the base system computer.
Table 1. The value ranges of real values.
Smallest negative value
Largest negative value
Smallest positive value
Largest positive value
-5.88 E(-39)
-3.41 E38
5.88 E(-39)
3.41 E38
Real numbers are written using digits, decimal points and signs. No exponents are allowed. Real numbers without any sign are considered positive. At least one digit must precede the decimal point. Numbers without any decimal point are considered as integer values if they fall within the value range of integer values. Outside that range, they are considered as real values.
Internally, real numbers are represented by a 32-bit floating point format.
Because the internal representation of a real number is generally not exact, care should be taken when comparing two real expressions for equality. For example, it is not safe to rely on such "facts" as ’1.7/5.0 == 0.34’. However, the following holds:
Every whole number in the range -16777215 .. +16777215 has an exact representation as a real number. Therefore, for example the relation ’170.0/5.0 == 34.0’ is safe, no rounding errors can occur.
Example
Examples of some valid real numbers:
0.0
1234.56789
1234567
5.
0.000000000000000000001
The second number contains 9 significant digits and consequently cannot be stored without some loss of precision.
ABB Automation
1MRS751250-MEN
3.4
3.5
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
3 Data Types
Boolean
Description
This kind of data may gain two values: FALSE and TRUE.
Boolean values are gained as the result from testing the truth of expressions, usually relationships or functions. They are used in conditional statements and expressions.
Internally, FALSE is represented by the value 0 and TRUE by the value 1. Hence, the relation between the two boolean values is :
FALSE <TRUE.
Integer 0 and 1 are returned when boolean SCIL expressions are used via DDE (Dynamic Data Exchange).
Examples
Some examples of boolean expressions and their values:
Expression
5 = = 5
"NIGHT" = = "DAY"
%V = = FALSE
Boolean value
TRUE
FALSE
TRUE, if the boolean variable %V is FALSE
(see Chapter 5).
Time
This kind of data is obtained as time information from the system when using the time function CLOCK (see section 8.3.) and some attributes, e.g. the RT attribute, registration time (see section 4.3.).
Time data exists only internally and consists of the number of seconds passed since the beginning of 1978. This number as an integer value represents time data when used in expressions. It is also the value returned when Time date is used via DDE.
Time data can be given a readable representation (e.g. calendar time) by means of the time functions (see section 8.3.).
Internally, time data is registered as 32-bit integer values.
ABB Automation
21
MicroSCADA
3 Data Types
3.6
3.7
22
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Text
Description
Text data is composed of one or more, up to 255, characters. All characters are allowed. When used in expressions, text data must be enclosed in quotation marks (").
These are omitted when text data is shown on screen.
Text data can be typed either in upper-case or lower-case letters. However, if you display lower case text in a semigraphic window, special semigraphic symbols are shown instead of lower case letters. If you have a semigraphic monitor, use the SCIL function UPPER_CASE to convert the lower case letters to upper case before display.
A single quote (’) or double quotes (") contained in a text must be typed as two single quotes or two double quotes respectively.
Text data is used, e.g., for displaying texts in windows. Texts can also be operated, e.g. added and compared (see Chapter 6).
Examples
Two text constants:
"ABC_123!!?%"
"This is a text constant containing one "" and one ’ ’ "
Bit String
Description
A bit string is a sequence of bits stored in consecutive memory bytes. The length of a bit string (the number of bits in the string) may be anything from 0 to 65535. The bits in a string are numbered from 1 to 65535 counting from left to right.
Bit strings appear as values of process objects, functions and variables. They have no visible representation, but they can be read as a text by means of the BIN function
(section 8.4.), and they can be written by means of the BIT_SCAN and BIT_STRING functions (sections 8.4. and 8.5.). Bit strings can be added and compared (see Chapter
6).
Internally, bit strings are represented as a field of two bytes length, followed by so many data bytes as are needed to hold the bits.
Example
An example of a bit string of eight bits converted to a text by means of the BIN function:
BIN(%BITSTRING) = = "01010101"
ABB Automation
1MRS751250-MEN
3.8
3.9
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
3 Data Types
Byte String
Description
A byte string is a sequence of consecutive 8-bit bytes with no structure and no predefined semantics. The length of a byte string may be anything between 0 and
1048576 bytes.
The contents of a byte string are defined by the SCIL programmer. Byte strings are especially suitable for exchanging non-ASCII data between MicroSCADA and other applications.
Byte string data can be added and compared by relational operators.
Byte string can be constructed by the PACK_STR function. By using the function
UNPACK_STR, a byte string can be interpreted as an array of numerical values. The length of a byte string can be read by means of the LENGTH function.
Vector
Description
A vector is a string of data. All data types are allowed in vectors, even so that data of different types are included in the same vector. A data item as a part of a vector is called an element. A vector may contain up to 10000 elements numbered from 1 to
10000. This numbering is used as indexes (sequence numbers) when referring to one or more elements of a vector.
Vectors occur as values of object notations and attributes (see Chapter 4), variables
(see Chapter 5) and functions (see Chapter 8). Indexes can only be used together with application and system object notations and variables. Hence, indexing is described in these contexts, i.e., in Chapters 4 and 5.
Vector Aggregates
In expressions a vector can be written as a vector aggregate. Vector aggregates are written in the following format:
(element1,element2,element3,....,elementn) that is, the vector elements separated with comma and enclosed in brackets. The elements are expressions of any data type.
Vectors can also be constructed with the VECTOR function (see Chapter 8).
Example
An example of a vector of five elements written as a vector aggregate:
(-23, "NAME", 0.000001, CLOCK, %A+%B)
23
MicroSCADA
3 Data Types
Programming Language
SCIL
Technical Reference Manual
The variables A and B may not be of list type.
3.10
List
1MRS751250-MEN
Description
Data of this type constitutes a list of attribute names and attribute values (see Chapter
4). The attributes may be any data type. A list can hold up to 10000 attributes.
Data of list type occurs as values of variable objects (see section 4.3.), variables (see
Chapter 5) and certain functions (see Chapter 8).
Using the LIST function (see Chapter 8), a list can be written in the following form:
LIST(attribute=expression,attribute=expression, ...) where
’attribute’ is a freely chosen attribute name of up to 63 characters,
’expression’ is an expression of any data type.
A list cannot be included in expressions but by using attribute names and indexes the attribute values can be extracted from a variable object and thereafter be handled as simple data or vectors.
Example
A list could have the following contents:
Attribute name: LN IX UN OA OB OV ....
Index
1 "A" 4 10 3560 7 0 ....
2 "B" 2 11 3430 16 5.5 ....
Using the LIST function, the list would be written:
LIST(LN=("A","B"),IX=(4,2),UN=(10,11),OA=(3560,3430),OB=(7,16),OV=(0,5.5))
24 ABB Automation
1MRS751250-MEN
4
4.1
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
4 Objects
Objects
This chapter describes in general terms the objects and how to handle them in SCIL.
The objects are of three main categories which are described in the following sections:
4.1
General: an overview of the three object categories, some object related concepts.
4.2
System Objects: The communication system objects and base system objects, their object notation and some attributes.
4.3
Application Objects: The application object types, their object notation, and some attributes.
4.4
User Interface Objects: The pictures and picture components, the visual SCIL objects, the object hierarchy, the object references, attributes and methods.
This description of the object types is superficial. For a detailed description, refer to the following manuals: System Objects, Application Objects, Visual SCIL Objects,
Visual SCIL User Interface Design and Picture Editing.
General
Object Categories
There are three categories of objects which represent three levels of system engineering:
•
System objects. The system objects are used for system configuration and communication. They are of two types:
- Base system objects
- Communication system objects (previously named system objects).
•
Application objects. These objects form the functional portion of the applications. There are nine types of application objects:
- Process objects
- Scale objects
- Data objects
- Command procedures
- Time channels
- Event channels
- Event objects
- Variable objects
- Free type objects.
•
User interface objects. There are two types of objects for composing the user interface portion of applications:
- Pictures
- Visual SCIL objects. There are about 40 Visual SCIL object types. Each type
25
MicroSCADA
4 Objects
4.2
26
4.2.1
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN corresponds to a type of dialog, dialog item (e.g. buttons, texts, lists, menus) or image.
Attributes and Methods
An important concept when talking about objects is the notion of attribute. Most object types have attributes which represent the values and features of the objects. The value of a process object, for example, is represented by an attribute, the time stamp is another attribute, and so is the alarm state. Regarding the Visual SCIL objects, the attributes may correspond to visual properties such as the label or color of a button.
Through the attributes, the SCIL programmer can use and change the object properties. For instance, the color of a dialog item and the alarm limits of a process object may be changed by means of a SCIL statement.
The Visual SCIL objects may also have a number of methods which are programs written in SCIL or in C. The SCIL programs may be freely modified while the C programs are predefined. By executing predefined methods, the programmer can affect certain features of the objects.
Handling Objects in SCIL
The values and properties of the objects can be read in SCIL as attributes. Provided that write access is allowed, the values and properties can also be written by means of
SCIL commands. Reading an attribute means that it is used in a SCIL expression, e.g., assigned to a variable or shown in a window. Writing an attribute may imply that its value is changed.
The system objects and application objects - or actually their attributes - are accessed by means of an object notation which contains the object name and type and the attribute name. The Visual SCIL objects are accessed by means of an object name or path and an attribute name.
The system objects and most of the application objects are global and accessible not only within the same application and the same base system, but even in the entire distributed MicroSCADA system. The Visual SCIL objects, on the contrary, are accessible from SCIL only within the same dialog system.
System Objects
General
Overview
The system objects define the hardware and software configuration of the entire MicroSCADA system, as well as the data communication with connected devices. There are two types of system objects:
•
Base system objects (B) which define the base system configuration.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
4 Objects
•
Communication system objects (S) which are images of the physical system devices connected to the communication units (NETs).
The base system objects are kept in the RAM memory of the base system computer as long as MicroSCADA is running. They are not stored on disk, but must be defined at each start-up of the base system. The communication system objects are stored in the communication units (NETs) as long as the units are running. Default values may be stored in the communication programs (board based NETs) as a preconfiguration.
System Object Notation
SCIL refers to a system object value, i.e. an attribute, by an object notation of the following format (the items within curly brackets may be omitted): name: {application} type attribute {index} where
name is the name of the object. The system objects have predefined names which are composed of a three-letter type notation and a sequence number.
application is an application number. Generally not needed.
type is a character indicating the object type: S = communication system object, B = base system object.
attribute
is the attribute to be read or written with the notation. The attribute names are a combination of two letters (A...Z). The attribute determines the data type of the entire notation. The system object attributes are all detailed in the manual System Objects.
index is a number or a range of numbers. The indexes have different meanings depending on the object type and attribute. For instance, for NET line attributes the index generally refers to the NET line number. For some attributes, the index denotes an address. The System Objects manual details the indexing of the attributes.
An index or index range is given in any of the following ways:
•
With an integer number (1 ... 10000), either a positive integer value or an octal number. Octal numbers must be used when addressing bits.
•
With an integer type expression enclosed by parentheses.
•
With an interval enclosed in parentheses, (i..j), where ’i’ denotes the first index number and ’j’ the last. If the index limits are given as expressions (e.g. an object notation or a variable) they should be enclosed by parentheses or spaces. Two points surrounded by parentheses, (..), denotes all the indices of the actual object notation. (i..) means all indices larger than or equal to ’i’, and (..j) all indices less than or equal to ’j’. In an index interval either both or none of the index limits may be given with bit addresses.
27
MicroSCADA
4 Objects
4.2.2
28
Programming Language
SCIL
Technical Reference Manual
There may be no spaces between the items in the object notation.
Base System Objects (B)
1MRS751250-MEN
Description
The base system objects correspond to the devices and applications situated in, connected to, or otherwise known to the base system. They determine the hardware and software properties of the base system and its applications. Each base system has its own set-up of base system objects.
The base system objects have the following names:
SYS
APLn
The base system itself
Applications (n = 1 ... 20)
PRIn
MONn
INDn
Printers ( n = 1 ... 20)
Monitors (n = 1 ... 50)
Input devices: keyboard, mouse, control board (n = 1...50)
STAn
STYn
NODn
LINn
Stations (n = 1 ... 2000)
Station types (n = 1 ... 31)
Nodes: base systems and NETs (n = 1 ... 99)
Links: connection line (n = 1 ... 20)
’n’ represents an ordinal number ("base system object number"). For APL and MON type objects, it can be omitted from the object notations, which means that the notation refers to the current application or monitor respectively.
Some Attributes
Each of the base system object types have their own attributes. Here are some examples:
AS Application State
The state of the application (APL): "HOT" = active, "WARM" = not active, but accessible, "COLD" = passive, not available.
LP
AC
Lines per Page
Number of lines per printed page. Belongs to PRI objects.
Alarm Count
Belongs to APL objects and shows the number of active alarms in the application. The alarm class is given as an index. Index 0 refers to the total number of active alarms.
ABB Automation
1MRS751250-MEN
4.2.3
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
4 Objects
PC Picture Cache Size
The cache memory space reserved for pictures and library representations in main memory. Belongs to SYS objects.
Examples
Examples of some base system object notations:
Notation
APL1:BAS
Value
"HOT"
Explanation
Application number 1 is active.
PRI1:BDT
PRI2:BLP
"NORMAL"
70
Printer number 1 is black and white.
Printer number 2 writes 70 lines per page.
APL1:BAC 20 There are 20 active alarms in application 1.
Communication System Objects
Description
The communication system objects correspond to the devices connected to the communication units. Hence, these devices - communication units, stations, other base systems, workstations and peripherals - can be accessed and controlled from SCIL as communication system objects. Each NET unit has its own set-up of communication system objects.
The communication system objects have the following names:
NETn (or NODn)
APLn
STAn
PRIn
Communication units and base systems (n = 1 ... 99)
Applications (n = 1 ... 32)
Stations (RTUs, PCLs, relays, etc.) (n = 0 ... 255)
Printers (n = 1 ... 8)
The ‘n’ above indicates the number of the objects as known to the NET where they are defined. When handling the objects in SCIL, the 'n' in the object name is the number of the device as known to the current application (according to the device mapping attributes, see appendix B).
Some Attributes
Each of the object types have their own attributes. Here are just a few examples:
SA
IU
Station Address.
The station address of a device. The NET objects and STA objects have a station address.
In Use.
States whether or not the object is in use. Most system objects have this attribute.
29
MicroSCADA
4 Objects
4.3
30
4.3.1
1MRS751250-MEN
PO
ME
Value: 0 ... out of use
1 ... in use.
Protocol
The protocol of a communication line given as an integer, e.g. 1 = ANSI full duplex, 14 = SPA. 0 = the line is not defined.
MEmory address.
The contents of the memory address given as an index. Belongs to the
STA objects (ANSI stations).
Examples
Examples of some communication system object notations :
Notation
STA1:SSA
Value
201
Explanation
Station 1 has station address 201.
NET1:SPO2
PRI4:SIU
STA5:SME1234^5
14
1
0
Line 2 of NET1 uses the SPA protocol.
The printer is in use.
The contents of storage address 1234, bit number 5 in STA5
Application Objects
General
Programming Language
SCIL
Technical Reference Manual
Object Types
The application objects are programmable units which perform various functional tasks in the MicroSCADA application. They constitute data images of physical process or system devices, data registers, SCIL programs, scaling algorithms, facilities for automatic activation, etc.
There are nine types of application objects:
•
Process objects (P) . . . data images of the physical process devices connected to process stations (remote terminal units (RTUs), protective equipment, PLCs, etc.).
•
Scales (X) . . . algorithms for scaling analog process values.
•
Data objects (D) . . . collections of stored data ("historical database").
•
Command procedures (C) . . . SCIL programs.
•
Time channels (T) . . . facilities for automatic time bound activation.
•
Event channels (A) . . . facilities for automatic event bound activation.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
4 Objects
•
Event objects (E) . . . mechanisms for event activated start-up of SCIL programs or program sequences in pictures and dialog objects.
•
Variable objects (V) . . . temporary objects which can contain attributes collected from other objects or arbitrary attributes.
•
Free type objects (F) . . . special objects for the definition of user-defined process object types (not described in this manual, refer to Object Description).
Process objects, scales and free type objects are stored in the process database, which holds an image of the process. Data objects, command procedures, time channels and event channels are all stored in the report database, which a database supporting reporting, calculation and control. These objects are also commonly named reporting objects. Variable objects are stored in the same way as variables (see Chapter 5).
Event objects are not stored at all.
All application objects, with the exception of the variable objects, are global and accessible throughout the entire system.
Application Object Notation
SCIL refers to an object value, i.e. an attribute, by an object notation of the following format (the terms in curly brackets may be omitted in cases where they are not needed): name:{application}type{attribute}{index} where name application type attribute index is the object name. The application object names are logical (symbolical) and can be freely chosen in accordance with the rules given in section 2.2.
is the logical number of the application where the object is stored.
Application number must be given if the object belongs to an application other than the current one (the application where the notation is used). If the object belongs to the same application, the number is omitted. The application number is defined by the
APL:BAP attribute (see the System Objects manual, Chapter 5).
is the type of the object given by using the letters P, X, D, C, T, A,
E, V, S, B or F in accordance with the above.
is the attribute to be read or written by the notation. As a rule, the attribute names are a combination of two letters (A...Z). However, if the object is a variable object the attribute name may be composed of up to 63 characters. The object notation may contain one or none attribute name. The attribute determines the data type of the entire notation when used in expressions.
is a number that distinguishes from each other individual attributes with otherwise identical object notations from each other. Indexes
31
MicroSCADA
4 Objects
4.3.2
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN are used to differentiate individual attribute values, which in all other respects have identical object notations, i.e., the same object name, application, object type and attribute.
As a rule, the indexes refer to the elements of an attribute of vector type. The actual attribute determines the data type of the elements. (In Object Description the data type and the indexing are given for each attribute.) The predefined process object types are an exception. For these objects, the indexes refer to the individual objects in a group, not to attributes of vector type. Still, for a certain attribute, the values are handled as elements in a vector.
An index or index range is marked in either of the following manners:
•
With an integer number, 1 ... 10000. An index of a variable object where the attribute is not composed of two letters must be enclosed by parentheses. In all other cases, no parentheses are needed.
•
With an integer type expression. The expression must be embraced by brackets.
•
With an interval (i..j), where ’i’ denotes the first index number and ’j’ the last. If the index limits are given as expressions (e.g. an object notation or a variable) they should be enclosed by parentheses or spaces. Two points surrounded by parentheses, (..), is interpreted as all the indices of the actual object notation. (i..) means all indices larger than or equal to ’i’, and (..j) all indices less than or equal to ’j’.
No spaces are allowed between the items in the object notation.
Process Objects (P)
Description
The process objects correspond to physical devices connected to the process stations
(RTUs, protection equipment, PLCs), for instance switches, sensors and breakers.
Each input and output connection in the stations is represented by a process object.
Normally, the value of an input object is updated from the process station, while the value of an output object is sent to the station when written with the SCIL command
#SET (section 7.3.).
Some process objects have no correspondence in the stations. These are called ficti-
tious process objects and they can generally be updated only from SCIL programs.
They can, e.g., be used for process simulation or manually updated data.
There are nine predefined process object types depending on the type of object value
(i.e. the input or output connection in the stations): binary input and output, analog input and output, digital input and output, double binary indications, pulse counters and bit streams. In addition, for special purposes, e.g. load management, the programmer can define his/her own process object types by means of free type objects.
32 ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
4 Objects
An updating of a process object value may cause an alarm, an automatic printout, an updating on screen (through event objects, section 4.3.8.), and activation of an event channel (section 4.3.7.).
Process objects with active alarms are included in an alarm buffer, which can be read by SCIL process queries (the function PROD_QUERY, Chapter 8) and displayed as alarm lists. If desired, the process object events can be stored in a history buffer, which can similarly be read with process queries and displayed as event lists.
Some Process Object Attributes
A few process object attributes are described below. All attributes are detailed in the
Application Objects manual.
OV Object value
The value of the process object as registered in the process database. The object value is the value read from the process (input values) or sent to the process (output values). The attribute is a common name for the attributes BI, BO, AI, AO, DI, DO, DB, PC and BS (see below and appendix B). Each object value has a time stamp and an error status code.
BI
BO
AI
AO
AL
HI, LI
Value: 1 or 0 for binary objects, real values for analog objects, bit string for bit streams and integer for the others.
Binary Input
Binary process value from the process to the control system.
Value: 1 or 0.
Binary Output
Binary set value from the control system to the process.
Value: 1 or 0.
Analog Input
Analog measurement value from the process to the control system.
Value: real.
Analog Output
Analog set value from the control system to the process.
Value: real.
Alarm.
States whether the object is in alarm state or not.
Value : 0 - no alarm
1 - alarm state.
Lower Input, Higher Input
Lower and higher alarm limits. These attributes are defined only for analog objects with an alarm function.
Value: real.
ABB Automation
33
MicroSCADA
4 Objects
4.3.3
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
If the object notation is given without any attribute, the attribute is assumed to be OV, except in connection with the commands #LIST, #CREATE, #DELETE and
#MODIFY (Chapter 7), where the whole object is referenced to.
Groups and Indexes
Related process objects (up to 255) of the predefined types may be given the same name. Process objects with the same name form a process object group. The individual objects in a group are accessed by means of indexes. A process object notation of any predefined type without an index is interpreted as the lowest indexed object with the given name and attribute (attributes common to the group are always used without indexes) .
Concerning user-defined types (defined by free type objects), the indexes refer to the elements of a vector type attribute. A notation without indexes means the entire vector.
Examples
Some examples of process object notations:
Notation
SWITCH:P
SWITCH:POV
SWITCH:PBI23
TEMP:POV(%N+1)
TEMP:PHI
TEMP:PLI
TEMP:PAL
Scales (X)
Value
1
1
1
37
90.0
10.0
1
Explanation
The value of the process object (the lowest indexed object in the group).
- " -
The switch with the index 23 is connected.
The value of the expression %N+1 is calculated and used as an index.
Alarm is given when the temperature rises above 90.
or falls below 10.
Alarm state prevails.
Description
Scales are related to the process objects, or more exactly, to the analog process objects. They define algorithms for the transformation of the digital process values transferred from the stations to the values of the analog units of the corresponding process objects.
Every analog process object has a scale name, which defines the scaling algorithm is to be used for the transformation. The same scale can be used by several process objects.
34 ABB Automation
1MRS751250-MEN
4.3.4
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
4 Objects
Some Scale Attributes
Below are two scale object attributes. All attributes are detailed in the Application
Objects manual.
LN Logical Name
Value: text.
SA Scaling Algorithm
Value: 0 = 1:1 scaling
1 = linear scaling
2 = step-wise linear scaling
Data Objects (D)
Description
Data objects (datalog objects) register and store calculated or sampled data. They are used for the storage of report data, trend data, data for calculation and control, system configuration data, etc. The data objects can also be used instead of global variables when there is a need for exchanging data between different objects.
The data registration may be initiated from a program (by means of the commands
#EXEC and #EXEC_AFTER, see section 7.3.), from a time channel (section 4.3.6.) or from an event channel (section 4.3.7.). Each registration is performed according to a SCIL expression and a logging function. Besides the calculated or sampled value, each registration includes a time stamp and a status code.
Every data object can store a chosen number of data registrations (up to 65535). The registrations, up to 10000 at a time, can be accessed as vectors by means of indexes.
The oldest registered value has the index number 1.
Some Data Object Attributes
Some of the most important attributes are listed below. A complete description is given in the Application Objects manual.
OV Object Value.
Registered value.
Value: real or vector of real values.
RT
OS
Registration Time.
Value: time or vector of time values.
Object Status.Indicates the reliability of the registered data.
Value: Integer or vector of integers. The status codes listed in appendix C, e.g.:
0 ... OK
1 ... uncertain
10 ... no values.
35
MicroSCADA
4 Objects
4.3.5
36
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
If the object notation lacks an attribute, the attribute is assumed to be OV, except in connection with the command #EXEC or #EXEC_AFTER (section 7.3.), where the notation refers to the whole object.
The above mentioned attributes are used indexed. An object notation with these attributes without any index refers to the latest registered value.
Examples
Some examples of data object notations:
Notation
DATA:D
Value
5.6
DATA:DOV
DATA:DRT
DATA:DRT(5..)
DATA:DOV(1..(DATA:DLR))
5.6
Explanation
The latest registered value of the data object.
The latest registered value of the data object.
Time of last registration given as time data. Can be converted to calendar time by means of time functions (section 8.3.).
The vector formed by the registration times for the datalog object DATA starting with registration number 5.
The values of the registered data ranging from the oldest one to the last registration
(LR).
Command Procedures (C)
Description
The command procedures contain SCIL programs which can be started automatically or by SCIL. They can be used for all kinds of manually or automatically started operations, such as calculations, control operations and reporting. They cannot be used for affecting the user interface. Command procedures can be started in the following ways:
•
From SCIL programs with the #EXEC and #EXEC_AFTER commands (section
7.3.). (A command procedure can even start itself).
•
From time channels (section 4.3.6.).
•
From event channels (section 4.3.7.).
After a command procedure has been started, it is normally executed to the end. It may be interrupted by an error and by the #RETURN command (section 7.3.).
A command procedure can hold up to 10000 SCIL statements. As a rule, command procedures may not contain user interface related commands (picture commands, Visual SCIL commands or graphical commands, see section 7.1.). However, a command procedure, or a selected part of it, can be handled as a vector and be executed with the
ABB Automation
1MRS751250-MEN
4.3.6
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
4 Objects
#DO command (section 7.3.) and the DO function (Chapter 8). In these cases, it may contain user interface commands if the #DO command or DO function is executed in a user interface object.
Some Command Procedure Attributes
Some command procedure attributes are shown below. All attributes are detailed in the Application Objects manual.
TC Time Channel.
The name of the time channel that starts the command procedure.
Value: text.
IN
OS
Instruction.
The program of the command procedure.
Value: text vector.
Object Status.
States how the last execution succeeded.
Value: The status codes listed in appendix C, e.g.:
0 ... correctly executed
10 ... not executed.
A command procedure notation without an attribute refers to the program, i.e., the IN attribute.
Indexes can be used only with the attribute IN where they refer to the line numbers.
The IN attribute without indexes refers to the whole program.
Examples
Some examples of command procedure notations :
Notation
TASK:C
TASK:COS
TASK:CIN5
Value
0
"@VAR = 10"
Explanation
The program as a text vector.
The program execution succeeded.
The fifth line of the command procedure
TASK.
Time Channels (T)
Description
Time channels are used for the automatic start-up of time-bound activities, which can be:
•
The registration of data objects.
•
The execution of command procedures.
37
MicroSCADA
4 Objects
4.3.7
38
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
A certain time channel can start several data objects and command procedures. The execution order is determined by the priorities of the data objects and command procedures.
A time channel is activated at the execution time which means that the connected objects are executed. At the initialization time, the time channel is initialized, which means that the registration of connected data objects is restarted from the first record.
Both initialization and execution can take place at absolute points of time or periodically with a fixed interval. All times are given with an accuracy of one minute. Discontinuous time activation is obtained with conditional expressions.
Time channels can be executed also with the #EXEC commands (section 7.3.) and with event channels (section 4.3.7.).
Some Time Channel Attributes
Some time channel attributes are listed below (a complete list is found in the Application Objects manual):
IU States whether the time channel is in use or not.
Values: 0 = not in use
1 = in use
RT The time of last initialization/activation.
Value: time vector
The time channels can be used without an attribute only with the #EXEC commands.
Indexes (1 or 2) can be used e.g. together with the RT attribute. Index 1 refers to the initialization time and index 2 the activation time.
Event Channels (A)
Description
Event channels are used for the automatic start-up of event-bound activities. The events normally originate from the process database, from where the event channels transmit them to objects in the report database which take the consequential actions
(calculations, control actions, etc.). An event channel can start the following operations:
•
Registration of a data object.
•
Execution of a command procedure.
•
Activation of a time channel.
Each process object may have only one event channel, but an event channel may be connected to up to 11 command procedures and data objects. At the activation of an event channel, some essential attributes are transmitted as variables from the process
ABB Automation
1MRS751250-MEN
4.3.8
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
4 Objects object to the connected reporting object. Thanks to this feature, several process objects can share the same event channel.
An event channel is activated by the following events in the activating process objects:
•
An alarm comes or goes.
•
The warning limits or alarm limits of an analog object are transgressed (provided that the control system, not the RTU, handles the limit value supervision).
•
The OV attribute (BI, BO, AI, AO, DI, DO, DB, PC or BS) is changed.
•
The OV attribute is updated.
The options are chosen with a process object attribute (AA). Event channels can also be activated with SCIL (the #EXEC commands, section 7.3.).
In addition, any user-defined attribute can activate the event channel of the object.
Some Event Channel Attributes
Examples of attributes (a complete list is found in appendix B) :
OT
ON
Object Type.
The type of the object to be executed.
Value: text.
Object Name
The name of the object to be executed.
Value: text.
Event Objects (E)
Description
The event objects are used to start event-bound activities, normally updates, in user interface objects (pictures and Visual SCIL objects).
In pictures, the activation of an event object causes the execution of the statement(s) determined by the #ON command (section 7.3.) for the specific event object. The
#ON commands are valid only for the actual picture - main picture or sub-picture where they have been executed. The event causes no action if there is no #ON command in force for the actual event in the picture shown on screen at the event moment.
In dialogs and dialog items, the activation of an event object starts the execution of the event method, if any, defined to be activated by the event object in question.
ABB Automation
39
MicroSCADA
4 Objects
4.3.9
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
An event object can be activated in two ways:
•
From the process database, so that a change in a process object automatically activates an event object with the same name and index as the process object.
The activation takes place independently of what causes the change - a change of state in a station or an assignment in a SCIL program (by the command #SET, section 7.3.). The coupling of an event object to a process object is optional. The activating attributes are listed in the manual Application Objects, Chapter 3, the
EE attribute description.
•
From a SCIL program (in a picture or a command procedure) by the #EXEC commands (section 7.3.). In this case the name of the event object can be freely chosen.
If a process object is equipped with an event object, updating in pictures is carried out automatically and immediately when a change occurs. The value of the changed attribute is not transmitted to the picture, nor is any information about which attribute has changed.
The event object notation does not contain any attribute. Event objects have no values, hence they cannot be parts of expressions.
Example
If the process object
TEMP:P2 is equipped with an event object (EE = 1), the event object
TEMP:E2 is always activated when a change in the process object (for instance the attribute AI) occurs in the process database.
Variable Objects (V)
Description
The variable objects serve as temporary storage places for attributes. They are used to compose lists, e.g. alarm and event lists, to browse through the object properties, to copy objects, to create and modify objects, etc.
A variable object is at the same time both an object and a variable of list type (section
3.9.). The list as a whole is handled as a variable with the same name as the object
(Chapter 5). The attributes in the list are accessed with a variable object notation.
40 ABB Automation
1MRS751250-MEN
4.4
4.4.1
ABB Automation
MicroSCADA
4 Objects
A variable object can be created and assigned attribute values in two ways:
•
By creating the variable object with the #CREATE command (section 7.3.) and assigning it attribute values with a list function or with the #SET command
(7.3.). In this case, the attribute names may be arbitrary, up to 63 characters.
•
By assigning a variable the value of a list type expression (section 5.2.). A variable object with the same name as the variable is formed. The variable object gets all the attributes of the list expression. This may be a list type function
(Chapter 8) or a list type variable.
A variable object notation must always contain an attribute. Unlike the other object types, the names of the variable object attributes can contain 1 ... 63 characters. If the attribute is of vector type, the vector elements are identified by indexes. An object notation without an index denotes the whole vector. If the attribute name contains more or less characters than two, the index must be enclosed by parentheses.
Like variables (Chapter 5), the variable objects belong to the picture, command procedure or dialog system in which they are assigned values. The same name may be used for different variable objects, provided that they appear in different contexts.
The variable objects are stored in the same way as variables and can be transferred between different objects as variables, see section 5.1.
Examples
The statement
@VAR = PROD_QUERY(20) assigns the variable VAR the value of the list defined by the function PROD_QUERY
(Chapter 8). At the same time the variable object VAR is formed.
Some variable object notations:
Notation
VAR:VLN1
VAR:VOV1
Value
"SWITCH"
0
Explanation
The first object name in the list.
The first object value in the list.
The first ten object names in the list.
VAR:VLN(1..10)
User Interface Objects
Pictures
Programming Language
SCIL
Technical Reference Manual
General
The pictures and picture components were briefly described in Chapter 2. The Picture
Editing manual describes how to build and program the pictures. This section discusses how to reference pictures and picture elements from SCIL.
41
MicroSCADA
4 Objects
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
In SCIL, the pictures and windows are handled by the picture handling commands described in section 7.2. In addition, the windows may have attributes which are accessed by a window attribute reference. The named programs of the pictures are executed by a named program call.
Picture Hierarchy
A picture may contain a number of sub-pictures in the shape of pictures shown in windows and picture functions. These sub-pictures in turn may contain sub-pictures.
A picture and its sub-picture form a picture hierarchy with the main picture (total picture) on the top. Figure 8 shows an example of such a hierarchy. A, B, C, D, E and
F denotes windows and picture functions.
Main picture
42
Sub-picture 1 Sub-picture 2 Sub-picture 3
Sub-picture 4 Sub-picture 5 Sub-picture 6
Figure 8. A hierarchical picture structure. The subpictures are picture functions or pictures shown in windows. The letters A ... F denotes the names of windows and picture functions.
A picture containing sub-pictures is the parent of its sub-pictures and the contained sub-pictures are children. This parent - child - relationship is of importance for how the windows are shown in relation to other windows. It is also of importance when referencing windows and named programs.
Picture Paths
When referencing windows and named programs, a picture path may be used. A picture path states in which picture - main picture or sub-picture - the window or named program should be searched. A picture path has the following format: name/name/name/ ... /name where each ‘name’ is the name of the window or picture function containing the next picture in the hierarchy counting from the picture where the command is issued.
(Back slash \ could be used instead of forward slash /. ) The main picture can be referenced with the predefined name ROOT. If the picture is included in a dialog system
(see section 4.4.2.) ROOT also refers to the picture container where the picture is included.
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
4 Objects
If no picture path is given, the window or named program is first searched from the same picture as where the reference is issued. If not found there, it is searched from the parent picture and so on up to the main picture. Hence, when referencing windows and programs within the same picture or its parent picture, no path is needed.
For example, the picture path for referencing a named program SAMPLE in subpicture 4 in Figure 8 from the main picture would be:
A/D
If not found in sub-picture 4, the program is searched in sub-picture 1 and then in the main picture.
Picture Object Attributes
The programmer can assign the windows and picture functions attributes for various purposes using the .SET command described in see section 7.4. The attributes have no functional meaning, but can be used, e.g., as window or picture function specific variables. The attributes may be given freely chosen names of up to 63 characters in accordance with the rules in section 2.2. They can be assigned data of any data type.
The window and picture function attributes are referenced according to the following format:
[picture].attribute
where ‘picture’ is the picture path and ‘attribute’ is the attribute name.
The attribute reference can be used in SCIL expressions where the value of the attribute replaces the reference. The operations allowed depend on the data type of the attribute (see Chapter 6). If the attribute is of vector type, the attribute reference denotes the entire vector. The picture object attributes cannot be indexed.
The picture object attributes can also be expanded in the same way as variables (see
Chapter 5).
Examples:
.
SET PIC_FUNC_1/WINDOW_2.RESIZED = TRUE
.SET .COUNTER = 0
.SET .COUNTER = .COUNTER + 1
ABB Automation
43
MicroSCADA
4 Objects
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Named Program Calls
Each picture can have a number of named programs which are started with the following program call:
[picture].program [(argument_list)]
where
’picture’ is the picture path to the object containing the named program, see above. If omitted, ’program’ is searched for in the picture containing the program call. If not found there, it is searched in its parent picture, and so on.
The name of the named program.
’program’
‘argument_list’ Arguments given as a list of SCIL expressions separated by commas and enclosed in parentheses. Up to 32 arguments may be given.
When encountered in a program, the program call starts the execution of the named program in the given picture. The subsequent statement in the calling program is not executed until the named program has been executed to the end. If no program with the given name is found, an error status is produced. Named programs can be executed from any program in the dialog system. They are also used as callback programs of Motif widgets.
The value of the arguments are used by means of the ARGUMENT functions, see
Chapter 8.
By using the SCIL command #RETURN (see section 7.3.) in the named program, it can be programmed to return a value to the calling program. A named program which returns a value can be used as operand in expressions, e.g. it can be assigned to a variable.
44 ABB Automation
1MRS751250-MEN
4.4.2
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
4 Objects
Example:
A/B.CREATE_ERROR_DIALOG
Executes the named program CREATE_ERROR_DIALOG of window B which is a child window of window A.
@A = .MY_NAMED_PROGRAM (125,%V+6,”ABC”)
The program MY_NAMED_PROGRAM is executed and its return value is assigned to the variable A.
Visual SCIL Objects
General
The Visual SCIL objects correspond to the dialogs, dialog items and images designed in the Dialog Editor or created with SCIL. There are about 40 types of Visual SCIL objects which could be grouped as follows:
•
Dialogs. These are of two types: ordinary dialogs and main dialogs.
•
Compound dialog items. These are dialog items which may contain other dialog items:
•
Containers - visible or invisible boxes containing other dialog items.
•
Picture containers. These are containers which can contain pictures.
•
Menu bars, menus and menu items. Menu bars can contain one or more menus, menus can contain menus and menu items.
•
Notebooks, notebook pages and notebook items.
•
Simple dialog items, such as buttons, toggle buttons, texts, lists, etc. The simple dialog items can contain no other objects.
•
Images.
In SCIL, the visual SCIL object types are referred to by names starting with VS_. For instance, buttons are named VS_BUTTON. The manual “Visual SCIL Objects” lists and describes all the Visual SCIL object types.
Generally, the dialogs, dialog items and images are designed in the Dialog editor, though they can also be created directly with SCIL. Dialog and dialog items created in the dialog editor are stored in files from where the SCIL command .LOAD loads them in the memory as a visual SCIL object with a specific name. Objects created with
.CREATE are not stored in files.
The SCIL commands for handling Visual SCIL objects are detailed in section 7.4.
Unlike the system and application objects, the Visual SCIL objects are not global.
They are known and accessed only within the dialog system where they are created or loaded.
Dialog Systems
The Visual SCIL objects are arranged in hierarchical dialog systems with a main dialog or picture container at the top. Each main dialog and each dialog system starts a
45
MicroSCADA
4 Objects
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN new dialog system. The object hierarchy is of importance when referencing the objects.
Objects containing another object are called parent objects and the contained objects are called child objects. The child objects are dependent upon their parent objects.
When the parent objects are loaded the child objects are loaded as well, and when the parent objects are deleted (with the .DELETE command), the child objects are also deleted.
When loading a dialog or a dialog item with the .LOAD command, it becomes a child object of the loading object (unless object path is given, see below). When loading a main dialog or picture container, it starts a new dialog system.
Figure 9 shows an example of a Visual SCIL dialog system with four dialogs. Dialog
1, which is the main dialog, contains four dialog items. Dialog item B loads dialog 2.
This dialog contains three dialog items, one of which, object G loads dialog 3. Dialog item D contains two dialog items, and dialog item F contains two items. For instance,
D could be a menu bar containing menus, which contain menu items (menu options).
Dialog item J loads dialog 4.
The dialog items A ... D are child objects of the main dialog. Dialog 2 is the child object of item B and the parent object of the dialog items G ... I. Dialog 4 is the child object of item J which is the child object of item F, and so on.
46
Figure 9.
An example of a dialog system
Attributes and Methods
The attributes of the Visual SCIL objects specify their features and functions, e.g., visibility, position, text contents, behavior, color, fonts, etc. Some attribute values can be set in the dialog editor, some only with SCIL, and some both in the editor and with
SCIL.
The dynamic changes of the dialogs and dialog items are obtained by changing their attribute values with the SCIL commands .SET and .MODIFY.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
4 Objects
Each object has a number of predefined attributes with predefined names, data types and meanings. The predefined attributes of each object type are listed and described in the manual Visual SCIL Objects. In addition, the objects can be given an arbitrary number of user defined attributes with the .LOAD, .CREATE and .MODIFY commands.
Each dialog and dialog item may have a number of methods which are programs for various purposes, e.g. cyclically executed programs, programs executed on certain events (event objects), programs started by a user operation, and programs started by
SCIL.
The programs started by SCIL may be predefined or user defined. They are started by a method call of the format described below.
Visual SCIL Object References
When designing a dialog or dialog item in the Dialog Editor, each item may be given a name. This name will be the Visual SCIL object name of the item when it is included in a dialog or dialog item loaded with the .LOAD command. The loaded dialog or dialog item is given a Visual SCIL object name with the .LOAD command. Objects created with .CREATE are given object names with this command.
Object references are used when loading, creating and deleting objects, and in the attribute references and method calls. When referring to an object one level below, the object name is sufficient. When referring to an object that is more than one level below, object path should be given as follows: name\name\name\.... \name where each ‘name’ is a Visual SCIL object name.
There are the following predefined path names:
ROOT = the main dialog or picture container on top of the dialog system.
PARENT = the parent of the object.
THIS = the object in question.
PARENT and ROOT are the only possibilities for accessing objects on a higher level in the hierarchy.
Attribute References
Attributes are referenced with the following notations:
[ object
]
.attribute
where ‘object’ is an object reference and ‘attribute’ is the name of the attribute.
If the attribute or method is referenced from a method within the same object, no object reference is needed. Likewise, when referencing to an attribute belonging to a
47
MicroSCADA
4 Objects
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN child object that is one level below, no object name is needed, if no confusion may occur.
Attribute references can be used in expressions which means that the reference is replaced by the value of the attribute. They are also used together with the .SET command to achieve a change of the attribute. The attribute references can be expanded like variables, see Chapter 5.
Example:
.SET MY_BUTTON._TITLE = “OK”
This statement sets the label of the button (the visual SCIL object MY_BUTTON) to
OK, which is immediately shown on screen if the button is shown.
Method Calls
Method calls start the execution of methods - predefined methods and user defined methods. In cases where the method returns a value, the method reference can be used similar to the attribute reference, i.e., it can be used in expressions and the reference is replaced by the returned value. Method calls have the following format:
[object].method [(argument_list)]
where
‘object’ is an object reference. Not needed when referencing methods in the same object or one level below.
is method name.
‘method’
'argument_list' Arguments, which may be any SCIL expressions given as a list of
SCIL expressions separated by comma and enclosed in parentheses. Up to 32 arguments may be given.
If the method is a SCIL program, the arguments are used by means of the
ARGUMENT functions (see Chapter 8). By using the SCIL command #RETURN, the method can be programmed to return a value. If the method returns a value, the method call can be used in expressions, and the returned value replaces the method call.
48 ABB Automation
1MRS751250-MEN
5
5.1
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
5 Variables
Variables
This chapter describes the use of variables in SCIL:
5.1
General Rules: variable names and variable contexts
5.2
Using Variables: how to assign the variables values and how to use the variables, indexing variables
5.3
Some Predefined Picture Variables
General Rules
In contrast with constants, the variables have no fixed values. A variable is a name which may be assigned any value. After the assignment, the variable name represents this value within the variable context in question (see below).
On assignment, the variable automatically becomes of the same data type as the assigned value. All SCIL data types (Chapter 3) are allowed as variable values. The values of variables, and also their data types, may be changed at any time by new assignments.
Variable Names
The variable names may be freely chosen in accordance with the rules in section 2.2.
The variable names may contain up to 63 characters.
Variable Contexts
The variables are not stored on disk. They exist only as long as the variable context where they are defined exists in the primary memory. A variable can be used within the context where it was defined (assigned a value) but generally not outside it. The following objects form a variable context:
•
A picture. All programs, windows and sub-pictures within the same picture have their variables in common. A variable defined in a window picture, e.g., can be used in the main picture, and vice versa. If window specific variables are desired, use user defined window attributes instead of variables (see Chapter 4).
•
A dialog system. All dialogs and pictures within the same dialog system have their variables in common. Hence, e.g., variables defined in a picture (picture container) can be used in all dialogs opened from that picture. If dialog or dialog item specific variables are desired, use the user defined attributes (see Chapter
4).
•
Each individual command procedure, data object and time channel started with
#EXEC or #EXEC_AFTER or by an event channel.
49
MicroSCADA
5 Variables
5.2
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
•
Command procedures and data objects started by the same time channel. Data objects and command procedures connected to a time channel can use variables defined in command procedures executed earlier by the same time channel (i.e.
which have a higher priority).
Programs executed by the #DO command (section 7.3.) or the DO function (Chapter
8) belong to the variable context where the command or function is situated.
Transferring Variable Values between Contexts
There are the following possibilities for transferring variable values between different contexts:
•
Variable values can be transferred to command procedures, data objects and format pictures (print-out pictures) by means of the commands #EXEC and
#PRINT (section 7.3.).
•
Event channels transmit process object attribute values to automatically generated variables ("snapshot variables") with the same names as the attributes.
These variable names can be used in the connected data objects and command procedures.
•
Pictures printed automatically as the consequence of a process event or by the
#LIST command can use some automatically defined variables ("snapshot variables") which get both their names and values from the attributes of the printed process object.
There are some pre-defined picture variables which are assigned values automatically.
These can be used in pictures anywhere in the application (section 5.3.).
Some base system object attributes have been reserved for the use as "global variables" in application programs: SYS:BUV, APLn:BUV and MONn:BUV.
Using Variables
Variable Assignment
Variables are assigned values with a statement of the following format:
@V = expression where ’V’ denotes the variable name. The expression, which may be of any data type, is evaluated and the value is assigned to the variable. The variable name hereafter represents the value of the expression and is of the same data type.
In the case where the variable is assigned a list type value, a variable object with the name ‘V’ is created on the assignment.
50 ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
5 Variables
If the expression is a vector, e.g. an object notation, another vector variable or a vector aggregate (section 3.6.), the variable becomes of type vector. A variable could also be assigned individual vector elements by indexing the variable name:
@V(i) = expression
@V(i1..i2) = expression where
‘i’, ‘i1’ and ‘i2’ are indexes, see “Indexing” below.
In the first case, the variable will be of a simple data type. In the second case, where an index range is given, the variable will be a vector. If the expression in the second statement is a simple data type, all the named elements are assigned this value. If there are other elements in the vector they remain unchanged.
The rules for indexing variables is described below.
(If the expression is a text constant, the assignment may also be written as follows:
@V character string which is the same as the statement @V = "character string", except that in the first case possible lower case letters are converted to upper case letters. The variable name must not be indexed.)
Examples
Statement
@VAR = ABC:PAI
@TEXT = "ABC:PAI"
@LIST = PROD_QUERY(20)
@A = FALSE
@V = DATA:D(1..20)
@V(1..5) = D1:D(1..5) + D2:D(1..5)
@A = (5,4,OBJ:POV3,CLOCK)
Explanation
The value of the process object is read from the process database and assigned to the variable.
The object value is not read. The variable gets the text value "ABC:PAI".
The variable LIST is assigned the value of the list formed by the function
PROD_QUERY. At the same time the variable object LIST:V is created.
The variable A is given the boolean value
FALSE.
The variable V becomes a vector containing the first 20 registered values of the data object DATA.
The first five elements in the variable V are assigned the values of the sums of the first five registered values of the data objects D1 and D2.
The variable A becomes a vector with four elements.
51
MicroSCADA
5 Variables
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Using Variables in Expressions
After a variable has been assigned a value, this value is referred to as:
%V that is, the variable name preceded by a percent sign.
This notation can be used as an operand in expressions where the value of the variable replaces the notation. The data type of the variable determines which operations may be carried out on it (Chapter 6). No operations may be carried out on list type variables. These may only be copied to a new variable name.
If the variable ’V’ is a vector, individual elements are referred to by means of indexes.
The %V notation without any index refers to the entire vector. See the rules for indexing below.
Examples
Statement
@NEW = 30 * %OLD
@NUMBER = %NUMBER + 1
@LIST2 = %LIST
!SHOW WIN %VAR
@A = %A(1) + %A(2)
Explanation
The variable NEW is assigned the value of the variable OLD multiplied by 30.
The old variable value is incremented by one.
If LIST is a list type variable, also LIST2 becomes of this type and the variable object LIST2:V is created.
The whole vector is shown in the window WIN, which must be of the type MULTIFIELD, BAR or CURVE.
The sum of the elements one and two in variable A.
Indexing Vector Variables
Vector variables may be used either with or without indexes. When giving an index or an index range, the following rules must be obeyed:
•
Indexes are positive integer numbers or integer expressions in the range 1 ...
10000.
•
Indexes are always surrounded by parentheses.
•
An index range is given as (i..j), where ’i’ and ’j’ are positive integer numbers or expressions. The low index ‘i’ should not be greater than the high index ‘j’. (..) represents all indexes of a vector variable. (i..) means all indices larger than or equal to 'i', and (..j) all indexes less than or equal to 'j'.
A vector variable name without an index refers to the entire vector.
52 ABB Automation
1MRS751250-MEN
5.3
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
5 Variables
“Variable Expansion”
The variables can also be used for forming text strings and names. By including a variable in a name or text string, you can assign different contents to the text or name depending on the context. To use a variable as a part of a text or name, enclose the variable name by quotes as follows:
’V’
The value of the variable is now regarded as a text constant that replaces the quote notation. In this case, the variable must be of a simple data type, i.e., it must not be a vector or a list, and it must not be indexed. An extra assignment is required, if the value of vector element or list attribute is "expanded".
This way of using variables is named “variable expansion”. Not only variables but also the variable object attributes, window attributes and Visual SCIL object attributes can be “expanded”, provided that they are not indexed.
Examples
Statement
@LN = "P_METER"
@IX = 22
@PRESSURE = 'LN':PAI’IX’
Meaning
The variable LN is assigned the text value
"P_METER" and the variable IX value 22
The variable PRESSURE is assigned the AI attribute value of the process object P_METER with index 22.
@PRESSURE = P_METER:PAI22 Same meaning as previous but without use of variables.
@QUANTITY=LIST-
(QUANT1="PRESSURE",-
QUANT2="TEMP",-
QUANT3="CURRENT")
@A='QUANTITY:VQUANT1':PAI22
Predefined Picture Variables
Using attributes in variable expansion.
Value of 'QUANTITY:VQUANT1' in this case is
“PRESSURE”. The variable ‘A’ is assigned the value of the AI attribute of the process object
‘PRESSURE:P’ with index 22.
There are some picture variables with pre-defined names and meanings. These variables can be used in pictures throughout the system, but their values depend on the circumstances in which they are used. The predefined picture variable names are:
VIDEO_NR
PIC_NAME
The logical monitor number of the current monitor (application session). The variable is the same as MONn:BAN. It can gain integer values in the range 1...50. The monitor number is selected when an application session is started. This variable should not be changed manually.
The name of the picture (main picture) displayed on screen at the moment. The variable can have text values containing a max. of 10 characters. This variable should not be changed manually.
53
MicroSCADA
5 Variables
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
CURSOR_POS This variable contains the coordinates of the cursor position of the last function key selection. It is always updated when a function key is selected, except when the system is in input mode (after the
!INPUT_VAR, !INPUT_POS or !INPUT_KEY commands). The variable is used, e.g., when building line command keys, see Picture Editing, Chapter 6.
The variable is a vector with four elements:
(x,y,x_rel,y_rel) where x, y = the coordinates related to the upper left corner of the picture, which is (1,1). x = 1 .. 160, y = 1 .. 96.
KEY_POS x_rel, y_rel = coordinates related to the upper left corner of the window where the cursor is situated, which is = (1,1).
This variable contains the coordinates of the last function key selection related to the upper left corner of the key. The variable is updated each time a function key is selected. The variable is a vector of two elements:
(x_rel,y_rel) where x_rel, y_rel = coordinates related to the upper left corner of the key, which is (1,1).
ENTER_POS This variable contains the coordinates of the last click on an
ENTER key. The variable is updated each time a function key containing an !ENTER command which terminates !INPUT_VAR
is pressed, no matter whether the ENTER key contains other statements or not. The variable is a vector of four elements:
(x,y,x_rel,y_rel) where x, y = coordinates related to the upper left corner of the picture
(=1,1).
x_rel,y_rel = coordinates related to the upper left corner of the window in where the ENTER key is situated (= 1,1).
54 ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
5 Variables
Examples
Statement
#EXEC EVENT_’VIDEO_NR’:E
#ON EVENT_’VIDEO_NR’:E !SHOW ....
#IF %CURSOR_POS(2) = 40 #THEN
......
#PRINT 1 ’PIC_NAME’
Meaning
An event object containing the video number is activated. In combination with
#ON sequences, likewise defined with video number, the event is directed to the same monitor.
A statement is executed on the condition that the pressed line is number 40.
The current screen picture is printed.
ABB Automation
55
1MRS751250-MEN
6
6.1
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
6 Expressions
Expressions
This chapter describes how to compose SCIL expressions using various types of operators:
6.1
General Principles
6.2
Arithmetical Operators
6.3
Relational Operators
6.4
Logical Operators
General Principles
Use
In SCIL, expressions are used as follows:
•
For value assignments (objects, attributes, variables).
•
As arguments for functions and commands.
•
As operands in expressions.
By using SCIL expressions, MicroSCADA application data can be accessed from external Windows applications via the DDE protocol.
Composition
Expressions are composed of operands and operators (possibly enclosed by parentheses). The operators are symbols for operations (e.g. + : addition). The operands constitute the objectives for these operations.
Operands
Operands may be:
•
Constants.
•
Variables (Chapter 5).
•
System and application object notations (attributes).
•
Visual SCIL attributes and window attributes.
•
Function calls (Chapter 8).
•
Vector aggregates (section 3.9.).
57
MicroSCADA
6 Expressions
6.2
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
•
Named program calls and method calls (provided that they return a value).
•
Expressions enclosed by parentheses.
The simplest type of an expression is a single operand, which may be a constant, e.g., a text.
The data types of the operands determine which operations that may be carried out on them, what other types of operands they can be combined with and what the result will be. The data compatibility rules for each operator are given in the tables below.
List type operands cannot be operated upon by any operator. They can only stand alone. The list data type is therefore omitted from the compatibility rule tables. The data type of an expression can be read with the function DATA_TYPE (see Chapter
8).
Operators
There are three types of SCIL operators:
•
Arithmetical operators.
•
Relational operators.
•
Logical operators.
In the SCIL expressions, they are evaluated in the above mentioned order of priority.
The operators and their usage are described in the next sections.
Reliability of Data
In SCIL, each data has a status code, which expresses the reliability of the data. As a rule, when an expression is evaluated, it gets the status code of the least reliable operand. Data written explicitly by the programmer or entered by the user always have OK status. A bad status code may originate from a process object value, which have been marked as obsolete due to a communication fault.
The status code of an expression can be read and written with the SCIL function
GET_STATUS and SET_STATUS. The status codes are listed in the manual Status
Codes.
Arithmetical Operators
Use
Arithmetical operators are used for numerical calculations. As operands they demand numerical values, except for addition, which allow text, bit string and byte string operators as well (Table 2).
58 ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
6 Expressions
Operators
SCIL has the following arithmetical operators:
+ addition, positive sign
-
* subtraction, negative sign multiplication
/
**
DIV division exponential operator integer division, the remainder is truncated from the result
MOD modulus operator (the remainder by integer division provided that the operators are positive).
The operators DIV and MOD must be enclosed by spaces. For the other operators, spaces are optional.
Priority Order
The order of priority for the arithmetical operators, i.e. the order in which different parts of an expression are evaluated, does not differ from that in mathematics. It is as follows (operators with the highest priority first):
1) **
2) / , * , DIV , MOD
3) + , -
Operations with the same order of priority are evaluated from left to right. If the expression contains parentheses, these are evaluated first.
Compatibility Rules
Below are rules for what data types can be combined by means of the arithmetical operators and the data type of the resulting expression.
ABB Automation
59
MicroSCADA
6 Expressions
60
Programming Language
SCIL
Technical Reference Manual
Addition, +:
Right op.
Left op.
I = Integer
R = Real
B = Boolean
T = Time
C = Text
S = Bit/Byte String
V = Vector
- = Not allowed
C
S
V
I
R
B
T
Table 2.
Addition rules
I
-
-
V
-
-
I
R
R
-
-
V
-
-
R
R
1MRS751250-MEN
-
-
-
-
-
-
-
B T
-
-
V
-
-
-
-
C
-
-
T
R
C
-
V
S
-
-
-
-
-
S
V
V
V
V
V
V
V
V
-
Subtraction, -:
I = Integer
R = Real
B = Boolean
T = Time
C = Text
S = Bit String
V = Vector
- = Not allowed
Right op.
Left op.
C
S
V
I
R
B
T
Table 3. Subtraction rules
I
-
-
V
-
T
I
R
R
-
-
V
-
T
R
R -
-
-
-
-
-
-
B T
-
-
-
V
I
-
-
C
-
-
-
-
-
-
-
S
-
-
-
-
-
-
-
V
V
V
-
V
-
-
V
As can be seen from Table 2 and Table 3, text data may be added to text data. The corresponding subtraction is not possible.
It is possible to add to or subtract from time data integer or real numbers, which are then regarded as numbers of seconds. The results yielded are of time data type. When time data is added to an integer the result is time data and when added to a real number the result is a real number.
When two time data expressions are subtracted, the result is an integer number stating the time difference in seconds. Hence, this difference cannot be used in operations demanding time data.
If an integer, real or time value is added to or subtracted from a vector (or vice versa), the value is added to or subtracted from every element in the vector. When a vector is added to or subtracted from a vector, the operation is carried out element by element.
For the elements the same rules apply as for simple data types. If one element has a bad status (not OK), the resulting element is given SUSPICIOUS_STATUS. If the number of elements is does not match in the operand vectors, the missing elements are regarded as zero, and the odd elements receive SUSPICIOUS_STATUS.
When two bit strings are added, they are appended together with the left operand to the left and the right operand to the right. When adding two byte strings, they are concatenated in the same way. If the result is longer than 1048576 bytes, the overflowing bytes are lost.
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
6 Expressions
The positive and negative signs do not change the data types of the values they belong to. The signs cannot be used together with boolean, time or text values.
Multiplication, *:
Right op.
Left op.
I = Integer
R = Real
B = Boolean
T = Time
C = Text
S = Bit String
V = Vector
- = Not allowed
I
R
B
T
C
S
V
Table 4. Multiplication rules
I
-
-
V
-
-
I
R
R
-
-
R
R
-
-
V -
-
-
-
-
-
-
B
C
-
-
-
-
-
-
-
-
-
-
-
-
-
-
T
S V
-
-
-
-
-
-
-
-
-
V
-
-
V
V
Division, /:
I = Integer
R = Real
B = Boolean
T = Time
C = Text
S = Bit String
V = Vector
- = Not allowed
Table 5.
Right op.
Left op.
C
S
V
I
R
B
T
Division rules
I
-
-
V
R
R
-
-
R
-
-
R
R
-
-
V
-
-
-
-
-
-
-
B T
-
-
-
-
-
-
-
C
-
-
-
-
-
-
-
S V
-
-
-
-
-
-
-
-
-
V
V
-
-
When a vector is multiplied or divided by an integer or real number (Table 4 and
Table 5) the operation is carried out on every element in the vector.
When a vector is multiplied by a vector, the operation is performed between corresponding elements. For the vector elements the same rules apply as for simple data types. If the number of elements does not match in the operand vectors, odd elements are multiplied by one and the resulting element receives SUSPICIOUS_STATUS.
A vector cannot be divided by another vector.
In cases where either one of the operands (Table 6) is a vector, the operation is performed on each of the vector elements. For the vector elements the same rules apply as for simple data types.
ABB Automation
61
MicroSCADA
6 Expressions
Programming Language
SCIL
Technical Reference Manual
Integer operators
DIV and MOD:
I = Integer
R = Real
B = Boolean
T = Time
C = Text
S = Bit String
V = Vector
- = Not allowed
Right op.
Left op.
I
R
B
T
C
S
V
Table 6.
DIV and MOD rules
I
-
V
I
-
I
-
-
R
-
-
-
-
-
-
-
B
-
-
-
-
-
-
-
T
-
-
-
-
-
-
-
C
-
-
-
-
-
-
-
1MRS751250-MEN
S
-
-
-
-
-
-
-
V
V
-
-
-
-
-
-
Exponential operator, **:
I = Integer
R = Real
B = Boolean
T = Time
C = Text
S = Bit String
V = Vector
- = Not allowed
Right op.
Left op.
T
C
S
V
I
R
B
Table 7.
Exponent rules
I
-
-
-
R
R
-
-
R
-
-
-
-
-
R
R
-
-
-
-
-
-
-
B
C
-
-
-
-
-
-
-
-
-
-
-
-
-
-
T
S V
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Examples
Below are some examples of expressions composed by arithmetical operators. The bit string operators are written here by means of the BIT_SCAN function, which transforms the argument text to bit string. The result of the addition is a bit string and hence it can not be read directly, but it can be read as a text by means of the BIN function .
Expression
"A" + "B"
3**2
5 DIV 2
5 MOD 2
2*3 + 4/2
(2*3 + 4)/2
BIT_SCAN("0101") + BIT_SCAN("0011")
Result
"AB"
9.0
2
1
8.0
5.0
"01010011" (read with the BIN function)
62 ABB Automation
1MRS751250-MEN
6.3
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
6 Expressions
Relational Operators
Use
Relational operators are used for comparing expressions. The result of a comparison is always a boolean value, that is, the relation is either TRUE or FALSE.
Operators
The following relational operators are available in SCIL:
= =
>
< equal to greater than less than
< >
< = unequal less than or equal to
> = greater than or equal to
The relational operators have a lower order of priority than the arithmetical operators.
Accordingly, arithmetical expressions are evaluated before comparisons are carried out.
Compatibility Rules
Table 8 presents rules for what data types may be compared by means of relational operators.
Relational operators:
I = Integer
R = Real
B = Boolean
T = Time
C = Text
S = Bit String
V = Vector
- = Not allowed
Table 8.
Right op.
Left op.
I R
C
S
V
I
R
B
T
B
-
B
-
-
B
-
Rules for relational operators
B
-
B
-
-
-
B
B
-
-
-
B
-
-
-
C
-
-
-
-
B
-
-
T
-
-
-
B
B
-
B
S V
-
-
-
-
-
B
-
-
-
-
-
-
-
-
Comparison of text expressions is based on the fact that each character corresponds to a number in the range 0…255. The characters are ordered so, that the digits (0...9) precede the letters. The letters are arranged in alphabetical order (except the Swedish
Å, which comes after Ä). The upper-case letters precede the lower-case letters.
ABB Automation
63
MicroSCADA
6 Expressions
6.4
64
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Boolean values and text may be compared only with values of the same data type.
Time data can be compared to time data, integer and real values.
Bit strings are compared bit by bit starting from the bit furthest to the left, which is the most significant bit. A 1 is greater than a 0, and an existing bit (0 or 1) is greater than a non-existing bit.
Byte strings may be compared by relational operators. The byte strings are compared numerically byte by byte (each byte has a value 0 .. 255), the first byte being the most significant. If two byte strings of different lengths are identical to their common length, the shorter one is considered ’smaller’.
Vectors cannot be handled by relational operators.
Examples
Below are some examples of expressions containing relational operators .
Expression
"B" > "A"
Result
TRUE
%A - 30 == 0
OBJ:PRT + 60 > CLOCK
BIT_SCAN("0011") < BIT_SCAN("0101")
BIT_SCAN("0101") < BIT_SCAN("010101")
BIT_SCAN("000111") < BIT_SCAN("0101")
BIT_SCAN("010100") > BIT_SCAN("0101")
TRUE, if %A = 30
TRUE, as long as less than one minute has passed since the latest registration time
TRUE
TRUE
TRUE
TRUE
Logical Operators
Use
With logical operators boolean values can be operated upon.
Operators
In SCIL there are the following logical operators:
AND conjunction, "both .. and"
XOR
NOT exclusive or, "either, but not both" logical negation, the opposite
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
6 Expressions
Logical operators have a lower order of priority than the relational operators, that is, relational expressions are evaluated before the logical operations are carried out.
Compatibility Rules
All logical operators demand operands of type boolean. Likewise, the results yielded from logical operations are of type boolean.
In an expression there may be several logical operators. But in cases where the operators are different, connected logical expressions must be enclosed by brackets. See the following example.
Examples
Imagine that A and B are boolean data with the values shown to the left. The logical operators give the following results:
A
TRUE
FALSE
TRUE
FALSE
Wrong:
B
FALSE
TRUE
TRUE
FALSE
A AND B
FALSE
FALSE
TRUE
FALSE
A OR B
TRUE
TRUE
TRUE
FALSE
%A == 1 AND %B == 2 OR %C == 3
A XOR B
TRUE
TRUE
FALSE
FALSE
NOT A
FALSE
TRUE
FALSE
TRUE
Right: or
(%A == 1 AND %B == 2) OR %C ==3
%A == 1 AND (%B == 2 OR %C == 3)
ABB Automation
65
1MRS751250-MEN
7
7.1
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
SCIL Commands
This chapter describes the SCIL commands. It is divided into four sections as follows:
7.1
General: The different types of SCIL commands, the arguments, and a table over all picture handling commands, control commands and Visual SCIL commands.
7.2
Picture Handling Commands: The picture handling commands listed and described.
7.3
Control Commands: The control commands listed and described.
7.4
Visual SCIL Commands: The Visual SCIL commands listed and described.
7.5
VS Object, Window and Picture Function Methods: The methods listed and described.
7.6
VS Object, Window and Picture Function Attributes: The attributes listed and described.
General
Types of SCIL Commands
There are four main types of SCIL commands:
•
Picture commands. Picture commands issues orders to the system concerning picture handling, e.g. producing pictures on screen, showing and erasing windows, etc. They are allowed only in pictures and are characterized by a starting !
(exclamation mark).
•
Control commands. Control commands execute operations concerning objects, system components, printouts, program executions, etc. Control commands are characterized by a starting # (number sign) and they can be used within all types of SCIL programs.
•
Visual SCIL Commands. These commands are characterized by a starting dot (.).
They can be used in user interface objects (pictures and Visual SCIL objects) provided that the logical monitor (application window or session) has been opened as a VS monitor.
•
Primitive graphics commands. The graphics commands handle full graphical elements. These commands can be used in MicroSCADA pictures and Visual
SCIL objects. The graphics commands are described in Chapter 9.
•
Motif widget commands. These commands can be used in MicroSCADA pictures and Motif widgets. They are described in Chapter 10. It is not recommended to use Motif Widget commands in new applications.
67
Command
!CLOSE
!FAST_PIC
!INT_PIC
!LAST_PIC
!NEW_PIC
!RECALL_PIC
!RESTORE
!STORE_PIC
!UPDATE
!ERASE
!SHOW
!SHOW_BACK
!WIN_BG_COLOR
!WIN_CREATE
!WIN_INPUT
!WIN_LEVEL
!WIN_NAME
!WIN_PIC
!WIN_POS
!WIN_REP
!CSR_ commands
!ENTER
!INPUT_KEY
!INPUT_POS
!INPUT_VAR
!RUBOUT commands
!TOGGLE_MOD
!SEND_PIC
!RESET
MicroSCADA
7 SCIL Commands
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Arguments
Most commands require arguments to become complete statements. The arguments of a command specify its objectives and provide additional information. In this chapter, the commands are written in upper case letters and the arguments in lower case letters. Arguments in square brackets ([]) are not obligatory. There must be at least one blank space between a command and its arguments.
Overview
The following tables list all picture commands, control commands and Visual SCIL commands (without their arguments), the tasks they execute and the pages where they are described.
Brief Description
Page
Closes the monitor. ................................................................................................ 70
Adds and removes fast picture definitions in semi-graphic monitors. .................... 70
Displays an alarm picture....................................................................................... 71
Displays the previous picture. ................................................................................ 71
Displays a picture................................................................................................... 72
Recalls a stored picture name................................................................................ 73
Stops function key blinking..................................................................................... 73
Stores the present picture name. ........................................................................... 73
Defines the update time interval............................................................................. 74
Erases a window from the screen. ......................................................................... 75
Shows a window. ................................................................................................... 75
Shows the picture background of a window. .......................................................... 76 pecifies the color of the background behind the window........................................ 76
Creates a window................................................................................................... 77
Assigns a window an expression. .......................................................................... 77
Specifies the level parameter of the window.......................................................... 78
Creates a new window. .......................................................................................... 78
Selects a picture to be shown in the window. ........................................................ 79
Positions a window................................................................................................. 79
Selects a library representation for a window. ....................................................... 80
These commands move the data entry cursor. ...................................................... 81
Completes data entry. ............................................................................................ 81
Reads function key information.............................................................................. 81
Reads mouse or cursor position. ........................................................................... 82
Reads an input value from the user. ...................................................................... 83
Delete input data.................................................................................................... 83
Insert/typeover. ...................................................................................................... 84
Copies the picture (semi-graphic) to a printer. ....................................................... 84
Deletes variables in a picture. ................................................................................ 84
68 ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
Command
#BLOCK commands
#CASE, #WHEN, etc.
#DO
#IF, #THEN, etc.
#LOOP, #LOOP_END
#LOOP_WITH, #LOOP_END
#LOOP_EXIT
#ON
#PAUSE
#RETURN
#CREATE
#DELETE
#EXEC
#EXEC_AFTER
#GET
#MODIFY
#SET
#INIT_QUERY
#SEARCH
#LIST
#ERROR commands
#ERROR RAISE
#ON ERROR
#ON KEY_ERROR
#PATH commands
#REP_LIB commands
#CLOSE_FILE
#CREATE_FILE
#DELETE_FILE
#OPEN_FILE
#READ
#READ_KEYS
#READ_NEXT
#READ_PREV
#REMOVE
#RENAME_FILE
#WRITE
#SET_TIME
.CREATE
.DELETE
.LOAD
.MODIFY
.SET
Brief Description
Page
Compound statements (block)................................................................................ 85
Case dependent execution of statements. ............................................................. 85
Executes SCIL statements. .................................................................................... 86
Conditional statements. .......................................................................................... 87
Executes a loop. ..................................................................................................... 88
Executes a loop a chosen number of times............................................................ 89
Interrupts a loop. .................................................................................................... 90
Executes a program block when an event occurs. ................................................. 90
Defines a pause. .................................................................................................... 91
Stops the program execution and evaluates the ‘expression’. ............................... 91
Creates a new object.............................................................................................. 92
Deletes an variable, object or variable object......................................................... 92
Executes an object. ................................................................................................ 93
Executes an object after a time delay..................................................................... 94
Updates process object values............................................................................... 95
Changes an object definition. ................................................................................. 95
Assigns values to objects. ...................................................................................... 96
Initiates a process query......................................................................................... 97
Initialises a search among objects.......................................................................... 98
Prints process object data. ..................................................................................... 100
Prints a picture. ...................................................................................................... 101
Define error handling policy.................................................................................... 102
Activates an error status......................................................................................... 103
Defines an error handler......................................................................................... 103
Defines a key error handler. ................................................................................... 103
Defines a logical path name. .................................................................................. 104
Defines a logical representation library name. ....................................................... 106
Closes a keyed file. ................................................................................................ 107
Creates and opens a new keyed file. ..................................................................... 108
Deletes a file........................................................................................................... 108
Opens a keyed file.................................................................................................. 109
Reads a keyed record in an open file. .................................................................... 110
Reads the keys of an open file. .............................................................................. 110
Reads a keyed record. ........................................................................................... 111
Reads a keyed record. ........................................................................................... 111
Deletes a keyed record........................................................................................... 112
Renames a file. ...................................................................................................... 112
Writes a keyed record in an open file. .................................................................... 113
Sets the system time. ............................................................................................. 113
Creates a Visual SCIL object.................................................................................. 114
Deletes a Visual SCIL object. ................................................................................. 115
Loads a Visual SCIL object. ................................................................................... 115
Modifies one or more attributes of a Visual SCIL object......................................... 116
Assigns a value to a user interface attribute........................................................... 117
7.2
Picture Handling Commands
The picture handling commands can be used only within MicroSCADA pictures.
They are not allowed in dialogs, or in command procedures.
ABB Automation
69
70
MicroSCADA
7 SCIL Commands
7.2.1
Programming Language
SCIL
Technical Reference Manual
General Picture Handling Commands
1MRS751250-MEN
!CLOSE
Closes the monitor.
On full graphic operator consoles, the command ends the application session by closing the kernel process of the monitor (PICO).
On a semi-graphic monitor, the command empties the screen from pictures and makes it turn black. The monitor can be refreshed by clicking the mouse, which loads the
MicroSCADA start picture on screen. If there are pictures in the monitor alarm picture queue when the !CLOSE command is issued, the monitor screen is not emptied but instead the oldest alarm picture in the queue is displayed on screen. If an alarm occurs while the monitor is kept closed, and the monitor in question is defined as an alarm monitor for the object, the alarm picture is immediately displayed.
!FAST_PIC [picture]
!FAST_PIC - [picture]
!FAST_PIC [-] [picture] , [-] [picture] , ...
Adds and removes fast picture definitions in semi-graphic monitors.
’picture’ A picture specified as:
[path/] picture name where:
’picture name’ and is the picture name exclusive the extension,
’path’ is a logical path name.
If ’path’ is omitted, the default path names are used. See the PATH command, section 7.3.6.
Default: the present picture.
!
The command applies to semi-graphic monitors only and has no effect in full graphic monitors.
The first command model marks the picture as a fast picture. When the picture is subsequently erased from the screen, it is saved as a fast picture. This means that every dynamic part of the picture is saved in the form it had when the picture was erased.
Updating is, however, terminated as in the case of ordinary pictures. When the picture is again displayed on screen, it has the same appearance as when it was previously
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands erased and updating starts from this state. The start program of the picture is no further executed.
The second command model, where the picture name is preceded by a minus sign, removes the fast picture definition. Henceforth, the picture is no longer stored as fast picture. Several fast picture definitions at a time can be added and removed as shown in the third command model above. Note: if ’picture’ is omitted, the minus sign at the end of the line will denote that the statement is continued on the next line. To avoid this, type two subsequent minus signs and an empty line as shown in the example below.
Fast pictures are monitor specific, i.e. a picture may be a fast picture in one monitor but not in the others.
The fast pictures are continuously stored in the main memory. If there is insufficient main memory storage space in the computer, a large number of fast pictures may delay the handling of the ordinary ones.
All fast picture definitions are cancelled when the system is exited or the application state is changed. After a fast picture has been edited in the picture editor it functions in the normal way until it is stored again.
Example:
!FAST_PIC MYPIC
;Next time the picture MYPIC is exited it is stored as a fast picture.
!FAST_PIC - -
;empty line
;The fast picture definition of the current picture is cancelled. Hereafter it
;functions as an ordinary picture.
!INT_PIC
Displays an alarm picture.
Incoming alarms are added to a monitor (application session or window) specific alarm picture queue. This command displays the oldest alarm picture in the queue. At the same time the name of the picture is removed from the alarm picture queue. If the alarm picture queue is empty, the command has no effect.
In other respects, the command works like !NEW_PIC.
!LAST_PIC
Displays the previous picture.
This command causes the picture handling process to go one step backwards in the queue built up by !NEW_PIC, see Figure 10, and display that picture.
In other respects, the command works like !NEW_PIC.
ABB Automation
71
MicroSCADA
7 SCIL Commands
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
!NEW_PIC picture
Displays a picture.
’picture’ The picture to be displayed, specified as:
[path/] picture name where is the picture name exclusive the extension, ’picture name’ and
’path’ is a logical path name.
If ’path’ is omitted, the default path names are used. See the
#PATH command, section 7.3.6.
The picture with the given name, if it exists, is displayed on screen. First the background becomes visible. After that, possible draw and start programs are executed
(unless the picture is stored as fast pictures, see !FAST_PIC). If the named picture does not exist, an error message is produced.
When a picture is displayed, its picture name is automatically placed as the last item in a monitor specific queue of shown pictures, which is maintained by the picture handling unit. If the picture name already is in the queue, all subsequent picture names are removed from the queue, and the picture name in its former position is thereafter the last item in the queue, see Figure 10.
If ’path’ is omitted, the picture is searched for in the directories defined by the default path name valid for the actual picture name, see the #PATH command, section 7.3.6.
An error status is produced if the picture does not exist.
Examples:
!NEW_PIC MYPIC
;The picture named MYPIC is shown on screen. The picture is searched for in the
;directory/directories defined by the path name PICT.
!NEW_PIC OWNPIC/MYPIC
;The picture MYPIC is searched for in the directory/directories defined by the
;path name OWNPIC.
72 ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
ABB Automation
Figure 10.
The picture queue. Each monitor or picture container has its own picture queue.
!RECALL_PIC
Recalls a stored picture name.
The picture, the name of which is stored by !STORE_PIC (see below), is displayed on screen. The command functions like !NEW_PIC.
The command has no effect if !STORE_PIC has not been used.
!RESTORE
Stops function key blinking.
When a function key has been pressed, it may be marked by blinking (depending on the key definition). This command stops the blinking of all function keys on the entire screen.
!STORE_PIC
Stores the present picture name.
The name of the present picture is stored and it can later be retrieved with the command !RECALL_PIC.
Only one name at a time may be stored in this way. When the command is used again, the previous picture name is removed.
73
MicroSCADA
7 SCIL Commands
7.2.2
74
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
!UPDATE interval
Defines the update time interval.
’interval’ Time interval in seconds given as a positive real expression. The value of ’interval’ is automatically rounded to an accuracy of 0.1
seconds.
If there is an update program in the picture, it is executed repeatedly with this interval as long as the picture is displayed on screen, or until a new !UPDATE command is issued. After the update program has been executed to the completion, it restarts when the time interval given by this command has elapsed. Subsequent !UPDATE commands may change the time interval. The most recently given time interval is valid. If
0 is given as a time interval, the updating ceases until a new interval other than 0 is given.
When an !UPDATE command is issued, the update program is immediately executed once (provided that the interval is unlike 0). The next execution takes place at a synchronization time. After that execution restarts cyclically with the given interval. The time interval between the first and second execution may differ from the interval given with the !UPDATE command.
The main picture, its window pictures and picture functions may have different updating intervals.
Examples:
!UPDATE 5
;The update program is restarted when five seconds have elapsed since the
;previous execution.
!UPDATE %A
;The updating interval is assigned the value of the variable A.
Window Handling Commands
Windows can be defined using the Picture Editor or the !WIN_CREATE or
!WIN_NAME commands together with the !WIN_POS, !WIN_PIC, !WIN_REP, and
!WIN_INPUT commands. Windows are displayed on screen with the !SHOW and
!SHOW_BACK commands and erased from screen with the !ERASE command.
When a window is displayed, it is placed on top of its parent picture (see the picture hierarchy in Chapter 4). Windows which are children of the same parent are arranged according to their level parameter which can be changed with the !WIN_LEVEL
command. Windows with the same parent and the same window level are stacked in the order they were first shown with the !SHOW command so that the newest window is placed on top. The updating of a window with !SHOW has no affect on the stacking order. However, when a shown window is moved by !WIN_POS, it is raised to become the topmost window among the windows with the same level and the same parent. When the level of a displayed window is updated with the !WIN_LEVEL command, the window is stacked as the topmost window among the windows with the same level and the same parent.
The stacking order is the same whether the child window is totally contained within its parent or not.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
!ERASE [picture path]window
Erases a window from the screen.
’window’ The name of the window to be erased.
’picture path’ A picture path according to the format described in Chapter 4. If omitted, the window is sought from the picture or picture function where the command was issued. If the window is not found there, the window is sought from the entire picture.
The command erases the named window from the screen. If the window is of type
PICTURE, a possible exit program is executed when the window is erased. If it contains windows, these windows are erased, too.
Examples:
!ERASE MESSAGE
;The window MESSAGE is erased.
!ERASE TREND/COLUMN
;The window COLUMN in the window (or picture function) TREND is erased.
!SHOW [picture path]window [expression]
Shows a window.
’window’ The name of the window to be shown.
’picture path’ A picture path according to the format described in Chapter 4. If omitted, the window is searched from the picture or picture function where the command was issued. If the window is not found there, the window is searched from the entire picture.
The expression to be shown in the window. Not obligatory.
’expression’
The window is displayed on screen at the location determined by the window definition. The value of the expression is calculated before the window is displayed.
If the expression is given by the !SHOW command, the expression in the window definition is disregarded. If the expression is omitted here, you may define it by the command !WIN_INPUT. Only as the last alternative, the expression is taken from the window definition. If the window is defined as PICTURE or FIGURE, the expression is disregarded.
If the window is of PICTURE type, possible background, draw and start programs are executed when the picture is shown. The update program is executed in the interval given in the window picture, which may differ from that of the main picture.
An error status is produced if the window cannot be found.
Windows are erased with the !ERASE command.
Examples:
!SHOW MESSAGE "ENTER PASSWORD:"
75
MicroSCADA
7 SCIL Commands
76
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
;The text ENTER PASSWORD: is shown in the window called MESSAGE.
!SHOW TREND/COLUMN %MAX
;The variable MAX is shown in the window COLUMN of the window TREND.
!SHOW_BACK [picture path]window [expression]
Shows the picture background of a window.
’window’
’picture path’
The name of the window to be shown.
A picture path according to the format described in Chapter 4. If omitted, the window is sought from the picture or picture function where the command was issued. If the window is not found there, the window is sought from the entire picture.
’expression’ The expression to be shown in the window. Not obligatory.
This command shows the picture background of a window picture. The background of the picture functions included in the picture are shown as well. The background and draw programs of the picture are executed. No other programs are executed. No windows are shown and the function keys do not function.
If the window is of some other type than PICTURE, the command works like
!SHOW.
An error status is produced if the window cannot be found.
The window background is erased with the !ERASE command.
Example:
!SHOW_BACK SCHEME
;The picture background of the window SCHEME is displayed.
!WIN_BG_COLOR [picture path]window color
Specifies the color of the background behind the window.
’window’ The name of the window
’picture path’
’color’
A picture path according to the format described in Chapter 4. If omitted, the window is sought from the picture or picture function where the command was issued. If the window is not found there, the window is sought from the entire picture.
The requested background color given as a named color, a vector of RGB values or a reference, see Chapter 9. Default color: the color defined by the MONn:BWC attribute (see the System Objects manual).
When a window is displayed, the background color can be seen for a moment until the window is drawn on screen. Likewise, when a window is erased, the background color appears for a moment until the background behind the window is redrawn on
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands screen. By choosing an appropriate background color for the window, disturbing color switches can be avoided.
The window background used in the monitor is specified by the base system attribute
MONn:BWC. By means of the !WIN_BG_COLOR command, the SCIL programmer can choose the background color of individual windows. The command may be given before or after the window is shown for the first time.
When a window is shown for the first time, the background color is set to the color defined by the MON:BWC attribute, if not otherwise defined by the
!WIN_BG_COLOR command. Later changes of WC do not affect the background color.
The !WIN_BG_COLOR command is not applicable to semi-graphic monitors.
!WIN_CREATE [picture path]window
Creates a window.
’window’ The name of the window
’picture path’ A picture path according to the format described in Chapter 4. If omitted, the window is created in the picture or picture function where the command was issued.
The command creates a new window during the picture handling. Once the window has been created with this command, it can be assigned a position with the
!WIN_POS command (default position: the upper left corner of the picture), a representation with !WIN_REP (library representation) or !WIN_PIC (picture), and an expression with the !WIN_INPUT or !SHOW command. Similar to windows created in the picture editor, windows created with !WIN_CREATE are shown with the !SHOW
command.
!WIN_CREATE first checks whether the window already exists. If no picture reference is given, the window is searched only within the current picture. If the window already exists, and if it is an ordinary window, the command does not produce any result. If the window exists as a Motif widget, its X background is mapped as a Micro-
SCADA window background to enable SCIL graphics to be drawn on it.
The created window exists as long as the picture is displayed on screen, or stored as fast picture (semi-graphic monitors).
Use !WIN_CREATE instead of !WIN_NAME in cases where !WIN_NAME might have undesired side-effects.
!WIN_INPUT [picture path]window expression
Assigns a window an expression.
’window’ The name of the window.
77
MicroSCADA
7 SCIL Commands
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
’picture path’
’expression’
A picture path according to the format described in Chapter 4.
The expression to be shown in the window.
The command assigns the window an expression which is stored as long as the picture is displayed on screen or stored as a fast picture. The expression is evaluated every time the window is shown with the !SHOW command.
With this command the window expression may be changed during the program execution. The last given expression is valid. Hence, if the expression given with
!WIN_INPUT is intended to be used, no expression should be given with the !SHOW
command.
If ’picture’ is omitted, the window is sought from the picture or picture function where the command was issued. If the window is not found there, the window is sought from the entire screen. An error status is produced if the window cannot be found.
Example:
!WIN_INPUT LINE "TRY AGAIN:"
!SHOW LINE
;The text TRY AGAIN: is shown in the window LINE
.
!WIN_LEVEL [picture path]window level
Specifies the level parameter of the window.
‘window’ The name of the window.
'picture path'
'level'
A picture path according to the format described in Chapter 4.
An integer value in the range -100 ... +100. -100 = the window is placed on bottom, +100 = the window is placed on top. Default value = 0. Instead of values, the following two predefined constants can be used: ON_BOTTOM ( = -100) and ON_TOP (=
+100).
The command specifies the level of the window in relation to other windows on the same level in the picture hierarchy (see Chapter 4.). See the general part of this subsection.
78
!WIN_NAME [picture path]window
Creates a new window.
'picture path' A picture path according to the format described in Chapter 4.
'window' The name of the window.
The command has the same function as the !WIN_CREATE command, except for the following:
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
If no picture reference is given, the !WIN_NAME command searches throughout the whole main picture. If a window with the given name is found, no new window is created.
Example:
!WIN_NAME A
!WIN_POS A (1,1)
!WIN_PIC A A_PIC
!SHOW A
;A window A is created and placed in the upper left corner. The picture A_PIC
;is shown in the window.
!WIN_PIC [picture path]window picture
Selects a picture to be shown in the window.
’window’ The name of the window in which the picture will be shown.
’picture path’
’picture’
A picture path according to the format described in Chapter 4.
The name of the picture to be shown in the window specified as:
[logical path/] picture name where
‘picture name' is picture name exclusive the extension, and
'logical path' is a logical path name.
If 'logical path' is omitted, the default path names are used. See the
#PATH command, section 7.3.6.
With this command you can change the picture name during program execution. The latest issued picture name is the valid one. The name of the window picture is stored as long as the main picture is displayed on screen or stored as a fast picture. The command entails that the picture name in the window definition is ignored.
If 'picture path' is excluded, the window is sought from the picture or picture function where the command was issued. If the window is not found there, the window is sought from the entire screen. An error status is produced if the window cannot be found.
Example:
!WIN_PIC AREA TABLE
!SHOW AREA
;The picture TABLE is shown in the window AREA.
!WIN_POS [picture path]window pos
Positions a window.
'window'
'picture path'
The name of the window to be positioned.
A picture path according to the format described in Chapter 7.
79
MicroSCADA
7 SCIL Commands
80
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
’pos’ The new window position as a vector with two positive integer elements. The first element is the x-position (horizontal coordinate, 1 ... 160) and the second one the y-position (vertical coordinate, 1 ... 96). If ’pos’ contains more than two elements (e.g. the variable generated with the !INPUT_POS command), these elements are ignored.
The upper left corner of the window ’window’ is positioned to the semi-graphic character position specified by ’pos’. If the x-coordinate is larger than 80 or the ycoordinate larger than 48, the window is placed on the control board, outside the screen.
If the window is currently shown, it is immediately erased from the old location and displayed at the new one. The window is placed on the top of all windows with the same level parameter and the same parent. The new location is stored as long as the main picture is displayed on screen or stored as a fast picture.
If ’picture’ is excluded from the command, the window is sought from the picture or picture function where the command was issued. If the window is not found there, the window is sought from the entire screen. An error status is produced if the window cannot be found.
Examples:
!WIN_POS ABC (1,1)
;The window ABC is moved to the upper left corner of the main picture.
!SHOW INFO "POINT OUT A NEW LOCATION"
!INPUT_POS POS
!WIN_POS FIG %POS
;The window FIG is moved to the position pointed out with the mouse.
!WIN_REP [picture path]window representation
Selects a library representation for a window.
‘window’ The name of the window to be assigned a library representation.
'picture path' A picture path according to the format described in Chapter 4.
'representation' The library representation to be used in the window specified as:
[library/] representation where:
'representation' is the name of the representation, and
'library' is a logical library name.
If library name is omitted, the representation is sought from the library DEFAULT. See the command #REP_LIB in section 7.3.6.
With this command the representation to be used in the window may be changed during the program execution. The most recently given representation is valid. The given representation name is stored as long as the main picture is displayed or stored
ABB Automation
1MRS751250-MEN
7.2.3
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands as a fast picture. The command entails that the representation given in the window definition is ignored.
If ’picture’ is excluded from the command, the window is sought from the picture or picture function where the command was issued. If the window is not found there, the window is sought from the entire screen. An error status is produced if the window cannot be found.
Examples:
!
WIN_REP LINE PASSWORD
!SHOW LINE
;The representation PASSWORD states the form for what is to be shown in the
;window LINE. The representation is sought from the file(s) defined by the
;library name DEFAULT.
!WIN_REP LINE ENG/PASSWORD
!SHOW LINE
;The same as above, but the representation is sought from the file(s) defined
;by the library name ENG.
Input Commands
!CSR_LEFT
!CSR_RIGHT
!CSR_BOL
!CSR_EOL
These commands move the data entry cursor.
!CSR_LEFT moves the data entry cursor one step to the left and !CSR_RIGHT one step to the right. !CSR_BOL moves the cursor to the beginning of the input field,
!CSR_EOL to the end of the input field.
These commands may be used only after the !INPUT_VAR command, and have no effect if this command has not been issued.
!ENTER
Completes data entry.
After an !INPUT_VAR command has been executed, the system waits for character inputs until it gets an !ENTER command, or the Enter key on the keyboard is pressed.
If the program containing the !ENTER command (usually a function key program) contains other statements after !ENTER, these are executed. Then the program execution continues with the statements following after !INPUT_VAR.
The command has no effect if no !INPUT_VAR command has been issued.
!INPUT_KEY keytext var
Reads function key information.
’keytext’ This argument states the kind of information to be read:
81
MicroSCADA
7 SCIL Commands
82
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
PROGRAM = the program, HEADER = the function key header,
HELP = the function key help text.
‘var' A variable name. The variable will contain the selected information as a text vector.
The chosen information of the clicked function key is read and placed in the variable
'var'. The variable becomes a vector, the length of which is determined by the chosen information.
After this command has been executed, no other commands are executed until a function key has been clicked.
Example:
!INPUT_KEY HELP V
!SHOW HELP %V
;After the !INPUT_KEY command has been executed, the system waits until a
;function key is pressed. If this has a help text, the text will be shown in
;the window HELP.
!INPUT_POS var
Reads mouse or cursor position.
'var' The name of a variable.
The command reads the coordinates of the subsequent push on the mouse, or the corresponding keyboard operation, and stores the coordinates in the given variable. The entire control board is available. After this command has been executed, no other commands are executed until a position has been pointed out with the mouse.
The variable 'var' becomes a vector with four integer elements:
(x,y,x_rel,y_rel) where:
'x,y' are the coordinates for the cursor position in relation to the upper left corner of the screen which is (1,1). The value range of the xcoordinate is 1 ... 160. The coordinates 1 ... 80 belong to the screen and 81 ... 160 lie on the control board outside the screen. The value range of the y-coordinate is 1 ... 96. The screen part lies in the range 1 ... 48. The coordinates 49 ... 96 are situated on the control board outside the screen.
'x_rel,y_rel' are the coordinates of the cursor position in relation to the upper left corner (= (1,1)) of the window where the !INPUT_POS command is executed. These coordinates may have negative values.
Examples:
!INPUT_POS V
;The position of the following push on the mouse is read and assigned to the
;variable V.
!WIN_POS WINDOW %V
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
;The window WINDOW is moved to the position determined by the variable V (only
;the first two elements are noted, i.e., the first coordinate pairs).
!INPUT_VAR [picture path]window variable max length
Reads an input value from the user.
’window’ Window name of the input field.
’picture path’
’variable’
A picture reference according to the format described in Chapter 4.
Name of the variable to which the input is assigned.
‘max_legth’ Maximum length of the input string (in fullgraphic input fields)
This command allows the user to assign a value to a variable during operation. The window name states in which window the value is echoed. The statement is executed only if the window is defined and is of FIELD type. The window definition determines the data type of the variable (integer, real or text) as well as the number of decimals (if real data).
After this command, the system waits for an input in the form of characters, from the keyboard or control board, until it gets an !ENTER command or the Enter/Line Feed key of the keyboard is pressed. No commands are handled other than those affecting the character input.
Entering data using the control board requires that a character key set is defined in the picture. When using the keyboard, lower case letters are converted to upper case letters. The Nordic letters Å, Ä, Ö, and the German Ü are converted to the corresponding MicroSCADA semi-graphic characters, i.e., the ASCII codes [ , \ , and ].
This command is not allowed in update programs.
Example:
!INPUT_VAR WIND V
;The value of the variable V is read from the window WIND.
!RUBOUT
!RUBOUT_CUR
!RUBOUT_BOL
!RUBOUT_EOL
Delete input data.
!RUBOUT deletes the character to the left of the input cursor.
!RUBOUT_CUR deletes the character in the current position of the cursor.
!RUBOUT_BOL deletes the beginning of the line until, but not including, the cursor.
!RUBOUT_EOL deletes the end of line starting from the cursor position.
83
MicroSCADA
7 SCIL Commands
7.2.4
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
The commands may be used only after the !INPUT_VAR command, and they have no effect if this command has not been issued.
!TOGGLE_MOD
Insert/typeover.
Shifts from type-over (default) to insert and vice versa. The command may be used only after the !INPUT_VAR command and has no effect if this command has not been issued.
Miscellaneous Picture Commands
!SEND_PIC device number
Copies the picture (semi-graphic) to a printer.
’device’
’number’
Device name = LPT (line printer).
Logical printer number. Integer expression, 1 ... 20.
The semi-graphic portions of the picture, in its current format, is copied to a printer
("hardcopy"). The printer starts a new page both before and after the printout.
Depending on the printer definition in the base system (the PRIn:BOD attribute), the printout may be stored on disk.
Example:
!SEND_PIC LPT 1
!RESET
Deletes variables in a picture.
All variables assigned before this command, except for those of the start program, are deleted. At the same time the command !RESTORE (section 7.2.1) is executed.
Example:
@PROFIT = 350000
!SHOW WIND %PROFIT
;350000 is shown in the window WIND.
!RESET
!SHOW WIND %PROFIT
;An error message is displayed.
#ON ERROR !RESET
;The variables are deleted when an error occurs.
84 ABB Automation
1MRS751250-MEN
7.3
7.3.1
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
Control Commands
Program Execution Commands
These commands starts the execution of program blocks, or otherwise affect the program execution. The #DO, #IF, #ELSE, #BLOCK, #LOOP, #CASE and #ON commands can be combined. Altogether, there may be at most 40 of these commands nested inside one another.
See also the #EXEC commands in section 7.3.2. When used with command procedures, these commands start the execution of the command procedure programs.
#BLOCK statement
.....
statement
#BLOCK_END
Compound statements (block).
’statement’ SCIL statements.
#BLOCK may replace ’statement’ after the commands #ON, #THEN and #ELSE and in loops, see below.
Example:
#IF %A > %B #THEN #BLOCK
#IF %A - %B > 10 #THEN #BLOCK
!SHOW_WIN "THE VALUE TOO LARGE"
#BLOCK_END
#ELSE !SHOW_WIN "CHECK!”
#BLOCK_END
#ELSE !SHOW_WIN "OK"
The status code SCIL_INVALID_PROGRAM_STRUCTURE is reported if illegally nested structured statements are found, for example in the following case:
#BLOCK
#LOOP_WITH I = 1 .. 10
#BLOCK_END ;Extraneous #BLOCK_END, still within a #BLOCK
;#LOOP_END
;#BLOCK_END
;#LOOP_END missing
;Proper #BLOCK_END missing
#CASE expression
[#WHEN selector statement
...........
#WHEN selector statement]
[#OTHERWISE statement]
#CASE_END
Case dependent execution of statements.
The command executes different statements or program blocks depending on the value of an expression and a number of selectors.
85
MicroSCADA
7 SCIL Commands
86
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
’expression’
’selector’
’statement’
An expression of type integer, real, text, boolean or time.
The selector can be given according to any of the following formats:
1. An expression of type integer, real, text, boolean, time or vector.
2. A list of integer, real, text, boolean, time or vector expressions, separated by commas.
3. An interval given in any of the following ways: n1 .. n2 n1 ..
.. n2
’n1’ and ’n2’ which means all values in the range n1 ... n2 which means all values above the value of n1 which means all values up to the value of n2.
are integer, real or text expressions.
Expressions must be enclosed by parentheses.
An arbitrary SCIL statement or a block of statement defined by
#BLOCK .... #BLOCK_END
The value of ’expression’ is related to each ’selector’ in the #WHEN commands. The first #WHEN statement where ’selector’ (a value in the list or interval) is equal to ’expression’ is executed. The other #WHEN statements are ignored. If no #WHEN statement was executed, i.e., none of the selectors matched the ’expression’, the
#OTHERWISE statement (if any) is executed.
There may be several selectors which match the expression, but only the first matching #WHEN statement is executed. No error is generated, in case no statement is executed. The status code SCIL_INVALID_PROGRAM_STRUCTURE is reported if illegally nested structured statements are found.
Examples:
#CASE %D
#WHEN 0,3,6,8,9 @SHAPE = "NO STRAIGHT LINES IN THIS DIGIT"
#WHEN 1,2,4..5,7 @SHAPE = "CONTAINS STRAIGHT LINES"
#WHEN .. -1 #BLOCK
@WISE_GUY = TRUE
@SHAPE = "DON''T TRY TO FOOL ME”
#BLOCK_END
#OTHERWISE @SHAPE = "ONE DIGIT ONLY,PLEASE"
#CASE_END
#CASE DATA_TYPE(%D)
#WHEN "INTEGER" @T = 1
#WHEN "REAL" @T = 2
#OTHERWISE !SHOW W –
"SIMPLE NUMERIC DATA EXPECTED"
#CASE_END
#DO expression
Executes SCIL statements.
’expression’ A text expression or a vector expression with text elements. The texts must be composed of SCIL statements.
The #DO command executes the SCIL statement or program defined by ’expression’.
The program is handled as a subroutine of the calling program (the program containing the #DO command). #DO is used for repeated execution of program sequences.
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
Variables defined in the calling program are transmitted to the program represented by ’expression’ and vice versa.
In principle, all kinds of SCIL commands and variable assignments are allowed in
’expression’. However, user interface related commands are not allowed when the
#DO command is executed from a command procedure. In contrast to from the
#EXEC-command (section 7.3.2), #DO immediately executes the program. There is no queue.
Example:
#DO READ_TEXT("ABC.TXT")
;The SCIL program of the file ABC.SCL is executed.
#DO ABC:C
;The program of the command procedure ABC is executed. (The RT and OS
;attributes of the command procedure are not updated).
#IF condition1 # THEN statement1
#ELSE_IF condition2 #THEN statement2
#ELSE statement3
Conditional statements.
’condition1’
’condition2’ boolean type expressions
’statement1’
’statement2’
’statement3’ SCIL statements. Each of the statements may be replaced with
#BLOCK, see below.
’Statement1’ is executed provided that ’condition1’ is TRUE. Otherwise, if ’condition2’ is TRUE 'statement2' is executed. If neither ‘condition1’ nor ‘condition2’ are TRUE,
‘statement3' is executed. By using the #BLOCK command (see above), a sequence of statements can be executed.
#ELSE_IF and/or #ELSE statements may be omitted, which means that no operation is performed if condition1 is not fulfilled. Several #ELSE_IF statements may succeed each other.
Examples:
#IF HOUR >=7 AND HOUR < 15 #THEN @SHIFT = “MORNING”
#ELSE_IF HOUR >= 15 AND HOUR < 23 #THEN @SHIFT = “EVENING”
#ELSE @SHIFT = “NIGHT”
ABB Automation
87
MicroSCADA
7 SCIL Commands
88
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
#LOOP [condition] statement
...
statement
#LOOP_END [max]
Executes a loop.
’condition’ A conditional expression that determines if the loop iterates.
’statement’
’max’
SCIL statements.
The maximal number of times the loop is iterated. An integer expression. Default value: 1000.
The sequence of statements (the loop) is executed repeatedly as long as the condition is TRUE, or until the loop is interrupted in one of the following ways :
•
The maximum number of loop iterations is reached. In this case the loop interruption causes an error status.
•
The innermost loop is interrupted when the command #LOOP_EXIT (see below) is met. This causes no error status.
Emergency interruption from outside the loop can be obtained in the following ways:
•
Loops in pictures are interrupted by pressing the upper left corner three times or by the statement:
#SET MONn:BMS where ’n’ is monitor number.
•
Loops in command procedures are interrupted by the statement:
#SET APLn:BRSm where ’n’ is the application number and ’m’ represents the queue number of the process that runs the command procedure. This number is determined as follows:
’m’ = 1, if the command procedure is non-parallel and started by a time channel
’m’ = 2, if the command procedure is non-parallel and started by an event channel or from a picture.
’m’ = 3 or larger, if the command procedure is parallel. The value can be counted as the PQ attribute of the command procedure + 2, unless PQ = 0.
•
Loops in format pictures are interrupted by the statement:
#SET APLn:BPSm where
’n’ is application number,
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
’m’ = 1 for process printouts and
’m’ = 2 for report printouts.
These loop interruptions produce an error status. The status code
SCIL_INVALID_PROGRAM_STRUCTURE is reported when illegally nested structured statements are found.
Example:
#SEARCH 1 0 "P" "A"
@I = 0
@POBJ = NEXT(1)
#LOOP (POBJ:VIU >= 0 AND %I < 50)
@I = %I + 1
@NAME(%I) = POBJ:VLN
@POBJ = NEXT(1)
#LOOP_END
!
SHOW OBJ %NAME
;Process objects are browsed through and the names are written into a vector
;variable. The names are shown in a window named OBJ.
#LOOP_WITH var = low .. high statement
...
statement
#LOOP_END
Executes a loop a chosen number of times.
’var’
’low’
A variable name which will contain the number of times the loop has been executed (integer).
The number of the first loop execution given as an integer expression. If given as an expression containing object notations and variables, it should be surrounded by spaces or brackets.
’high’ The number of the last loop execution given as an integer expression. If given as an expression containing object notations and variables, it should be enclosed by spaces or parentheses.
SCIL statements.
’statement’
The sequence of statements (the loop) is executed repeatedly a certain number of times, defined as ’high’ - ’low’ + 1. Each time the loop is completed, the variable ’var’ is incremented by one.
The innermost loop can be interrupted with the #LOOP_EXIT command (see below).
This produces no error status. As regards emergency interruption from outside the loop, see the #LOOP command above.
The status code SCIL_INVALID_PROGRAM_STRUCTURE is reported when illegally nested structured statements are found.
Example:
#LOOP_WITH I = 1 . . LENGTH(%VECTOR)
89
MicroSCADA
7 SCIL Commands
90
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
!SHOW WIN’I’ %VECTOR(%I)
#LOOP_END
;Each of the elements in the vector variable VECTOR is shown in a separate
;window.
#LOOP_EXIT
Interrupts a loop.
The command interrupts the innermost one of the running loops. It must be situated in the same program as the command that starts the loop (#LOOP or #LOOP_WITH).
Example:
#LOOP_WITH I = 1 .. 20
!SHOW LOOP_NR %I
.
.
!SHOW QUESTION "CONTINUE?Y/N"
!INPUT_VAR ANSWER ANSWER
#IF %ANSWER == "N" #THEN #LOOP_EXIT
#LOOP_END
#ON event [statement]
Executes a program block when an event occurs.
’event’ An event object notation.
’statement’ A SCIL statement (not obligatory). By using the #BLOCK command (see below), a block of statements can be defined.
This command can be used only in pictures. It has no meaning in dialogs or command procedures. Only events from the current application can be caught. If an event from a foreign application is tried to catch, a SCIL error is generated.
’statement’ is executed each time the event object is activated, provided that the picture containing the #ON statement is displayed on screen at the event moment - as main picture, window picture, picture function or control board picture. If the event object is activated while the picture is stored as a fast picture, ’statement’ is executed when the picture is displayed on screen. Possible expressions included in the statement or block defined by ’statement’ are evaluated when ’statement’ is executed. If
’statement’ is omitted, the #ON command cancels the previous #ON command for the event object in question.
The #ON command affects only the picture (main picture, window picture, picture function or control board picture) where it is executed. After the #ON command has been executed in a picture (in a start program or key program), it is valid as long as the picture is displayed on the monitor or stored as a fast picture, or until it is cancelled by a new #ON command. For a certain event object only the last given #ON command is valid in a picture.
The #ON command has no relevance in dialogs.
Examples:
#ON TEMP:E1 !SHOW W TEMP:PAI1
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
;When the event object TEMP:E is activated, the value of the process object
;TEMP is shown in the window W.
#ON TEMP:E1
;The former statement is canceled.
#ON SWITCH:E2 #BLOCK
!SHOW SWITCH SWITCH:PBO2
!SHOW TIME SWITCH:PRT2
#BLOCK_END
;The block is executed when the event object SWITCH:E2 is activated.
#PAUSE interval
Defines a pause.
’interval’ Time interval in seconds given as a real expression.
This command is used to momentarily interrupt the program execution. For example, after a DCP-NET has been started, a pause is required before you can start the on-line configuration of the NET.
Be careful when using this command, especially in command procedures! #PAUSE in a command procedure entails that all activities in the executing process pause for the time interval defined by this command.
Examples:
#PAUSE 3.5
;The system waits for 3.5 seconds before the next statement is executed.
#PAUSE %T
;The length of the pause is specified by the variable T.
#RETURN [ expression ]
Stops the program execution and evaluates the ‘expression’.
‘expression’ Any SCIL expression.
When #RETURN is encountered in a named program, a method, or a program executed with the DO function (see Chapter 8), it stops the program execution and evaluates the ‘expression’. The value of 'expression' replaces the program or function call if it appears in an expression.
The #RETURN command may be used without 'expression' in any SCIL program
(command procedures, #ON blocks, programs executed by #DO) to exit the program.
A program encountering no #RETURN statement returns a value with data type
"NONE".
Example:
;Suppose you have the following named programs:
;Named program ADD:
#RETURN ARGUMENT(1) + ARGUMENT(2)
;Named program MULTI_ADD:
@TOTAL = 0
#LOOP_WITH I = 1 .. ARGUMENT_COUNT
@TOTAL = %TOTAL + ARGUMENT(%I)
#LOOP_END
#RETURN %TOTAL
91
MicroSCADA
7 SCIL Commands
7.3.2
92
Programming Language
SCIL
Technical Reference Manual
;After the following named program calls:
@S = .ADD(1, 0.5)
@M = .MULTI_ADD(1, 2, 3, 4)
S has the value 1.5 and M 10.
General Object Handling Commands
1MRS751250-MEN
#CREATE object [= expression]
Creates a new object.
’object’ An object notation without any attribute. Object types allowed are the application objects P, C, D, A, T, X, V, and F, and the system objects B. An index may be used only together with process objects of the predefined types.
’expression’ An expression of the data type list. If the object being created is a variable object, the expression may be omitted.
The command creates a new object of the given type, with the given name and index
(process objects) and assigns it the attribute values of the list expression. Possible occurrences of name (LN attribute) and index (IX attribute) in the list expression are disregarded.
If the process object notation for a process object of a predefined type is given without an index, a group with the given name is created. A group is automatically created when an indexed process object of a predefined type is created.
A list type expression can be built by creating a variable object and assigning desired attributes to it (see the examples below). In order to copy the new object from an existing one, use the list type functions FETCH, PHYS_FETCH, NEXT or PREV
(Chapter 8).
An error message is produced if the object already exists, or if the assigned attributes
(the attributes of ’expression’) do not suit the actual object type.
The command is mainly used in tool pictures and configuration files.
Example:
@TMP = LIST(BI = 0, UN = 20, OA = 1, OB = 2)
#CREATE ABC:P1 = %TMP
;The process object ABC is created and assigned the attributes of the variable
;object V.
#CREATE SYS:B = LIST(SA = 192)
;A SYS:B object is created and assigned the station address 192.
#DELETE object
Deletes an variable, object or variable object.
’object’ An object notation of type P, C, D, A, T, X, V or F. Process objects of the predefined types may have one index. The other object
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands types may not be indexed. A variable object notation may have an attribute.
The given object is deleted. If a variable object notation contains an attribute, the attribute, and not the variable object, is deleted.
Though all process objects in a process object group are deleted, the group name is preserved. The group is deleted by giving the process object notation without an index. This may be done only if all objects in the group are deleted beforehand.
A time channel may be deleted only if there is no object connected to it. A scale can be deleted only if no process objects use it. An object of free type (F) can be deleted only if all process objects of the corresponding type have been deleted.
Examples:
@tmp=1
#delete tmp:v
;The variable tmp is deleted
#DELETE A:P1
;The process object A with index 1 is deleted.
#DELETE A:P
;The process object group A is deleted (possible only if there are no objects
;in the ;group).
#DELETE GHI:T
;The time channel GHI is deleted (possible only if there is no object connected
;to it).
#DELETE V:VAB
;The attribute AB of the variable object V is deleted.
#EXEC object [(variable list)]
Executes an object.
’object’ An application object notation of type D, C, T, A or E without attribute. Only event object notations may be indexed.
’variable list’ A list of variable assignments separated with commas. Not obligatory.
The object may be a data object, a command procedure, a time channel, an event channel or an event object:
•
If the object is a data object, the value of the object (the OV attribute) is calculated and registered in the database. At the same time the RT and OS attributes are registered.
•
A command procedure is started by this command. When the command procedure is executed to the completion, the RT and OS attributes are registered. The command procedure must not contain picture or graphics commands.
•
A time channel is activated, which means that the data objects and command procedures connected to it are executed. This does not affect any other function of the time channel, and the RT attribute of the time channel is not updated.
93
MicroSCADA
7 SCIL Commands
94
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
•
An event channel is activated, which means that the data object, command procedure or time channel connected to it is executed.
•
An event object is activated, which means that the #ON sequences defined for the object in question are executed in all monitor pictures. The object may have one index.
Internally, event objects are executed by the picture operator process, and event channels by the event channel process. Regarding data objects and command procedures, there may be different processes that handle the execution. The following circumstances determines which process that executes the object:
•
If the #EXEC command is in a command procedure, and the PE attribute of the object is 0, the execution is handled by the same process which handles the command procedure.
•
If the #EXEC command comes from a picture, and the PE attribute of the object is 0, the execution is handled by the event channel process.
•
If the PE attribute of the object is 1, the execution is handled by a parallel process, which is determined by the PQ attribute.
The operation is not executed at once, the request for execution is placed in a queue.
Subsequent statements should not assume that the task of the #EXEC statement has been completed.
In the variable list, values are given to variables used in the object. There must always be a space before the list. The variable list is omitted if no values are to be sent to the objects. It is always omitted when the object is an event object. The variable values are not transmitted back to the calling program.
Examples:
#EXEC_AFTER 10 TASK:C (@LN = “DEFG”, @IX = 1)
;The command procedure TASK is started.
#EXEC DATA:D (@A = %B + 2)
;The data object DATA is updated.
#EXEC EVENT:E1
;An event object named EVENT is activated.
#EXEC_AFTER delay object [(variable list)]
Executes an object after a time delay.
’delay’
’object’
The delay time in seconds given as and integer or real expression.
An object notation of type D, C, T, A or E without attribute. Only event object notations may be indexed.
’variable list’ A list of variable assignments separated with commas. Not obligatory.
The command works like #EXEC, but the execution is delayed for ’delay’ seconds.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
If the ’object’ does not exist, or if it is erroneous, an error status is produced when the object is executed, after the delay. The amount of delayed executions is controlled by the APL:BQU(4) and APL:BQM(4) attributes (see Object Description, Chapter 5).
APL:BQU(4) is the sum of delayed executions not yet started and the APL:BQM(4) is the maximum number of such executions. If the maximum is exceeded, an error status
(REPF_EXECUTION_QUEUE_FULL) is generated.
Example:
#EXEC_AFTER 10 TASK:C (@LN DEFG,@IX=1)
;The command procedure TASK is started after 10 seconds.
#GET object
Updates process object values.
’object’ A process object notation or an STA system object notation with the attribute ME.
The command entails that the object value is read from the station and updated in the process database. The object may be indexed. For process objects, the attribute may be omitted. It is then assumed to be OV. The command is valid only for process objects corresponding to physical objects in stations on ANSI lines.
Examples:
#GET A:PBI
#GET B:PBI(1..4)
#GET STA1:SME1003^3
;The binary object A, the four first indexes of the binary object B and bit
;number 3 in station address 1003 of station 1 are read from the RTUs and
;updated in the process database.
#MODIFY object = expression
Changes an object definition.
’object’ An application object notation without an attribute. Allowed object types are P, C, D, A, T, X, V and F. Process objects may have one index.
An expression of data type list.
’expression’
The object is assigned the attributes and attribute values of the list expression. The attribute values in the expression replaces possible previous attribute values of the object. If the object has attributes, which are not included in the expression, they remain unchanged. If UN and OA attributes are set equal to 0, an error,
PROF_BIT_ADDRESS_NOT_ALLOWED, is generated.
Scale objects used by process objects cannot be renamed.
Examples:
#CREATE V:V
#SET V:VHR = 24
#SET V:VTC = "TC_1H"
#MODIFY DEF:D = %V
;The HR and TC attributes of the data object DEF are changed, but all other
95
MicroSCADA
7 SCIL Commands
96
Programming Language
SCIL
Technical Reference Manual
;attributes remain unchanged.
#MODIFY PROC:P = LIST(AE=1,AN="A_1")
;The process object PROC is connected to the event channel A_1.
1MRS751250-MEN
#SET object [= expression]
Assigns values to objects.
’object’
’expression’
An object notation of type P, D, S, C, T, A, X, V, B or F, including the attribute to be set. See Chapter 4.
An expression of the same data type as the attribute in the object notation (not obligatory). Default = 1.
The attribute in the object notation is assigned the value of the expression. If ’expression’ is omitted, the object is assigned the value 1.
With this command all types of system and application objects, except event objects, may be given values through their attributes. For real process objects of output type, the command implies control of the process via NET. When process objects are set, the RT and RM attributes of the objects (output as well as input objects) are set according to the system time.
Depending on the object type and the attribute, the object notation may be indexed by one index or an index range. Data objects can be indexed up to the value of the LR attribute. If the object notation has an index range, the given indexes are assigned the value of ‘expression’. If ‘expression’ is a simple data, all indexes are assigned this value.
Data object and process object notations may used without an attribute. It is then assumed to be the OV attribute.
The attributes which are described as “read-only” in the attribute descriptions (the
Application Objects and System Objects manuals) cannot be set with the #SET command.
Examples:
#SET SWITCH:PBO = 1
;The switch is set to 1. If the object is in AUTO state, the order is passed
;out to the process.
#SET STA3:SME(3121^0..3121^7) = 0
;All storage bits in the given interval are set to zero.
#SET TASK:CIU = 1
;The command procedure TASK is taken into use.
#SET DATA:DOV5 = 10.0
;The fifth registration of the data object is set to 10.0.
#SET TC_1H:TIU = 0
;The time channel TC_1H is taken out of use.
#SET A:AON = "B"
;The event channel A is connected to the object B.
#SET TMP:VATTRIBUTE1 = (1,2,3)
;The variable object TMP is given an attribute named ATTRIBUTE1 which is
;assigned the vector value (1,2,3).
#SET PRI1:BLP = 72
ABB Automation
1MRS751250-MEN
7.3.3
ABB Automation
Programming Language
SCIL
Technical Reference Manual
;The number of lines per page is set to 72 for printer 1.
Object Query Commands
MicroSCADA
7 SCIL Commands
#INIT_QUERY n [condition]
Initiates a process query.
’n’ Text expression with the values "A", "P" , "L", "H" or "E":
"A" (Alphabetical) The query encompasses the entire process database in alphabetical order, so that for each process object group, every index is included
(LN+IX).
"P" (Physical) The query concerns the entire process database, but the objects are ordered according to their physical addresses (UN + AO + OB).
"L" (alarm List) The query concerns the alarm buffer. The alarm buffer contains all alarming or unacknowledged process objects sorted in time order according to the alarm time (the AT and AM attributes).
The buffer is read from the newest to the oldest alarms.
"H" (History) The query concerns the history buffer, which is read with the oldest event first. The history buffer contains events which occurred in process objects defined with history buffering (the
HA attribute). When this value is chosen, the
HP attribute of the application has to have the value “EVENT_LOG”.
"E" (Event) The query concerns the history buffer, which is read with the latest event first. When this value is chosen, the HP attribute of the application has to have the value “EVENT_LOG”.
'condition' A boolean type expression which selects the objects to be included in the query. The condition is comprised of relations and logical operators. The relations have an attribute as the left operand. All attributes (including CA), except those of vector type, can be used.
The objects, the attributes of which fulfill the condition (give the expression the value TRUE), are included in the query. In the formation of names, the characters % and * can be used. % represents one character anywhere in the name, * represents none, one or several characters at the end of the name.
With this command you determine which items are to be included in the process query executed by the function PROD_QUERY (Chapter 8). The #INIT_QUERY
97
MicroSCADA
7 SCIL Commands
98
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN command must precede the PROD_QUERY function within the same picture or command procedure. Only one #INIT_QUERY at a time is valid.
The #INIT_QUERY command searches through the process objects in the RAM memory. If no condition is given, the query concerns all process objects within the scope specified with ’n’. The query concerns only the process objects of the application where the query command is issued.
The command assumes that the maximum length for the process database queries, which is defined by the base system object attribute APL:BQL, is large enough.
Examples:
#INIT_QUERY "A"
;The process query includes all objects in alphabetical order.
#INIT_QUERY "P" UN == 5
;The objects of RTU 5 in address order.
#INIT_QUERY "A" LN == "K*"
;Process objects beginning with K.
#INIT_QUERY "L" AR == 0
;Unacknowledged objects in the alarm list.
#SEARCH n apl type order [start [condition]]
Initialises a search among objects.
’n’
’apl’
’type’
’order’
The identification number of the search. An integer expression 1 ...
10 that identifies the search within a picture, command procedure or dialog system.
Logical application number. Integer expression, 0 . . . 20. 0 = the own application. The application must be situated in the same base system.
The object type, "P", "D", "C", "A", "T", "X" or "F" given as a text expression.
The search order given as a text expression:
"A" =
"I" =
Alphabetical order. Searching through the object names in alphabetical order (no index).
Regarding process objects, only group names are included in the search.
Index order (only for process objects of predefined types). Searching through the individual objects of a process object group.
"P" =
"E" =
Address order (only for process objects).
Execution order. The execution order within a time channel. ’type’ can be either "D" or "C".
Both are equal and means that the search con-
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
’start’ The starting point of the search. Depending on ’order’, the parameter has the following values:
’order’ = "A": name, where ‘name’ is object name as a text expression. If omitted, the search starts from the first name.
'order' = "I": cerns both data objects and command procedures.
name or (name,index), where ‘name’ is the name of the object given as a text expression and ‘index’ is omitted, the browsing starts from the first index.
'order' = "P":
'order' = "E": unit or (unit,address) or (unit, address, bit address), where ‘unit’ is the RTU number given as an integer expression, ‘address’ is the word address given as an integer expression, ‘bit address’ is the bit address given as an integer expression.
time channel or (time channel, type, name), where ‘time channel’ is the name of the time channel given as a text expression, 'type' and
'name' is the name and type of the connected object from where the search starts, given as text expressions.
If only the time channel name is given, the search starts from the object with the highest priority. Otherwise, the search starts from the object called 'name' of type 'type'. Both data objects and command procedures are included.
'condition'
'start' is obligatory when 'order' is "I" or "P", and when a condition is appended to the statement. If 'order' is "A" or "E", 'start' can be given as an empty string (" ").
A boolean type expression which selects the objects to be included in the browsing. The condition is comprised of relations and logical operators. The relations have an attribute as the left operand.
All attributes, except vector type attributes, can be included in the expression. The objects, the attributes of which fulfill the condition (give the expression the value TRUE), are included in the browsing. In the formation of names, the characters % and * can be used. % represents one character anywhere in the name, * represents none, one or several characters at the end of the name.
The #SEARCH command initializes a search among the objects stored on hard disk.
After a search has been initialized, it can be completed with the functions NEXT and
PREV (see Chapter 8). Up to ten searches can be initialized in parallel in a picture, command procedure or dialog system.
99
MicroSCADA
7 SCIL Commands
7.3.4
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Examples:
#SEARCH 1 0 "P" "A"
;All process objects are included in search number 1 which is per formed in
;alphabetical order.
#SEARCH 2 2 "T" "A"
;Browsing through all time channels in alphabetical order.
#SEARCH 3 1 "P" "P" (4,1000) LN == "B*"
;The search refers to those objects of station 4 which have an address = 1000
;(octal number) and begins with B. The search is performed in address order.
#SEARCH 4 0 "D" "E" "10MIN"
;Searching among those data objects and command procedures which are connected
;to the time channel 10MIN.
Printout Commands
#LIST printer object [(variable list)]
Prints process object data.
’printer’ Logical printer number. Integer expression, 1 ... 20.
’object’
’variable list’
A process object notation without an attribute.
A list of variable assignments, separated with commas (not obligatory).
The format picture of the process object is written to the printer. If the process object is given with an index, the physical format picture (PF) is written, otherwise the logical format picture of the group (LF) is used. For process objects of user-defined types, the command always prints the physical format picture (PF).
The start program of the picture, exclusive of the picture commands, is executed before printout. Only those windows which have an expression are printed. Curves and bars are not printed. Depending on the printer definition in the base system (the
PRIn:BOD attribute), the printout may be stored on disk.
The variable list, which may be omitted, defines the variables used in the printed picture (in windows or in start programs). The variable list may assign a value to a variable called FORM_FEED, which determines the paper form feed, see the #PRINT command. Together with #LIST, the default value of FORM_FEED is 0, which means that the printer starts a new page only when the previous one is full.
The #LIST command defines a couple of variables which get their names as well as their values from attributes ("snapshot variables"). If the process object is given with an index, these attributes may be (depending on the object type and definition): LN,
IX, OV, BI, BO, DB, DI, DO, AI, AO, PC, BS, AL, AS, OS, SE, SP, OF, AZ, RT,
RM, AT, AM and CA. For user-defined object types also other attributes may also be transferred to variables. The corresponding variables (for example %LN) may be used in the physical format. If the process object is given without an index, only the LN attribute is transmitted in this way to the logical format. The variable values given in the variable list have precedence of these automatically generated variables.
100 ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
Examples:
#LIST 3 TEMP:P (@A=30)
;The logical format of the process object group is printed to printer 3. The
;printer starts a new page both before and after each printout.
#LIST 1 LEVEL:P7 (@FORM_FEED = 2)
;The physical format of the process object is printed to printer 1. E.g. the
;variable %LN has the value "LEVEL", and the variable %IX the value 7. The
;printer starts a new page before, but not after a printout.
#PRINT printer picture [(variable list)]
Prints a picture.
’printer’ Logical printer number. Integer expression, 1 ... 20.
’picture’ The picture to be printed, specified as:
[path/] picture name where
’picture name’
’path’ is picture name exclusive the extension, and is a logical path name.
If ’path’ is omitted, the default path names are used. See the
#PATH command, section 7.3.6.
’variable list’ A list of variable assignments, separated by commas. Not obligatory.
This command is used when a paper printout of a picture is needed, for example, a report picture. The start program of the picture, excluding the picture commands, is executed before the print process. Only those windows which have an expression are printed. Curves and bars are not printed. Depending on the printer definition in the base system (the PRIn:BOD attribute), the printout may be stored on disk.
The variable list, which may be omitted, defines the variables used in the printed picture (in windows or in start programs). In addition, the variable list may assign a value to a predefined variable called FORM_FEED, which controls the form feed during printing. The FORM_FEED parameter can have the following values:
0 ........
1 ........
2 ........
3 ........
form feed only when the page is full (the page length is determined by the PRIn:BLP attribute, where ’n’ is physical printer number) form feed before (if not already done) and after printout form feed before printout (if not already done) form feed after printout
Together with #PRINT, the default value of FORM_FEED is 1.
Examples:
#PRINT 1 REPORT (@VAR=TEMP:PAI(1..20))
;The picture named REPORT is written to printer 1. The printer starts a new
;page both before and after each printout.
LOOP N = 1 . . 20
#PRINT 1 FORM_’N’ (@FORM_FEED = 0)
#LOOP_END
;The pictures FORM_1 ... FORM_20 are printed without form feed.
101
MicroSCADA
7 SCIL Commands
7.3.5
102
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Error Handling Commands
The commands in this section specifies the error handling within programs.
#ERROR IGNORE
#ERROR CONTINUE
#ERROR STOP
#ERROR EVENT
Define error handling policy.
IGNORE means that the program execution continues regardless of errors.
The error handling programs are not activated and no error message is produced.
CONTINUE
STOP means that an error handler is activated or an error message is produced, but the program execution continues.
means that an error handler is activated or an error message is produced and the execution of the program containing the error is aborted. The statement of an active #ON ERROR command is executed (see below).
EVENT means that the execution of the program containing the error is aborted, but no error message is produced. The statement of an active #ON ERROR command is executed (see below). Not possible in the methods of the dialogs.
An #ERROR command applies only to the program or #ON block in which it is executed. The latest given #ERROR command is valid.
The most recent error status that has occurred in the program can be read with the
STATUS function, Chapter 8.
If no ERROR command has been executed in a program, the following default policies are valid:
Background and draw programs:
Start programs:
Update programs:
Exit Programs:
Key programs:
Named programs:
Command procedures:
#ON blocks:
Methods in dialogs:
Error handling programs:
CONTINUE
STOP in monitors, IGNORE when printed
IGNORE
IGNORE
STOP
STOP (not in ERROR_HANDLER)
STOP
IGNORE
STOP ( not in delete method)
IGNORE
In error handling programs, the error handling policy is always IGNORE, independently of possible #ERROR commands. In delete methods all errors are ignored.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
#ERROR RAISE [status]
Activates an error status.
’status’Integer expression. The status code to be activated. Default: the latest error code occurred in the program.
The command is mainly used within error handling blocks (#ON ERROR or #ON
KEY_ERROR blocks) in order to activate an error status in the program. In error handling blocks, ’status’ can be omitted, whereby the activated status is the most recent error status that has occurred in the program. Outside an error handling block, the command interrupts the program execution.
Example:
#ON ERROR #BLOCK
#IF STATUS = 107 #THEN !SHOW
#ELSE #ERROR RAISE
#BLOCK_END
#ON ERROR [statement]
Defines an error handler.
’statement’ A SCIL statement to be executed when an error occurs. By using the #BLOCK command (section 7.3.1) a block of statements can be defined.
The command defines a statement, or block of statements, to be executed in a program each time an error occurs, in the cases where the error handling is defined by
#ERROR STOP or #ERROR EVENT (see above). The command is valid only for the program or #ON block in which it has been executed. Only the last executed #ON
ERROR command is valid. The #ON ERROR command takes precedence over the
#ON KEY_ERROR command (see below).
Example:
#ON ERROR !SHOW MESSAGE STATUS
;The window MESSAGE is shown when an error occurs.
#ON KEY_ERROR [statement]
Defines a key error handler.
’statement’ A SCIL statement. By using the #BLOCK command, a block of statements can be defined.
The command defines a program section to be executed in a picture each time an error occurs in a function key program. The command is valid only in the picture in which it has been executed. If there is no key error handler in a picture, it utilizes the error handler of its main picture, if any. The #ON ERROR command (see above) takes precedence over the #ON KEY_ERROR command.
103
MicroSCADA
7 SCIL Commands
7.3.6
104
Programming Language
SCIL
Technical Reference Manual
Example:
#ON KEY_ERROR !SHOW MESSAGE "FUNCTION KEY ERROR"
Path Commands
1MRS751250-MEN
#PATH name [dir, .., dir]
#PATH name + dir, .., dir,
#PATH name - [dir, ... , dir]
Defines a logical path name.
’name’ A logical path name. The name must be added here according to the rules in Chapter 2.
’dir’ Real directory name including the complete path in the operating system format. A starting \ means that the directory path starts from the sc directory. A trailing \ is stripped off, so the path can be written either with or without it. Up to 255 directories are allowed in the command. If a directory does not exist, it is automatically created. However, if the word NO_CREATE is included in the directory list, the subsequent directories are not created. If they do not exist, the error FILE_DIRECTORY_DOES_NOT_EXIST is raised. Default directory: The directory from where the main program has been started.
Logical path names can be used in all commands where files are called by name, e.g.
together with picture names. Each path name may correspond to several directories, which are given in order of priority and separated by commas. When a file is requested with the path name, it is first searched for in the first directory of the path, then in the next one, etc. If a path name is used when a new file (e.g. a picture) is created, the new file will be stored in the first directory of the path name.
A #PATH command without any sign defines a "global" path. Such a path definition is monitor specific when executed in a picture or dialog. If executed in a command procedure, it applies to all command procedures. If executed in a printed picture, it applies to all pictures printed with #PRINT. If the directory list is omitted, all directories of the path name are removed, but the path name remains.
A #PATH command with a + or - sign defines "local" and temporary paths by adding directories to, or removing them from, the path definition. A + sign means that the directories are added to the beginning of the directory list of the path name. A - sign means that the directories are removed from the directory list. If the directory list is omitted, the - sign removes all locally defined directories from the path name. (Note: as a terminating - sign means that the statement is continued on the next line, and in this case should be typed as two subsequent minus signs followed by an empty line, see the example below).
A local path applies only to for the dialog system, picture, printout picture, command procedure or time channel (objects started by the same time channel) where it was defined. A local path defined in a picture is valid as long as the picture is shown or stored as a fast picture. In a printout picture, it is valid as long as the picture is
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
PICG
PICL
PROD
PROL
REPC
REPL
SYS_ printed, and in a command procedure as long as it is under execution. A local path defined in a command procedure started by a time channel is valid as long as the time channel is active. The local path definitions have precedence over the global ones.
When an object invokes another one, both the global and local path definitions are inherited as local path definitions in the started object. If, e.g., a picture program starts a command procedure, the paths of the picture will be local paths in the command procedure and, hence, take precedence over the global command procedure paths.
The latest definition of a path is valid. Hence, by defining paths locally (with + and -), you ensure that no inherited definitions will override the desired path definitions.
The following automatically defined path names are used as default paths:
SCS_ \SCS\ACTIVE\SCS_
LAN_
SYSF
SYSO
\LAN\ACTIVE\LAN_
\LAN\ACTIVE\SYSF
\LAN\ACTIVE\SYSO
\LAN\ACTIVE\PICG
\LAN\ACTIVE\PICL
\LAN\ACTIVE\PROD
\LAN\ACTIVE\PROL
\LAN\ACTIVE\REPC
\LAN\ACTIVE\REPL
\SYS\ACTIVE\SYS_
APL_ \APL\application\APL_
FORM \APL\application\FORM
PICT \APL\application\PICT
These default path names are valid everywhere, though the corresponding directories may be changed globally or locally. A file called without any path name is stored or sought in the directory/directories defined by the default path name which coincide with the first four characters in the file name. If no other path name suits, PICT is used. Visual SCIL main dialogs constitute an exception to this case. This is described in the Visual User Interface Design manual.
The path name definitions, except the original default path names, are removed when the system is shut down or the application is closed.
105
MicroSCADA
7 SCIL Commands
106
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Defined paths can be read with the path functions, see Chapter 8.
Example:
#PATH PROCESS /APL/APPL1/PICT, NO_CREATE, /APL/APPL2/PICT
;A logical path named PROCESS is created. If the directory /APL/APPL1/PICT
;does not exist, it is created, but if the directory /APL/APPL2/PICT does not
;exist, it is not created.
!NEW_PIC PROCESS/PICTURE
;The picture named PICTURE is first sought in the application branch APPL1,
;then in application branch APPL2.
#PATH PROCESS +/APL/APPL3/PICT
;The picture named PICTURE is first sought in the application branch APPL3,
;then APPL1 and APPL2.
#PATH PROCESS - -
;empty line
;The local path definitions (/APL/APPL3/PICT) is removed.
#REP_LIB library [file, ...,file]
#REP_LIB library + [file, ...file]
#REP_LIB library - [file, ...file]
Defines a logical representation library name.
’library’
’file’
A logical library name. The name must adhere to the rules in
Chapter 2.
A representation library file specified in either of the following two manners:
1. [path/]file_name where ’path’ is a logical path name and ’file_name’ is the name of the file, possibly including an extension. If ’path’ is omitted, the default path names are used (see the #PATH command above).
2. file_name where ’file_name’ is the name of the file including the complete path in the operating system format (max. 14 characters).
Up to 255 representation library files can be included in the command.
Logical library names can be used everywhere, where library representations are requested. Each library name may correspond to several library files, given in order of priority and separated by commas. When a library representation is requested, it is first sought in the first library, then in the next one, etc. If a library name is used when a new library representation is created, the new representation will be stored in the first file related to the library name.
A #REP_LIB command without any sign defines a "global" library name. Such a name is monitor specific, when executed in a picture or dialog. If executed in a printed picture, it applies to all pictures printed with #PRINT. If the file list is omitted, all files defined for the library name are removed, but the library name is preserved.
ABB Automation
1MRS751250-MEN
7.3.7
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
A #REP_LIB command with a + or - sign defines "local" and temporary library names by adding files to, or removing files from, the given library name. A + sign means that files are added to the beginning of the file list of the library name. A - sign means that files are removed from the list. If the file list is omitted from the command, the minus sign removes all locally added files from the actual library name. (Note: as a terminating - sign means that the statement is continued on the next line, this case should be typed as two subsequent minus signs followed by an empty line, see the example below).
The local definitions are picture and printout picture specific. If executed in a picture, they are valid only as long as the picture is shown or stored as a fast picture. In a printout picture, they are valid as long as the picture is printed. The local definitions have precedence over the global ones. If a printout is started from a picture, the printed picture inherits all its global and local library name definitions as local definitions. The latest definition of a library name is valid. Hence, by defining library names locally (with + and -), you ensure that no inherited definitions will override the desired library name definitions.
If no library name is given, a representation is searched for in the library called
DEFAULT. Unless changed with a #REP_LIB command, the library name
DEFAULT corresponds to the files:
1. /APL/application/APL_STAND.PIR
2. /LAN/ACTIVE/LAN_/LAN_STAND.PIR
in the order outlined.
An error status is produced if a non-existent or empty logical library name is used.
The logical library name definitions, except the original meaning of DEFAULT, are removed when the system is shut down or the application is closed. If a logical representation name is defined or redefined with #REP_LIB, and the real file does not exist, the logical name is deleted.
Defined library names can be read with the replib functions, see Chapter 8.
Example:
#PATH PATH /APL/APPL2
#REP_LIB PROCESS PATH/MYLIB
!WIN_REP WINDOW PROCESS/MYREP
;The library representation MYREP, which is to be shown in the window WINDOW,
;is sought from the file MYLIB in the application APPL2.
File Handling Commands
#CLOSE_FILE n
Closes a keyed file.
’n’ File number. The file number assigned to the file when opened with the #OPEN_FILE or #CREATE_FILE command. Integer ex-
107
MicroSCADA
7 SCIL Commands
108
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN pression, 1..10.
Closes the file defined by ’n’. This command should always be issued to terminate the operations on an opened file.
Example:
#CLOSE_FILE 2
;The file opened as number 2 in a picture or command procedure is closed.
#CREATE_FILE n apl file keylength
Creates and opens a new keyed file.
’n’ File number. An ordinal number which identifies the file within the picture, command procedure or dialog system where the
#CREATE_FILE command is executed. Integer expression, 1...10.
’apl’
’file’
Logical application number, integer expression 0... 99. 0 is the own application. The application must be local.
Text expression. The file to be created specified in one of the following ways:
1. [path/]file_name where ’path’ is a logical path name and ’file_name’ is the name of the file, possibly including an extension. If ’path’ is omitted, the default path names are used (see the #PATH command described earlier).
2. file_name where ’file_name’ is the name of the file including the complete real path in the operating system format (max. 14 characters).
’keylength’ The key length. Integer expression.
The command creates a file with the properties given as arguments and opens the file.
After completing the operations on the created and opened file, it should be closed with the #CLOSE_FILE command (see above).
Example:
#CREATE_FILE 3 0 "RTU5" 5
;A file called RTU5 with the key length 5 is created and opened in the current
;application.
#DELETE_FILE apl file
Deletes a file.
’apl’ Logical application number. Integer expression, 0 ... 99. 0 = the current application. The application must be local.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
’file’ Text expression. The file to be deleted given in one of the following two ways:
1. [path/]file_name where ’path’ is a logical path name and ’file_name’ is the name of the file, possibly including an extension. If ’path’ is omitted, the default path names are used, see the #PATH command, section 7.3.6.
2. file_name where ’file_name’ is the name of the file including the complete real path in the operating system format (max. 14 characters).
The command deletes the named file in the given application. Use this command with care. The file deletion cannot be undone.
Example:
#DELETE_FILE 3 "RTU52"
;The file RTU5 in application 3 is deleted.
#OPEN_FILE n apl file keylength
Opens a keyed file.
’n’
’apl’
’file’
File number. A number which identifies the file within the picture, command procedure or dialog system where the #OPEN_FILE command is executed. Integer expression, 1..10.
Application number, integer expression 0 ... 99. 0 = the current application. The application must be local.
Text expression. The ASCII file from where text lines are read.
The file can be specified in one of the following ways:
1. [path/]file_name where ’path’ is a logical path name and ’file_name’ is the name of the file, possibly including an extension. If ’path’ is omitted, the default path names are used (see the #PATH command, section
7.3.6).
2. file_name where ’file_name’ is the name of the file including the complete real path in the operating system format (max. 14 characters).
A variable name.
’keylength’
The command opens a file for operations. Any keyed file can be opened. Up to 10 files can be open at the same time in a picture, command procedure or dialog system.
109
MicroSCADA
7 SCIL Commands
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
The variable ’keylength’ gets the value of the key length (integer) used in the file.
After completing the operations on the opened file, it should be closed with the
#CLOSE_FILE command, see below.
Example:
#OPEN_FILE 2 1 "RTU3" %L
;The file RTU3 in application 1 is opened. The variable %L will contain the key
;length.
#READ n key result1 [result2]
Reads a keyed record in an open file.
’n’ File number. The file number assigned to the file when opened with the #OPEN_FILE or #CREATE_FILE commands (see above). Integer expression, 1...10.
’key’ The key of the record to be read. A text expression containing
’keylength’ number of characters (see the #OPEN_FILE command above).
Variable names.
’result1’
’result2’
The command reads the contents of the record defined by ’key’ and places it as a text in one or two variables, ’result1’ (up to 255 characters) and ’result2’ (the rest of the contents if the record exceeds 255 characters).
Example:
#READ 2 RTU_KEY(X:POA1) V1 V2
;The record corresponding the process object X in the opened file number 2 is
;read. The RTU_KEY function is described in Chapter 8.
#READ_KEYS n vector [key1 [key2]]
Reads the keys of an open file.
’n’ File number. The file number assigned to the file when opened with the #OPEN_FILE or #CREATE_FILE commands (see above). Integer expression, 1..10.
‘vector'
'key1'
A variable name.
The first key to be read. A text expression containing 'keylength' number of characters (see the #OPEN_FILE command above). Not obligatory.
'key2' The last key to be read. A text expression containing 'keylength' number of characters. Not obligatory.
110 ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
The command reads the keys of the file defined by ’n’ and stores them in the variable
’vector’. Up to 10000 keys are read, starting from ’key1’ and ending with ’key2’. If
’key2’ is omitted the keys are read to the end of the file, or until the vector is full
(10000 keys). If ’key1’ and ’key2’ are omitted, the keys of the entire file, up to 10000, are read.
Example:
#READ_KEYS 2 V
;The keys in the file opened as number 2 are read and stored in the variable V
;(up to 10000).
#READ_NEXT n key result1 [result2]
Reads a keyed record.
’n’ File number. The file number assigned to the file when opened with the #OPEN_FILE or #CREATE_FILE commands (see above). Integer expression, 1..10 .
’key’
’result1’
The key of the record previous to the record to be read. A text expression.
Variable names.
’result2’
The command reads the contents of the record following the record defined by ’key’ and places it as text in one or two variables, ’result1’ (up to 255 characters) and ’result2’ (the rest of the contents if the record exceeds 255 characters).
Example:
#READ_NEXT 2 RTU_KEY(A:POA1) V1 V2
;The record following process object A1 is read. The RTU_KEY function is
;described in Chapter 8.
#READ_PREV n key result1 [result2]
Reads a keyed record.
’n’
’key’
File number. The file number assigned to the file when opened with the #OPEN_FILE or #CREATE_FILE commands (see above). Integer expression, 1..10.
The key of the record following the record to be read. A text expression.
Variable names.
’result1’
’result2’
The command reads the contents of the record previous to the record defined by ’key’ and places it as text in one or two variables, ’result1’ (up to 255 characters) and ’re-
111
MicroSCADA
7 SCIL Commands
112
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN sult2’ (the rest of the contents if the record exceeds 255 characters).
Example:
#READ_PREV 2 RTU_KEY(A:POA1) V1 V2
;The record previous to the process object A is read. The RTU_KEY function is
;described in Chapter 8.
#REMOVE n key
Deletes a keyed record.
’n’ File number. The file number assigned to the file when opened with the #OPEN_FILE or #CREATE_FILE commands (see above). Integer expression, 1..10.
’key’ The key of the record to be deleted. A text containing ’keylength’ number of characters (see the #OPEN_FILE command above).
The command deletes the chosen record. The deletion cannot be undone.
Example:
#REMOVE 2 RTU_KEY(D:POA5)
;The record configuring the process object D is deleted.
#RENAME_FILE apl old new
Renames a file.
’apl’
’old’
Logical application number. Integer expression, 0 ... 99. 0 is the current application. The application must be local.
Text expression. The file to be renamed given in one of the following two ways:
1. [path/]file_name where ’path’ is a logical path name and ’file_name’ is the name of the file, possibly including an extension. If ’path’ is omitted, the default path names are used, see the #PATH command, section 7.3.6.
’new’
2. file_name where ’file_name’ is the name of the file including the complete real path in the operating system format (max. 14 characters).
Text expression. The new file given in the same way as ’old’.
The command renames the file ’old’ to ’new’. If ’new’ already exists, an error message is raised.
Example:
#RENAME_FILE 0 "W89" "W90"
;The file W89 in the current application is renamed to W90.
ABB Automation
1MRS751250-MEN
7.3.8
7.4
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
#WRITE n data1 [data2]
Writes a keyed record in an open file.
’n’ File number. The file number assigned to the file when opened with the #OPEN_FILE or #CREATE_FILE command (see above).
Integer expression, 1..10.
’data1’
’data2’ Two text expressions containing the data to be written.
The command writes a record to the file defined by ’n’. ’data1’ contains as a text the key of the record and data to be written, up to 255 characters. The rest of the data to be written is in ’data2’. The key is included as the first characters in ’data1’.
Any possible previous data in the record is overwritten.
Example:
#WRITE 2 %V1 %V2
;The data of the variables %V1 and %V2 is written in the file opened as number
;2.
Miscellaneous Commands
#SET_TIME time
Sets the system time.
The command sets the time of the system clock (both the operating system clock and the physical clock). If the computer has an external clock, the command has no relevance.
’time’ Time given in the format YY-MM-DD HH:MM:SS (if SYS:BTF =
0) or DD-MM-YY HH:MM:SS (if SYS:BTF = 1). The seconds may be omitted.
Example:
#SET_TIME 90-04-25 12:00
Visual SCIL Commands
The Visual SCIL commands creates, loads and deletes the Visual SCIL objects and handles the attributes of the Visual SCIL objects. The Visual SCIL objects are superficially described in Chapter 4 of this manual. They are described in more detail in the
Visual SCIL User Interface Design and Visual SCIL Objects manuals.
ABB Automation
113
MicroSCADA
7 SCIL Commands
7.4.1
114
Programming Language
SCIL
Technical Reference Manual
Loading, Creating and Deleting Visual SCIL Objects
1MRS751250-MEN
.CREATE object = type
[
(attribute = value, .... , attribute = value)
]
Creates a Visual SCIL object.
’object’
’type’
’attribute’
The name of the object or an object reference including the path
(see Chapter 4). Giving a path means that the object is created as the last child in the object chain. The object name must be unique among the objects with the same parent. Up to 63 alpha-numeric characters are allowed in the object name.
The name of the Visual SCIL object type. See the manual Visual
SCIL Objects.
The name of an attribute which is assigned the subsequent value. If no predefined attribute with the given name exists, the attribute is created as a user defined attribute.
‘value’ The value assigned to the attribute. If the attribute is predefined, the value must be of the correct data type (see the manual Visual
SCIL Objects). If the attribute is user defined, the value may be of any data type.
The .CREATE command creates the object and loads it into the dialog system. Unless an object path is given, the object will be the child object of the object containing the
.CREATE command.
The predefined attributes which are not assigned values in the attribute list are given default values. After an object has been created, its attributes can be changed with the
.MODIFY and .SET commands, see below.
The .CREATE command is normally used for creating objects whose appearance is dynamically defined, based on some run time information. It must also be used for creating objects of the ready-built types which are not accessed in the Dialog Editor.
The .LOAD command described below is used for loading dialogs and dialog items drawn in the editor.
Generally, methods cannot be written with this command. However, if the object has action methods, these can be written with attributes, see the manual Visual SCIL Objects. Except for this type of methods, objects created with .CREATE will only have the predefined methods with predefined contents.
Examples:
.create CANCEL = VS_BUTTON(_TITLE =“Cancel”, _NOTIFY=vector(“.delete DLG”))
;The statements above creates a button with the label text Cancel and the
;NOTIFY program .delete DLG (deletes the dialog DLG).
.create ROOT\DLG = VS_DIALOG( -
_GEOMETRY=LIST(X=100,Y=100,W=220,H=110))
.create ROOT\DLG\GROUP = VS_CONTAINER( -
_GEOMETRY=LIST(X=5,Y=5,W=100,H=100))
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
.create ROOT\DLG\GROUP\ROWS = VS_CHECK_BOX( -
_TITLE="Check 1", -
_GEOMETRY=LIST(X=5,Y=5,W=80,H=20))
.create ROOT\DLG\GROUP\COLUMNS = VS_CHECK_BOX( -
_TITLE="Check 2", -
_GEOMETRY=LIST(X=5,Y=30,W=80,H=20))
.create ROOT\DLG\CONTAINER = VS_CONTAINER( -
_GEOMETRY=LIST(X=115,Y=5,W=100,H=100))
.
create ROOT\DLG\CONTAINER\OK = VS_BUTTON( -
_TITLE="OK", -
_GEOMETRY=LIST(X=5,Y=5,W=50,H=25))
.create ROOT\DLG\CONTAINER\CANCEL = VS_BUTTON( -
_TITLE="Cancel", -
_GEOMETRY=LIST(X=5,Y=35,W=50,H=25))
.create ROOT\DLG\CONTAINER\HELP = VS_BUTTON( -
_TITLE="Help", -
_GEOMETRY=LIST(X=5,Y=65,W=50,H=25))
.set ROOT\DLG._OPEN = TRUE
The example above creates a dialog containing two containers, each of which contains dialog items. The last statement makes the dialog visible on screen.
.DELETE object
Deletes a Visual SCIL object.
’object’ The object name, possibly including a path (see Chapter 4).
Deleting a Visual SCIL object means that it is removed from the screen (if shown) and from the dialog system. When an object is deleted, all its children are deleted as well.
When an object is deleted, its Delete method, if any, is executed.
Examples:
.DELETE DIALOG1
;Deletes the object DIALOG 1 and all its child objects.
.DELETE ROOT
;Deletes the entire dialog system.
.LOAD object = type( file , name {, attr = value, attr = value, ....})
Loads a Visual SCIL object.
’object’ The Visual SCIL object reference (name and possibly path) of the loaded object. This argument determines the name of the loaded object and its situation in the object hierarchy. If the object reference is given with an object path, the loaded object will be created as the last child in the object chain. If no path is given, only object name, the object will be the child object of the object containing the .LOAD command. The object name can be freely chosen, only it is unique among all objects with the same parent. Up to 63 alpha-numeric characters are allowed in the object name.
115
MicroSCADA
7 SCIL Commands
7.4.2
116
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
’type’
’file’
’name’
The name of the Visual SCIL object type. The Visual SCIL object types are listed and described in the manual Visual SCIL Objects.
Text. The name of the file where the object is stored, including the path. Path is not needed if the file is situated in the directory defined as the default path of the main dialog of the dialog system.
The default path is defined by the attribute DEFAULT_PATH when loading the main dialog.
Text. The name under which the dialog, dialog item or image is stored within the file. The name is given in the dialog editor.
’attr’
’value’
An attribute name.
A value assigned to the attribute.
This command is used for loading objects (dialogs, dialog item and images) built in the dialog editor and stored in files. It loads the specified object as a Visual SCIL object with the given name. If a loaded dialog or dialog item contains other dialog items, they are also loaded. The contained dialog items will be known as Visual SCIL objects with the names they were given in the dialog editor. The loaded object is incorporated with all its child objects into the existing object hierarchy.
When loaded, the create methods of the objects are executed (see the Visual SCIL
User Interface Design manual). If the load command contains attribute definitions, the attributes are set after the create methods.
A stored dialog, dialog item or image can be concurrently loaded several times in parallel under different object names or in different contexts.
Example:
.load DIALOG = VS_DIALOG(“MYFILE.VSO”,”MYDIALOG”,_OPEN = TRUE)
In the example above, the dialog stored as MYDIALOG in the file MYFILE is loaded as a Visual SCIL object of type VS_DIALOG. As the visibility attribute _OPEN is set to “TRUE”, the dialog is shown immediately. The command loads the complete contents of the dialog MYDIALOG.
Handling Visual SCIL Attributes
.MODIFY object = LIST(attribute = value, .... , attribute = value)
Modifies one or more attributes of a Visual SCIL object.
'object'
'attribute'
'value'
A Visual SCIL object reference, possibly including an object path.
Attribute name. If an attribute name does not exist as a predefined attribute, it is created as a user defined attribute.
Attribute value. For predefined attributes, the value should be of an appropriate data type.
ABB Automation
1MRS751250-MEN
7.5
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
Example:
.create CANCEL = VS_BUTTON
.modify CANCEL = list(_TITLE=“Cancel”, _NOTIFY=vector(“.delete DLG”))
.SET object.attribute = value
Assigns a value to a user interface attribute.
‘object’ A Visual SCIL object reference or a picture reference (see Chapter
4).
'attribute'
'value'
An attribute name.
The value given to the attribute. If the attribute is predefined, the value must be of an allowed data type (see the attribute descriptions in the manual Visual SCIL Objects). If the attribute is user defined, any data type is allowed.
The command assigns the given attribute the given value. If the object is shown when the .SET command is issued, the assignment may cause an immediate change of the appearance of the object.
When referencing Visual SCIL attributes, an error is produced in the event that the attribute does not exist. When referencing a window attribute, the attribute is defined if it does not exist.
User defined attributes will always have the data type of the value last assigned to the attribute.
Examples:
Moving a button:
.SET BUTTON._GEOMETRY = (20,20,20,20)
Defining or modifying window attributes:
.SET PIC_FUNC_1/WINDOW_2.RESIZED = TRUE
.SET .COUNTER = 0
VS Object, Window and Picture Function Methods object._FLAG_FOR_EXECUTION( name , program [, delay])
The predefined method _FLAG_FOR_EXECUTION indicates that the object, VS object, window or picture function, should execute a SCIL program in the future.
'name' Text value used as the identifier of the flagged execution. An empty name is allowed.
Text or text vector, the program to be executed.
'program'
'delay' Real value indicating the minimum amount of seconds to elapse before the program is executed.
117
MicroSCADA
7 SCIL Commands
7.6
118
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Default is 0.
If _FLAG_FOR_EXECUTION method of an object is called twice using the same
’name’, the first flagged execution is cancelled if not yet done.
object._QUEUE_FOR_EXECUTION(program [, delay])
This method is used when the programmer wants to execute a SCIL program at a later point in time when the system is idle. The program to be executed is given as parameter in the method call. There is no way to exactly know when in time the program is executed. A minimum time that has to expire can however be defined in seconds as an optional second parameter in the method call. The maximum number of queued programs per object is 100. If this limit is exceeded all queued executions are removed and a SCIL error is produced.
’program’ Text or text vector, the program to be executed.
’delay’ Real value indicating the minimum amount of seconds to elapse before the program is executed.
Return value: No return value.
Below is an example that shows how to ensure that the blocking cursor of a dialog is swithed off after a long program execution even if an error occurs that interrupts the normal program flow.
...
my_dialog._queue_for_execution(".set my_dialog._blocked = false")
.set my_dialog._blocked = true
;long SCIL processing here
...
VS Object, Window and Picture Function Attributes
Attributes of windows and picture functions contain properties of these. Many of the attributes of windows and picture functions are common with those of Visual SCIL
Objects(see Visual SCIL Objects manual).
_FILE_REVISION
Predefined read-only VS object and window attribute _FILE_REVISION contains the
FILE_REVISION attribute of the picture file where the window was loaded from. For a window created on-the-fly, the attribute is empty.
Value:
Access:
Text (up to 255 characters).
Read-only.
_ATTRIBUTE_NAMES
Value type: List.
ABB Automation
1MRS751250-MEN
Value:
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
7 SCIL Commands
Attribute USER_DEFINED: Text vector containing the names of user-defined attributes, i.e. the attributes created by .MODIFY command (or by .SET command in a picture container context).
Attribute PREDEFINED: Text vector containing the names of the attributes defined by the object class.
The attributes are listed in no particular order.
ABB Automation
_CHILD_OBJECTS
Value type:
Value:
Text vector.
The names of the immediate children of the object listed in the order of creation.
_OBJECT_CLASS
Value type: Text.
Value: The name of the class of the object.
If the object is a window or picture function, the attribute has value "WINDOW" or
"PICTURE_FUNCTION", respectively.
_OBJECT_NAME
Value type: Text.
Value: The name of the object.
_SOURCE_FILE_NAME
Value type:
Value:
Text.
The full operating system format name of the ’vso’ file where the object has been loaded from or the full name of the ’pic’ file where the window or picture function has been read from.
Value is an empty string, if the object is created on-the-fly, i.e.
119
MicroSCADA
7 SCIL Commands
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN using .CREATE, !WIN_NAME or !WIN_CREATE command.
_VARIABLE_NAMES
Value type: Text vector.
Value:
Note:
The names of SCIL variables defined in the SCIL context that the object belongs to.
The names are listed in no particular order.
_SG_GEOMETRY
This attribute is inapt for VS objects.
Value type:
Value:
List.
Attribute X:
Attribute Y:
X position of window/pf relative part picture / picture function.
Y position of window/pf relative part picture / picture function.
Attribute ABSOLUTE_X: X position of window/pf relative
ROOT.
Attribute ABSOLUTE_Y: Y position of window/pf relative
ROOT.
Attribute W: width of window/picture function in semigraphical characters.
Attribute H: height of window/picture function in semigraphical characters.
W and H are 0 if window is not shown.
120 ABB Automation
1MRS751250-MEN
8
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
Functions
This chapter describes the predefined SCIL functions. The chapter is organized into the following sections:
8.1
General
8.2
Arithmetical Functions
8.3
Time Functions
8.4
String Functions
8.5
Bit Functions
8.6
Vector Handling Functions
8.7
Database and List Functions
8.8
Functions for Reading and Writing Files
8.9
Functions Related to Program Execution
8.10 Communication Functions
8.11 File and Directory Handling Functions
8.12 File and Directory Management Functions
8.13 DDE Client Functions
8.14 DDE Server Functions
8.15 ODBC Functions
8.16 RTU Functions
8.17 Printout Functions
8.18 Error Tracing Functions
8.19 Data Type Handling Functions
8.20 Miscellaneous Functions
Besides the SCIL functions described in this chapter, there are also some functions for handling full graphic elements, which are described in Chapter 9.
ABB Automation
121
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
8.1
General
Function Calls
SCIL provides a number of standard functions, which return values according to a predetermined algorithm. When a function is called upon, its value is immediately calculated, and the result replaces the function call. Function calls are used as operands in expressions (see example 8-1).
A function call has the following format: function(argument(s))
The arguments are one or several arbitrary expressions, separated by commas. The allowed data types of the arguments, as well as the data type of the result (value), are fixed by the actual function. The data type of the result determines how the function call is used in expressions (see Chapter 6).
In the function descriptions in this chapter, the data types of the arguments, as well as the data type of the resulting value, are given for each function. Arguments in square brackets are not obligatory. If not otherwise stated, all arguments can be arbitrary
SCIL expressions of the specified data types.
Examples
The following examples illustrates the use of functions:
!SHOW TIME TIMES(OBJ:PRT)
;The latest registration time for the object is written out as a text in the
;window called TIME.
#IF ODD(%I) #THEN #SET S:PBO(%I) = 0
;If the variable I is an odd number, the function ODD gets the value TRUE and
;the #SET statement is executed.
@SUM = PICK(A:D(1..1000),%I) + PICK(B:D(1..1000),%I)
;Corresponding indexes of the data objects A and B are summed. The indexes are
;determined by the variable I.
!SHOW PEAK HIGH(EFFECT:DOV(1..1000))
;The peak effect is shown in the window PEAK. As the function HIGH returns a
;vector of one element, the window should be of type MULTIFIELD, BAR or CURVE.
Overview
The following table lists all SCIL functions and the tasks they perform along with the page numbers where they are described.
Function
ABS(arg)
ADD_INTERLOCKED( object , index , amount )
APPEND(v1, v2)
APPLICATION_OBJECT_ATTRIBUTES(apl, type,objects,attributes)
APPLICATION_OBJECT_COUNT(apl, type [,order
[,direction [, start [,condition]]]])
APPLICATION_OBJECT_LIST
(apl,type[,order[,direction[,start[,condition[,attributes[
,max]]]]])
Brief Description
The absolute value of the argument.
Implicitly modifies the UV or SV attribute of a SYS or an
APL object.
The function appends data to a vector.
Returns the values of specified attributes of selected objects.
Counts the application objects of a specified type which obeys a given criterion.
Returns a list of application objects selected by type and other criteria.
Page
128
231
146
168
156
165
122 ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
Function Brief Description Page
ARCSIN(arg)
ARCCOS(arg)
ARCTAN(arg)
Arcus sinus, arcus cosinus and arcus tangent. 128
ARGUMENT(n) Reads input arguments. 179
ARGUMENT_COUNT Returns the total number of arguments in the argument list of the program call.
ARGUMENTS Returns all arguments in the argument list of the program call as a vector.
180
180
ASCII(n) Returns the ASCII character corresponding to the argument.
135
ASCII_CODE(c) Returns the ASCII code of the argument. 135
AUDIO_ALARM Sets and resets the specified audio alarm(s). 231
BCD_TO_INTEGER(bcd) Converts BCD coded numbers to integer 136
BIN(b) Converts bit strings, integers and vectors to texts and text vectors.
BIT(a,n) The bit value of a given bit number in a bit string or
136
143
BIT_AND(a1,a2)
BIT_OR(a1,a2)
BIT_XOR(a1,a2) integer.
Combining bit representations with and, or and xor. 144
BIT_CLEAR(a,b1, ... ,bn) Sets given bits to zero. 144
BIT_COMPL(a) Calculates a new integer or bit string by complementing the bits of the argument.
145
BIT_MASK(n1,....,n32) Creates an integer by setting given bit numbers to 1. 145
BIT_SCAN(string) Converts character strings to bit strings. 137
BIT_SET(a,b1, ..., bn) Modifies integers and bit strings by setting given bit numbers to 1.
145
BIT_STRING(l[,b1, ... ,bn]) Creates a bit string by setting given bit numbers to 1 and the other ones to 0.
CAPITALIZE(text)
LOWER_CASE(text)
146
Changes the case of a text. 137
UPPER_CASE(text)
CLASSIFY(vector,n,low,high) Classifies the elements of a vector into size classes and 146 re-turns the counts of each class.
CLOCK(time) The present time. 131
COLLECT ( v, delimiter ) Collects the elements of a vector to a text string where the elements are surrounded by given delimiter
147 characters.
COMPILE(source) Runs the SCIL compiler. 180
CONSOLE_OUTPUT(text) Writes a message in the notify windows. 232
CUMULATE(vector) The elements of the argument vector are accumulated to
DATA_FETCH (appl,name,index1[,step[,count]])
DATA_FETCH (appl,name,time1,time2[,step[,shift]]) the result vector.
Reads the records of a data object and returns them as a list.
DATA_FETCH
(appl,name,time1[,step[,count[,shift]]])
DATA_FETCH (appl,name,indexes)
147
172
DATA_STORE (appl,name,data,index1[,step])
DATA_STORE (appl,name,data,indexes)
Writes historical data into a data object and returns the status of the operation.
173
DATA_TYPE(expression) Returns the data type of the argument. 228
DATE[(time)] The date (year, month and day). 131
DAY[(time)] The date of the day specified by the argument. 132
DDE_CONNECT(service, topic) Opens a connection to an external application. 208
DDE_DISCONNECT(connection_id) Closes the connection specified by the argument. 209
DDE_EXECUTE(connection_id, statement
[,timeout])
Executes a statement in a remote application. 211
ABB Automation
123
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Function Brief Description Page
DDE_POKE(connection_id, item, value [,timeout]) Sets the value of ’item’ in a remote application. 210
DDE_REAL(real , separator) Creates a text format real number with a user defined decimal separator.
213
DDE_REQUEST(connection_id, item [,timeout]) Requests data from a remote application. 209
DDE_VECTOR(vector , decimal separator , list separator)
Creates a text format vector with user defined list separator.
212
DEC(value[,length[,decimals]]) Converts integer and real data to text. 137
DEC_SCAN(string) HEX_SCAN(string)
OCT_SCAN(string)
Converts character strings to decimal numbers. 139
DELETE_ELEMENT ( v, index [ , index2 ] ) Deletes individual elements in the vector ‘v’. 148
DELETE_PARAMETER(file, section[, key]) Deletes a parameter in a paramter file. 179
DIRECTORY_MANAGER("COPY", source, target ) Copies a directory and all its contents into a new directory.
DIRECTORY_MANAGER("COPY", source, target[, filter[, subdirectories[, overwrite]]])
Copies the files of a directory into another directory.
Optionally, the subdirectories are recursively copied as
188
188
DIRECTORY_MANAGER("CREATE", directory[, well.
Creates a directory or a hierarchy of directories. 188 recursion])
DIRECTORY_MANAGER("DELETE", directory) Deletes one or more directories and all the directories 188
DIRECTORY_MANAGER("DELETE_CONTENTS", and files contained in them.
Deletes files and directories contained in a given 188 directory[, filter[, subdirectories]]) directory.
DIRECTORY_MANAGER("EXISTS", directory) Checks the existence of one or more directories. 188
DIRECTORY_MANAGER("GET_ATTRIBUTES" , directory)
DIRECTORY_MANAGER("LIST", directory[, filter[,
Returns attribute information from one or more directories.
188
Lists the directories contained in a given directory. 188 recursion]])
DIRECTORY_MANAGER("MOVE", directory, target) Moves a directory to another directory. 188
DIRECTORY_MANAGER("RENAME", directory, name
Renames a directory. 188
DO (program [, a1, .... , an]) Executes a SCIL program given as argument. 181
DOW[(time)] Day of week. 132
DOY[(time)] Day of year. The number of the day since the beginning 132 of the year.
DRIVE_MANAGER("EXISTS", drive) Checks the existence of one or more drives. 193
DRIVE_MANAGER("GET_ATTRIBUTES", tag) Returns some information from drives. 193
DRIVE_MANAGER("GET_DEFAULT") Returns the default drive, i.e. the drive assumed if an absolute path does not contain the drive.
193
DRIVE_MANAGER("LIST") Returns the drives available in the system. 193
DUMP( data ) Transforms the value of an expression into text format. 232
EDIT(text,key) Rearranges text. 138
ELEMENT_LENGTH(vl) The lengths of vector elements and list attributes 148
END_QUERY Tells whether a process query initiated with
#INIT_QUERY is completed.
169
ENVIRONMENT(variable) Retrieves the value of the specified variable from the environment block of the calling process.
232
EQUAL(v1, v2, [, status_handling]) Two scil values are compared for equality 129
ERROR_STATE Returns the current ‘ERROR_STATE’. 181
EVALUATE( expression ) Evaluates an expression given in text format. 232
EXP(arg) The number e (neper's number) raised to the power of the argument.
178
FETCH(appl,type,name[,index]) Fetches the attribute of a selected object. 169
FILE_LOCK_MANAGER(function, file) Locks and unlocks files. 193
FILE_MANAGER("COPY", source, target[, overwrite])
Copies the contents of a file to another file. 194
FILE_MANAGER("DELETE" , file ) Deletes one or more files. 194
124 ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
Function
FILE_MANAGER("EXISTS" , file )
FILE_MANAGER("GET_ATTRIBUTES", file )
FILE_MANAGER("LIST", directory[, filter[, recursion]])
FILE_MANAGER("MOVE", file, target)
FILE_MANAGER("RENAME", file, name)
FM_APPLICATION_DIRECTORY
FM_COMBINE(tag1[, tagi ]*, tagn )
FM_COMBINE_NAME(’name’, ’extension’)
FM_DIRECTORY(path[, check])
FM_DRIVE(name[, check])
FM_EXTRACT(tag, component)
FM_FILE(path[, check])
FM_REPRESENT(tag[, option]* )
FM_SCIL_DIRECTORY(name[, check])
FM_SCIL_FILE(name[, option][, option])
FM_SCIL_REPRESENT(tag[, case])
FM_SPLIT_NAME(file)
Brief Description
Checks the existence of one or more files.
Returns attribute information from one or more files.
Lists the files ( but not directories ) contained in a given directory.
Moves a file to another directory.
Renames a file.
Creates the absolute directory tag of the home directory of current application.
Combines two or more drive, directory or file tags to create a new directory or file tag.
Combines a proper file name and an extension to a file name.
Creates a directory tag from one or more directory paths or checks directory paths.
Creates a drive tag from one or more drive names or checks drive names.
Extracts a component from one or more directory or file tags.
Creates a file tag from one or more file paths or checks file paths.
Converts one or more drive, directory or file tags into an
OS dependent text representation.
Creates a directory tag from one or more SCIL names or checks SCIL names.
Creates a file tag from one or more SCIL names or checks SCIL names.
Converts one or more directory or file tags into a SCIL name text representation.
Extracts the proper name and the extension from one or more file names.
Returns the status code(s) of an expression.
Converts integers to text and hexadecimal format.
The largest (high) or the smallest (low) element in a vector.
The index of the largest or smallest element in a vector.
Page
194
194
194
194
194
197
200
201
197
197
200
198
199
197
198
199
201
233
138
149
149
GET_STATUS(expression)
HEX(n)
HIGH(vector)
LOW(vector)
HIGH_INDEX(vector)
LOW_INDEX(vector)
HISTORY_DATABASE_MANAGER(command[, command_arguments])
HOD[(time)]
Function for handling the history database
Hours of day. Hours passed since the beginning of the day.
Hour, minute and second respectively.
HOUR[(time)]
MINUTE[(time)]
SECOND[(time)]
HOY[(time)]
HR_CLOCK
INTEGER_TO_BCD(int [, digits ])
INTERP(vector,x)
INVERSE(vector,n,low,high)
KEYED_FILE_MANAGER( function, file {,output_file
{, key_size}})
LENGTH(arg)
LIST(attribute=expression, attribte=expression, ...)
LIST_ATTR(list)
LN(arg)
LOAD_DCP(file,link,start)
Hours of year. Hours passed since the beginning of the year.
System time in seconds and milliseconds.
Converts an integer value to a BCD coded bit string.
Interpolates a value from a curve.
Inverts a curve.
File maintenance function.
Returns the "length" of the argument.
Forms a list of attributes and attribute values.
The function returns a vector of all attributes contained in a list.
The natural logarithm of the argument.
Loads and starts an internal DCP-net.
156 -
164
132
132
132
133
139
149
150
203
233
234
234
129
184
ABB Automation
125
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Function
LOCATE(string1, string2 [, all]))
MEAN(vector)
MEMORY_POOL_USAGE(pool)
MEMORY_USAGE
MIN(arg1,...,arg32) MAX(arg1,...,arg32)
Brief Description
Searches for a text string in a text or text vector and returns the position of its first character.
The mean value of all the elements in the argument vector.
Monitor the usage of memory pools.
Returns the amount of memory pool (as bytes) allocated for the expression, or for the variable.
Returns the smallest or the largest value in the argument list.
The number of the month.
Page
139
150
235
235
130
MONTH[(time)]
NEXT(n) PREV(n)
OCT(n)
ODD(arg) EVEN(arg)
Next object and "previous object".
Returns the octal ASCII representation of integers.
Tells if an expression is odd or even.
OPS_CALL(command [,0]) The function executes an operating system command.
OPS_PROCESS ( command [ , directory [ , wait ] ] ) Starts an external program as a separate process within the operating system environment.
PACK _TIME(year,month,day,hour,minute,second) Transforms calendar time to internal system time given as time data.
PACK_STR ( source , type [, length [, byte_order]] ) Converts text vector to text or integer vector to bit or byte string.
PARSE_FILE_NAME ( name [ , file ] )
PATH( name )
Converts logical paths names and file names to operating system file names.
The real directory paths of a logical path name.
PATHS( level )
PHYS_FETCH (appl,unit,address[,bitaddress])
PICK(vector,indexes)
The logical paths defined on a specified level.
The function forms a list with attributes taken from a process object.
Picks specified elements from a vector and stores them in another vector.
Sends printout to a printer.
PRINT_TRANSPARENT( data [, log] )
PRINTER_SET
PROD_QUERY(n)
RANDOM( n1 , n2 )
READ_BYTES( file [ , start [ , length ] ] )
Returns the target printer numbers.
Returns the attributes of the process objects selected with
#INIT_QUERY.
Generates a random number in a given range.
Reads data from a binary file.
Reads the columns of a text file.
READ_COLUMNS( file, pos, width [ , start [ , count ]
] )
READ_PARAMETER(file, section, key, alt)
READ_TEXT(file[,start[,number]])
REMOVE_DUPLICATES(v [, status_handling])
REP_LIB( name )
REP_LIBS( level )
REPLACE(text, string, new_string)
REVERSE(vector)
REVISION_COMPATIBILITY( issue { , enable })
RTU_ADDR(key)
RTU_AINT(i)
RTU_AREAL(r)
RTU_ATIME[(t,[msec])]
133
170
141
130
182
182
133
228
204
205
206
170
151
223
226
171
235
174
175
Reads a parameter in a parameter file.
The function reads selected lines from an ASCII file and stores them as a text vector.
Removes duplicate elements of a vector
178
176
The real file names of a logical representation library name.
The logical library names defined on a specified level.
151
205
206
Replace textstrings with a new textstring 141
Assembles a new vector by reversing the order of the elements in the argument vector.
151
Selects the compatibility issues to be used in the context.
236
219 Returns a list with the address of the object in a certain re-cord.
Converts an integer to ascii characters (according to the
RP570 protocol).
Converts a real number to four ASCII-characters (float
DS801).
Converts time data (operating system time) to ascii
(RTU200 time).
220
220
221
126 ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
Function
RTU_BIN(h)
RTU_HEXASC(b)
RTU_INT(a)
RTU_KEY(oa)
RTU_MSEC(atime)
RTU_OA(type,ba)
RTU_REAL(a)
RTU_TIME(a)
SCALE(v, scale_object [, direction ])
SCIL_HOST
SELECT(source,condition,[wildcards])
SEPARATE( text , delimiter )
SET_CLOCK(time)
SET_STATUS(source,status)
SHADOW_FILE( file_name )
SHUFFLE( n )
SIN(arg)
COS(arg)
SORT(data,[start,[length]])
SPACOM(message)
SPREAD(vector,indexes,value)
SQL_BEGIN_TRANSACTION(connection_id)
SQL_COMMIT(connection_id)
SQL_CONNECT(source, user, password )
SQL_DISCONNECT(connection_id)
SQL_EXECUTE(connection_id, SQLstring)
SQL_FETCH(statement_id)
SQL_FREE_STATEMENT(statement_id)
SQL_ROLLBACK(connection_id)
SQRT(arg)
STATUS
SUBSTR(string,start,length)
SUM(vector)
SUM_POS(vector)
SUM_NEG(vector)
TIMEOUT(integer)
TIMES[(time)] TIME[(time)]
TODS[(time)]
TOD[(time)]
TRACE_BEGIN( filename [, append ] [,time_tags])
Brief Description
Converts hex-ASCII numbers given as a text to binary numbers in text form.
Converts binary numbers given as a text to hex-ASCII numbers as a text.
Converts two ascii characters (2’s Complement RP570) to an integer.
Returns the search key for a record in an RTU200 configura-tion file.
Returns the milliseconds of the 6-byte rtu time string atime.
Returns the object address.
Page
221
221
221
222
222
222
222 Converts 4 ascii characters (float DS801) to a real number.
Converts ascii (RTU200 time) to microscada time data.
Scaling of a real value with a scala object
Returns the name and number of the kernel process that executes the current scil code.
The function selects the elements of a vector or a list that fulfill a given criterion.
Converts text to vector.
Sets the system time.
Writes the status codes of an expression.
Enable shadowing of files not created by microscada.
Arranges specified integer numbers in a random order and returns them as a vector.
The sine and cosine of the argument.
223
237
237
152
141
133
238
206
236
130
Sorts a vector in ascending order or alphabetical order.
Communicates with a spacom unit connected to a com port.
The function replaces certain vector elements with other values.
Marks the beginning of a transaction.
153
185
153
Commits a transaction the start of which was marked with
SQL_BEGIN_TRANS.
Opens an odbc connection to a data source.
Closes the ODBC connection defined by the argument.
Executes an SQL statement.
217
218
214
215
215
216 Fetches a row of data from a result set obtained by
SQL_EXECUTE.
Frees the specified statement and stops processing associated with the statement.
Rolls back a transaction started with
SQL_BEGIN_TRANS.
The square root of the argument.
The status produced by the latest error situation in the program that is being executed.
Extracts a substring from a text or bit string.
217
219
131
183
142
The sum of all the elements in a vector.
154
The sum of the positive or negative elements in a vector.
154
Changes communication time-out.
Date and time, with and without seconds.
Time of day.
Starts trace logging.
185
134
134
227
ABB Automation
127
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Function
TRACE_END
TRACE_PAUSE
TRACE_RESUME
TRANSLATE(text [,language])
TREND(vector,n)
TRUNC(arg)
ROUND(arg)
TYPE_CAST ( source, type )
UNPACK_STR ( source [, length [, byte_order]])
VECTOR[([element1, ....., elementn])]
WEEK[(time)]
WORKSTATION_CALL(command[, other, ...])
WRITE_BYTES(file, data[, append] )
WRITE_COLUMNS ( file, pos , width , data [ , append ] )
WRITE_PARAMETER(file, section, key, value)
WRITE_TEXT(file,text[,cont])
YEAR[(time)]
8.2
Brief Description
Stops trace logging.
Pauses trace logging
Resumes trace logging
Translates texts defined in visual scil objects.
Assembles a new vector from the last (highest indexed) elements in a vector.
Transform the arguments from real into integer.
Page
227
227
227
239
155
131
Converts data from one data type to another.
Converts texts, bit strings and byte strings to vectors of integer or text elements.
Creates a vector with given elements.
The number of the week within a year.
Function for communicating with workstation.
Writes data in a binary file.
Writes text in columns in a text file.
230
229
155
134
183
175
176
Writes a parameter in a parameter file.
The function writes the contents of a text vector into an
ASCII-file.
The year in complete format (for example 1993).
178
177
134
Arithmetical Functions
128
ABS(ar g)
The absolute value of the argument.
’arg’ An integer or real expression, or a vector with integer or real values.
Value: The same data type as the argument (’arg’).
Example:
ABS(-3) ;returns the value 3.
ARCSIN(arg)
ARCCOS(arg)
ARCTAN(arg)
Arcus sinus, arcus cosinus and arcus tangent.
These functions return the angles in radians, whose sine, cosine or tangent are the arguments.
’arg’ An integer, real or vector expression. The elements of a vector must be integer or real expressions.
Value: A real number or a vector with real elements. The angles in radians.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
EQUAL(v1, v2, [, status_handling])
Two SCIL values are compared for equality.
’v1’ First value of any type.
’v2’ Second value of any type.
’status_handling’ Text value, either "CONSIDER_STATUS" or
"IGNORE_STATUS"), default = "IGNORE_STATUS"
Value: Boolean value TRUE if ’v1’ is equal to ’v2’, otherwise FALSE.
Two values are considered equal if :
•
The value types are the same and
•
The values are the same and
•
The status values are the same (when "consider_status") or else both valid (< 10)
(when "ignore_status")
The test for equality is recursive, i.e. if the value is a vector or list, its components are tested for equality.
Example:
@b_istrue_1=EQUAL(1,1)
;returns TRUE
@b_istrue_2=EQUAL(1,10)
;returns FALSE
@i_A=TRUNC(RANDOM(1,10))
@i_B=TRUNC(RANDOM(1,10))
@b_istrue_3=EQUAL(%i_A,%i_B)
;returns TRUE or FALSE
EXP(arg)
The number e (Neper’s number) raised to the power of the argument.
’arg’ An integer or real expression, max. +88.0, or a vector of integer and real expressions max. +88.0.
Value: A real number or a vector with real elements.
LN(arg)
The natural logarithm of the argument.
’arg’ An integer or real expression > 0, or a vector, the elements of which are integer or real expressions > 0.
Value: A real number or a vector with real elements.
129
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
MIN(arg1,...,arg32)
MAX(arg1,...,arg32)
Returns the smallest or the largest value in the argument list.
'arg1' ... 'arg32’ 1 ... 32 integer and real values and vectors with integer or real elements. The number of arguments may be up to 32.
Value: An integer, a real number or a vector. If all arguments or all compared elements are integers, the result is an integer or an integer element, otherwise a real/real element.
If the argument list contains both numbers and vectors, the numbers are compared with each one of the vector elements and corresponding vector elements are compared. If the number of vector elements is unequal, odd elements get
SUSPICIOUS_STATUS (see the Status Codes manual).
Example:
@X = (MIN(4,83,-1.8,-3) ;returns -3.0
@A = (2,4)
@B = (5,6,1)
@C = MIN(3,%A,%B)
;Vector C gets value (2,3,1)
;The last element has SUSPICIOUS_STATUS.
ODD(arg)
EVEN(arg)
Tells if an expression is odd or even.
These functions return the boolean value TRUE if the argument is odd (ODD) or even
(EVEN) respectively.
'arg' An integer or an integer vector.
Value: A boolean value or a vector, the elements of which are boolean.
Examples:
@A = ODD(5) ;returns TRUE
@A = EVEN(5) ;returns FALSE
SIN(arg )
COS(arg)
The sine and cosine of the argument.
'arg'
Value:
One or several angles given in radians as an integer or real number or as a vector with integer or real values.
A real value, or a vector with real elements.
130 ABB Automation
1MRS751250-MEN
8.3
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
SQRT(arg)
The square root of the argument.
’arg’ An integer or a real value > = 0, or a vector, the elements of which are integer or real > = 0.
Value: A real value > = 0 or a vector, the elements of which are real > =
0.
TRUNC(arg)
ROUND(arg)
Transform the arguments from real into integer.
TRUNC truncates all the decimals, no matter what value they have. ROUND rounds off to the nearest integer number.
‘arg'
Value:
A real number or a vector with real elements.
An integer or a vector with integer elements.
Examples:
@X = TRUNC(4.8) ;returns 4
@X = ROUND(4.8) ;returns 5
Time Functions
The time functions are used for reading time information in various forms, setting the system time, and converting time information from one form to another. All time functions, except PACK_TIME and SET_CLOCK, require arguments of type time, integer (positive) or vector. In vector type arguments, all elements must be time data or positive integers. Integer arguments are regarded as time data given as the number of seconds (see Chapter 3). The time functions may also be used without any argument. In such cases, the argument is assumed to be the present time.
At the end of this section you find examples of the time functions.
CLOCK[(time)]
Returns its argument as such.
Always used without an argument to obtain current time.
Value: Time data.
DATE [(time)]
The date (year, month and day).
131
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
The date is given in the format yy-mm-dd or dd-mm-yy depending on the value of the attribute SYS:BTF.
Value: A text or text vector.
DAY[(time)]
The date of the day specified by the argument.
Value: An integer or integer vector.
DOW[(time)]
"Day of Week".
The number of the day counting from Monday which is number one.
Value: An integer or integer vector.
DOY [(time)]
"Day of Year". The number of the day since the beginning of the year.
Value: An integer or integer vector.
HOUR[(time)]
MINUTE[(time)]
SECOND[(time)]
Hour, minute and second respectively.
Value: An integer or integer vector.
HOD[(time)]
"Hours of Day". Hours passed since the beginning of the day.
Value: A real or real vector.
HOY[(time) ]
"Hours of Year". Hours passed since the beginning of the year.
Value: A real or real vector.
132 ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
HR_CLOCK
System time in seconds and milliseconds.
Value: A list containing the following two attributes:
CL = the system time as time data (= CLOCK)
US = the microseconds of the system time as an integer (with an accuracy depending on the operating system, often 10 milliseconds).
Example:
@TIME = HR_CLOCK
!SHOW TIMES TIMES(TIME:VCL)
!SHOW MILLI TIME:VUS/1000
MONTH[(time)]
The number of the month.
Value: An integer or integer vector.
PACK_TIME(year,month,day,hour,minute,second)
Transforms calendar time to internal system time given as time data.
’year’ Integer, 1978 ... 2045
’month’ Integer, 1 ... 12
’day’
’hour’
’minute’
’second’
Integer, 1 ... 31
Integer, 0 ... 23
Integer, 0 ... 59
Integer, 0 ... 59
If any of the arguments are outside the given intervals, the time is assumed to be Jan
1st 1978, 00:00 o’clock.
Value: Time data.
SET_CLOCK(time)
Sets the system time.
’time’ Time data or a list with the following two attributes:
CL = system time on second level.
133
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Value:
US = the microseconds of the system time.
A real value. The number of seconds that the system clock time was changed. A positive value means that the clock was set forward. A negative value indicates that it was set backward.
Example:
@T = SET_CLOCK(LIST(CL = CLOCK, US = 500000))
TIMES[(time)]
TIME[(time)]
Date and time, with and without seconds.
The date and time is given in the form yy-mm-dd hh:mm:ss or dd-mm-yy hh:mm:ss depending on the value of the attribute SYS:BTF.
Value: A text or text vector.
TODS[(time)]
TOD[(time)]
"Time of Day".
The TODS function returns the time in the format hh:mm:ss. The TOD function returns the same as TODS, but without seconds.
Value: A text or text vector.
WEEK[(time)]
The number of the week within a year.
Value: An integer or integer vector.
YEAR[(time)]
The year in complete format (for example 1993).
Value: An integer or integer vector.
134 ABB Automation
1MRS751250-MEN
8.4
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
Examples:
On 19 February ’97 at 20:35:04 o’clock the time functions returned the following values (supposing SYS:BTF == 0):
Function call
TIMES
TIMES(CLOCK-1)
TIMES(OBJ:PRT)
TIME
TODS
DATE
YEAR
MONTH
HOUR
MINUTE
SECOND
DOY
HOD
TIMES(PACK_TIME(1993,5,5,12,30,0))
!SHOW TIME TIMES(LISTA:VRT)
Value
"97-02-19 20:35:04"
"97-02-19 20:35:03"
"97-01-28 15:43:26" (the latest registration time for the object)
"97-02-19 20:35"
"20:35:04"
"97-02-19"
1997
2
20
35
4
50
20.58444
97-05-05 12:30:00
All the registration times of the variable object are shown as a column in the window TIME.
String Functions
The string functions perform operations on texts, bit strings and byte strings, for example transformations of numbers into character strings or vice versa.
ASCII(n)
Returns the ASCII character corresponding to the argument.
’n’ An integer in range 0 ... 255, or a vector, all elements of which are integers within the given range.
Value: An ASCII character or a vector with ASCII characters.
Examples:
@A = ASCII(65)
;returns "A"
@A = ASCII(13)
;returns ‘carriage return’
ASCII_CODE(c)
Returns the ASCII code of the argument.
’c’ An ASCII character or a vector with ASCII characters.
135
MicroSCADA
8 Functions
136
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Value: An integer in range 0 ... 255 or a vector with integers within this range.
Example:
ASCII_CODE("A") == 65
BCD_TO_INTEGER(bcd)
Conversion of bcd coded number to integer. (Binary Coded Decimal)
BCD values are represented in SCIL by values of BIT_STRING data type. Each digit takes 4 bits so the length of a BCD bit string is a multiple of 4. The length of a BCD value is limited to 9 digits.
’bcd’ Bit string value containing the BCD coded number.
Value: List value with attributes
STATUS Integer status code of the conversion
INT Integer value, the result of conversion
If the bit string represents a valid BCD number, the STATUS attribute is set to
OK_STATUS ( 0 ) and the result of the conversion is returned in attribute INT.
If the bit string is invalid, i.e. it contains nibbles out of range 0 .. 9, its length is not a multiple of 4 or its length is greater than 36, STATUS is set to
SCIL_NOT_A_BCD_NUMBER and INT attribute is not returned.
Example:
@bcd_string_of_number=INTEGER_TO_BCD(98)
;returns list with BCD representation of the integer
;as the value of the attribute named BCD
@l_of_number=BCD_TO_INTEGER(bcd_string_of_number:vBCD)
;returns list with attribute INT containing the
;integer, 98
@i_number=l_of_number:vINT
;assign the value of the INT attribute to
;the variable ’i_number’
BIN(b)
Converts bit strings, integers and vectors to texts and text vectors.
If the argument is a bit string, the function returns its first 255 bits as a text. If the argument is an integer, the function returns its bit representation as a text. If the argument is a vector if bit strings and integers, the vector elements are converted to texts correspondingly.
‘b'
Value:
A bit string or integer, or a vector of bit strings and integers .
A text or text vector. Each text element converted from an integer will contain 32 characters. A text element converted from a bit
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions string will contain the same number of characters as the bit string, however, at most 255 characters.
Example:
@A = BIT_SCAN ("010101")
@B = BIN (%A)
;returns "010101"
@C = BIN (23)
;returns "0000...0010111" (initially 27 zeroes)
BIT_SCAN(string)
Converts character strings to bit strings.
’string’ A text or text vector. The text must be composed of the digits 0 and 1.
A bit string or a vector of bit strings.
Value:
Example:
BIT_SCAN ("010101") = a bit string with the contents 010101 (not visible)
CAPITALIZE(text)
LOWER_CASE(text)
UPPER_CASE(text)
Changes the case of a text.
LOWER_CASE converts the text to lower case letters. UPPER_CASE converts the text to uppercase letters. CAPITALIZE converts the first character of the text or each text vector element to an uppercase letter, the rest of the text to lower case letters.
’text’
Value:
A text or text vector.
A text or text vector.
DEC(value[,length[,decimals]])
Converts integer and real data to text.
The function converts an integer or a real value or a vector of integer and real values
(’value’) to a text or text vector respectively.
’value’ An integer or real expression, or a vector of integer and real expressions.
’length’ An integer expression. The minimum length of the produced text.
Default = 6.
ABB Automation
137
MicroSCADA
8 Functions
138
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
’decimals’
Value:
Examples:
@A = DEC (1000)
;returns "1000"
@A = DEC (-1)
;returns "-1"
@A = DEC(1.3,6,3)
;returns "1.300"
An integer expression. The number of decimals included in the conversion of real or integer data to text. Default = 0.
A text of ’length’ characters or more, or a text vector, the elements of which contain ’length’ characters or more. If the number is shorter than ’length’, the string is filled up by initial blanks.
EDIT(text,key)
Rearranges text.
The function rearranges a text (’text’) by removing spaces and tabs according to a specified rule (’key’).
’text’ A text or text vector expression.
’key’ A text. One of the following key words:
"TRIM" = Removes leading and trailing spaces and tabs.
Value:
"LEFT_TRIM" = Removes leading spaces and tabs.
"RIGHT_TRIM" = Removes trailing spaces and tabs.
"COLLAPSE" = Removes all spaces and tabs.
"COMPRESS" = Replaces multiple spaces or tabs with single spaces.
A text or text vector.
HEX(n)
Converts integers to text of hexadecimal format.
The function converts an integer or integer vector (‘n’) to its hexadecimal ASCII representation.
'n'
Value:
An integer or integer vector.
A text of 4 or 8 characters or a text vector, the elements of which contain 4 or 8 characters. If the number is shorter than 4 characters, or longer than 4 but shorter than 8, the string is filled up by initial zeroes.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
Example:
@A=HEX(26)
;returns "001A"
@A=HEX(-1)
;returns "FFFF"
@A=HEX(123456)
;returns “0001E240”
MicroSCADA
8 Functions
BIN_SCAN(string)
DEC_SCAN(string)
HEX_SCAN(string)
OCT_SCAN(string)
Converts character strings to decimal numbers.
BIN_SCAN converts character strings of binary numbers, DEC_SCAN decimal numbers, OCT_SCAN octal numbers, and HEX_SCAN hexadecimal numbers to the corresponding integers.
’string’ A text of digits or a text vector of digits. Leading blanks, a sign and a decimal point are allowed, all other non-digit characters produce an error.
Value: An integer or a real number, or a vector with integer or real elements. If the argument lacks a decimal point, the result is an integer. If there is a decimal point, the result is a real number. If an argument without decimal point falls outside the integer value range
(see Chapter 3), DEC_SCAN returns a real value, while
OCT_SCAN and HEX_SCAN cuts off the value to an integer.
Examples:
@A = BIN_SCAN("10011")
;returns 19
@A = BIN_SCAN("10.1")
;returns 2.5
@A = DEC_SCAN(" -5")
;returns -5
@A = DEC_SCAN("40000")
;returns 40000
@A = OCT_SCAN("10")
;returns 8
@A = OCT_SCAN("1.2")
;returns 1.25
@A = HEX_SCAN("F")
;returns 15
@A = HEX_SCAN("A.8")
;returns 10.5
INTEGER_TO_BCD(int [, digits ])
Converts an integer value to a BCD coded bit string. (Binary Coded Decimal)
BCD values are represented in SCIL by values of BIT_STRING data type. Each digit takes 4 bits so the length of a BCD bit string is a multiple of 4. The length of a BCD value is limited to 9 digits."
’int’ Integer value containing the integer to be converted.
139
MicroSCADA
8 Functions
140
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
’digits’
Value:
Integer value 0 to 9, number of BCD digits in the result. Default is
0.
List value with attributes
STATUS Integer status code of the conversion
BCD Bit string value, the BCD coded representation of ’int’
If ’digits’ is 0, a bit string long enough to hold the result is returned. Otherwise exactly
’digits’ BCD digits are returned, padded with leading zeroes, if necessary.
If the value of ’int’ can be represented as a BCD bit string ( i.e. it is non-negative and in the range specified by ’digits’ ), the STATUS attribute is set to OK_STATUS ( 0 ) and the result of the conversion is returned in attribute BCD.
If the argument is invalid, STATUS is set to SCIL_ARGUMENT_OUT_OF_RANGE and BCD attribute is not returned.
Example:
@i_A=9876
@l_bcd=INTEGER_TO_BCD(%i_A,9)
;converts the value of the variable ’i_A’
;returns a list with attributes ’BCD’ and ’STATUS’
@t_bcd=bin(l_bcd:vbcd)
;returns the BCD code converted to textformat
@t_status=dec(l_bcd:vSTATUS)
;returns the status converted to textformat
@l_converted=BCD_TO_INTEGER(l_bcd:vbcd)
;returns a list with attributes ’INT’ and ’STATUS’
@i_converted=l_converted:vINT
;returns an integer as value of the attribute ’INT’
;from the list named ’l_converted’
@t_converted_status=dec(l_converted:vSTATUS)
;returns the status converted to textformat
;from the list named ’l_converted’
LOCATE(string1, string2 [, all])
Searches for a text string in a text or text vector and returns the position of its first character.
’string1’ A text or text vector. The text to be searched through.
’string2’
‘all’
Value:
A text. The text string to be located.
A text expression, “ALL”. If given, LOCATE searches for all occurrences of ‘string2’ in ‘string1’.
An integer (>=0), a vector containing integer elements (>= 0) or another vectors, which contains integer elements. It represets the start position of 'string2' in 'string1'.
Without [, all] The result represents the start position of the first found string2 in string1. If ‘string 2’ occurs several times in the text, the result gives only the position of the first occurrence. The result is a integer if ‘string1’ is a text value. If
‘string1’ is a vector, the result is a vector of
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
With [, all] same length as string1 containing integer values. Zero means that the string was not found.
The result represents the start position of all found string2 in string1. If ‘string 2’ occurs several times in the text, the result gives the position of all occurrences. The result is a vector with integer values if ‘string1’ is a text value. If
‘string1’ is a vector, the result is a vector of the same length as ‘string1’ containing vectors with integer values. Zero means that the string was not found.
Example:
@A = LOCATE ("ABC","BC")
;returns 2
@A = LOCATE ("ABC","BC ")
;returns 0
@A = LOCATE (“ABB”,”B”,“ALL”)
;returns vector(2,3)
@A = LOCATE (("FGHBBN","ABBBB"),"BB","ALL")
;returns (vector(4), vector(2,4))
@A = LOCATE (("HBBN","ABBBB","BB","AA"),"BB","ALL")
;returns (vector(2), vector(2, 4), vector(1), vector(0))
OCT(n)
Returns the octal ASCII representation of integers.
‘n’ An integer or an integer vector.
Value: A text of 6 or 11 characters or a text vector, the elements of which contain 6 or 11 characters. The argument ‘n’ in octal format. If the octal number is shorter than 6 characters, or longer than 6 but shorter than 11, the string is filled up by initial zeroes.
Examples:
@A = OCT(10)
;returns "000012"
@A = OCT(-1)
;returns "177777"
REPLACE(text, string, new_string)
Replace text strings by another text string in a text or textvector.
'text'
'string'
'new_string'
Value:
Text or text vector containing the input text.
Text value, the string to be replaced.
Text value, the replacing string.
Text or text vector containing the text in 'text' with all occurrences of 'string' replaced by 'new_string'.
141
MicroSCADA
8 Functions
142
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
The arguments ’string’ and ’new_string’ may be of different length.
Argument ’new_string’ may be empty. In this case, all the occurrences of ’string’ are deleted.
If the string resulting string is too long ( > 255 characters ),
SCIL_STRING_TOO_LONG error is generated when the ’text’ argument is of text type. If it is a vector, the status of the overflowing element is set to
SCIL_STRING_TOO_LONG.
SEPARATE ( text , delimiter )
Converts text to vector.
The function converts the first argument (‘text’) to a vector by taking text strings separated by a specified delimiter (‘delimiter’) as elements.
‘text' Any text expression. The original text string.
'delimiter'
Value:
A text expression of one character. The delimiter.
A text vector containing the fields of 'text' that are delimited by the delimiter character. The delimiter character itself is not included. If there is no delimiter character found in the text, the entire text is returned as the only element of the resulting vector. An empty field is returned in case of two consecutive delimiters.
Example:
@A = SEPARATE(“A,B,C,D”, “,”)
;returns the vector (“A”,”B”,”C”,”D”).
SUBSTR(string,start,length)
Extracts a sub-string from a text or bit string.
’string’
’start’
’length’
A text, a bit string or a byte string, or a vector of texts, bit strings and byte strings. The text, bit string or vector from which a substring is extracted.
An integer 1 ... 255 (texts) or 1 ... 65535 (bit strings) or 1 ...
1048576 (byte strings). The starting position of the sub-string.
An integer 0 ... 255 (texts) or 0 ... 65535 (bit strings) or 1 ...
1048576 (byte strings). The length of the sub string. If ’length’ = 0, the function returns the end of ’string’ starting from ’start’. If the sub-string extends ’string’, i.e. if ’length’ > the number of characters in ’string’, the result is padded with blanks (texts) or bit zeroes (bit strings) or zero bytes (byte strings).
ABB Automation
1MRS751250-MEN
8.5
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
Value: The same data type as ’string’. The substring.
Examples:
@A = SUBSTR("ABCDE",3,2)
;returns "CD"
@A = SUBSTR("ABCDE",4,3)
;returns "DE "
@A = SUBSTR("ABCDE",6,3)
;returns " "
@V = BIT_SCAN("1010101")
@B = BIN(SUBSTR(%V,2,3))
;returns "010"
@A = SUBSTR(%BYTES, 1, 100000)
;returns a byte string containing the first 100000 bytes of byte string %BYTES.
Bit Functions
The bit functions manipulate numbers, characters and bit strings on bit level.
One "word" consists of 32 bits. The bits are numbered 0 ... 31 from right to left, i.e., 0
= Least Significant Bit (LSB) and 31 = Most Significant Bit (MSB). A bit string can be composed of up to 65535 bits numbered 1 ... 65535 from left to right (see Chapter
3).
See also the SUBSTR function in section 8.4. This function extracts a small bit string from a larger one.
BIT(a,n)
The bit value of a given bit number in a bit string or integer.
The function returns the bit value of bit number 'n' in ‘a’. If ‘a’ is an integer, it returns bit number ‘n’ in the bit representation of the integer.
'a' An integer or a bit string, or a vector of integers and bit strings.
'n' The bit number. An integer in the range 0 ... 31 or 1 ... 65535 depending on the data type (integer or bit string) of 'a' or its elements, see the general part of this section. 'n' must not exceed the number of bits in 'a' or its elements.
Value: An integer, 0 or 1, or a vector with elements which are 0 or 1.
Examples:
@A = BIT(3,0)
;returns 1
@A = BIT(-1,15)
;returns 1
@A = BIT(BIT_SCAN("010101"),5)
;returns 0
ABB Automation
143
MicroSCADA
8 Functions
144
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
BIT_AND(a1,a2)
BIT_OR(a1,a2)
BIT_XOR(a1,a2)
Combining bit representations with AND, OR and XOR.
The function returns an integer or a bit string calculated by AND-ing, OR-ing or
XOR-ing bit-wise the corresponding bits in two bit string arguments or in the bit representations of two integer arguments.
’a1’ An integer or a bit string, or a vector of integers and bit strings.
’a2’
Value:
The same data type as ’a1’.
An integer or a bit string, or a vector of integers and bit strings.
If one of the arguments is a vector and one a simple data, the operation is performed between the simple data and each vector element. If both arguments are vectors, the operation is performed between corresponding elements. If the number of vector elements is unequal, odd elements are given SUSPICIOUS_STATUS (see the Status
Codes manual).
Examples:
@A = BIT_AND(6,5)
;returns 4
@A = BIT_AND(BIT_MASK(0,2,4,6,12),BIT_MASK(1,2,4,7,13))
;returns 20 (the bits 2 and 4)
@A = BIT_OR(6,5)
;returns 7
@A = BIT_XOR(6,5)
;returns 3
BIT_CLEAR(a,b1, ... ,bn)
Sets given bits to zero.
The function returns the value yielded when the bit numbers ’b1’ ... ’bn’ in a bit string or in the bit representation of an integer (’a’) are set to zero.
’a’ An integer or a bit string, or a vector of integers and bit strings.
’b1’ ... ’bn’ The bit numbers to be set to 0. Up to 31 integers in the range 0 ...
31 or 1 ... 65535 depending on the data type (integer or bit string) of ’a’ or its elements, see the general part of this section. The bit numbers must not exceed the number of bits in ’a’ or its elements.
The same data type as the argument ’a’.
Value:
Examples:
@A = BIT_CLEAR(3,0)
;returns 2
@A = BIT_CLEAR(2,0)
;returns 2
@A = BIT_CLEAR(-1,15)
;returns - 32769
@A = BIT_CLEAR(BIT_SCAN("01111"),2,4,5) = = BIT_SCAN("00100")
;returns true
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
BIT_COMPL(a)
Calculates a new integer or bit string by complementing the bits of the argument.
The function returns an integer, bit string, or vector calculated by complementing the bits in a bit string argument or the bits in the bit representation of an integer argument.
‘a' An integer or bit string, or a vector of integers and bit strings.
Value: The same data type as the argument 'a'.
Examples:
@A = BIT_COMPL(0)
;returns -1
@A= HEX(BIT_COMPL(HEX_SCAN("207F")))
;returns "DF80"
@A= BIT_COMPL(BIT_SCAN("0101"))
;returns bitstring “1010”
BIT_MASK(n1,....,n32)
Creates an integer by setting given bit numbers to 1.
The function returns the integer number yielded when the bit numbers given in the argument list are set to 1 and all the others are set to zero.
’n1’ ... ’n32’ Bit numbers. 1...32 integer values in the range 0..31.
Value: An integer.
Examples:
@A=BIT_MASK(0)
;returns 1
@A=BIT_MASK(4,0)
;returns 17
@A=BIT_MASK(4,0,15)
;returns 32785
@A=HEX(BIT_MASK(0))
;returns "0001"
BIT_SET(a,b1, ..., bn)
Modifies integers and bit strings by setting given bit numbers to 1.
The function returns the value yielded when the bit numbers ’bn’ in the bit representation of ’a’ are set to one.
’a’
’b1’ ... ’bn’
Value:
An integer, a bit string or a vector of integers and bit strings.
The bit numbers to be set to 1. Up to 31 integers in the range 0 ...
31 or 1 ... 65535 depending on the data type (integer or bit string) of ’a’ or its elements, see the general part of this section. The bit numbers must not exceed the number of bits in ’a’ or its elements.
The same data type as ’a’.
145
MicroSCADA
8 Functions
8.6
146
Programming Language
SCIL
Technical Reference Manual
Examples:
@A=BIT_SET(0,3)
;returns 8
@A=BIT_SET(-1,15)
;returns -1
@A=BIT_SET(6,0)
;returns 7
@A=BIT_SET(BIT_SCAN("0101"),1,3)
;returns bitstring “1111”
@A=BIT_SCAN("1111")
;returns bitstring “1111”
1MRS751250-MEN
BIT_STRING(l[,b1, ... ,bn])
Creates a bit string by setting given bit numbers to 1 and the other ones to 0.
’l’ An integer, 1 ... 65535. The number of bits in the bit string.
’bn’ An integer, 1 ... ’l’. The bit numbers (’n’ = 0 ...31) which are to be set to 1. All other bits are set to 0.
Bit string.
Value:
Example:
BIT_STRING(5,1,3,5) == BIT_SCAN("10101")
Vector Handling Functions
The vector functions perform various manipulations on vector data.
APPEND(v1,v2)
The function appends data to a vector.
’v1’
’v2’
Value:
Example:
@V1 = (1,2,3)
@V2 = (4,5)
@V = APPEND(%V1,%V2)
;returns (1,2,3,4,5)
@X = APPEND(%V1,6)
;returns (1,2,3,6)
A vector. The vector to which data is appended.
Any SCIL data type. The data which is appended to ’v1’.
A vector. The result vector is ’v1’ and ’v2’ merged.
CLASSIFY(vector,n,low,high)
Classifies the elements of a vector into size classes and returns the counts of each class.
’vector’ A vector with real elements. The vector to be classified.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
’n’
'low', 'high’
An integer in the range 1..10000. The number of classes.
Integer or real numbers (high > low).
The range 'low' ... 'high' is divided into 'n' equal classes. The length of each class is thus: ('high' - 'low')/'n'. The value of the function is a vector, the elements of which state the number of elements in each of these classes from the first one to the last one.
If an element in 'vector' is smaller than or equal to 'low', it is counted to the lowest class. Elements larger than or equal to 'high' are counted to the highest class. Elements on the class limits are classified to the upper class.
Value: A vector of length 'n' with real elements. The number of elements in each class.
Examples:
@A(1) = 1.
@A(2) = 5.0
@A(3) = 3.0
;The variable B is assigned values as follows:
@B = CLASSIFY(%A,2,0.0,10.0)
;B(1) = = 2.0 (the range 0.0 ... 5.0)
;B(2) = = 1.0 (the range 5.0 ... 10.0)
COLLECT ( v, delimiter )
Collects the elements of a vector to a text string where the elements are surrounded by given delimiter characters.
‘v’ Any text vector expression.
‘delimiter’
Value:
One character given as an expression. The delimiter which will surround the vector elements in the text.
A text where the elements of are concatenated with the delimiter character into one string.
CUMULATE(vector)
The elements of the argument vector are accumulated to the result vector.
Each element number n of the result vector is set to the sum of the n first elements of the argument vector.
'vector'
Value:
A vector with integer, real or time elements.
A vector of the same length as the argument vector. The elements of the vector are of real type.
Example:
@V = (1,-5.6,3.3,37)
CUMULATE(%V)
;returns (1.0,-4.6,-1.3,35.7)
147
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
ELEMENT_LENGTH( vl )
The lengths of vector elements and list attributes.
’vl’ Vector or list value.
Value: Vector or list containing the lengths of elements or attributes of
’vl’.
If the argument ’vl’ is a vector, the value of the function call is an integer vector of the same length, the n:th element of the resulting value containing the length of n:th element of ’vl’.
If the argument ’vl’ is a list, the value of the function call is a list having the same attributes as ’vl’, each containing the length of the corresponding attribute of ’vl’.
Example 1:
@v_txtvector=READ_TEXT("c:\sc\stool\misc\languages.txt")
;returns a vector which elements are rows
;from the text file
@v_txtvector_len=ELEMENT_LENGTH(%v_txtvector)
;returns a vector which elements are integers giving
;the length of corresponding element of the textvector
Example 2:
#CREATE P_OBJ_LIST:V=LIST(AL=APPLICATION_OBJECT_LIST-
(0,"P","A","F","*","","LN",100))
;returns a list containing logical names of process objects
@l_list_elem_len=ELEMENT_LENGTH(P_OBJ_LIST:VAL)
;returns a list, with the same attributes giving the length
;of the corresponding attribute in the processobjects list
DELETE_ELEMENT ( v, index [ , index2 ] )
Deletes individual elements in the vector ‘v’.
‘v’ Any vector expression.
‘index’ A positive integer or a vector specifying the element or elements to be deleted. If index is higher than the length of vector v or negative, nothing is deleted.
‘index2’
Value:
A positive integer ( >= index ). If given, the range index .. index2 is deleted. If omitted, only one element is deleted.
A vector which is otherwise identical to ‘v’, but the element(s) specified by the index or index range are deleted.
Example:
@V = (1,3,5,7,9)
@I = (6,2,4,0,4)
@R = DELETE_ELEMENT(%V,%I) ;returns vector (1,5,9)
148 ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
HIGH(vector)
LOW(vector)
The largest (HIGH) or the smallest (LOW) element in a vector.
’vector’
Value:
Example:
@V = (1,-5.6,3.3,37)
@HIGH = HIGH(%V)
;returns 37.0
@LOW = LOW(%V)
;returns -5.6
A vector, the elements of which are integer, real or time data.
A vector of one element which is the largest or smallest element in the argument vector. The element is of the data types integer or time, provided all elements in the argument vector are of these data types, else it is a real value.
HIGH_INDEX(vector)
LOW_INDEX(vector)
The index of the largest or smallest element in a vector.
HIGH_INDEX returns the index of the largest and LOW_INDEX the index of the smallest element in the argument vector. If the argument vector is empty, or if there are no valid elements, the function returns the value 0.
‘vector'
Value:
A vector with integer, real or time elements.
An integer.
Examples:
@V = (1,-5.6,3.3,37)
@A = HIGH_INDEX(%V) ;returns 4
@B = LOW_INDEX(%V) ;returns 2
INTERP(vector,x)
Interpolates a value from a curve.
'vector’ A vector with integer or real elements.
'x' A real or integer number.
'vector' is interpreted as (X,Y) coordinate pairs defining a curve. The 1st and 2nd elements define one point (x,y) on the curve, 3rd and 4th define another point, etc. The X values must be given in ascending order. The Y value corresponding to the given 'x' is interpolated from the curve and returned as a real number. If 'x' < X1, Y1 is returned.
If 'x' > Xn, Yn is returned (where 'n' denotes the number of coordinate pairs in the vector).
Value: A real number.
149
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
Examples:
@A(1) = 1.0
@A(2) = 6.0
@A(3) = 3.0
@A(4) = 7.0
;X1
;Y1
;X2
;Y2
Y3=INTERP(%A,1.0) ;returns 6.0
Y4=INTERP(%A,2.0) ;returns 6.5
Y5=INTERP(%A,5.0) ;returns 7.0
1MRS751250-MEN
INVERSE(vector,n,low,high)
Inverts a curve.
’vector’
’n’
A vector with real elements given in ascending order.
An integer in the range 1...10000, the length of the resulting vector.
’low’,’high’ Real or integer numbers (high > low).
The elements in ’vector’ are thought to define a monotonously ascending curve y = y(x), where the indexes of the vector represent x-values and the elements of the vector represent y-values. The INVERSE function inverts the curve, i.e. solves the curve x = x(y) by linear interpolation.
The numeric solution is returned in the resulting vector elements so that the i:th element gives the x-value corresponding to y = ’low’ + i * (’high’ - ’low’)/’n’. The y values smaller than the first x value (first index of the source vector) are assigned the value of the first index, and the elements larger than the highest index are assigned the value of the highest index.
Value: A vector of length ’n’ with real elements, where the element values are the x values of the inverted curve, y(x) in the range y = ’low’ ...
’high’. The y values are counted according to the formula y = ’low’
+ i * (’high’ - ’low’)/’n’, where ’i’ is the index of the x value.
Examples:
@A(1) = 3.0
@A(2) = 4.0
@A(3) = 9.0
@X = INVERSE(%A,5,0.0,10.0)
;The vector X now consists of the elements:
; 1.0
; 2.0
(y=2)
(y=4)
; 2.4
; 2.8
; 3.0
(y=6)
(y=8)
(y=10)
For y=2, x gets the value 1.0, because this is the lowest possible value, and for y=10, x gets the value 3.0, because this is the highest possible value.
MEAN(vector)
The mean value of all the elements in the argument vector.
150 ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
’vector’ A vector, the elements of which are of the data type real, integer or time.
Value: A vector of one element. The data type of the element is real.
Example:
@V = (1,-5.6,3.3,37)
@M = MEAN(%V)
;Now M(1) == 8.925
PICK(vector,indexes)
Picks specified elements from a vector and stores them in another vector.
’vector’ A vector expression. The source vector from which elements are selected.
’indexes’ A vector with integer elements, 1...10000. The vector specifies the indexes of the elements which will be selected from the source vector.
Value: A vector containing the elements selected from the source vector.
If the index vector contains indexes that cannot be found in the source vector, the corresponding elements in the result vector are given NOT SAMPLED_STATUS (see the “Status Codes” manual).
Example:
@P = (1,2,3,5,7,11,13,17,19)
@N = (7,4,1)
@S = PICK(%P,%N)
;Now S == (13,5,1)
See also SELECT.
REMOVE_DUPLICATES(v [, status_handling])
Removes duplicate elements of a vector.
'v' Vector value to be examined.
'status_handling' Text value, either "CONSIDER_STATUS" or
"IGNORE_STATUS"), default = "IGNORE_STATUS"
Value: Vector value containing the different element values of 'v'.
Two elements are considered equal if all the following criteria are satisfied:
•
The value types are the same.
•
The values are the same.
151
MicroSCADA
8 Functions
152
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
•
The status values are the same ( when "CONSIDER_STATUS") or else both valid ( < 10 ) (when "IGNORE_STATUS").
The test for equality is recursive, i.e if an element is a vector or list, its components are tested for equality.
The element values are returned in the order of appearance in ’v’.
REVERSE(vector)
Assembles a new vector by reversing the order of the elements in the argument vector.
’vector’
Value:
A vector.
A vector of the same length as the argument vector.
Example:
@V = (1,-5.6,3.3,37)
REVERSE(%V)
;returns (37,3.3,-5.6,1)
SELECT(source,condition,[wildcards])
The function selects the elements of a vector or a list that fulfill a given criterion.
’source’
’condition’
‘wildcards’
A vector or a list where all attributes are vectors of equal length.
The source vector or list from which the elements are selected.
A text containing the selection criterion. If ’source’ is a vector, the individual elements can be referred to by the notation ( ), which can be used as an operand. Alternatively, the selection criterion can be typed as an incomplete conditional expression which lacks left operands. The condition starts with a relation operator and if it contains logical operators, they are followed by relational operators. If ’source’ is of list type, the attribute names can be used as operands.
Text, “WILDCARDS” or “NO_WILDCARDS”. “WILDCARDS”
= wildcards % and * allowed. “NO_WILDCARDS” = wildcards not allowed.
If 'source' is a vector, each vector element is related to the condition. The indexes of those elements which fulfil the condition, i.e., give it the value TRUE, are included in the result vector. Likewise, if 'source' is a list type expression, the function selects the indexes which fulfil the condition.
If wildcards are allowed, % can be used in ‘condition’ to represent any single character, and * to represent one or more characters, including spaces.
Value: An integer vector containing the indexes of the elements that were selected from the source vector or list.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
Examples:
@A = (1.0,2.5,7.0,10.6)
@I = SELECT(%A,">= 2 AND < 10")
;Now I == (2,3)
@S = SELECT(A:DOS(1..30),">0")
@A = PICK(B:DOV(1..30),%S)
;The registrations of the data object A that have a status >0 are selected and
;the corresponding values of the data object B are picked.
;If ’source’ is a list containing the attributes AB and CD the condition can be written, ;e.g., ;"(AB > 10) AND (CD == 5)" which implies that the indexes which
;fulfil these conditions are selected.
SELECT(%V,"GET_STATUS () == 0")
;means that the elements with status == 0 in the vector %V are selected.
SORT(data,[start,[length]])
Sorts a vector in ascending order or alphabetical order.
The function sorts a vector of numeric data or ASCII strings into ascending order or alphabetical order (ASCII code order) respectively. If the vector contains ASCII elements, the sorting can be based on a selected sort key, i.e., a substring, in the elements.
’data’
’start’
The vector to be sorted. The elements of the vector must be uniform, either numeric or ASCII strings.
The start position (1 ... 255) of the sort key string if ’data’ is composed of ASCII elements. Default = 1, i.e., the first character in the
ASCII elements.
’length’ The length in number of characters (1 ... 255) of the sort key, if
’data’ is composed of ASCII elements. Default = 255, i.e., the entire string.
Value: An integer vector containing the indexes of ’data’ arranged in the order gained from the sorting. For instance, if the first element of the result vector is 25, the 25th element of the ’data’ vector is the smallest one or the first one in alphabetic order.
Example:
@UNSORTED = (7,9,4,3,35,6)
@INDEX = SORT(%UNSORTED)
;Now: %INDEX == (4,3,6,1,2,5)
@SORTED = PICK(%UNSORTED,%INDEX)
SPREAD(vector,indexes,value)
The function replaces certain vector elements with other values.
’vector’ A vector. The source vector containing the elements to be replaced.
’indexes’
’value’
A vector of integer elements, 1...10000. The index vector containing the indexes to be replaced.
Any SCIL data type. The replacing value(s).
153
MicroSCADA
8 Functions
154
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Those elements in the source vector which have the indexes specified by the index vector are replaced with ’value’. If ’value’ is a vector, its elements replace in turn the elements specified by the index vector. If ’value’ contains more elements than ’indexes’, the superfluous elements are disregarded. If there are fewer elements in ’value’ than in ’indexes’, the indexes that have no corresponding value are omitted from the result vector. If the index vector contains higher indexes than what are included in the source vector, they are disregarded, i.e., the length of ’vector’ is not changed.
Value: A vector.
Example:
@V = (1,2,3,4,5)
@I = (1,3,5)
@A = (6,7,8)
@S = SPREAD(%V,%I,%A)
@T = SPREAD(%V,%I,0)
;Now
;%S = = (6,2,7,4,8)
;%T = = (0,2,0,4,0)
SUM(vector)
The sum of all the elements in a vector.
’vector’
Value:
Example:
@V = (1,-5.6,3.3,37)
@SUM= SUM(%V)
;Now
;%SUM(1) = = 35.7
A vector with integer, real or time elements.
A vector of one element. The element is an integer or a time value if all the elements in the argument vector are integers or time values respectively. Else it is a real number.
SUM_POS(vector)
SUM_NEG(vector)
The sum of the positive or negative elements in a vector.
These functions work in the same way as SUM, but SUM_POS calculates the sum of the positive values, and SUM_NEG the sum of the negative values.
A vector with integer, real or time elements.
’vector’
Value: A vector of one element. The element is an integer or a time value if all the elements in the argument vector are integers or time values respectively. Else it is a real number.
Examples:
@V = (1,-5.6,3.3,37)
@POS = SUM_POS(%V)
@NEG = SUM_NEG(%V)
;Now
;%POS(1) == 41.3
;%NEG(1) = = -5.6
ABB Automation
1MRS751250-MEN
8.7
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
TREND(vector,n)
Assembles a new vector from the last (highest indexed) elements in a vector.
’vector’ A vector.
’n’ An integer in the range 0...10000. The number of elements to be included in the result vector.
Value: A vector of length ’n’. If ’n’ is greater than the length of the argument vector, the first elements get no values (they get
NOT_SAMPLED_STATUS, see appendix C).
Examples:
@V = (1,-5.6,3.3,37)
TREND(%V,2) == (3.3,37)
;returns vector (3.3,37)
VECTOR [ ( [element1, ....., elementn] ) ]
Creates a vector with given elements.
‘elementn’ An expression of any data type. The elements in the vector. Up to
10000 elements can be given. Using VECTOR without any element list creates an empty vector.
Value: A vector with the given elements.
Example:
@A = VECTOR()
;The variable A will be an empty vector.
Database and List Functions
The functions in this section are used for building application object navigators, object lists, event and alarm lists.
The functions APPLICATION_OBJECT_COUNT, APPLICATION_OBJECT_LIST¸ and APPLICATION_OBJECT_ATTRIBUTES provide the same functionality as the
NEXT and PREV functions used along with the #SEARCH command. Unlike the
#SEARCH command, the APPLICATION_ functions operate in memory (RAM). As they do not read the database files, they give a faster result than NEXT and PREV.
Some simple cases, such as APPLICATION_OBJECT_COUNT(apl ,type), do not require browsing the database and are therefore very fast.
A navigation tool should not rely on the counts returned by
APPLICATION_OBJECT_COUNT and APPLICATION_OBJECT_LIST being the same, because the database may change between the calls.
ABB Automation
155
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
History Database Functions
1MRS751250-MEN
HISTORY_DATABASE_MANAGER("OPEN"[, apl])
Open a session to the history database of an application.
The HISTORY_DATABASE_MANAGER function is session-based. A query session is first created. Subsequent calls of the function may then set various query parameters and do queries. At last, the session is closed.
There may be up to 10 open query sessions within one SCIL context.
When a SCIL context is deleted, the open query sessions are closed automatically.
However, it is a good practice to close the sessions explicitly by SCIL to save system resources.
’apl’ Integer or text value.
When an integer, specifies the application number ( 0 = current application )
Text keyword "NO_APPLICATION" is used to specify no application.
Default value is 0.
List.
Value:
SESSION Integer value. Used to identify the session in subsequent calls.
Integer value, SCIL status code.
STATUS
This command opens a new query session and sets the query parameters to their default values (described later). If already 10 sessions are open, status
SCIL_TOO_MANY_HDB_SESSIONS is returned in the STATUS attribute of the result.
If another than the current APPLICATION is specified, it has to be local ( in same
SYS ) but its state is allowed to be COLD.
If no application is specified, SET_DIRECTORY command must be used to tell the history database manager where to find the database.
If a cold application or no application at all is specified, the user defined attributes of user defined process objects are not returned, because there is no process database to find the attribute descriptions of corresponding F-type objects.
156 ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
HISTORY_DATABASE_MANAGER("CLOSE", session)
Close a session to the history database of an application.
’session’ Integer value returned by OPEN command.
Value: List.
STATUS Integer value, SCIL status code.
This command closes the session by releasing all the resources associated to the session.
HISTORY_DATABASE_MANAGER("SET_PERIOD", session, begin[, end])
Set time period of database query.
’session’ Integer value returned by OPEN command.
’begin’ Time value defining the first day of the period. The following format can be used pack_time(1998,4,1,0,0,0)
’end’
’session’
Time value defining the last day of the period, default = ’begin’.
Integer value returned by OPEN command.
Value: List.
DATE_COUNT
MISSING_DATES
MISSING_STATUS
Integer value. Number of days whose history database was successfully opened.
Time vector containing the dates whose database files could not be read.
Integer vector containing the status codes of failed database file reads.
Integer value, SCIL status code.
STATUS
The period defines the time period whose database files are included in the query. A period may contain up to 1000 database files. Status SCIL_PERIOD_TOO_LONG is returned, if this limit is exceeded.
The arguments ’begin’ and ’end’ are used only to define the date: hours, minutes and seconds are ignored.
The period is initially empty.
ABB Automation
157
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
HISTORY_DATABASE_MANAGER("SET_DIRECTORY", session, directory)
Set location of database files.
’session’
’directory’
Integer value returned by OPEN command.
Text or text vector containing the directory ( or directories ) where to locate the database files.
Value: List.
STATUS Integer value, SCIL status code.
Up to 20 directories may be specified. Status SCIL_TOO_MANY_DIRECTORIES is returned if this limit is exceeded.
Setting this parameter resets the active period.
When a session is opened, this parameter is set to point to the APL_ subdirectory of the application. If no application is defined, the parameter is left empty.
HISTORY_DATABASE_MANAGER("SET_WINDOW", session, begin, end)
Set the time window of the query.
’session’
’begin’
Integer value returned by OPEN command.
Time value or an integer 0.
Begin time of the window. If 0, the window has an open beginning.
’end’ Time value or an integer 0.
End time of the window. If 0, the window has an open end.
Value: List.
STATUS Integer value, SCIL status code.
This command sets the time window of the query. A time window may have an open beginning and/or an open end, meaning all events older than ’end’ or old events newer than ’begin’, respectively.
158 ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
If both ’begin’ and ’end’ are non-zero, they may be given in any order.
MicroSCADA
8 Functions
ABB Automation
When a session is opened, the window is set to ( 0 , 0 ).
HISTORY_DATABASE_MANAGER("SET_ORDER", session, order)
Set logging order.
’session’ Integer value returned by OPEN command.
’order’
Value:
Text keyword, either "LOG" or "EVENT".
Value "LOG" requests the manager to return the events in the order they were written into the database, value "EVENT" in the order of ET and EM attribute value.
List.
STATUS Integer value, SCIL status code.
If logging order is requested, the time window applies to attributes HT and HM of the event, otherwise to attributes ET and EM.
When a session is opened, the order is set to "EVENT".
HISTORY_DATABASE_MANAGER("SET_DIRECTION", session, direction)
Set search direction.
’session’
’direction’
Integer value returned by OPEN command.
Text keyword, either "FORWARD" or "BACKWARD".
Value ’FORWARD’ requests the manager to start the query from the beginning of the time window, value "BACKWARD" from the end of the time window .
Value: List.
STATUS Integer value, SCIL status code.
The results of a query are returned in the order of ’direction’: If "FORWARD", they are returned in time order, if "BACKWARD", they are returned in reversed time order.
159
MicroSCADA
8 Functions
160
Programming Language
SCIL
Technical Reference Manual
When a session is opened, the direction is set to "BACKWARD".
1MRS751250-MEN
HISTORY_DATABASE_MANAGER("SET_TIMEOUT", session, timeout)
Set a maximum time a query may last.
’session’ Integer value returned by OPEN command.
’timeout’ Integer or real value, time-out in seconds.
Value: List.
STATUS Integer value, SCIL status code.
The time-out of a query specifies the maximum time a query may last. If it is exceeded, the query is interrupted and the partial results found so far are returned.
When a session is opened, the time-out is set to 5 seconds.
HISTORY_DATABASE_MANAGER("SET_CONDITION", session, condition)
Set a condition for requested events.
’session’ Integer value returned by OPEN command.
’condition’ Text value, the condition requested events should fulfill.
Value: List.
STATUS Integer value, SCIL status code.
The condition is given as in #INIT_QUERY and #SEARCH commands.
When a session is opened, the condition is set to an empty string.
HISTORY_DATABASE_MANAGER("SET_ATTRIBUTES", session, attributes)
Set the attributes whose values are to be returned a query. History database information related to each event are described in the Application Objects manual Chapter 3.
’session’
’attributes’
Integer value returned by OPEN command.
Text vector.
Specifies the set of attributes whose value is returned by the query.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
Value: List.
STATUS Integer value, SCIL status code.
Up to 100 attributes may be specified. Status SCIL_TOO_MANY_ATTRIBUTES is returned if this limit is exceeded.
Attributes LN, IX, OV, ET and EM do not have to specified, they are always included in the set. The object type specific names ( BI, BO, etc. ) for the object value attribute are not used. If no application is specified for the session, the user defined attributes of user defined process objects are not returned by the query.
The initial value of the set is ( LN, IX, OV, ET, EM ).
HISTORY_DATABASE_MANAGER("GET_PARAMETERS", session)
Get current value of parameters.
’session’ Integer value returned by OPEN command.
Value: List.
DIRECTORY
PERIOD
WINDOW
ORDER
Text vector, file directories to locate database files.
Two place vector containing the first and last date of the period, see SET_PERIOD command.
Two place vector containing the beginning and end of the time window, see SET_WINDOW,
"LOG" or "EVENT".
DIRECTION
TIMEOUT
"FORWARD" or "BACKWARD".
Real value, the query time-out in seconds.
ATTRIBUTES Text vector, the attributes returned by the query.
CONDITION Text value, the query condition.
STATUS Integer value, SCIL status code.
HISTORY_DATABASE_MANAGER("QUERY", session, count[, start])
Query history database.
’session’ Integer value returned by OPEN command.
161
MicroSCADA
8 Functions
162
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
’count’
’start’
Value:
Integer value, the maximum number of events to be returned.
Integer or vector value, the identifier of event to start the query at.
Integer value 0 restarts the query. Default is 0.
List.
STATUS Integer value, SCIL status code.
SUCCESS
"DONE"
"MORE"
Text value, indicating the success of the query :
All the specified events were found.
"TIMEOUT"
The number of events specified by ’count’ were found. There may be more events to find.
The query took a too long time and was interrupted. There may be more events to find.
COUNT
LAST
ID
DATA
Integer value depicting the number of the returned events.
Vector value, the event identifier of the last processed event.
Vector value containing the identifiers of the returned events.
List value containing the attributes of the returned events.
To continue a query, the event id returned by the interrupted query ( attribute LAST ) should be used as the argument ’start’ of the subsequent query. The event identified by
’start’ is not included in the result.
The attribute DATA of the function result contains the event data read from the database as a list. The attributes of the list are the ones specified by SET_ATTRIBUTES command, see 2.12. History database information related to each event are described in the Application Objects manual Chapter 3. The value of each attribute is a vector of length COUNT. If an event does not have a certain attribute, the corresponding element in the vector has status PROF_ATTRIBUTE_DOES_NOT_EXIST. The list may be further processed with SELECT function by the event list dialog, if needed.
When a query is interrupted by TIMEOUT and the query order is EVENT, it is not guaranteed that the events returned by two subsequent queries are returned in exactly correct order. It is possible, that events contained in database files not yet processed should have been included in the results of the interrupted query.
The following example reads the latest 20 events, then waits a second and reads the new ones. For clarity, error handling is omitted.
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
Example:
@R = HISTORY_DATABASE_MANAGER("OPEN")
@SESSION = R:VSESSION
@PER=HISTORY_DATABASE_MANAGER(“SET_PERIOD”, SES:VSESSION,
PACK_TIME(1998,4,1,0,0,0),CLOCK)
@FIRST = HISTORY_DATABASE_MANAGER("QUERY",%SESSION,20)
#IF FIRST:VCOUNT > 0 #THEN #BLOCK
#PAUSE 1
@R = HISTORY_DATABASE_MANAGER("SET_ORDER",%SESSION,"FORWARD")
@SECOND = HISTORY_DATABASE_MANAGER("QUERY",%SESSION,100,FIRST:VID(1))
#BLOCK_END
The second query may miss a new event if its time-stamp is out of order.
ABB Automation
HISTORY_DATABASE_MANAGER("READ", session, event)
Read all the attributes of the event specified by the event identifier. History database information related to each event are described in the Application Objects manual
Chapter 3.
’session’
’event’
Value:
Integer value returned by OPEN command.
Vector value, the event identifier of the event.
List.
DATA
STATUS
List value containing all the attributes of the event.
Integer value, SCIL status code.
HISTORY_DATABASE_MANAGER("SET_COMMENT", session, event, comment)
Set the EX attribute of the specified event.
’session’ Integer value returned by OPEN command.
’event’
’comment’
Value:
Vector value, the event identifier of the event.
Text value, the comment.
List.
STATUS Integer value, SCIL status code.
163
MicroSCADA
8 Functions
164
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
HISTORY_DATABASE_MANAGER("WRITE", session, data)
Writes an event into the history database.
’data’ List value describing all the attributes of one event.
’session’
Value:
Integer value returned by OPEN command.
List.
STATUS Integer value, SCIL status code.
This command writes an event into the history database. The attribute values to be written are given in the list argument ’data’.
Attribute HT is used to specify the history database file, into which the event is written. The file is created if it does not exist.
The following conventions are used to handle missing attributes:
1.
Current time is used for missing HT, HM and HD.
2.
HT, HM and HD values are used for missing ET, EM and ED.
3.
All other missing numeric attributes are set to zero.
4.
All missing text attributes are set empty.
General Object Listing Functions
APPLICATION_OBJECT_COUNT (apl, type [,order [,direction [, start
[,condition]]]])
Counts the application objects of a specified type which fulfill a given criterion.
‘apl’ Integer. The number of the application where objects are counted.
0 = current application. The function supports both local and external applications.
‘type’
‘order’
Text value. Object type, See the ‘type’argument of the
APPLICATION_OBJECT_LIST function.
See the ‘order’ argument of the APPLICATION_OBJECT_LIST function.
‘direction’
‘start’
See the ‘direction’ argument of the
APPLICATION_OBJECT_LIST function.
See the ‘start’ argument of the APPLICATION_OBJECT_LIST function.
‘condition’ See the ‘condition’ argument of the
APPLICATION_OBJECT_LIST function.
ABB Automation
1MRS751250-MEN
ABB Automation
Value:
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
Integer. The number of objects of the given type fulfilling the condition.
Because of modifications to types "P" and "IX", the new behavior is not fully compatible with revision 8.4.1. Types "P" and "IX" no longer count process objects of user defined types.
Example:
@Alarms_in_Unit_5 = APPLICATION_OBJECT_COUNT ( 0, "IX", "UNIT", "", 5,-
"AL == 1")
@Time_Channel_Count = APPLICATION_OBJECT_COUNT ( 0, "T")
APPLICATION_OBJECT_LIST
(apl,type[,order[,direction[,start[,condition[,attributes[,max]]]]])
Returns a list of application objects selected by type and other criteria.
‘apl’
‘type’
Integer. The number of the application to navigate in. 0 = current application. The function supports both local and external applications.
Text value. Object type: "P", "IX", "UP", "IX_AND_UP", "X",
"F", "D", "C", "T" or "A".
"P"
"IX"
"UP" denotes process objects (predefined).
denotes indexes of process objects (predefined).
denotes process objects of user defined types.
"IX_AND_UP" denotes process objects of both predefined and user defined types.
‘order’
"F"
"D"
"C" denotes free type objects.
denotes data objects.
denotes command procedures.
"T"
"A" denotes time channels.
denotes event channels.
Text. The search order given as a text expression:
"A" or “ALPHABETICAL” Alphabetical order. Searching through the object names in alpha-
165
MicroSCADA
8 Functions
166
‘direction’
‘start’
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
"I" or “INDEX”
P" or “PHYSICAL”
"U" or "UNIT"
"E" or "EXECUTION" betical order (no index). When used with type “P”, only group names are included in the search.
If used with type "IX" or
"IX_AND_UP", the indexes are searched in name/index order.
Index order (only for process objects of predefined types). Returns the indexes of the process object given as 'start’.
Address order. Only applicable when ‘type’ is “IX”, “UP” or
“IX_AND_UP”.
Alphabetic ( name / index ) order within the unit given as 'start' ( type "IX", “UP” or
“IX_AND_UP”).
Execution order. The execution order within a time channel. 'type' can be either "D" or "C". Both are equal and means that the search concerns both data objects and command procedures.
""
Text value:
Default value ( = "A" )
"F" or "FORWARD" Forward browsing
"B" or "BACKWARD" Backward browsing
"" Default value ( = "F" )
Start point of the search. Depends on the object type and search order as follows:
Order "A": Type "IX" and "IX_AND_UP": Logical name
(text), or a list with the following attributes:
LN
IX
Logical name ( text )
Index ( integer )
Other types
All types:
Logical name (text)
"" = default value
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
Order "I":
Order "P":
Order "U":
Logical name ( text )
Unit (integer), or a list with the following attributes:
UN Unit ( integer )
OA Object address ( integer ) (optional)
OB Object bit address ( integer ) (optional)
"" = default value
Unit number ( integer), or a list with the following attributes:
UN Unit ( integer )
Order "E":
LN
IX
Logical name ( text ) (optional)
Index ( integer ) (optional)
Time channel name ( text ), or a list with the following attributes:
TC Time channel name ( text )
OT Object type: "D" or "C" (optional)
ON Object name ( text ) (optional)
If the ‘start’ argument specifies an existing object, that object is not included in the search. The ‘start’ argument is case insensitive.
‘condition’ A text containing the criterion for selecting objects. The selection criterion is a boolean type expression composed of relations and logical operators. The relations have an attribute as the left operand. All attributes, except vector type attributes, can be included in the expression. In the formation of names, the wildcard characters
% and * can be used. % represents one character anywhere in the name, * represents none, one or several characters at the end of the name. Default = "".
‘attributes’ Text vector containing the names of attributes to be returned in addition to LN (and IX or OT). Default = "" ( no additional attributes ).
‘max’
Value:
Maximum number of objects to be returned ( integer ). Default = max. vector length.
A list including the following attributes:
167
MicroSCADA
8 Functions
168
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
COUNT
MORE
Integer value, number of objects returned
Boolean value. TRUE if browsing was interrupted due to ‘max’ being exceeded
Text vector, names of the objects LN
IX
OT
Integer vector, indexes ( types "IX" and
"IX_AND_UP" only)
Text vector ( values "D" or "C" ) (order "E" only)
Plus additional attributes defined by the 'attributes' argument.
The objects are returned in the order specified by 'order' even if backward browsing is specified.
Because of modifications to types "P" and "IX", the behavior in 8.4.2 revision is not fully compatible with 8.4.1. Types "P" and "IX" no longer returns process objects of user defined types.
Example:
@l_ctype=APPLICATION_OBJECT_LIST(0,"C","E","F","TC_TEST","","",100)
@v_attributes=("GC","GT","LF","ZT")
@l_ptype=APPLICATION_OBJECT_LIST(0,"P","A","F","","",%v_attributes,100)
@ATS_V=("EP","OS","AG","IU")
@l_POINDEX=APPLICATION_OBJECT_LIST(0,"IX","P","F","","",%ATS_V,100)
@l_xtype=APPLICATION_OBJECT_LIST(0,"X","A","F","","","",100)
@EVENT_CHANNEL_ATS_V=("CM","ON","LN","OT","SN","ST","ZT")
@l_atype=APPLICATION_OBJECT_LIST(0,"A","A","F","*","",-
%EVENT_CHANNEL_ATS_V,100)
APPLICATION_OBJECT_ATTRIBUTES (apl,type,objects,attributes)
Returns the values of specified attributes of given objects.
‘apl’
‘type’
‘objects’
‘attributes’
Application number ( as in APPLICATION_OBJECT_LIST ).
Object type ( as in APPLICATION_OBJECT_LIST ).
A text vector containing the names of the objects or a list with the attribute LN as a text vector. In the case when the ´type´ argument
(second argument) is “IX” or “IX_AND_UP”, the ´objects´ argument (third argument) is a list with the attributes:
LN Text vector containing object names
IX Integer vector containing the indexes
Text vector containing the names of attributes to be read.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
Value: A list with attributes specified by ’attributes’. Each attribute has a vector value containing the values of object attribute.
Example:
@ATTRS_V=( "AB","UB","PB","XB")
@OBJECTS_L=LIST(LN=vector("HLTEST","HLTEST"),IX=vector(10,22))
@OBJ_A=APPLICATION_OBJECT_ATTRIBUTES(0,"IX",%OBJECTS_L,%ATTRS_V)
Notes referring to Example, the example requires the existance of a processobject named ´HLTEST´. Object ´HLTEST´ needs to have at least the indexes 11 and 22.
The returned value is a list of 4 attributes.
END_QUERY
Tells whether a process query initiated with #INIT_QUERY is completed.
The function tests whether all objects matching a process query initiated by the
#INIT_QUERY command (Chapter 7) have been read with the PROD_QUERY function. The END_QUERY function is always used without an argument.
Value: Boolean data. TRUE = the query is completed. FALSE = the query is not completed.
Example:
#IF END_QUERY #THEN #BLOCK
!SHOW MESSAGE "READY"
#BLOCK_END
#ELSE #BLOCK
@LIST = PROD_QUERY(20)
!SHOW NAME LIST:VLN
!SHOW VALUE LIST:VOV
#BLOCK_END
If the query has been completed, the message READY is shown on screen. Otherwise,
20 more process objects are handled.
FETCH (appl,type,name[,index])
Fetches the attribute of a selected object.
The function forms a list containing all definition attributes of an object, which can be a process object, a data object, a command procedure, a time channel, an event channel, a scale, a base system object or a free type object.
'appl' Integer expression, 0 ... 99. The number of the application. 0 = the own application. The function supports both local and external applications.
'type'
'name'
'index'
Text expression. The type of the object: "D", "C", "T", "A", "P",
"X", "B" or "F".
Text expression. The name of the object.
Integer expression, 0...255. The index of a process object of a predefined type (not obligatory). If 'index' is omitted or == 0 for proc-
169
MicroSCADA
8 Functions
170
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN ess objects of the predefined types, the function returns the attributes that are common to the process object group.
Value: List. The list contains most attributes of the object (excluding some changing attributes, such as OV). If the named object does not exist, a list is returned with only one attribute, IU, which has the value -1.
Example:
@V = FETCH(0,"P","A",1)
;V:VLN has value "A"
;V:VIX has value 1
NEXT (n)
PREV (n)
"Next object" and "previous object".
These functions enables browsing through the records of a search initiated with the
#SEARCH command. Process objects, data objects, command procedures, scales, time channels, event channels and free type objects can be searched through. The functions require that the search has been initiated with the #SEARCH command
(Chapter 7. ).
’n’ Integer, 1 ... 10. The identity number of the search within the picture, command procedure or dialog system (see the #SEARCH command in Chapter 7.).
Value: A list containing all the attributes of the next or the previous object of the search. The object type determines which attributes are returned. If the object does not exist a list is returned containing only the IU attribute which has the value -1.
Example:
#SEARCH 2 0 "P" "A" "A"
@OBJ = NEXT(2)
!SHOW NAME OBJ:VLN
The name of the process object group following A in alphabetical order is shown.
PHYS_FETCH (appl,unit,address[,bitaddress])
The function forms a list with attributes taken from a process object.
The process object is specified with its physical address.
’appl’ Integer, 1 ... 99. The application number. 0 = the own application.
’unit’
’address’
Integer. The unit number of the process unit where the object is situated. This is the station number as known to the application.
Integer. Object address. The OA attribute of the process object.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
’bitaddress’
Value:
Integer, 0...15. Bit number (can be omitted). The OB attribute of the object.
List. All attributes which appear in the object definition form are included in the list. If the object does not exist, the list contains only one attribute, IU, which has the value -1.
Example:
@OBJ = PHYS_FETCH (0,3,1010,5)
PROD_QUERY (n)
Returns the attributes of the process objects selected with #INIT_QUERY.
The function returns in list form the attribute values of the process objects selected with the preceding #INIT_QUERY command (see Chapter 7.). The PROD_QUERY function must be situated in the same picture, command procedure or dialog system as the #INIT_QUERY command. The query concerns always the current application.
After one #INIT_QUERY, the function may be called several times. Each time it continues from where it finished previously.
’n’ Integer, [-] 1 ... APL:BQL. The maximum number of process objects that are included in the query. If the number is given with a negative sign, the browsing is performed backwards. For computer performance reasons, it is recommended not to give a number that is larger than 100.
Value:
Identification:
A list containing the following attributes:
LN (Logical Name), IX (Index), PT (Process Object Type), OI
(Object Identification), OX (Object Text)
OV (Object Value), OS (Object Status) Object value:
Alarm state: AL (Alarm), AS (Alarm State), AR (Alarm Receipt), AZ (Alarm
Zone)
Time stamps: RT (Registration Time), RM (Registration Milliseconds), AT
(Alarm Time), AM (Alarm Milliseconds), YT, YM
RTU attributes: SE (Selection), SP (Stop Execution), OF (Overflow),
Stamps set by the station:
Blocking attributes:
BL, CT, OR, RA, RB, SB
AB, HB, PB, UP, XB
Miscellaneous attributes: RI, RX
In addition, when the query concerns the history buffer: CA (Changed Attribute)
171
MicroSCADA
8 Functions
172
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
The attribute values of a certain attribute form a vector. For example, the LN attribute is a vector of all object names included in the query. Vector elements with the same index refer to the same process object (does not concern objects of user-defined types).
Examples:
The result of the function call PROD_QUERY(4) could be:
1
2
3
4
Index LN
"TEMP"
"PH"
"SWITCH"
"SWITCH"
1
5
1
2
Attributes
IX
63.0
6.5
1
0
OV
The attribute LN (logical name) constitutes the first vector, IX (index) the second one and OV (object value) the third one.
Data Object Functions
DATA_FETCH (appl,name,index1[,step[,count]])
DATA_FETCH (appl,name,time1,time2[,step[,shift]])
DATA_FETCH (appl,name,time1[,step[,count[,shift]]])
DATA_FETCH (appl,name,indexes)
Reads the records of a data object and returns them as a list.
Up to 10000 data records can be read in one function call. If the function call comprises more records, only the first 10000 records are returned, but no error message is given.
’appl’
’name’
Integer, 0 ... 99. The application number (0 = the own application).
Text data. The name of the data object.
’index1’
’step’
Integer, 0 ... 65535. The index of the first record to be fetched.
Integer, -32767 ... +32767. Defines the step between indexes to be fetched. The default value = 1 (all indexes are fetched). If ’step’ is negative, the values are returned in reverse time order.
Examples:
’step’ = 2:
’count’ indexes ’index1’, ’index1’ + 2, ’index1’ + 4, etc. are fetched.
’step’ = -2: indexes ’index1’, ’index1’ - 2, ’index1’ - 4, etc. are fetched.
Integer, 0 ... 10000. The number of indexes to be fetched. 0 (default) means all existing indexes up to 10000.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
’indexes’
’time1’
’time2’
’shift’
Vector. An integer vector defining explicitly the indexes to be fetched.
Time data. The start of the time interval to be fetched.
Time data. The end of the time interval. If ’time1’ < ’time2’, the values are returned in time order regardless of the sign of ’step’. If
’time1’ > ’time2’, the values are returned in reversed time order regardless of the sign of ’step’. The given time range is regarded as a semi-open range. For example, if the range is given as 09.00.00 -
10.00.00, a record sampled at 09.00.00 is included but a record sampled at 10.00.00 is excluded (if shift = 0, see below).
Integer, 0 or 1. 0 = no shift, 1 = a shift of one sampling interval.
For example, a record sampled at 10.00.05 is included in the time range 09.00.00 - 10.00.00, but a record sampled at 09.00.05 is excluded. Default value: 0.
Value: A list including the following attributes:
OV real vector, registered data
RT
OS time vector, the registration times integer vector, the status codes
IX
LE integer vector, the indexes of the values integer, the number of elements in the result vectors above (OV, RT, OS, IX).
Examples:
@A = DATA_FETCH (0,"ABC",1,5,0)
;Every fifth registration of the data object ABC, from the first index to the last one, but at ;the most 10000 registrations, are fetched and placed in the variable object A:V.
@T1 = PACK_TIME (1989,9,10,0,0,0)
@T2 = PACK_TIME (1989,9,10,12,0,0)
;Two time data values are defined.
@A = DATA_FETCH (0, "ABC", %T1, %T2)
;The registrations in the data object ABC of the given time interval.
@B = DATA_FETCH (0, "DEF", A:VIX)
;The corresponding values of the data object DEF.
@C = DATA_FETCH (0, "GHI", A:VIX +5)
;The corresponding values of GHI shifted by 5.
DATA_STORE (appl,name,data,index1[,step])
DATA_STORE (appl,name,data,indexes)
Writes historical data into a data object and returns the status of the operation.
’appl’ Integer, 0 ... 99. The application system number. 0 = the own application.
173
MicroSCADA
8 Functions
8.8
174
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
’name’
’data’
’index1’
’step’
Text. The name of the data object.
List. The values to be stored.
Integer, 1 ...65535. The index of the first record where data is stored.
Integer. This argument defines the step between indexes to be stored. Default value = 1 (all indexes are stored). If ‘step’ is negative, the values are stored in reverse time order.
Examples:
'step' = 2:
'step' = -2:
'indexes' indexes 'index1', 'index1' + 2, 'index1' + 4, etc., are stored.
indexes 'index1', 'index1' - 2, 'index1' - 4, etc., are stored.
Integer vector. Defines explicitly the indexes where data is stored.
The following attributes in 'data' are stored:
OV real vector - recorded values
RT time vector - registration times
OS integer vector - status codes
If the RT attribute is missing from 'data', the original registration times are kept. If the
OS attribute is missing, the status codes in the OV vector are stored as the OS attribute.
Value: Integer. A status code. See the status codes in the Status Codes manual.
0 = OK.
Examples:
@V = DATA_FETCH(0,"A",%I)
@OS = DATA_STORE(0,"DATA",%V,5,2)
@OS = DATA_STORE(2,"A",%V,%I)
The registrations of the data object A in the current application are stored in the variable V and copied to the data object DATA in the current application and the data object A in application 2.
Functions for Reading and Writing Files
The following two files reads and writes binary files:
READ_BYTES ( file [ , start [ , length ] ] )
Reads data from a binary file.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
This function enables the importing of binary data from a file. The function is analogous to the READ_TEXT function (see below) but returns byte string data instead of a text vector.
‘file’ Text. The name of the file. See the ‘file’ argument of the
READ_TEXT function below.
‘start’ Positive integer value, defaults to 1. Specifies the byte position within the file where to start reading.
‘length’
Return value:
Non-negative integer value. Specifies the maximum number of bytes to be read. Default value = 1048576 (max. byte string length).
Byte string containing the read data.
WRITE_BYTES ( file , data [ , append ] )
Writes data in a binary file.
This function enables the export of binary data to a file. The function is analogous to the WRITE_TEXT function (see below) but takes a byte string data argument instead of a text vector.
‘file’ Text or byte string. The name of the file. See the ‘file’ argument of the READ_TEXT function below.
Byte string value containing the data to be written.
‘data’
‘append’ Integer value 0 or 1, defaults to 0. If 0, a new file is created. If 1, the data are appended to the file, if it already exists.
Value: Integer value. The status code of file write operation, 0 if OK.
The following two functions read and write data in text files:
READ_COLUMNS(file, pos, width[, start[, count]])
Reads the columns of a text file.
The file reads the columns and stores them in a vector where each element is a text vector containing the text of one column.
‘file’ Text or byte string. The name of the file. See the ‘file’ argument of the READ_TEXT function below.
‘pos’ Integer vector. Specifies the start positions of the columns to be read ( 1 .. 510). The positions do not have to be in ascending order.
‘width’ Integer vector. The ‘width’ argument must be of the same length as the ‘pos’ argument. Specifies the column widths ( 1 .. 255). The
175
MicroSCADA
8 Functions
176
‘start’
‘count’
Value:
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN columns are allowed to overlap. Columns are read up to character position 510 only.
Positive integer value, defaults to 1. Specifies the line number within the file where to start reading.
Non-negative integer value, defaults to 10000. Specifies the maximum number of lines to be read.
A vector of the same length as ‘pos’ and ‘width’. Each element of the vector is a text vector containing the contents of one column.
WRITE_COLUMNS ( file, pos , width , data [ , append ] )
Writes text in columns in a text file.
The text to be written is given as a vector where each element is a text vector corresponding to one column in the file.
‘file’ Text value or byte string. The name of the file. See the ‘file’ argument of the READ_TEXT function below.
‘pos’
‘width’
‘data’
‘append’
Value:
Integer vector. Specifies the start positions of the columns to be written ( 1 .. 510). The positions do not have to be in ascending order.
Integer vector. Must be of the same length as pos. Specifies the column widths ( 1 .. 255). The columns are allowed to overlap. If they do, a column earlier in the list will be covered by the later one. Any data written past character position 510 are lost. Possible gaps between the columns are filled with space characters.
Vector value of the same length as pos and width. Each element of the vector is a text vector containing the contents of one column.
The element vectors must be of the same length.
Integer value 0 or 1, defaults to 0. If 0, a new file is created. If 1, the data are appended to the file, if it already exists.
Integer value. The status of the write operation, 0 if OK.
READ_TEXT(file[,start[,number]])
The function reads selected lines from an ASCII file and stores them as a text vector.
'file' Text or byte string expression. This argument specifies the ASCII file from where text lines are read given in one of the following manners:
[path/]file_name where 'path' is a logical path name and 'file_name' is the
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions name of the file, including a possible extension. If ’path’ is omitted, the default path names are used (see the #PATH command), except in Visual SCIL objects where the path defined by the attribute DEFAULT_PATH in the main dialog is used.
file_name where ’file_name’ is the name of the file in operating system dependent form.
’start’
file tag. The internal file name representation.
See file handling functions.
Positive or negative integer. If the integer is positive, it is the number of the first line to be read from the ASCII file counted from the beginning of the file (1 = the first line). If it is negative, it is the number of the last line to be read counted from the end of the file (-1 = the last line). Default: 1.
’number’ Integer, 0 ... 10000. The number of lines to be read from the ASCII file.
0 = nothing is read. Default: 1000.
If ’start’ is omitted, reading starts from the beginning of the file. If ’number’ is omitted, reading is performed to the end of file, or until 1000 lines have been read.
Value: A vector containing the lines read from the ASCII file, in the same order as in the file. The elements of the vector are of text type.
Example:
!SHOW DIRECTIVE READ_TEXT("DIRECT.TXT")
;The contents of the file DIRECT.TXT are shown in the window DIRECTIVE.
#SET T:VIN = READ_TEXT("ABC.TXT")
#SET T:VIU = 1
#CREATE ABC:C = %T
The file ABC.TXT is read and its contents are stored as the program of the command procedure ABC.
READ_TEXT("FILE",-1,100) means that the last 100 lines are read,
READ_TEXT("FILE",-101,100) the preceding 100 lines, etc.
WRITE_TEXT(file,text[,cont])
The function writes the contents of a text vector into an ASCII-file.
’file’
'text'
'cont'
Text or byte string data. This argument specifies the ASCII file to be written. See the ‘file’ argument of the READ_TEXT function.
A text vector containing the text to be written.
An integer, 1 or 0. Default = 0.
177
MicroSCADA
8 Functions
178
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
The text in the text vector is stored under the name and in the directory determined by
’file’. If ’cont’ = 1, the contents of the text vector are appended to the file, and possible previous contents are saved. If it is 0, or if it is lacking, the function destroys possible previous contents of the file. If ’text’ contains elements of other types than text, these elements are written as empty lines.
Value: An integer. The status code of the action. See the Status Codes manual.
0 = OK.
Example:
@A = WRITE_TEXT("A",%V,1)
;Now %A == 0, if the operation was successful.
The following three functions are used to handle ASCII files, here called parameter files. The parameter files are described in Appendix C.
WRITE_PARAMETER(file, section, key, value)
Writes a parameter in a parameter file.
The file and/or the section is created if it does not exist.
‘file’
‘section’
Text or byte string data. This argument specifies the parameter file to be written. See the ‘file’ argument of the READ_TEXT function.
Text. The name of the section.
‘key’
‘value’
Return value:
Text. The key of the parameter.
Text. The value to be assigned to the parameter.
A list with one attribute:
STATUS = The status code of the write operation.
Parameter file lines may be up to 510 characters long. If both the key and the data are exactly 255 characters long, error SCIL_PARAMETER_FILE_LINE_TOO_LONG is raised.
READ_PARAMETER(file, section, key, alt)
Reads a parameter in a parameter file.
‘file’ Text or byte string data. This argument specifies the parameter file to be written. See the ‘file’ argument of the READ_TEXT function.
‘section’ Text. The name of the section.
ABB Automation
1MRS751250-MEN
8.9
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
‘key’
‘alt’
Value:
Text. The key of the parameter.
Text. The value to be returned if "section" or "key" does not exist in the specified file.
A list with the following two attributes if the operation was successful:
STATUS =
VALUE =
The status code of the read operation.
The value of the parameter. In case that operation did not succeed only a list with attribute:
STATUS = “the statuscode” is returned.
If the fourth argument is not given error status 558
SCIL_SECTION_DOES_NOT_EXIST/559 SCCIL_KEY_DOES_NOT_EXISIT is returned if the section/key does not exist.
Example:
@PORT=READ_PARAMETER("C:\WINNT\WIN.INI","MCILAU","UDP PORT")
DELETE_PARAMETER(file, section[, key])
Deletes a parameter in a parameter file.
‘file’ Text or byte string data. This argument specifies the parameter file to be written. See the ‘file’ argument of the READ_TEXT function.
‘section’ Text. The name of the section.
‘key’
Return value:
Text. The key of the paramter to deleted. If ‘key’ is omitted from the argument list, the whole section is deleted.
A list with the attribute STATUS.
STATUS = The status code of the delete operation.
Functions Related to Program Execution
The argument functions are used in programs that can take arguments and return a value. Such programs are named programs, user defined methods and programs executed with the DO function.
ARGUMENT( n )
Reads input arguments.
This function reads the input arguments given in the argument list of method calls, named program calls and the DO function. By means of this function the arguments can be used in the programs.
179
MicroSCADA
8 Functions
180
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
’n’ Integer. The ordinal number of the argument ( 1 .. 32 ) as given in the argument list.
Value: The value of the n:th argument in the argument list.
If there are fewer than ‘n’ arguments in the argument list, a value with data type
"NONE" is returned. The actual count of the arguments in the call is obtained by the
ARGUMENT_COUNT function.
Example:
See the DO function below.
ARGUMENT_COUNT
Returns the total number of arguments in the argument list of the program call.
Value: Integer, 0 .. 32.
ARGUMENTS
Returns all arguments in the argument list of the program call as a vector.
Value: Vector with 0 ... 32 elements. The arguments given in the argument list of the program call (method call, named program call or
DO function). If the program call has no arguments, a zero length vector is returned.
Example:
@A = ARGUMENTS
@B = DO (%PROGRAM, %A)
COMPILE(source)
Runs the SCIL compiler.
'source' Text vector containing the SCIL source code.
Value: A list value with following attributes:
STATUS
CODE
Integer, status code from the compilation
Byte string , the compiled byte code
ERROR_LINE
ERROR_LINE_NUMBER
Text, the erroneous source line
Integer, the line number in error
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
ERROR_POSITION Integer, the character position in error
Attribute CODE is returned if the compilation succeeds (STATUS == 0). Attributes
ERROR_LINE, ERROR_LINE_NUMBER and ERROR_POSITION are returned if the compilation fails.
DO (program [, a1, .... , an] )
Executes a SCIL program given as argument.
Up to 31 arguments can be passed to the SCIL program. If the executed program contains a #RETURN command the function returns the value of the expression following the #RETURN command (see Chapter 7.). If the SCIL program does not contain a #RETURN command, integer zero is returned.
‘program’ A text vector containing the SCIL program to be executed.
‘a1’ ... ’an’ Any SCIL data type. These arguments are passed to the SCIL program (up to 31 arguments may be specified).
Value: The value returned by the #RETURN command in the executed program, or 0 if the program did not terminate by #RETURN command.
Example 1:
@RESULT = DO ( READ_TEXT ( "APL_/TEST.TXT" ))
;Contents of file TEST.TXT:
@l_app_info=APL:BSV11
#return %l_app_info
Example 2:
;An example that calculates the tangent function of its argument.
@RESULT = DO ( READ_TEXT ( "TANGENT.TXT" ), 0.5 )
;Contents of file TANGENT.TXT:
#RETURN SIN ( ARGUMENT ( 1 ) ) / COS ( ARGUMENT ( 1 ) )
ERROR_STATE
Returns the current ‘ERROR_STATE’ at execution point.
Value: Text value depicting the current error state: "STOP",
"CONTINUE", "IGNORE" or "EVENT".
Example:
@t_old_state = ERROR_STATE
;assign value of current error handling policy to t_old_state
#ERROR IGNORE
;set error handling policy to IGNORE
@t_error_state1=ERROR_STATE
;returns IGNORE that is the ’ERROR_STATE’ at this point
#ERROR CONTINUE
;set error handling policy to CONTINUE
@t_error_state2=ERROR_STATE
;returns CONTINUE that is the ’ERROR_STATE’ at this point
#ERROR STOP
181
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
;set error handling policy to STOP
@t_error_state3=ERROR_STATE
;returns STOP that is the ’ERROR_STATE’ at this point
#ERROR EVENT
;set error handling policy to EVENT
@t_error_state4=ERROR_STATE
;returns EVENT that is the ’ERROR_STATE’ at this point
#ERROR ‘t_old_state’
;reset error handling policy
1MRS751250-MEN
OPS_CALL(command
[
,0
]
)
The function executes an operating system command.
’command’
’0’
Value:
Text. The command to be executed.
Integer. If not included, the OPS_CALL starts the execution of the command and waits until it has finished. If included, the command only starts the execution of the command.
A list with the following attributes is returned:
ST
FN
Integer, the status value returned by the operating system.
0 = OK, any other value = failure.
0. The attribute has no meaning when Windows
NT i
is used.
Example:
@A = OPS_CALL("mons -d rbsnt 4 -n")
;Opening a MicroSCADA application window.
OPS_PROCESS ( command [ , directory [ , wait ] ] )
Starts an external program as a separate process within the operating system environment.
The functionality is close to that of OPS_CALL function. However, OPS_PROCESS does not start the command interpreter, it simply runs the program given as an argument of the function call. In Windows NT this means that only "EXE" files may be started this way. To execute "BAT" files, OPS_CALL should be used.
‘command’ Text value containing the command to start the process, e.g.
"\tools\my_tool my_file -my_option".
‘directory’ Optional text value containing the work or default directory to be used by the process. The directory is given in OS dependent format (see PARSE_FILE_NAME function to obtain OS directory names ). An empty name, "", denotes the work directory of the caller. Default value = "". i
Windows NT is a trademark of Microsoft Corporation
182 ABB Automation
1MRS751250-MEN
ABB Automation
‘wait’
Value:
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
Optional text value, either "WAIT" or "NOWAIT". If "WAIT" is given, termination of the created process is waited for. Otherwise, the function returns immediately after the process has started. Default is "NOWAIT".
A list value containing the following attributes:
START_STATUS Integer value containing the OS dependent status code obtained when starting the process.
EXIT_STATUS Integer value containing the OS and application dependent exit status of the process. This attribute is returned only if "WAIT" is specified and start of process succeeded.
STATUS
The status produced by the latest error situation in the program that is being executed.
The function is set to zero after use and when a new program other than named program is started. If a program executes a named program, then the status will not be set to zero. Hence, if STATUS <> 0 in the program that is calling the other one, then
STATUS is also <> 0 in the named program. The function is always used without an argument.
Value: A positive integer. A status code. See the status codes in the Status
Codes manual.
Example:
#ERROR IGNORE
@S = STATUS
#SET ABC:PBI = 0
@S = STATUS
#IF %S <> 0 #THEN !SHOW ERROR %S
#ELSE !ERASE ERROR
WORKSTATION_CALL(command[, other, ...])
Function for executing commands on the workstation.
'command'
'other'
Text, the action to be done at the workstation.
"EXECUTE" = workstation execution
"VIEW_DOCUMENT" = viewing a document in a browser
Argument is case insensitive.
Text, command specific arguments.
Argument is case insensitive with a maximum length of 255 characters..
183
MicroSCADA
8 Functions
8.10
184
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Return value: SCIL status code.
When WORKSTATION_CALL is used, the first argument should always be one of the commands.
When the command "EXECUTE" is used, the second argument should be the program to be started (including the path and possible program specific parameters) and the third argument should be a default working directory to be used. When "EXECUTE" is used, the first two arguments must be included.
When the command "VIEW_DOCUMENT" is used, the second argument should be the page to be shown in a browser. When "VIEW_DOCUMENT" is used, the two first arguments must be included.
Initialization file for viewing documents is "wserver.ini" and it is located in
\sc\prog\exec -directory. It contains information about the document viewer (Browser including the path) to be started to view a document.
Listing of wserver.ini:
[document_viewer] viewer = C:\Program Files\Plus!\Microsoft Internet\Iexplore.exe
;;viewer = C:\Program Files\Netscape\Communicator\Program\netscape.exe
If the installation of the browser is located elsewhere, the wserver.ini file should be edited to point to the installation directory of the browser.
Examples:
@S=WORKSTATION_CALL("VIEW_DOCUMENT", "file://c:/ms_docs/help.html")
;Opens a file called help.html in the browser on the workstation
@S=WORKSTATION_CALL("EXECUTE", "c:\winnt\notepad.exe test.txt", "c:\")
;Starts the notepad program on the workstation
Communication Functions
LOAD_DCP(file, link, start)
Loads and starts an internal DCP-NET.
The function LOAD_DCP loads a DCP-NET program to an internal DCP-NET (situated within the base system), and starts the NET unit. The file named in the argument list is read from the disk and stored in the RAM memory of the communication unit.
The program starts if the ’start’ is other than 0.
The function could be placed in the initial NET configuration program
SYS_NETCON.COM or in an initial application program (APL_INIT_1 or 2). It can also be used for restarting NET during operation.
’file’ Text. The file name of the communication program which is loaded to the communication unit. The communication program includes the NET node number of the communication unit and a preconfiguration (default configuration).
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
’link’ Integer. The base system object number of the link, the LINn:B object, to which the communication unit is connected. The LIN object (the LINn:BSD attribute) defines the system device name of the unit, RM00 or RM01, which was given to the unit during installation. Hence, the program given with ‘file’ is loaded to the
NET unit with the device name defined in the LIN object specified with ‘link’.
'start' An integer stating whether the NET unit will be started or not after the program has been loaded: 0 = the NET is not started, anything else = the NET is started.
The function always returns the value 0.
Value:
Example:
@LOAD = LOAD_DCP("SYS_NET2",2,1)
In the example the function loads the communication program called SYS_NET2 to the communication board connected to link number 2 (defined as LIN2:B).
SPACOM(message)
Communicates with a SPACOM unit connected to a COM port.
The SPACOM function sends the ‘message’ string to the SPACOM unit and returns the reply character string. The function can be used only for communication with
SPACOM units connected to the basesystem. This assumes that the base system attributes SYS:BSD and SYS:BSP have been set (see the System Objects manual,
Chapter 4).
‘message’
Value:
Text. The message to be sent to the SPACOM unit.
Text. Reply string. “N” is returned if the unit replies with NAK, and “T” is returned if the unit does not reply or the reply cannot be interpreted (time-out).
TIMEOUT(integer)
Changes communication time-out.
Changes locally the base system time-out used in the communication with other nodes. The function affects only the context where it is used. The global time-out is specified by the SYS:BTI attribute.
'integer'
Value:
Integer expression, >= 0. The time-out in milliseconds.
0 means that SYS:BTI will be used for time-out.
The previous time-out value.
185
MicroSCADA
8 Functions
8.11
186
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Example:
@OLD = TIMEOUT(10000)
;The time-out is changed
#SET STA:S.. .......
;Communication with NET
@TEMP = TIMEOUT(0) ;The time-out is reset to SYS:BTI.
File and Directory Handling Functions
File handling SCIL functions implement the handling of drives (or disk-like devices ), directories and files in an operating-system independent way.
Used terminology:
Drive name
Directory name
File name
Absolute path
Relative path
SCIL name
Printable drive name in OS dependent format. In NT, oneletter name A, B, ... or a UNC name. Lower case letters accepted as a function argument.
Printable directory name. In NT, any valid file name. Returned in case stored by the file system, case-insensitive as a function argument. For portability, directory names created by SCIL should contain only letters A-Z, digits and underscores.
Printable file name. In NT, any valid file name. Returned in case stored by the file system, case-insensitive as a function argument.
By convention, file name is divided into the proper file name and the extension separated by a period. If there are several periods in the name, the last one is considered as the name/extension separator.
For portability, file names created by SCIL should contain only letters A-Z, digits, underscores and at most one period.
Printable absolute directory or file path in OS dependent format. Absolute path contains the drive name ( or uses the default drive ) and all the intermediate directory names to uniquely identify a directory or a file.
In NT, the syntax of an absolute path is
[drive:]\[directory_name\]*name.
Printable relative directory or file path in OS dependent format. Given a root directory, relative path contains intermediate directory names ( if any ) to uniquely identify a directory or a file within the root directory. The absolute path of a file is obtained by combining the absolute path of the root directory and the relative path of the file.
In NT, the syntax of a relative path is [directory_name\]*name. In MMC, also the syntax referring to the current directory (e.g. "..\file") may be used.
File (or directory) name given in operating system independent format used by other SCIL commands and functions, see PARSE_FILE_NAME function for details.
Examples:
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
"PATH/FILE.EXT",
"/SYS/ACTIVE/SYS_/SYS_BASCON.COM", "/LIB"
Drive tag An OS independent identifier of a drive represented as a byte string data in SCIL.
Absolute directory tag An OS independent representation of the absolute path of a directory. A drive tag is a valid absolute directory tag referring to the root directory of the drive.
Relative directory tag An OS independent representation of the relative path of a directory.
Absolute file tag An OS independent representation of the absolute path of a file.
Relative file tag
Filters
An OS independent representation of the relative path of a file.
Filters used when browsing directories may contain following wildcard characters:
* Matches with any character string including null string.
?
Matches with any single character, at the end of name or extension it matches also null character.
% Matches with any single character.
An example: sysm?.exe? matches with sysm.exe, but sysm%.exe% does not.
Operation of the filters is comparable to the
Windows NT Find|Files or Folders operation.
Calling Syntax
The calling syntax and functionality of the SCIL functions is described below.
The common calling syntax of DRIVE_MANAGER, DIRECTORY_MANAGER and
FILE_MANAGER is
FUNCTION_NAME ( command [ , argument ]* )
The first argument ’command’ is a text keyword that selects the requested subfunction.
The keyword is case-insensitive. In the descriptions of subfunctions below, the ’command’ argument is represented as an upper-case text constant. Any valid SCIL expression resulting to a valid keyword value will do, of course.
The auxiliary functions do not follow this convention.
Example listing all files at given directory:
@tag=FM_DIRECTORY(“c:\temp”)
187
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
@list=FM_REPRESENT(FILE_MANAGER(“LIST”, %tag))
; %list is a vector containing the filenames of the directory “c:\temp”.
Compatibility
The functions in this chapter all use abstract tags instead of text names as file identifiers.
To enable using these functions together with the file handling commands and functions of section 8.12, all the functions of section 8.12 will also accept a file tag argument as the identifier of the file.
DIRECTORY_MANAGER
The following commands are recognized by DIRECTORY_MANAGER:
•
LIST
•
CREATE
•
DELETE
•
DELETE_CONTENTS
•
EXISTS
•
COPY
•
COPY_CONTENTS
•
MOVE
•
RENAME
•
GET_ATTRIBUTES
DIRECTORY_MANAGER("LIST", directory[, filter[, recursion]])
Lists the directories contained in a given directory.
’directory’
’filter’
’recursion’
Value:
Absolute directory tag of the directory whose contents are listed.
Text value: The filter for the directory names to be listed. May contain wildcard characters * , % and ?.
Default value is "" (no filter).
Text keyword "RECURSIVE" or "NON_RECURSIVE". Recursive listing means that whole directory hierarchy rooted in ’root’ is listed.
Default value is "NON_RECURSIVE".
Vector value containing the relative directory tags of the directories found.
188 ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
DIRECTORY_MANAGER("CREATE", directory[, recursion])
Creates a directory or a hierarchy of directories.
’directory’ Absolute directory tag of the directory to be created.
’recursion’
Value:
Text keyword "RECURSIVE" or "NON_RECURSIVE".
Recursive creation means that all missing directories contained in
‘directory' are created.
Default value is "NON_RECURSIVE".
Integer value: The status code of the operation.
DIRECTORY_MANAGER("DELETE", directory)
Deletes one or more directories and all the directories and files contained in them.
'directory'
Value:
Absolute directory tag or a vector of tags to be deleted.
List value with following attributes:
OK Boolean value, TRUE if successful.
FAILED A vector value containing relative directory or file tags of directories and files not deleted.
Missing if OK == TRUE.
STATUS An integer vector containing the status codes of failed deletions. Missing if OK == TRUE.
DIRECTORY_MANAGER("DELETE_CONTENTS", directory[, filter[, subdirectories]])
Deletes files and directories contained in a given directory.
'directory' Absolute directory tag of the directory whose contents are deleted.
'filter'
'subdirectories' Text keyword "INCLUDE_DIRECTORIES" or
"OMIT_DIRECTORIES"
Specifies whether the subdirectories are deleted or not.
If subdirectories are deleted, the filter is applied to the name of subdirectories ( not to the contained files ).
Default value is "OMIT_DIRECTORIES".
Value:
Text value: The filter for the file and directory names to be deleted.
May contain wildcard characters * , % and ?.
Default value is "" (no filter).
List value with following attributes:
OK Boolean value, TRUE if successful.
189
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
FAILED
STATUS
1MRS751250-MEN
A vector value containing relative directory or file tags of directories and files not deleted.
Missing if OK == TRUE.
An integer vector containing the status codes of failed deletions. Missing if OK == TRUE.
DIRECTORY_MANAGER("EXISTS", directory)
Checks the existence of one or more directories.
’directory’
Value:
Absolute directory tag or a vector of tags to be checked.
Boolean or boolean vector value indicating whether the directories exist or not.
DIRECTORY_MANAGER("COPY ", source, target )
Copies a directory and all its contents into a new directory.
’source’
’target’
Value:
Absolute directory tag of the source directory.
Absolute directory tag of the target directory, which is created by
COPY.
List value with following attributes:
OK Boolean value, TRUE if successful.
FAILED
STATUS
A vector value containing relative directory or file tags of directories and files not copied.
Missing if OK == TRUE.
An integer vector containing the status codes of failed copies. Missing if OK == TRUE.
DIRECTORY_MANAGER("COPY_CONTENTS ", source, target[, filter[, subdirectories[, overwrite]]])
Copies the files of a directory into another directory. Optionally, the subdirectories are recursively copied as well.
’source’ Absolute directory tag of the source directory.
’target’ Absolute directory tag of the target directory ( not created by
COPY_CONTENTS ).
190 ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
’filter’ Text value: The filter for the file and directory names to be copied.
May contain wildcard characters * , % and ?.
Default value is "" (no filter).
’subdirectories’ Text keyword "INCLUDE_DIRECTORIES" or
"OMIT_DIRECTORIES"
Specifies whether the subdirectories are copied or not.
If subdirectories are copied, the filter is applied to the name of subdirectories ( not to the contained files ).
Default value is "OMIT_DIRECTORIES".
’overwrite’
Value:
Text keyword "OVERWRITE" or "DONT_OVERWRITE"
Specifies whether an existing file in target directory is overwritten or not.
Default value is "DONT_OVERWRITE"
List value with following attributes :
OK
FAILED
Boolean value, TRUE if successful.
A vector value containing relative directory or file tags of directories and files not copied.
Missing if OK == TRUE.
STATUS An integer vector containing the status codes of failed copies. Missing if OK == TRUE.
Keyword arguments ’subdirectories’ and ’overwrite’ may be given in any order.
ABB Automation
DIRECTORY_MANAGER "MOVE", directory, target)
Moves a directory to another directory.
’directory’
’target’
Value:
Absolute directory tag of the directory to be moved.
Absolute directory tag of the directory to become the new parent directory.
List value with following attributes:
STATUS Integer value, the status code of the operation.
NEW_TAG New tag for the moved directory
(if STATUS == 0)
191
MicroSCADA
8 Functions
192
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
DIRECTORY_MANAGER("RENAME", directory, name)
Renames a directory.
’directory’ Absolute directory tag of the directory to be renamed.
’name’
Value:
Text value, the new directory name.
List value with following attributes:
STATUS
NEW_TAG
Integer value, the status code of the operation.
New tag for the renamed directory
(if STATUS == 0)
DIRECTORY_MANAGER("GET_ATTRIBUTES", directory)
Returns attribute information from one or more directories.
’directory’ value
Absolute directory tag or vector of directory tags of interest.
List value containing the following attributes:
STATUS Integer or integer vector value containing the status of each query.
READ_ONLY Boolean or boolean vector value.
SYSTEM
FAILURES
Boolean or boolean vector value, TRUE if exclusively used by the OS.
Integer value telling the number of failed queries.
DRIVE_MANAGER
A drive is the root of a file hierarchy. Depending on the operating system, a drive may correspond to a physical disk-like device or it may consist of several physical devices or it may be a partitioning of a physical device or it may map to a directory of another drive. In Windows NT, a drive corresponds to a Windows NT logical drive ( labeled
A, B, and so on ) or an UNC (Universal Naming Convention) name of the form
\\servername\sharename.
The following commands are recognized by DRIVE_MANAGER:
•
LIST
•
EXISTS
•
GET_DEFAULT
•
GET_ATTRIBUTES
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
DRIVE_MANAGER("LIST")
Returns the drives available in the system.
Value: Vector value containing the drive tags of the available drives.
DRIVE_MANAGER("EXISTS", drive)
Checks the existence of one or more drives.
’drive’ Drive tag or a vector of drive tags to be checked.
Value: Boolean or boolean vector value indicating whether the drive(s) exist or not.
DRIVE_MANAGER("GET_DEFAULT")
Returns the default drive, i.e. the drive assumed if an absolute path does not contain the drive.
Value: Byte string value containing the tag of the default drive.
DRIVE_MANAGER("GET_ATTRIBUTES", tag)
Returns some information from drives.
’tag’ The drive tag or a vector of drive tags of interest.
Value: A list of following attributes:
STATUS
FAILURES
TYPE
Integer or integer vector value, the status code(s) of the query. Bad status is not returned if TYPE is "REMOVABLE" and device is not available.
Integer value containing the number of failed queries.
If FAILURES == 0, STATUS contains all zeroes.
Text or text vector value:
"FIXED"
"REMOVABLE"
"CDROM"
"NETWORK"
"RAM"
"SHARED"
"UNKNOWN"
193
MicroSCADA
8 Functions
194
Programming Language
SCIL
Technical Reference Manual
CAPACITY
FREE
1MRS751250-MEN
Integer or integer vector value: The total capacity of the drive in kilobytes. 0 is returned for unavailable device of TYPE "REMOVABLE".
Integer or integer value: The unused capacity of the drive in kilobytes. 0 is returned for unavailable device of TYPE "REMOVABLE".
FILE_MANAGER
The following commands are recognized by FILE_MANAGER:
•
LIST
•
DELETE
•
EXISTS
•
COPY
•
MOVE
•
RENAME
•
GET_ATTRIBUTES
FILE_MANAGER("LIST", directory[, filter[, recursion]])
Lists the files ( but not directories ) contained in a given directory.
’directory’
’filter’
’recursion’
Value:
Absolute directory tag of the directory whose contents are listed.
Text value: The filter for the file names to be listed.
May contain wildcard characters * % and ?.
Default value is "" (no filter).
Text keyword "RECURSIVE" or "NON_RECURSIVE".
Recursive listing means that all files in the directory hierarchy rooted in ’directory’ is listed.
Default value is "NON_RECURSIVE".
Vector value containing the relative file tags of the files found.
FILE_MANAGER(“DELETE",file )
Deletes one or more files.
’file’ Absolute file tag or a vector of file tags to be deleted.
Value: A list value containing the following attributes:
DELETED Integer value containing the number of deleted files.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
FAILED
STATUS
MicroSCADA
8 Functions
Integer value containing the number of failed deletions.
Integer or vector value containing the status code for each deletion.
FILE_MANAGER("EXISTS", file)
Checks the existence of one or more files.
’file’ Absolute file tag or a vector of file tags to be checked.
Value: Boolean or a boolean vector value indicating whether the file exists or not.
FILE_MANAGER("COPY", source, target[, overwrite])
Copies the contents of a file to another file.
’source’ Absolute file tag of the source file.
’target’
’overwrite’
Absolute file tag of the target file.
Text keyword "OVERWRITE" or "DONT_OVERWRITE".
Default value is "DONT_OVERWRITE".
Value: Integer value, the status code of the operation.
FILE_MANAGER("MOVE", file, target)
Moves a file to another directory.
’file’ Absolute file tag of the file to be moved.
’target’
Value:
Absolute directory tag of the directory to become the new parent directory.
List value with following attributes:
STATUS
NEW_TAG
Integer value, the status code of the operation.
New tag for the moved file ( if STATUS == 0 )
FILE_MANAGER("RENAME", file, name)
Renames a file.
’file’ Absolute file tag of the file to be renamed.
195
MicroSCADA
8 Functions
196
’name’
Value:
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Text value, the new file name.
List value with following attributes:
STATUS
NEW_TAG
Integer value, the status code of the operation.
New tag for the renamed file
(if STATUS == 0).
FILE_MANAGER("GET_ATTRIBUTES", file )
Returns attribute information from one or more files.
’file’
Value:
Absolute file tag or vector of file tags of interest.
List value containing the following attributes:
STATUS
FAILURES
Integer or integer vector value, the status of the query.
Integer value telling the number of failed queries.
READ_ONLY Boolean or boolean vector value.
SYSTEM Boolean or boolean vector value, TRUE if exclusively used by the OS.
CREATED_S,
CREATED_US List or list vector values containing the creation time of the file.
MODIFIED_S,
MODIFIED_US List or list vector values containing the modification time of the file.
SIZE_KB,
SIZE_B List or list vector values containing the size of the file.
The creation and modification times are given in two attributes: xxx_S xxx_US
Time value, time to the accuracy of one second.
Integer value, microseconds.
The file size is given in two attributes:
SIZE_KB Integer value, kilobytes.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
SIZE_B Integer value 0 … 1023, bytes.
MicroSCADA
8 Functions
Auxiliary Functions
FM_DRIVE(name[, check])
Creates a drive tag from one or more drive names or checks drive names.
'name'
'check'
Value:
Text or text vector value, drive name(s). In NT, one-letter name optionally followed by ":" or a UNC name.
Text keyword "CHECK".
If "CHECK", a text or text vector value "OK" or "ERROR", otherwise a drive tag ( a byte string value ) or a vector of drive tags.
FM_DIRECTORY(path[, check])
Creates a directory tag from one or more directory paths or checks directory paths.
'path'
'check'
Value:
Text or text vector value, directory path(s).
In NT, any valid directory path.
Text keyword "CHECK".
If "CHECK", a text or text vector value:
"ABSOLUTE" if 'path' denotes a valid absolute path.
"RELATIVE" if 'path' denotes a valid relative path.
"ERROR" if 'path' is not a valid path.
Otherwise an absolute or relative directory tag ( a byte string value) or a vector of tags.
FM_APPLICATION_DIRECTORY
Creates the absolute directory tag of the home directory of current application.
Value: The absolute directory tag of the home directory of current application.
FM_SCIL_DIRECTORY(name[, check])
Creates a directory tag from one or more SCIL names or checks SCIL names.
'name' Text or text vector value, SCIL name(s).
197
MicroSCADA
8 Functions
198
’check’
Value:
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Text keyword "CHECK".
If "CHECK", a text or text vector value.
"ABSOLUTE", if ’name’ denotes a valid absolute directory.
"RELATIVE", if ’name’ denotes a valid application directory.
"ERROR", if ’name’ is not a valid SCIL name.
Otherwise an absolute directory tag ( a byte string value ) or a vector of tags.
FM_FILE(path[, check])
Creates a file tag from one or more file paths or checks file paths.
’path’ Text or text vector value, file path(s).
In NT, any valid file path.
’check’ Text keyword "CHECK".
Value: If "CHECK", a text or text vector value.
"ABSOLUTE" if ’path’ denotes a valid absolute path.
"RELATIVE"
"ERROR"
if ’path’ denotes a valid relative path.
if ’path’ is not a valid path.
Otherwise an absolute or relative file tag ( a byte string value ) or a vector of tags.
FM_SCIL_FILE(name[, option][, option])
Creates a file tag from one or more SCIL names or checks SCIL names.
’name’ Text or text vector value, SCIL name(s).
’option’
Value:
Text keyword "CHECK" or "IGNORE_EXISTING".
If "CHECK", a text or text vector value.
"ABSOLUTE" if ’name’ denotes a valid absolute file.
"RELATIVE"
"ERROR" if ’name’ denotes a valid application file.
if ’name’ is not a valid SCIL name.
Otherwise an absolute file tag ( a byte string value ) or a vector of tags.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
If "IGNORE_EXISTING" option is not specified, the function does a lookup for the name given, and returns a tag for the found file. If the file does not exist, a tag for a file that would be created by ’name’ is returned. If the option is specified, the lookup is bypassed.
FM_REPRESENT(tag[, option]* )
Converts one or more drive, directory or file tags into an OS dependent text representation.
’tag’
’option’
Byte string or a byte string vector value: drive, directory or file tag(s).
One or more of following text keywords in any order
"DRIVE_POSTFIX" In NT, append a ":" to a drive name ( if a drive tag ).
"DIRECTORY_POSTFIX" In NT, append a "\" to directory path ( if a directory tag ).
Value:
"UPPER_CASE"
"LOWER_CASE"
Use upper case letters.
Use lower case letters.
"CAPITALIZE" Capitalize the names.
Text or text vector value, the text representation of the given tag(s).
By default, in NT a drive name is given without the trailing ":", a directory name is given without the trailing "\" and the case used when the tag was created is not changed.
If ’tag’ denotes the default drive, an empty string is returned.
FM_SCIL_REPRESENT(tag[, case])
Converts one or more directory or file tags into a SCIL name text representation.
’tag’ Byte string or a byte string vector value: directory or file tag(s).
’case’ One of the following text keywords:
"UPPER_CASE" Use upper case letters.
"LOWER_CASE" Use lower case letters.
"CAPITALIZE" Capitalize the names.
199
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Value: Text or text vector value, the SCIL name representation of the given tag(s).
A zero length text is returned if the ’tag’ cannot be converted into a SCIL name, i.e. it contains a drive or is not located below the root of SCIL file hierarchy (in NT,
"\SC\").
FM_COMBINE(tag1[, tagi ]*, tagn )
Combines two or more drive, directory or file tags to create a new directory or file tag.
A drive or a directory tag ( either absolute or relative ).
’tag1’
’tagi’ One or more (up to 30 ) directory tags.
The tags must be relative directory tags, except for the first one which can be an absolute directory tag using the default drive if
’tag1’ is a drive tag.
’tagn’ A directory or file tag or vector of tags.
Value: A directory or file tag denoting the path from ’tag1’ to ’tagn’ or a vector of such tags.
The tags given as the arguments must follow the order of file hierarchy. A drive must be first argument if any. Any absolute path containing a drive may not be specified if the first argument is a drive tag. Only one absolute path may be given. An absolute path may not follow a relative path in the argument list. A file path must be the last argument if any.
FM_EXTRACT(tag, component)
Extracts a component from one or more directory or file tags.
’tag’ Any directory or file tag or a vector of such tags.
’component’ Text keyword specifying the component to be extracted.
"DRIVE" The drive, zero length byte string is returned if
’tag’ is not an absolute path.
"PATH" The intermediate directory path to the last component.
"DIRECTORY" The directory containing the ’tag’ ( "DRIVE" and "PATH" combined).
"LAST" The directory or file denoted by ’tag’.
200 ABB Automation
1MRS751250-MEN
8.12
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
"APPLICATION_RELATIVE" The tag relative to the current application directory.
Value: A byte string or a byte string vector containing the tag(s) of the selected component.
For a missing component, a zero length byte string is returned.
If the selected component is "LAST", a relative directory or file tag is returned.
If the selected component is "PATH" or "DIRECTORY", the result is absolute if ’tag’ is absolute and relative if ’tag’ is relative.
FM_COMBINE_NAME(’name’, ’extension’)
Combines a proper file name and an extension to a file name.
’name’
’extension’
Text or text vector value, the proper file name(s).
Text or text vector value, the file name extension(s).
Value: Text or text vector value, the combined file name(s).
Either ’name’ or ’extension’ or both may be vectors. If both, they must be of equal length.
Trailing blanks, if any, are removed from ’name’ and ’extension’. If the extension is empty, the name is returned. Otherwise, a period is inserted between name and extension. The resulting file name is not syntax checked.
FM_SPLIT_NAME(file)
Extracts the proper name and the extension from one or more file names.
’file’ Text or text vector value, file name(s).
Value: List value with following attributes.
NAME Text or text vector value, the proper name(s).
EXTENSION Text or text vector value, the extension(s).
File and Directory Management Functions
FILE_LOCK_MANAGER (function, file)
Locks and unlocks files.
ABB Automation
201
MicroSCADA
8 Functions
202
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
This function is used to temporarily lock a file for use of only one SCIL context. This function is mainly needed by tools (such as dialog editor) to prevent simultaneous modification of same data by two users. All the SCIL tools accessing the file should use FILE_LOCK_MANAGER to synchronize the access to the file, locking a file with FILE_LOCK_MANAGER does not prevent accessing of the file by
READ_TEXT, WRITE_TEXT or other SCIL functions.
‘function’ Text value, the function to be performed:
‘file’
Value:
“LOCK"
"UNLOCK" lock the file for exclusive use.
unlock the file.
"BREAK" break the lock.
Text value containing the name of the file to be locked in OS dependent format ( see PARSE_FILE_NAME function to obtain OS file names).
A text value containing:
"OK"
"LOCKED"
"BROKEN"
Function successfully performed.
"LOCK" failed because of an existing lock.
"UNLOCK" detected that the file not locked, i.e. broken by somebody else.
“ INVALID" The 'file' argument is invalid. This means that the name is not a valid file name or the directory in the name does not exist or the access to it is denied.
Notes:
•
The file does not have to exist, actually ’file’ argument is used as a unique identifier of the lock. The argument is used a seed for a lock file name, which is generated by prefixing the file name in ’file’ by ’_L_’ , for example if ’file’ is
"C:\DATA\ABC.DAT", then the lock file name used is
"C:\DATA\_L_ABC.DAT". Therefore, the file name should not be extremely long.
•
Two different ’file’ arguments may refer to one and same lock. For example, if a logical drive K points to directory "C:\DATA", then ’file’ arguments
"C:\DATA\ABC.DAT" and "K:\ABC.DAT" denote the same lock.
•
When a SCIL context is destroyed, all the locks it holds are automatically released by the base system software.
•
The function "BREAK" should be used with care. It should be used only after a program crash or other such failure which has left the file locked.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
KEYED_FILE_MANAGER ( function, file {,output_file {, key_size}})
File maintenance function.
This function saves corrupted files and does some other file maintenance. It can handle one file at a time, the ‘file’ argument, and provides the following operations selected by the ‘function’ argument:
"INFORMATION" Returns some information of the file.
"COMPACT" Compacts the file by rewriting the records in their key order. After the compacting, the file is smaller and faster to access. The off-line program REORG was previously used for this purpose.
"REBUILD" Reconstructs the file by scanning and rewriting the data blocks of the file, ignoring the index blocks. This function should be used if the internal structure of the file is corrupted, for example if status
5015 ( FILE_INCONSISTENT ) is returned when the file is accessed. The file may not be used by MicroSCADA when this function is performed. The off-line program SAVER was previously used for this purpose.
The optional argument 'key_size' overrides the key size read from the status block of the file. It should be used only if the status block of the file is corrupted. The corruption is indicated by status code 5016 (FILE_INVALID_KEY_SIZE) when attempting this function without the key_size argument, or the same status code when trying to access the output file generated by this function without the key_size argument.
‘function’
‘file’
‘output_file’
‘key_size’
Value:
The correct value of this argument is obtained by applying the
"INFORMATION" function to an uncorrupted file of the same type.
Text: "INFORMATION", "COMPACT", or "REBUILD". The operation to be performed on the file (see above):
Text or byte string value containing the file name.
Text or byte string value containing the output file name (functions
COMPACT and REBUILD only).
Integer value, the size of the record key (function REBUILD only).
List value containing various information depending on the function argument.
The ‘function’ value "INFORMATION" returns the following attributes in the result list:
STATUS The status of the operation.
203
MicroSCADA
8 Functions
204
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
VERSION
USED_BLOCKS
KEY_SIZE
INDEX_LEVELS
The file format version number, currently
0 or 1.
Number of 512-byte blocks allocated for the file.
The length of the record key.
The number of index levels used by the index tree of the file.
The attributes VERSION, USED_BLOCKS and INDEX_LEVELS are present only if STATUS = 0.
The ‘function’ value "COMPACT" returns the same attributes as the ‘function’ value "INFORMATION" ( the values are those before the compacting) and in addition the following attribute:
RECORDS Number of records copied.
The ‘function’ value "REBUILD" returns the same attributes as the ‘function’ value "COMPACT" and in addition the following attribute:
DUPLICATES A text vector containing the key values that were found duplicated in the source file. The corresponding records in the output file may contain obsolete or otherwise bad data, they should be checked. Max. 1000 duplicate keys are reported.
If the status block of the file was corrupted, attributes VERSION,
USED_BLOCKS and INDEX_LEVELS are not returned.
PARSE_FILE_NAME ( name [ , file ] )
Converts logical paths names and file names to operating system file names.
The path names and file names are converted in an operating system independent way.
‘name’ Text value: directory or path name, either
‘file’
Value:
1) SCIL path name, e.g. "PICT"
2) SCIL directory name, e.g. "/APL/TEST/PICT" or "PICT/"
3) OS dependent directory name, e.g. "C:\SC\APL\TEST\PICT"
Text value: optional file name, e.g. "station.pic"
Text value containing the path name of the file ( or directory ) in
OS dependent format, e.g.
"C:\SC\APL\TEST\PICT\STATION.PIC" ( or
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
"C:\SC\APL\TEST\PICT"). Returns "", if there is an error in arguments.
Notes:
•
The directory name in SCIL format may be given with or without the trailing "/"
(see however note 3).
•
The OS dependent directory name may be given with or without the OS dependent delimiter (e.g. "\").
•
In SCIL, depending on the context, "PICT" may mean either the path PICT or the directory "/APL/xxx/PICT". To resolve the ambiguity, "PICT" is used for the path and "PICT/" for the directory.
•
If a path name is given as ’name’ and file is not given, the function returns the first directory in the path.
•
If a path name is given as ’name’ and ’file’ exists, the complete file path name of the found file is returned.
•
If a path name is given as ’name’ and ’file’ does not exist, the returned path name contains the first directory of the logical path, i.e. the returned value is the complete would-be name of the file if created.
•
The arguments of the function are case-insensitive. The case of the returned value is OS dependent. In NT, upper case string is returned.
PATH ( name )
The real directory paths of a logical path name.
‘name’ Text expression containing the name of a logical path.
Value: Text vector containing the names (in an operating system dependent format) of directories that make up the logical path.
REP_LIB ( name )
The real file names of a logical representation library name.
‘name’ Text expression containing the name of the logical representation library.
Value: Text vector containing the names (in an operating system dependent format) of library files that make up the logical library.
ABB Automation
205
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
PATHS ( level )
The logical paths defined on a specified level.
‘level’ Integer value 0 to 3 specifying the requested level in path hierarchy:
0 = global paths
Value:
1 = application paths
2 = process specific paths (e.g. monitor paths)
3 = temporary paths
Text vector containing the names of the defined logical paths on the requested level.
REP_LIBS ( level )
The logical library names defined on a specified level.
‘level’
Value:
Integer value 0 to 3 specifying the requested level in path hierarchy:
0 = global paths
1 = application paths
2 = process specific paths (e.g. monitor paths)
3 = temporary paths
Text vector containing the names of the defined logical representation libraries on the requested level.
SHADOW_FILE ( file_name )
Enable shadowing of files not created by MicroSCADA.
This function should be used, for example, by a tool that copies files to an application directory using operating system file transfer utilities.
‘file_name’
Value:
Text or byte string value containing the file name
A list value containing the following attributes:
STATUS status code ( 0 = OK ).
206 ABB Automation
1MRS751250-MEN
8.13
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
QUEUED Boolean value indicating whether the file was queued for shadowing.
The function first locates the file. The status is returned in attribute STATUS. Then it checks whether the file belongs to an application that is currently shadowed. If yes, the file is queued for shadowing ( the function does not wait for the completion of shadowing) and TRUE is returned in attribute QUEUED. If not, FALSE is returned and nothing is done.
DDE Client Functions
The DDE client functions allow the MicroSCADA user (application) access to external applications using the DDE (Dynamic Data Exchange) protocol. The DDE client functions establish a DDE link between MicroSCADA and other Windows applications, such as Microsoft Excel or Word. The MicroSCADA application works as a client and the other application as a server. The other application must be running when the connection is opened.
If the client and server applications are running in separate computers, NetDDE must be used.
The DDE protocol is supported by most Microsoft Windows applications. To use the
MicroSCADA DDE client functions, the user should be familiar with the server application and its DDE functions.
The MicroSCADA DDE client functions support the following data transaction commands directed from the client (MicroSCADA) to the server application:
Request
Poke
Requests a data transfer from a server to a client .
Writes data in the server application.
Execute Executes an item (a command) in the server application (if execute supported by the application).
The DDE client functions use the following three identifiers to address data in the server application:
Service name
Topic name
Item name
Usually the name of the server application.
Identifies a logical data context, e.g. a file.
Identifies the data.
The DDE functions in MicroSCADA use status codes listed below, most of which are
DDE protocol status codes. The status code texts can be, and should be, used as such in SCIL expressions. They are defined as predefined integers in the MicroSCADA kernel.
STATUS codes
DMLERR_NO_ERROR
Decimal value
0
207
MicroSCADA
8 Functions
208
Programming Language
SCIL
Technical Reference Manual
DMLERR_ADVACKTIMEOUT
DMLERR_BUSY
DMLERR_DATAACKTIMEOUT
DMLERR_DLL_NOT_INITIALIZED
DMLERR_DLL_USAGE
DMLERR_EXECACKTIMEOUT
DMLERR_INVALID_PARAMETER
DMLERR_LOW_MEMORY
DMLERR_MEMORY_ERROR
DMLERR_NOTPROCESSED
DMLERR_NO_CONV_ESTABLISHED
DMLERR_POKEACKTIMEOUT
DMLERR_POSTMSG_FAILED
DMLERR_REENTRANCY
DMLERR_SERVER_DIED
DMLERR_SYS_ERROR
DMLERR_UNADVACKTIMEOUT
DMLERR_UNFOUND_QUEUE_ID
DMLERR_ITEM_TOO_LONG
16394
16395
16396
16397
16398
16399
16400
16401
20483
16384
16385
16386
16387
16388
16389
16390
16391
16392
16393
1MRS751250-MEN
DDE_CONNECT(service, topic)
Opens a connection to an external application.
The connection gets an identification number which is used in the subsequent DDE operations. The DDE connections are SCIL context specific which means that they are automatically closed when a picture is exited, when a command procedure has been executed to the end or when the dialog system is deleted. Each SCIL context can have up to 10 open DDE connections simultaneously.
The remote application must be running when the DDE_CONNECT function is issued. Likewise, the topic for which DDE_CONNECT is issued must be available. For instance, for Excel this means that the desired spreadsheet must be opened. The remote application can be started from SCIL with the OPS_CALL command. At the same time the desired topic (e.g. a file) can be opened. A topic can also be opened later by sending an open command to the server application using the DDE-
_EXECUTE function.
’service’ Text. The service name the remote application responds to. Usually the same as the application name.
’topic’ Text. A valid topic name within the remote application.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
Value: A list containing the following two attributes:
STATUS = A predefined integer (see above). The value indicates whether the function was successfully executed or not.
DMLERR_NO_ERROR (= 0) means that the operation succeeded.
CONNECTION_ID = Integer, 1 ... 10. The Id-number of the connection. If the connection did not succeed (STATUS <>
DMLERR_NO_ERROR), the
CONNECTION_ID is undefined.
Example:
Connecting to Excel 5.0, sheet 1:
@RESULT=DDE_CONNECT("EXCEL", "SHEET1")
#IF RESULT:VSTATUS == DMLERR_NO_ERROR #THEN #BLOCK
@CONN = RESULT:VCONNECTION_ID
#BLOCK_END ; Connection was successful
#ELSE #BLOCK ; Connection not successful
#BLOCK_END
DDE_DISCONNECT(connection_id)
Closes the connection specified by the argument.
’connection_id’ Integer, 1 .. 10. The DDE connection identifier obtained using the
DDE_CONNECT.
Value: A list containing the following attribute:
STATUS = A predefined integer, see above. The value indicates whether the function was successfully executed or not. DMLERR_NO_ERROR (= 0) means that the operation succeeded.
Example:
Disconnecting from a remote application (e.g. Excel):
@RESULT=DDE_DISCONNECT(%CONN )
#IF RESULT:VSTATUS == DMLERR_NO_ERROR #THEN #BLOCK
;Connection was successfully closed.
#BLOCK_END
#ELSE
; Connection not successfully closed.
DDE_REQUEST(connection_id, item
[
,timeout
]
)
Requests data from a remote application.
A connection to the application must be open (see above).
209
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
’connection_id’ Integer, 1 ... 10. The DDE identifier obtained using the
DDE_CONNECT.
’item’
‘timeout’
Text. A valid DDE item in the remote application.
Integer, 0 ... 1000. The DDE transaction timeout in seconds. The parameter is optional. Default value = 20 s.
Value: A list containing the following two attributes:
STATUS = A predefined integer (see above). The value indicates whether the function was successfully executed. DMLERR_NO_ERROR (= 0) means that the operation succeeded.
DATA = Text (max length 255). Includes requested data.
If STATUS is NOT equal to
DMLERR_NO_ERROR, the DATA is undefined.
Example:
Requesting data from Excel:
@RESULT=DDE_REQUEST(%CONN, "R1C1", 30)
#IF RESULT:VSTATUS== DMLERR_NO_ERROR #THEN #BLOCK
@ITEM_VALUE=RESULT:VDATA
;The request was successful
#BLOCK_END
#ELSE #BLOCK
;The request was NOT successful
#BLOCK_END
The cell references in Excel are language dependent if the referens style R1C1 is used
(R for row and C for column). To check the type of referens style and the cell referens notation of your Excel version select: Tools | Options | Genaral tab.
210
DDE_POKE(connection_id, item, value
[
,timeout
]
)
Sets the value of 'item' in a remote application.
A connection to the application must be open (see above).
'connection_id' Integer, 1 ... 10. The DDE identifier obtained using the
DDE_CONNECT.
'item'
'value'
Text. A valid DDE item in the remote application.
Text. The value which will be set into item.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
‘timeout’
Value:
Integer, 0 ... 1000. The DDE transaction time-out in seconds. The parameter is optional. Default value = 20 s.
A list containing the following attribute:
STATUS = A predefined integer (see above). The value indicates whether the function was successfully executed. DMLERR_NO_ERROR (= 0) means that the operation succeeded.
Example:
Setting "Time of Day" in cell "R1C1" in Excel:
@RESULT=DDE_POKE(%CONN, "R1C1", TOD, 30)
#IF RESULT:VSTATUS == DMLERR_NO_ERROR #THEN #BLOCK
;The value was successfully set.
#BLOCK_END
#ELSE #BLOCK
;The value was NOT successfully set.
#BLOCK_END
DDE_EXECUTE(connection_id, statement
[
,timeout
]
)
Executes a statement in a remote application.
The connection to the application must be open. To be able to use this function you need to have the DDE documentation of the server application.
'connection_id' Integer, 1 ... 10. The DDE connection identifier obtained using the
DDE_CONNECT.
'statement'
‘timeout’
Value:
Text. A valid executable statement in the remote application (see the documentation of the application in question).
Integer, 0 ... 1000. The DDE transaction time-out in seconds. The parameter is optional. Default value = 20 s.
A list containing the following attribute:
STATUS = A predefined integer (see above). The value indicates whether the function was successfully executed. DMLERR_NO_ERROR (= 0) means that the operation succeeded.
Example:
Executing a statement in Excel:
@RESULT=DDE_EXECUTE(%CONN, "%o~", 30)
#IF RESULT:VSTATUS== DMLERR_NO_ERROR #THEN #BLOCK
;The request command was successfully executed
#BLOCK_END
#ELSE #BLOCK
;The request was NOT successful.
#BLOCK_END
211
MicroSCADA
8 Functions
8.14
212
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
The string "%o~" corresponds to <Alt+o><ENTER> in Excel and opens a dialog for cell formatting.
Use the DDE_EXECUTE function with caution! Different applications respond differently to the DDE_EXECUTE statement. Excel, for example, must be the active application on the desktop to be able to execute a submitted DDE_EXECUTE command.
DDE Server Functions
MicroSCADA applications can be accessed from external Windows applications using the DDE protocol, so that the MicroSCADA application works as a server and the other application as a client. See Chapter 2.
DDE Server supports the following SCIL data types:
Integer
Text
Time (Time will be returned as seconds count from 1.1.1978)
Boolean (Boolean will be returned as 0 or 1)
Real (Real will be returned to client application as SCIL real format
("." as decimal separator))
The vector data type is not supported directly but can be used with the help of the
DDE_VECTOR function described below. MicroSCADA real data can be transformed into text data with user defined decimal separator using the DDE_REAL function (see below). The data types Bit string, Byte string and List are not supported.
DDE_VECTOR(vector , decimal separator , list separator)
Creates a text format vector with user defined list separator.
The function transforms a SCIL vector into a format readable in the client in the application.
‘vector’ Vector. A valid SCIL expression. The vector may only contain real, integer, text and boolean elements. Note that the vector will be transformed into a text which can contain no more than 256 characters.
‘decimal separator’ Text. A valid separator in the client application.
‘list separator’ Text. A valid separator in client application.
ABB Automation
1MRS751250-MEN
8.15
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
Return value: A text composed of the elements in ‘vector’ separated by the list separator (see the example below).
If a vector element is of invalid data type or missing, there is an empty value in result string. In other words, there are two consecutive list separator characters in the result string.
Example:
#SET APL:BUV = (TEST,1,2.0)
@A = DDE_VECTOR(APL:BUV," ." ," ;" )
;Result: %A = TEST;1;2.0
DDE_REAL(real , separator)
Creates a text format real number with a user defined decimal separator.
‘real’ Real. A valid SCIL expression.
‘separator’
Return value:
Text. A valid decimal separator in client application.
A text value with defined decimal separator.
Example:
#SET APL:BUV1 = 1.23
@A = DDE_REAL(APL:BUV1,",")
;Result: %A = 1,23
ODBC Functions
The ODBC functions provide means for accessing databases and applications that support SQL (Structured Query Language), e.g. databases built with Microsoft Access, Paradox and Oracle. MicroSCADA uses the database interface Microsoft ODBC
(Open Database Connectivity) and SQL statements.
Access to databases requires that an ODBC driver for the database management system in question has been installed and configured in the MicroSCADA computer where the ODBC functions are executed (the base system computer or an MMC computer). For more information, see the ODBC documentation.
To be able to use the ODBC functions, the programmer should be familiar with SQL statements. Refer to suitable SQL manuals and books.
The ODBC functions may return the following seven status codes, which can be used as such in SCIL expressions because they are defined as predefined integers:
0
1
-1
100
2
99
2001
SQL_SUCCESS
SQL_SUCCESS_WITH_INFO
SQL_ERROR
SQL_NO_DATA_FOUND
SQL_STILL_EXECUTING
SQL_NEED_DATA
SQL_UNSUPPORTED_DATATYPE
213
MicroSCADA
8 Functions
214
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
In certain cases, also an error code may be returned (for status codes SQL_ERROR and SQL_SUCCESS_WITH_INFO). The error codes are the ODBC error codes listed in appendix B.
SQL_CONNECT(source, user, password )
Opens an ODBC connection to a data source.
The data source may be situated in the same computer or in another computer on the network. The connection gets an identification number which is used in the subsequent ODBC functions.
The ODBC connections are SCIL context specific. This means that when the context, e.g. the picture or command procedure, is exited, the connections are automatically closed.
Up to 10 ODBC connections may be open simultaneously.
’source’ Text. The data source name as defined by the ODBC administration tool.
’user’
’password’
Text. A text string containing the user name that is to be used when accessing the data source specified in ’source’. An empty string if no user name needed.
Text. A text string containing the password for ’user’ when accessing the data source specified in ’source’. An empty string if no password needed.
Value: A list containing the following three attributes:
STATUS = A predefined integer (see above). The value indicates whether the function was successfully executed or not.
CONNECTION_ID = Integer, 1...10. The identification number of the connection. If the operation did not succeed, i.e., STATUS is neither
SQL_SUCCESS nor
SQL_SUCCESS_WITH_INFO,
CONNECTION_ID is undefined.
ERROR_CODE = Text. A five characters long ODBC-error code. If STATUS is anything else than
SQL_ERROR or
SQL_SUCCESS_WITH_INFO,
ERROR_CODE is undefined.
Example:
Opening the connection to a data source named ACCESS:
@RESULT = SQL_CONNECT("ACCESS", "MICRO", "SCADA")
#IF RESULT:VSTATUS == SQL_SUCCESS OR-
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
RESULT:VSTATUS == SQL_SUCCESS_WITH_INFO #THEN #BLOCK
@CONN = RESULT:VCONNECTION_ID
;Continue the database interaction.
#BLOCK_END
#ELSE #BLOCK
;The connection was not successful.
#BLOCK_END
MicroSCADA
8 Functions
SQL_DISCONNECT(connection_id)
Closes the ODBC connection defined by the argument.
If SQL_BEGIN_TRANSACTION has been issued, SQL_COMMIT is run automatically before the connection is closed (see below). All statements associated with the connection are freed.
’connection_id’ Integer 1 ... 10. The connection identification of the connection that is to be disconnected.
Value: A list containing the following two attributes:
STATUS =
ERROR_CODE =
A predefined integer (see above). A value that indicates whether the function was successfully executed.
Text. A five characters long ODBC-error code. If STATUS is anything else than
SQL_ERROR or
SQL_SUCCESS_WITH_INFO,
ERROR_CODE is undefined.
Example:
Closing the connection opened in the example above:
@RESULT = SQL_DISCONNECT(%CONN)
#IF RESULT:VSTATUS <> SQL_SUCCESS AND-
RESULT:VSTATUS <> SQL_SUCCESS_WITH_INFO #THEN #BLOCK
;The connection was not successfully disconnected.
#BLOCK_END
SQL_EXECUTE(connection_id, SQLstring)
Executes an SQL statement.
The function executes the SQL statement on the connection specified by the ‘connection_id’ argument. It reserves a statement identification number which is used in a possible subsequent SQL_FETCH function. Each connection may have up to ten simultaneous execute statements.
'connection_id' Integer 1 ... 10. The identification number of the connection on which the statement is to be executed.
'SQLstring'
Value:
Text or textvector. The SQL statement that is to be executed. For more information, see SQL manuals.
A list containing the following three attributes:
215
MicroSCADA
8 Functions
216
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
STATUS =
STATEMENT_ID = Integer, 1 ... 100. The identification number of the statement. If STATUS is something else than SQL_SUCCESS or
SQL_SUCCESS_WITH_INFO,
STATEMENT_ID is undefined.
ERROR_CODE =
A predefined integer (see above). A value that indicates whether the function was successfully executed.
Text. A five characters long ODBC-error code. If STATUS is anything else than
SQL_ERROR or
SQL_SUCCESS_WITH_INFO,
ERROR_CODE is undefined.
Example:
Deleting all records in the table “MYTABLE” where the value in the column “AGE” is equal to 18:
@SQLSTMT = "DELETE FROM MYTABLE WHERE AGE = 18"
@RESULT = SQL_EXECUTE(%CONN, %SQLSTMT)
#IF RESULT:VSTATUS == SQL_SUCCESS OR-
RESULT:VSTATUS == SQL_SUCCESS_WITH_INFO -
#THEN #BLOCK
@STMT = RESULT:VSTATEMENT_ID
;Continue the database interaction.
#BLOCK_END
#ELSE #BLOCK
;The statement was not successfully executed.
#BLOCK_END
See also the SQL_FETCH example below.
SQL_FETCH(statement_id)
Fetches a row of data from a result set obtained by SQL_EXECUTE.
The function has no meaning if SQL_EXECUTE not executed.
'statement_id'
Value:
Integer 1 ... 10. The statement identification number returned by
SQL_EXECUTE.
A list containing the following three attributes:
STATUS =
DATA =
A predefined integer (see above). A value that indicates whether the function was successfully executed.
A vector containing data fetched from a result table. If STATUS is neither SQL_SUCCESS nor SQL_SUCCESS_WITH_INFO, DATA is undefined.
ERROR_CODE = Text. A five characters long ODBC-error code.
If STATUS is anything else than SQL_ERROR
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
or SQL_SUCCESS_WITH_INFO,
ERROR_CODE is undefined.
Example:
Reading names and addresses from a database:
@SQLSTMT = "SELECT NAME, ADDRESS FROM EMPLOYEE"
@RESULT = SQL_EXECUTE(%CONN, %SQLSTMT)
#IF RESULT:VSTATUS == SQL_SUCCESS OR-
RESULT:VSTATUS == SQL_SUCCESS_WITH_INFO -
#THEN #BLOCK
@STMT = RESULT:VSTATEMENT_ID
#LOOP
@RESULT=SQL_FETCH(%STMT)
#IF RESULT:VSTATUS == SQL_SUCCESS OR-
RESULT:VSTATUS == SQL_SUCCESS_WITH_INFO -
#THEN #BLOCK
...... ; FETCH succeeded
#BLOCK_END
#ELSE #LOOP_EXIT
#LOOP_END
#BLOCK_END
;RESULT:VDATA(1) and RESULT:VDATA(2) contain
;the name and address respectively.
8 Functions
SQL_FREE_STATEMENT(statement_id)
Frees the specified statement and stops processing associated with the statement.
This function must be used if several calls to SQL_EXECUTE are issued on the same connection. All open statements associated with the connection will be freed automatically when a connection is closed.
’statement_id’
Value:
Integer, 1... 100. The statement identification returned from
SQL_EXECUTE.
A list containing the following two attributes:
STATUS = A predefined integer (see above). A value that indicates whether the function was successfully executed.
ERROR_CODE = Text. A five characters long ODBC-error code.
If STATUS is anything else than SQL_ERROR or SQL_SUCCESS_WITH_INFO,
ERROR_CODE is undefined.
Example:
@RESULT=SQL_FREE_STATEMENT(%STMT)
#IF RESULT:VSTATUS <> SQL_SUCCESS AND-
RESULT:VSTATUS <> SQL_SUCCESS_WITH_INFO -
#THEN #BLOCK
;The statement was not successfully freed.
#BLOCK_END
SQL_BEGIN_TRANSACTION(connection_id)
Marks the beginning of a transaction.
217
MicroSCADA
8 Functions
218
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
The transaction will be completed when SQL_COMMIT or SQL_ROLLBACK is encountered (see below). Disconnecting the connection will also commit the transaction.
’connection_id’ Integer, 1 ... 10. The identification of the connection on which the transaction is to be executed.
Value: A list containing the following two attributes:
STATUS = A predefined integer (see above). A value that indicates whether the function was successfully executed.
ERROR_CODE = Text. A five characters long ODBC-error code.
If STATUS is anything else than SQL_ERROR or SQL_SUCCESS_WITH_INFO,
ERROR_CODE is undefined.
Example:
@RESULT = SQL_BEGIN_TRANSACTION(%CONN)
#IF RESULT:VSTATUS == SQL_SUCCESS OR-
RESULT:VSTATUS == SQL_SUCCESS_WITH_INFO -
#THEN #BLOCK
@SQLSTMT = "DELETE FROM MYTABLE WHERE AGE = 18"
@RESULT1 = SQL_EXECUTE(%CONN, %SQLSTMT)
@SQLSTMT = "UPDATE MYTABLE SET AGE = 18 WHERE AGE = 17"
@RESULT2 = SQL_EXECUTE(%CONN, %SQLSTMT)
#IF (RESULT1:VSTATUS == SQL_SUCCESS OR-
RESULT1:VSTATUS == SQL_SUCCESS_WITH_INFO) AND-
(RESULT2:VSTATUS == SQL_SUCCESS OR-
RESULT2:VSTATUS == SQL_SUCCESS_WITH_INFO) -
#THEN #BLOCK
@RESULT = SQL_COMMIT(%CONN)
#IF RESULT:VSTATUS <> SQL_SUCCESS AND-
RESULT:VSTATUS <> SQL_SUCCESS_WITH_INFO - #THEN #BLOCK
;The commit was not successful
#BLOCK_END
#BLOCK_END
#ELSE #BLOCK
@RESULT = SQL_ROLLBACK(%CONN)
#IF RESULT:VSTATUS <> SQL_SUCCESS AND-
RESULT:VSTATUS <> SQL_SUCCESS_WITH_INFO -
#THEN #BLOCK
;The rollback was not successful
#BLOCK_END
#BLOCK_END
#BLOCK_END
#ELSE #BLOCK
;The transaction could not be started.
#BLOCK_END
SQL_COMMIT(connection_id)
Commits a transaction the start of which was marked with SQL_BEGIN_TRANS.
’connection_id’ Integer, 1 ... 10. The identification number of the connection on which a transaction is to be committed.
Value: A list containing the following two attributes:
STATUS = A predefined integer (see above). A value that indicates whether the function was successfully executed.
ABB Automation
1MRS751250-MEN
8.16
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
ERROR_CODE = Text. A five characters long ODBC-error code.
If STATUS is anything else than SQL_ERROR or SQL_SUCCESS_WITH_INFO,
ERROR_CODE is undefined.
Example:
See the example related to the SQL_BEGIN_TRANSACTION function above.
SQL_ROLLBACK(connection_id)
Rolls back a transaction started with SQL_BEGIN_TRANS.
’connection_id’ Integer, 1 ... 10. The connection identification of the connection on which a transaction is to be rolled back.
Value: A list containing the following two attributes:
STATUS = A predefined integer (see above). A value that indicates whether the function was successfully executed.
ERROR_CODE = Text. A five characters long ODBC-error code.
If STATUS is different from SQL_ERROR and
SQL_SUCCESS_WITH_INFO,
ERROR_CODE is undefined
.
Example:
See the example related to the SQL_BEGIN_TRANSACTION function above.
RTU Functions
The following functions apply only to S.P.I.D.E.R. RTUs.
RTU_ADDR(key)
Returns a list with the address of the object in a certain record .
’key’
Value:
Text of three characters. The search key of the record.
A list with the following attributes:
TP Integer, 0...11. The type of the RTU200 object
(see below).
BA Integer. The block address in RTU200.
The TP attribute contains the four most significant bits and the BA attribute the 12 least significant bits of the object address (OA).
219
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
The TP attribute has the following meanings:
0 = No object type
1 =
2 =
3 =
Object command
Regulation command
Digital set-point
4 =
5 =
6 =
7 =
Analog set-point
General persistent output
Analog value
Indication (single or double)
8 =
9 =
Pulse counter
Digital value
10 =
11 =
Indication event recording (indication with time stamp)
Analog event recording
Example:
RTU = RTU_ADDR(RTU_KEY(X:POA1))
;Now
;RTU:VTP = = 5
;RTU:VBA = = 201
RTU_AINT(i)
Converts an integer to ASCII characters (according to the RP570 protocol).
’i’
Value:
An integer number.
A text of two characters.
Example:
RTU_HEXASC(RTU_AINT(342))
;returns "0156"
RTU_AREAL(r)
Converts a real number to four ASCII characters (float DS801).
’r’
Value:
A real number.
A text of four ASCII characters.
220 ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
Example:
RTU_HEXASC (RTU_AREAL(5.5))
;returns "40B00000"
MicroSCADA
8 Functions
RTU_ATIME[(t,[msec])]
Converts time data (operating system time) to ASCII (RTU200 time).
’t’
’msec’
Time data. Default: the present time.
The milliseconds of the time. Default = 0.
Value: A text of 6 ASCII characters.
Example:
RTU_HEXASC (RTU_ATIME (OBJ:PRT))
;returns "0EC5226ED990"
RTU_BIN(h)
Converts HEX-ASCII numbers given as a text to binary numbers in text form.
’h’ A text or a text vector of HEX-ASCII numbers.
Value:
Example:
RTU_BIN("414243")
;returns "ABC"
Text or text vector. The texts represent binary numbers.
RTU_HEXASC(b)
Converts binary numbers given as a text to hex-ascii numbers as a text.
’b’
Value:
Example:
RTU_HEXASC("ABC")
;returns "414243"
A text or text vector representing 8 bit binary numbers.
A text of hex-ascii numbers.
RTU_INT(a)
Converts two ASCII characters (2’s complement RP570) to an integer.
’a’
Value:
A text of two ASCII characters.
Integer.
Example:
RTU_INT(RTU_BIN("0156"))
221
MicroSCADA
8 Functions
222
Programming Language
SCIL
Technical Reference Manual
;returns 342
1MRS751250-MEN
RTU_KEY(oa)
Returns the search key for a record in an RTU200 configuration file.
The process object corresponding to the record must be known.
’oa’ Integer. The object address, the OA attribute, of the process object stored in the record.
Value: A text of three characters. The search key for the record.
Example:
@UN = X:PUN1
#OPEN_FILE 1 0 "RTU’UN’.CFG" KL
#READ 1 RTU_KEY(X:POA1) RECORD
;%RECORD contains the configuration record associated with the object X:P1.
RTU_MSEC(atime)
Returns the milliseconds of the 6-byte RTU time string atime.
’atime’
Value:
Text. The RTU time.
Integer. The number of milliseconds.
RTU_OA(type,ba)
Returns the object address.
’type’ Integer, 0 ... 11. The type of the object (see the TP attribute in the
RTU_ADDR description above).
’ba’
Value:
Integer. The address (block address) of the object in RTU200, see the BA attribute in the RTU_ADDR description above.
Integer. The object address, the attribute OA of the process object.
Example:
RTU_OA(5,201)
;returns 20681
RTU_REAL(a)
Converts 4 ASCII characters (float DS801) to a real number.
’a’
Value:
A text of four ASCII characters.
A real number.
Example:
RTU_REAL(RTU_BIN("40B00000"))
ABB Automation
1MRS751250-MEN
8.17
;returns 5.5
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
RTU_TIME(a)
Converts ASCII (RTU200 time) to MicroSCADA time data.
’a’ A text of 6 ASCII characters.
Value: Time data.
Printout Functions
PRINT_TRANSPARENT ( data [, log] )
Sends printout to a printer.
The function sends printout (data, printer commands and control codes) directly to printers defined as "transparent" and writes data to the printer log file. The function enables full printer control and allows the printout of freely formatted texts and graphics.
When called in a printed picture (printout activated by the #PRINT or #LIST command or by an event in the process database), the function spools the output (printer commands, control codes and data) to the printer, where it is formatted (see Figure
11).
The function should be placed in the start program of all pictures used for printout on
"transparent" printers. If the printed picture contains picture functions, the start programs are executed in the following order: the start program of the main picture, the start program of the base function, the start programs of the picture functions in the installation order. Used in other environments than printed pictures (pictures shown on screen, command procedures), the function causes an error message
(SCIL_UNKNOWN_FUNCTION).
ABB Automation
223
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
224
Figure 11.
SCIL defined or “transparent” printout
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
The target printer(s) of the printout are defined by the initiating #PRINT or #LIST command or the LD attribute of the process object. If there is no "transparent" printer among the target printers, the function has no effect. Printers defined as "transparent" can only handle printout defined by this function.
Unlike the semi-graphic picture based printout, the printout produced with the
PRINT_TRANSPARENT function does not automatically include any MicroSCADA picture elements, only the texts, graphics and formatting specified by the function.
However, complete pictures and picture elements may be included as printout files.
The first argument of the function, ’data’, specifies the printout - i.e. the printed data, formatting and print processing. The second (optional) argument, ’log’, specifies the output to the log file. The function returns the status of the printer spool operation.
’data’ Vector. The printout vector. 0 = no printout.
-1
-2
-3
-4
The printout vector is an ordinary SCIL vector containing text, integer and vector type elements. It may contain the following elements:
The data to be sent to the printer. This is specified by texts and text vectors given as constants or SCIL expressions.
The texts may be encoded in any symbol set supported by the printer. The SCIL expressions must be marked by the printout processing command -5 as the preceding element
(see below). They are evaluated at the moment of physical printing, and the result is sent to the printer. Expressions can be used, e.g. to print the actual printout time of a report. The text elements may also comprise printer control sequences for producing graphics. However, this is generally not recommended, because they would make the print vector printer interface dependent and the print processor would not be able to keep track of output pages. Instead, printer control sequences can be defined in the CS attribute and included in the print vector as printer control commands. Files (e.g. window dump files transferred to printout files) may be included using the READ_TEXT function.
Printer control commands. The printer control commands are logical commands that control the printer. They are represented as positive integers defined by the printer specific CS attribute of the printer object (see the System Objects manual, Chapter 10). There is a tool for defining the printer control commands.
Print processor commands. The print processor commands control the processing of the print vector itself. They are given as negative integers. The following print processor commands are available:
Auto-NL on
Auto-NL off
Increment LN
Increment PN
Automatic new line feature on (default)
Automatic new line feature off
Increment line number attribute LN
Increment page number attribute PN
225
MicroSCADA
8 Functions
’log’
Value:
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
-5 Formula follows The next element in the vector will be interpreted as a SCIL expression instead of plain text
The automatic new line feature (on by default) means that a new line command (printer control command 1, see above) is automatically appended to each text element in the print vector.
The increment LN and increment PN commands may be used to inform the print processor that a new line or new page is started using printer control commands that are not predefined (see the CS attribute).
Vector. The contents of the vector is in full transferred to the log file (provided that the printer has been defined with printer log output in the base system configuration). SCIL expressions are evaluated before the transfer. 0 = no log file output.
Integer. The status code generated by the print spool operation. 0 =
OK or no "transparent" printer among the target printers.
The target printers can be examined by means of the PRINTER_SET function (see below). By reading the SCIL_HOST function, the SCIL program can conclude whether the picture is being printed or displayed on screen.
Example:
@S_H=SCIL_HOST
@OX = ‘LN’:POX’IX’
@CX = ‘LN’:PCX’IX’
#IF S_H:VNAME == "PRIN" #THEN #BLOCK
@S=PRINT_TRANSPARENT((-2,TIMES,"OBJECT TEXT:",%OX,-
"COMMENT TEXT:",%CX," OBJECT VALUE:",-1,DEC(%OV)))
#BLOCK_END
This program block checks whether the picture is being printed or shown on screen. If it is printed, the PRINT_TRANSPARENT function prints a row starting with the present time, and ending with the object value given as a text. After the object value starts a new line.
PRINTER_SET
Returns the target printer numbers.
The function returns the logical target printer numbers (as known to the application through printer mapping) of the printed picture (printout started with the #PRINT command or a process database event). By means of this function, the SCIL program may examine the numbers and types of target printers.
Called somewhere else than in a printed picture, the function has no meaning.
226 ABB Automation
1MRS751250-MEN
8.18
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
Value: A vector of integer elements. The integer elements are the logical printer numbers (as known to the application through the printer mapping).
Error Tracing Functions
The functions in this section are used for debugging SCIL programs. Tracing means recording of the SCIL statements that are executed. The tracing is started by the
TRACE_BEGIN function and stopped by TRACE_END. If TRACE_BEGIN is called while tracing is already on, the second call is ignored but counted: two
TRACE_ENDs are needed to stop tracing. When applied in a picture, tracing records all the programs executed within the picture.
The statements that contain variable expansions (’macros’), are recorded in their expanded form. Each line is preceded by the depth of the control structure hierarchy to help find matching BLOCKs and BLOCK_ENDs etc.
TRACE_BEGIN( filename [, append ] [,time_tags])
Starts error tracing.
‘filename’ Text value. The name of the file where the trace output is written.
‘append’
‘time_tags’
Value:
Text value "APPEND". If given, the trace output is appended to the file if it already exists.
Text value "TIME_TAGS". Switches on time tags which are time stamps on every line in the tracefile.
Integer value. The status of file creation ( 0 = successful ).
TRACE_END
Stops error tracing.
Value: Integer value. The status of closing the trace file ( 0 = successful).
TRACE_PAUSE
Pauses trace logging.
Value: Integer value. The status the operation ( 0 = successful).
TRACE_RESUME
Resumes trace logging.
Value: Integer value. The status of the operation ( 0 = successful).
227
MicroSCADA
8 Functions
8.19
228
Programming Language
SCIL
Technical Reference Manual
Data Type Handling Functions
1MRS751250-MEN
DATA_TYPE(expression)
Returns the data type of the argument.
The function can, e.g. be used for testing the correctness of an expression.
’expression’ An expression of any data type.
Value: Text. The data type of the expression:
INTEGER
REAL
BOOLEAN
TEXT
TIME
BIT_STRING
BYTE_STRING
VECTOR
LIST
NONE (= the expression is wrong or undefined)
Example:
DATA_TYPE(CLOCK) == "TIME"
#IF DATA_TYPE(DATA:DOV) == "NONE" #THEN .......
PACK_STR ( source , type [, length [, byte_order]] )
Converts text vector to text or integer vector to bit or byte string.
The function converts the ‘source’ vector to the data type given by ‘type’.
'source' A vector containing integer and text elements.
'type' Text. The data type of the result: "TEXT", "BIT_STRING" or
“BYTE_STRING”.
'length' An integer value, 1, 2, 4, 8, 16 or 32.
If 'type' = "BIT_STRING", this is the number of bits in each element of the source vector.
If type = "TEXT", 'length' is ignored.
If ‘type’ = “BYTE_STRING” , the 'length' argument specifies how many bytes are initialized by each element of the vector. The length may be 1, 2 or 4. For example, if the length is 2, each element of the vector is taken as a 2-byte integer and then appended to the resulting byte string (The two high order bytes of the element are ignored).
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
‘byte_order’
Default = 1.
Text: "BIG_ENDIAN" and "LITTLE_ENDIAN". This argument is relevant only when ‘type’ is “BYTE_STRING”. The 'byte_order' argument may be used to create byte strings for an application running in a computer of a different architecture. In a little endian architecture (e.g. Intel, Alpha), integers are stored with the least significant byte first. In a big endian architecture (e.g. Motorola), integers are stored with the most significant byte first. This argument should be used only if the resulting byte string is going to be exported into a foreign system requiring a specific byte ordering. If omitted, the byte string is created with the byte ordering of the underlying architecture.
Text, bit string or byte string depending on the 'type' argument.
Value:
Examples:
PACK_STR(("A","B","CD"),"TEXT") == "ABCD"
PACK_STR((0,1,0),"BIT_STRING") == BIT_SCAN("010")
PACK_STR((0,3,1),"BIT_STRING",2) == BIT_SCAN("001110")
UNPACK_STR ( source [, length [, byte_order]])
Converts texts, bit strings and byte strings to vectors of integer or text elements.
UNPACK_STR creates an integer or text vector out of the ‘source’ argument. When
‘source’ is a byte string, it is interpreted as an array of integers of 'length' bytes. By using function UNPACK_STR, a byte string can be interpreted as an array of numerical values.
’source’ Text, bit string or byte string.
’length’
‘byte_order’
Integer. The length of the elements in the result vector.
If 'source' is a bit string, ‘length’ is the number of bits in each bit string. The following values are allowed: 1, 2, 4, 8, 16, 32.
If ‘source’ is a byte string, ‘length’ is the number of bytes in the byte strings. The values 1, 2 and 4 are allowed. ‘length’ may also be negative (-1, -2 or -4), in which case the integers in the byte string are taken as signed, otherwise they are taken as unsigned.
Default = 1.
Text. The 'byte_order' argument specifies the byte ordering of the byte string (see PACK_STR above). It should only be used if the byte string has been imported from a foreign system. If omitted, the bytes string is supposed to have the byte ordering of the underlying architecture.
Value: Vector of text ('source' = a text) or integer ('source' = a bit string or byte string) elements. If a bit string contains a number of bits that is not evenly divisible with 'length', the excess bits are ignored.
229
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
Examples:
UNPACK_STR("ABC") == ("A","B","C")
UNPACK_STR("ABCDE",2) == ("AB","CD","E")
UNPACK_STR(BIT_SCAN("0111")) == (0,1,1,1)
UNPACK_STR(BIT_SCAN("011011"),2) == (2,1,3)
UNPACK_STR(BIT_SCAN("0110111"),2) == (2,1,3)
1MRS751250-MEN
TYPE_CAST(source, type )
Converts data from one data type to another.
This function converts data from one data type to another as follows:
•
Data of data type INTEGER, REAL, TIME or BOOLEAN to a selected data type which may be INTEGER, REAL, TIME or BOOLEAN.
•
Data of data type TEXT, BIT_STRING or BYTE_STRING to a selected data type which may be TEXT, BIT_STRING or BYTE_STRING.
’source’
’type’
The source expression to be converted to another data type. Integer, real, time, boolean, text or bit string.
Text expression specifying the result data type. If ’source’ is integer, real, time or boolean, ’type’ may have any of the following values:
Value:
"INTEGER","REAL","TIME","BOOLEAN"
If ’source’ is a text or bit string, ’type’ may have the following values:
"TEXT","BIT_STRING", “BYTE_STRING”
The value of 'type' represented in the data type specified by
'source'. The function returns the bit pattern of the representation of 'source' interpreted as data type 'type'. Note that type casting from and to real data is hardware dependent and may result in invalid floating point numbers. Type-casting from text to bit string returns the bit pattern of the text as a bit string, the length of which is 8 times the length of the text (one character occupies 8 bits).
Type-casting from bit string to text returns a text the length of which is 1/8 of the bit string.
Example:
TYPE_CAST(TRUE,"INTEGER") returns the integer value 1, which is the integer representation of the boolean value TRUE.
230 ABB Automation
1MRS751250-MEN
8.20
ABB Automation
Programming Language
SCIL
Technical Reference Manual
Miscellaneous Functions
MicroSCADA
8 Functions
ADD_INTERLOCKED( object , index , amount )
Implicitly modifies the UV or SV attribute of a SYS or an APL object.
ADD_INTERLOCKED supports synchronization of SCIL programs executing in parallel.
’object’
’index’
Text value, either "SYS" or "APL".
Specifies the base system object. Note that application number may not be given, the current application is always assumed.
Integer or vector value.
If an integer, specifies the index of the UV attribute to be modified.
If a vector, specifies both the attribute and the index:
’amount’
First element is a text value, either "UV" or "SV"
Second element is an integer value specifying the index
Integer value to be added into the element of the UV or SV attribute.
Value: Integer value, the result of the addition.
Example:
#LOOP ADD_INTERLOCKED("SYS",77,1) <> 1 ;Try to reserve the resource
@DUMMY = ADD_INTERLOCKED("SYS",77,-1) ;Didn’t get it
#PAUSE 0.5
#LOOP_END
;Wait a while
;and try again
; The resource is now reserved for exclusive use
@DUMMY = ADD_INTERLOCKED("SYS",77,-1) ;Release the resource
A system wide (inter-application) binary semaphore may be implemented by this
SCIL code. SYS:BUV77 is used as the semaphore. It is supposed to been set to zero in SYS_BASCON.COM. For clarity, the code to handle a deadlock situation is omitted. In a real application, it is needed to avoid too long waits and/or SCIL error messages. Note that the value returned by 2nd and 3rd call of the function is not used anywhere, it is known to be zero (unless there is a SCIL design error somewhere else in the system).
AUDIO_ALARM (alarm_class, on_or_off)
Sets or resets the specified audio alarm(s).
‘alarm_class’
‘on_or_off’
Integer value 1 … 7 or text keyword “ALL”
Text keyword value “ON” or “OFF”
231
MicroSCADA
8 Functions
232
Value:
Programming Language
SCIL
Technical Reference Manual
Integer, returns the status code of the operation,
(0=OK_STATUS).
1MRS751250-MEN
CONSOLE_OUTPUT(text)
Writes a message to the MicroSCADA Notify windows.
‘text’ Text. The message to be written to the MicroSCADA Notify windows.
Value: The status code of the operation. 0 = OK.
It is not recommended to use control characters (for example CR or LF) in text sent to the MicroSCADA notification window. If control characters are used, the behaviour is undefined.
DUMP(data)
Transforms the value of an expression into text format.
‘data’
Value:
An expression of any data type.
Text vector representing the contents of data in SCIL expression syntax. The status code of each data item (unless 0) is also dumped.
ENVIRONMENT(variable)
Retrieves the value of the specified variable from the environment block of the calling process.
'variable' A text string specifying the name of the environment variable.
Value: A text specifying the value of the environment variable. The value is an empty text string if the environment variable with the specified name is not existing.
Example:
@t_env = ENVIRONMENT("OS")
;returns the text "Windows_Nt"
EVALUATE ( expression )
Evaluates an expression given in text format.
‘expression’ A text or text vector value containing the SCIL expression to be evaluated. If a text vector is given, other lines but the last one must end with a continuation character ( - ).
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
Return value:
MicroSCADA
8 Functions
The result of the evaluation, which may be of any data type.
For any value v, EVALUATE ( DUMP ( v ) ) results to v, except for one case:
Real numbers may slightly lose their precision.
Example:
The following examples shows how to store any data value (such as complicated list) in a disk file and then read it back:
@WRITE_STATUS = WRITE_TEXT("DUMP.TXT",DUMP(%V))
#IF WRITE_STATUS == 0 #THEN -
@W = EVALUATE(READ_TEXT("DUMP.TXT"))
GET_STATUS(expression)
Returns the status code(s) of an expression.
’expression’
Value:
An expression of any data type. Typically, ’expression’ is a variable reference (e.g. %V, %V(5), LISTVAR:VAT ).
If ’expression’ is of a simple data type (integer, real, text, time, or boolean), the function returns an integer value. If it is a vector, the function returns an integer vector containing the status codes of each element of the argument vector. If it is a list, the function returns a list with the same attribute names, each attribute containing the status code of the corresponding argument attribute.
When the GET_STATUS function is used in the condition of the SELECT function (see section 8.6.), elements with status codes larger than 10 are not regarded.
ABB Automation
LENGTH(arg)
Returns the "length" of the argument.
’arg’
Value:
Any data type.
Integer. According to the data type of the argument, the following is returned:
Integer
Real
1
1
233
MicroSCADA
8 Functions
234
Programming Language
SCIL
Technical Reference Manual
Boolean
Time
Text
Bit string
Byte string
Vector
List
Examples:
LENGTH(340)
LENGTH("ABCD")
= = 1
= = 4
LENGTH(PROD_QUERY(20)) = = 18
LENGTH(" ") = = 1
LENGTH("") = = 0
1MRS751250-MEN
1
1 the number of characters in the text.
the number of bits in the string the length of the byte string the number of elements in the vector.
the number of attributes in the list.
LIST(attribute=expression, attribute=expression, ...)
Forms a list of attributes and attribute values.
The argument list can contain up to 10000 attribute assignments.
’attribute’ A freely chosen attribute name of up to 63 characters.
ute’.
A list of the given attributes and attribute values.
Value:
Example:
@l_new_list=LIST(NUMBER = (1, 2 ,3), NAME = (“A”, “B”, “C”))
List is actually not a function, because it does not have expressions as its arguments.
LIST_ATTR(list)
The function returns a vector of all attributes contained in a list.
’list’ A list type expression.
Value: A vector with text elements composed of the attribute names in
’list’.
Example:
@X = LIST(AA=1,BB=2,CM="TEST")
;Now
;LIST_ATTR(%X) == ("AA","BB","CM")
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
MEMORY_POOL_USAGE(pool)
Monitor the usage of memory pools.
’pool’ Text keyword value telling the pool to get information from:
"LOCAL"
"GLOBAL"
Local pool of the process.
Global memory pool.
Value:
"PROCESS" The pool used by the process.
List value with following attributes
SIZE
USED
FREE
Size of the pool as megabytes.
Bytes used.
Bytes free.
BLOCK_SIZES Vector of allocation block sizes used by the pool (only if SIZE > 0).
USED_BLOCKS Vector counting allocations of each block size
(only if SIZE > 0).
FREE_BLOCKS Vector counting free blocks of each size (only if SIZE > 0).
POOL Text value, "LOCAL" or "GLOBAL" (only if
’pool’ is "PROCESS").
MEMORY_USAGE ( keyword, arg )
This function helps debugging and analyzing SCIL applications. It returns the amount of memory pool (as bytes) allocated for the expression, or for the variable (including the bookkeeping data and the value of the variable).
keyword Text keyword argument, either "EXPRESSION" or "VARIABLE"
If keyword = "EXPRESSION": arg: Any valid SCIL expression.
Returns
If keyword = "VARIABLE": arg: Text expression, the name of the variable.
Integer value, the amount of memory pool allocated for the expression or the variable.
ABB Automation
235
MicroSCADA
8 Functions
236
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Examples:
(Memory usage in current implementation of SCIL, may change in future releases.)
MEMORY_USAGE ("EXPRESSION","ABC") returns 8
MEMORY_USAGE ("EXPRESSION",1) returns 0, since integer values are not allocated from the pool
@X = "ABC"
MEMORY_USAGE("VARIABLE","X") returns 136
RANDOM ( n1 , n2 )
Generates a random number in a given range.
‘n1’
‘n2’
An integer or real value.
An integer or real value.
Value: Integer or real value.
If ‘n1’ and ‘n2’ are integer values, an integer value in the range n1 ... n2 (including n1 and n2) is returned. If n1 and n2 are real values, a real value in the range [ n1 , n2 ) , i.e. including n1 but excluding n2, is returned.
SHUFFLE ( n )
Arranges specified integer numbers in a random order and returns them as a vector.
This function shuffles the integer numbers 1 to ‘n’ into a random order and returns them in an integer vector. Each number 1 to n appears in the vector once and only once.
‘n’ Integer value in range 0 .. max. vector length ( = 10000 ).
Value:
Example:
Integer vector of length ‘n’.
To rearrange any vector V to a random order:
@SHUFFLED = PICK(%V,SHUFFLE(LENGTH(%V)))
REVISION_COMPATIBILITY ( issue { , enable })
Selects the compatibility issues to be used in the context.
The compatibility with the old revision is enabled/disabled by compatibility issues.
The REVISION_COMPATIBILITY function overrides temporarily (in the picture, command procedure or dialog system) the revision compatibility, or a part of it, defined in the APL:BRC attribute.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
‘issue’ Text. The name of the compatibility issue. See the description of the APL:BRC attribute in the System Objects manual.
‘enable’
Value:
An optional boolean argument. TRUE = compatibility is enabled.
FALSE = compatibility is disabled. If this argument is not given, the function only reads the compatibility state without modifying it.
Boolean value indicating the compatibility before it was changed with the function.
Example:
@RC = REVISION_COMPATIBILITY ("FILE_FUNCTIONS_CREATE_DIRECTORIES", FALSE)
; WRITE_TEXT function used here
@RC = REVISION_COMPATIBILITY ("FILE_FUNCTIONS_CREATE_DIRECTORIES", %RC)
The first variable assignment disables the compatilibity issue
FILE_FUNCTIONS_CREATE_DIRECTORIES, which means that the
WRITE_TEXT function does not create new directories. The second variable assignment resets the compatibility issue to the value it had before (enabled or disabled).
SCALE(v, scale_object [, direction ])
Scaling of a real value with a scale object.
'v' Real value, the value to be scaled.
'scale_object'
'direction'
Text value, the name of the scale object to do the scaling.
Text value, either "INPUT" or "OUTPUT". Defaults to "INPUT".
Value: Real value, the scaled value.
The direction "INPUT" corresponds to the scaling of analog input process objects, direction "OUTPUT" corresponds to the scaling of analog output process objects.
Example:
@r_invalue=SCALE(100,"TEST_SCALE","INPUT")
@r_outvalue =SCALE(0.1,"TEST_SCALE","OUTPUT")
SCIL_HOST
Returns the name and number of the kernel process that executes the current SCIL code.
For example, by reading this function, the start program of a picture, can find out whether the picture is being displayed on a monitor or printed.
Value: A list containing two attributes, NAME and NUMBER.
NAME is the process name as a text string. The possible values are:
237
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
NUMBER
"MAIN" The main process
"PICO" A monitor process
"REPR" A report process
"PRIN" A printer spooler process processing a format picture
"PRNC" A printer process processing a page header
"PICL" A picture documentation process
"EXTERNAL" An external program running the SCIL interpreter is the process number as an integer. For the
MAIN process and EXTERNAL processes, the value is 0. For a PICO and PICL process, this is the base system monitor object number.
For a REPR process, the number is coded as
100 x apl + n where ’apl’ is the system application number and
’n’ = 1 for the time channel queue,
’n’ = 2 for the event channel queue and
’n’ = 2 + p for parallel queue ’p’.
For a PRIN process, the number is coded as
100 x apl + n where ’apl’ is the system application number and ’n’
= 1 for process printouts and 2 for report printouts.
Example:
See the example of the PRINT_TRANSPARENT function.
SET_STATUS(expression,status)
Writes the status codes of an expression.
’expression’ An expression of any data type. The expression will be assigned the status code(s) specified by the ’status’.
238 ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
8 Functions
’status’ An integer expression, 0 ... 65535, or a vector of integer expressions. The status codes. If ’expression’ is a simple data type, ’status’ must be an integer.
The ’expression’ argument with the assigned status code .
Value:
The function returns the ’expression’ argument modified by the ’status’ argument as follows:
•
If ’expression’ is of a simple data type, ’status’ must be an integer value, which becomes the status of ’expression’.
•
If 'expression' is a vector, 'status' may be an integer or vector value. If ‘status’ is an integer, the status of each element of 'expression' is set to 'status'. If ‘status’ is a vector, the status of n:th element of 'expression' is set to the n:th element of
'status'. If the vector 'status' is shorter than the vector 'expression', the 'expression' is modified only up to the length of 'status'. If 'status' is longer than 'expression', the extra elements are ignored.
•
If 'expression' is a list, 'status' may be an integer or list value. If ‘expression’ is an integer, the status of each attribute of 'expression' is set to 'status'. If ‘expression’ is a list, the status of 'expression' attribute NN is set to the value of 'status' attribute NN. The attributes of 'status' that do not exist in 'expression' are ignored. The attributes of 'expression' that do not exist in 'status' are unaffected.
If a value in 'expression' has a status code >= 10, and it is assigned a status code <10, the value is initialized to integer zero.
Examples:
@V = SET_STATUS(%A,2)
;Status code 2, OBSOLETE_STATUS, is set to the variable A.
@V = SET_STATUS(%A,GET_STATUS(%B))
;The status of the variable A is copied from the variable B.
TRANSLATE(text [,language])
Translates texts defined in Visual SCIL objects.
‘text’
‘language’
A text. A reference to a text identified defined in the dialog editor.
The reference starts with an @.
A text. Language identifier as defined in the ISO standard 639. Default: the language defined by the base system configuration, by the MON:BLA attribute.
The function can only be used in user interface objects (pictures and Visual SCIL objects). The function searches for the text reference and language in the dialog or dialog item where the function is encountered. If either the text reference or the language is not found there, the reference is searched for in the parent object, and so on, up to the object that was loaded with SCIL.
239
MicroSCADA
8 Functions
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
The ‘language’ argument is used only if you wish to override the language selected in the base system configuration. If no ‘language’ argument is given, the language is the one defined by the MON:BLA attribute. If no MON:BLA attribute has been defined, the language is the one set by the APLn:BLA attribute, and if no such attribute has been defined, the language is English.
Value: Text data. The translated text. If there is no initial @ character in
‘text’, no translation is done, but the text is returned as such. If there are two initial @ characters, one of the @ characters is removed from the resulting text, but no translation takes place.
240 ABB Automation
1MRS751250-MEN
9
9.1
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
9 Graphics Primitives
Graphics Primitives
This chapter describes the use of the graphics primitives, which constitute the base of all full graphics elements in MicroSCADA pictures, partly also in dialogs. The first section introduces some concepts related to the graphics primitives.
Introduction
MicroSCADA full graphics in pictures, partly also in dialogs, are realized using SCIL graphics commands. There are SCIL commands for drawing various types of graphical elements, such as points, lines, polylines and polygons, arcs, circles, ellipses, boxes (rectangles), and texts. The SCIL graphics commands specify the geometry of the graphical elements, while the location and size, as well as other features, are given as arguments.
The graphics commands can be included in any MicroSCADA picture program (see section 2.1.) and in the methods of the dialogs and dialog items. The
BACKGROUND program of a picture contains the graphics commands generated by the picture editor. As a rule, this program should not be edited manually. Context dependent graphics in the background can be written in the DRAW program. Like picture commands and Visual SCIL commands (Chapter 7), the graphics commands are not allowed in command procedures, unless they are executed by #DO commands or
DO functions situated in user interface objects. The graphics commands are described in section 9.2.
Graphics Contexts
The features of the graphical elements - color, type of line, line width, font, etc. are defined by graphics contexts, which are identified by integer numbers. A graphics context is a series of properties, called "components", such as the ones mentioned.
Several commands can use the same graphics context, though all properties are not used by all graphics commands. The graphics contexts are described in section 9.3.
Graphics Canvas
The graphical elements are displayed in the user interface object (picture, picture function, dialog item) chosen as graphics "canvas". By default, the canvas is the picture or Visual SCIL object where the graphical commands are situated.
Any picture and picture function can be chosen as graphics canvas. However, regarding the dialogs, only certain types of dialog items can contain graphics elements.
These are the dialog items that allow the display of images (have the image attribute).
The location of a graphical element is given by x,y coordinates related to the home position of the canvas. The upper left corner of the picture or picture function where the element will be displayed. As the resolution of screens varies, the graphics commands use a screen independent coordinate system. The coordinate system can contain SCIL coordinates or VS coordinates. The SCIL coordinate system is fixed by a scaling factor. By means of an input command, the coordinates can be read from the
241
MicroSCADA
9 Graphics Primitives
9.2
9.2.1
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN mouse position. Refer to section 9.4. to learn about the SCIL and VS coordinates, and the mouse input commands.
Miscellaneous
The context definitions, canvas selection and scaling can be temporarily stored and restored within the same picture. See section 9.5.
The display of the graphics on screen can be controlled by some display handling commands (section 9.5.2).
Full Graphics SCIL Commands
Drawing Graphical Elements
The commands below draw graphical elements on screen, in the user interface object selected for canvas (default = the same object as where the commands are situated).
Coordinate system is different in pictures and in VS objects. The command
.COORDINATE_SYSTEM is described in section 9.4.
The color and other features of the elements are fixed by the graphics contexts. The graphics contexts are described in section 9.3.
In most cases, several elements can be drawn with one command by giving vectors for coordinates and sizes. If one coordinate or size is a scalar while the other one is a vector, the scalar argument is handled as a vector with all elements equal, for example
.POINT 0, (100,200) is equivalent to .POINT (0,0), (100,200). If the coordinates fall outside the canvas (that is they are negative or too large), they will still affect the shape of the graphical element. The part of the graphical element that falls outside the canvas will not be displayed.
In the command syntax descriptions below, all arguments given in lower case letters can be SCIL expressions of the data type required for the respective argument.
.ARC [[scope,]n :] x,y, r, a1,a2 [,FILL]
Draws one or several arcs as circle segment arcs.
’scope’
’n’
’x,y’
The scope of the context (see section 9.3.).
Graphics context number, 0 ... 20 or 0 ... 50 depending on the scope. Default = 0. Used components: FUNCTION,
FOREGROUND, BACKGROUND, LINE_WIDTH,
LINE_STYLE, CAP_STYLE, DASH_OFFSET, DASH_LIST,
ARC_MODE. See section 9.3.
The coordinates of the center of the circle. Real, integer or vector of real and integer elements.
242 ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
9 Graphics Primitives
’r’ The radius of the circle given in coordinate units, see section 9.4.
Real, integer or vector of real and integer elements.
’a1’ The angle from where the arc starts, given in degrees increasing counter-clockwise from horizontal 0 value. Real, integer or vector of real and integer elements. See Figure 12.
’a2’ The angle of the arc given in degrees. If a2 is positive, the arc is drawn counter-clockwise. Otherwise, it is drawn clockwise. Real,
Integer or vector of real and integer elements. See Figure 12.
If the FILL option is given, the arc is filled according to the ARC_MODE component of the graphics context.
(x,y) a2 if positive a1
ABB Automation
Figure 12.
Drawing an arc with the .ARC command
.BOX [[scope,]n :] x,y, width, height [,FILL]
Draws one or several boxes (rectangles).
’scope’ The scope of the context, see 9.3. below.
’n’ Graphics context number, integer 0 ... 20 or 0 ... 50 depending on the scope. Default = 0. Used components: FUNCTION,
FOREGROUND, BACKGROUND, LINE_WIDTH,
LINE_STYLE, CAP_STYLE, JOIN_STYLE, DASH_OFFSET,
DASH_LIST. See section 9.3.
‘x,y' Integer or real, or vector of integer or real data. The coordinates of the upper left corner of the rectangle.
'width' Integer or real or vector of integer or real data. The width of the rectangle given in coordinate units, see section 9.4.
243
MicroSCADA
9 Graphics Primitives
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
’height’ Integer or real or vector of integer or real data. The height of the rectangle given in coordinate units, see section 9.4.
If the FILL option is given, the box is filled (in the FOREGROUND color).
244
.CIRCLE [[scope,]n :] x,y, r [,FILL].
Draws one or several circles.
’scope’
’n’ is the scope of the context, see 9.3. below.
Graphics context number, integer 0 ... 20 or 0 ... 50 depending on the scope. Default = 0. Used components: FUNCTION,
FOREGROUND, BACKGROUND, LINE_WIDTH,
LINE_STYLE, CAP_STYLE, DASH_OFFSET, DASH_LIST.
See section 9.3.
’x,y’
’r’
Integer or real data, or integer or real vector. The coordinates for the center of the circle.
Integer or real data, or integer or real vector. The radius given in coordinate units, see section 9.4 .
If the FILL option is given, the circle is filled.
.ELLIPSE [[scope,]n :] x,y, a,b [,FILL]
Draws one or more ellipses.
’scope’ The scope of the context, see 9.3. below.
’n’ Graphics context number, 0 ... 20 or 0 ... 50 depending on the scope. Default = 0. Used components: FUNCTION,
FOREGROUND, BACKGROUND, LINE_WIDTH,
LINE_STYLE, CAP_STYLE, DASH_OFFSET, DASH_LIST
’x,y’
’a,b’
Integer or real data, or integer or real vectors. The coordinates of the center of the ellipse.
Integer or real data, or integer or real vectors. The axes of the ellipse given in coordinate units, see section 9.4.
If the FILL option is given, the ellipse is filled.
.IMAGE x, y, w, h, filename, tag_1[, tag_2[, tag_3[, tag_4] ] ]
.IMAGE command draws a VS_IMAGE object into the current window or VS object.
’x’ Real, x coordinate
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
9 Graphics Primitives
’y’
’w’
’h’
’filename’
’tag_n’
’tag_8_10’
Real, y coordinate
Real, width
Real, height
Text, vso file name
’tag_12_15’
Text, tag name within the vso file, image to be used when 8 x 10 font is used.
Text, tag name within the vso file, image to be used when 12 x 15 font is used.
’tag_16_20’ Text, tag name within the vso file, image to be used when 16 x 20 font is used.
’tag_20_25’ Text, tag name within the vso file, image to be used when 20 x 25 font is used.
The current coordinate system is SCIL, the coordinates x and y define the position of the upper left corner of the image, otherwise the lower left corner.
’w’ and ’h’ specify the size of the rectangle the image is drawn into, the image is scaled to fill the rectangle.
If ’w’ is 0, no horisontal scaling is done. If ’h’ is 0, no vertical scaling is done.
’filename’ specifies the VSO file where the image is stored.
At least one image must and up to 4 images may be specified in the command. The one used in drawing depends on the size of the current MicroSCADA font. If no image is specified for the current font size, the image for the next smaller font is used. If there is no image for smaller fonts, the image for the next larger font is used. When an image for a wrong font size is used, it is scaled in proportion to font sizes ( if ’w’ and/or ’h’ is 0).
.IMAGE command is ignored in monitors of other type than VS.
.LINE [[scope,]n :] x1,y1, x2,y2
Draws one or more lines from (x1,y1) to (x2,y2).
’scope’
’n’
The scope of the context, see 9.3. below.
Graphics context number, integer 0...20 or 0...50 depending on the scope. Default = 0 Used components: FUNCTION,
FOREGROUND, BACKGROUND, LINE_WIDTH,
LINE_STYLE, CAP_STYLE, DASH_OFFSET, DASH_LIST.
See section 9.3.
245
MicroSCADA
9 Graphics Primitives
’x1,y1’
’x2,y2’
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Integer or real, or vector of integer or real data. The coordinates of the start point. See section 9.4.
Integer or real, or vector of integer or real data. The coordinates of the end point. See section 9.4.
.POINT [[scope,]n :] x,y, [RELATIVE]
Draws one or several points of one pixel’s size at the coordinates (x,y). If any of x or y or both are vectors, and the option RELATIVE is given, the first point is taken as canvas relative, the next one as relative to the previous one, etc.
The scope of the context, see section 9.3 .
’scope’
’n’ Graphics context number, integer 0 ... 20 or 0 ... 50 depending on the scope. Default: 0. Used components: FUNCTION,
FOREGROUND. See section 9.3.
’x,y’ Integer or real, or vector of integer or real data. coordinates for the point, see section 9.4.
.POLYLINE [[scope,]n :] x,y [,RELATIVE] [,FILL]
Draws a polyline or a polygon.
’scope’ is the scope of the context, see 9.3. below.
’n’
’x’
Graphics context number, integer 0 ... 20 or 0 ... 50 depending on the scope. Default = 0. Used components: FUNCTION,
FOREGROUND, BACKGROUND, LINE_WIDTH,
LINE_STYLE, CAP_STYLE, JOIN_STYLE, DASH_OFFSET,
DASH_LIST.
real or integer, or vector with real and integer elements, the xcoordinates in SCIL or VS coordinate units.
’y’ real or integer, or vector of real and integers, the y-coordinates in
SCIL or VS coordinate units.
The corresponding elements in the x and y vectors are taken as x,y-coordinates (see
Figure 13). The command draws a line between each of the coordinates.
If the RELATIVE option is included in the argument list, the first coordinate pair is placed relative to the upper left corner of the canvas and each of the following coordinates are drawn relative to the previous one.
If the first and last point coincide, the polyline will form a closed figure (a polygon), where the end points are joined according to the JOIN_STYLE component of the graphical context.
246 ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
9 Graphics Primitives
If the FILL option is included in the argument list, the polygon outlined will be filled
(with the FOREGROUND color). In this case, the polyline is always closed.
x(2),y(2) x(4),y(4) x(1),y(1) x(3),y(3) x(5),y(5) x(6),y(6)
Figure 13.
Drawing a polyline with .POLYLINE
.TEXT [[scope,]n :] x,y, text [,FILL] [,EXTENDED] [,align]
This command draws horizontal text starting at (x,y). The size and font of the texts is determined by the graphics context.
’scope’
’n’
’x,y’
The scope of the context, see 9.3. below.
Graphics context number, integer expression 0 ... 20 or 0 ... 50 depending on the scope. Default = 0. Used components:
FUNCTION, FOREGROUND, BACKGROUND, FONT. See section 9.3.
Integer, real or vector of integer or real. The coordinates of the start point of the text. The starting-point (x,y) defines the location of the origin pixel of the first character (if left alignment). The location of the origin pixel is font dependent. For the MicroSCADA semi-graphic font, it is the upper left corner of a character.
’text’
’align’
A SCIL expression of type text or a text vector. The text to be displayed. The SCIL text functions LOWER_CASE, UPPER_CASE and CAPITALIZE can be used for converting the text to lowercase, upper-case or capitalized text respectively, see section 8.4.
The alignment of the text: LEFT, RIGHT or CENTER. The default is LEFT, if the font is a left-to-right font, and RIGHT if the font is a right-to-left font (e.g. Hebrew).
When multiple lines are drawn, i.e. ’text’ is a text vector, the x,y coordinates can be vectors with the coordinates for each new line or they can be scalars. In the latter case, the text lines are displayed under one another starting from x,y with a line space adjusted to the font characteristics.
ABB Automation
247
MicroSCADA
9 Graphics Primitives
9.3
9.3.1
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
If the EXTENDED option is given, extended (2 byte) character coding is used, otherwise, normal (1 byte) coding is used. The EXTENDED option is only valid in X-type monitors.
If the FILL option is given, the background of the text is filled with the
BACKGROUND color of the graphics context, otherwise the background is transparent.
Graphics Contexts
General
General
A graphics context is a collection of components (section 9.3.3.) each of which define a graphical property, for instance, background color, foreground color, font. A picture contains a number of graphical contexts identified by a number. The context numbers are used as arguments in the graphical commands. The maximum number of graphics contexts that can be used in one picture is limited to 2000.
The defined graphics contexts (together with the canvas selection and the scaling) can be temporarily stored and restored, see section 9.5.
Scope of Graphics Contexts
The scope of a graphics context is the set of objects where the context applies. A graphics context can be defined for a single object (picture, dialog object), for a group of objects, or for all objects used in the monitor. There are five different scopes, each of which can contain a number of graphics context definitions. In the context definition commands, the scope is given by a text, a single letter or a word as follows:
"C" or "CURRENT"
"P" or "PARENT"
The scope is the object (picture or Visual SCIL object) containing the .GC command. Max. number of contexts: 20.
The scope is the parent object of the object in which the context is defined with .GC. Max. number of contexts: 20.
"R" or "ROOT"
"M" or "MONITOR" The scope is all object used in the monitor. Max. number of contexts: 50. This scope is reserved for LIB 500 pictures.
"U" or "USER"
The scope is the root object (main dialog, picture container or main picture). Max. number of contexts: 20.
The scope = all objects shown in the monitor. Max. number of contexts: 50. This scope is for use in the application pictures.
The number of the context together with its scope identify the context and distinguishes it from other contexts with different context number or scope.
When a part picture is shown, it inherits the contexts of its parent picture. However, changes in the contexts of the parent picture do not affect the contexts of the part
248 ABB Automation
1MRS751250-MEN
9.3.2
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
9 Graphics Primitives pictures which are already displayed on screen. Likewise, the contexts are inherited downwards in the hierarchy of a dialog system.
Default Settings
As long as no component definitions have been done for a context in a certain scope, all the components have the default values mentioned in the component descriptions section 9.3.3. The contexts (except number 99) can be modified any time with the commands described in section 9.3.2.
Context number 99 contains the default settings of the components. This contexts cannot be changed. It contains the following components:
FUNCTION
FOREGROUND
BACKGROUND
LINE_WIDTH
LINE_STYLE
CAP_STYLE
JOIN_STYLE
FONT
ARC_MODE
NAME
= "COPY"
= "WHITE"
= "BLACK"
= 0
= "SOLID"
= "BUTT"
= "MITER"
= "" (semi-graphic)
= "PIESLICE"
= ""
GC number 99 may only be used as a source in GC copy. For self-documentation, a predefined constant name DEFAULT_GC may be used instead of number 99
(DEFAULT_GC == 99).
Context number 0 is the default context in those cases where no context number is given in the graphics commands.
Defining Graphics Contexts
The following three commands are used for the modification of graphics contexts.
The graphics contexts can be read with a SCIL function described in section 9.3.5.
.GC [[scope,]n [=[scope,]m]]:[[component = value]...[,component = value]]
Modifies the graphics context number ’n’.
’scope’ is a text which specifies the scope of the context, i.e., the objects
(pictures, and Visual SCIL objects) where the context is valid.
’scope’ can take the values "C" or "CURRENT", "P" or
"PARENT", "R" or "ROOT", "M" or "MONITOR", "U" or
"USER". See section 9.3.1. Default value = "C".
249
MicroSCADA
9 Graphics Primitives
9.3.3
250
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
’n’
’m’
’component’
’value’
The number of the graphics context, integer 0 ... 20 or 0 ... 50. This number is used in the graphical commands, see section 9.2. Default: 0.
The number of another graphics context which is copied to the current one before modification. Integer, 0 ... 20 or 0 ... 50.
The name of a component to be modified. The component names can be given in the complete or abbreviated form, see section
9.3.3.
A SCIL expression, the value assigned to the component. The allowed data types are mentioned in the component descriptions in section 9.3.3.
The modification concerns all graphical elements subsequently drawn with the context in question. It does not affect the graphical elements drawn previously with the same context number. Those components which are not included in the component list are not affected by the command. The graphics contexts are inherited to the pictures shown in windows and to the picture functions.
The ROOT, MONITOR and USER scopes represent separate sets of contexts, while the CURRENT and PARENT scopes can mean the same or separate sets of contexts depending on the situation.
Example:
("C",5), ("R",5), ("M",5) and ("U",5) are all different graphics contexts. The contexts
("C",5) and ("P",5) may be the same or different contexts: When a part picture is shown, its context is the same as the one of the parent (i.e. CURRENT = PARENT).
If the parent’s context is changed later, they become two different contexts and the parent’s context is referred to as ("P",5).
The PARENT scope could, e.g., be used in a general purpose tool designed to change the appearance of any picture it is used in. The MONITOR and USER scopes are suitable for defining monitor specific graphics contexts in the start program of the
APL_INIT picture, which is shown each time a monitor is mapped for an application
(either at system start-up or later).
Example:
.GC 0 = DEFAULT_GC : FOREGROUND = "RED"
Components of Graphics Contexts
This sub-section describes the components included in the graphics contexts. The components are listed in alphabetical order.
The components are assigned values by means of the commands described in section
9.3.2. The values are given as SCIL expressions of the allowed data types. From the start, the components have the default values given below. In the context defining commands, the component names can be given in complete form or in the abbreviated form found to the left in the description below.
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
9 Graphics Primitives
AM ARC_MODE
This component specifies how filled arcs are drawn: as sectors or segments.
Value: "CHORD" = The end points of the arc are connected and the resulting segment is filled.
"PIESLICE" = The end points of the arc are connected in the center of the circle and the resulting sector is filled.
Default: "PIESLICE"
BG BACKGROUND
Specifies the "background color" of the full graphic lines and text. This
BACKGROUND color is used in the following cases:
•
In the gaps of double dashed lines.
•
As the background of "filled" texts.
Values: The color can be given in the following four ways (see section
9.3.4.):
- With a color name given as a text, e.g., "LIGHT BLUE"
- With a RGB number given as a vector of three elements, e.g.,
(10000,20000,30000)
- With a color number given as an integer expression, e.g. 5
- With scope and color number given as a vector of two elements:
(scope,color_number), e.g., ("M",5).
Default value: "BLACK"
CS CAP_STYLE
Specifies the endpoints of the line, see Figure 15.
Values: "BUTT" = The line is cut off in a 90° angle to the line direction at the end point.
"NOTLAST" = The same as "BUTT", but the line is cut off one pixel before the end point.
"PROJECTING" = The line is cut off in the same way as "BUTT" half its width past the endpoint.
"ROUND" = The line end is rounded in a half circle with r = half its width past the endpoint.
Default value: "BUTT"
ABB Automation
251
MicroSCADA
9 Graphics Primitives
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
"PROJECTING" and "ROUND" are meaningful only for lines with a width larger than 1 pixel.
DL DASH_LIST
Specifies the length of dashes and gaps when drawing dashed lines.
Value: Vector of even length. The odd indexes define the lengths of dashes and the even indexes the lengths of the gaps. The lengths are given in coordinate units, see section 9.4.
Default: The dashes as well as the gaps are four pixels long.
Start
Point
Width
End
Point
Figure 14.
Wide lines are drawn centered in relation to the start and end points
Figure 15.
The CAP_STYLE component
252 ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
9 Graphics Primitives
ABB Automation
Figure 16.
The JOIN_STYLE component
DO DASH_OFFSET
Specifies the position in the dash pattern where to start a dashed line. For example, if
DASH_LIST == (5,2) and DASH_OFFSET == 5, the line starts with the gap.
Default value: 0
FT FONT
Specifies the X-windows name of the font used to draw a text.
Value:
Default:
The value can be given in the following three ways (see section
9.3.4.):
•
With a font name given as a text, e.g. "KANJI_24"
•
With a font number given as an integer expression, e.g. 3.
•
With scope and font number given as a vector of two elements:
(scope,font_number), e.g., ("M",3).
The MicroSCADA semi-graphical font which is called
"MICROSCADA-SEMIGRAPHICS".
FG FOREGROUND
This component specifies the color in which the graphical element is displayed.
Values: The color can be given in the following four ways (see section
9.3.4.):
- With a color name given as a text, e.g., "LIGHT BLUE".
- With a RGB number given as a vector of three elements, e.g.,
253
MicroSCADA
9 Graphics Primitives
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
(10000,20000,30000).
- With a color number given as an integer expression, e.g. 5.
- With scope and color number given as a vector of two elements:
(scope,color_number), e.g., ("M",5).
Default value: "WHITE"
FU FUNCTION
This component states how the color of added pixels (’new’) are combined with the color of already existing pixels (’old’) on screen.
Each color in use has a palette number (pixel value, 0 ... 255). The FU component determines how the bit representations of the color numbers are combined bit-wise by means of logical operators.
Value: Definition:
"CLEAR" 0
"AND"
"ANDREVERSE" new AND old new AND (NOT old)
"COPY"
"ANDINVERTED"
"NOOP" new
(NOT new) AND old old
"XOR"
"OR"
"NOR"
"EQUIV" new XOR old new OR old
(NOT new) AND (NOT old)
(NOT new) XOR old)
"INVERT"
"ORREVERSE"
(NOT old) new OR (NOT old)
"COPYINVERTED" (NOT new)
"ORINVERTED" (NOT new) OR old
"NAND" (NOT new) OR (NOT old)
"SET"
"SCIL_XOR"
1
X server independent XOR
Default value: "COPY"
Examples:
"COPY" means that the added color replaces the former color.
254 ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
9 Graphics Primitives
Using "SCIL_XOR" or "XOR" (the latter does not work in all X servers) repeatedly on the same graphic element alternately draws and deletes the graphics.
JS JOIN_STYLE
Specifies how corners are drawn for wide lines drawn with a single graphics command, see Figure 16.
Values: "MITER" = The outer edges of the two lines are extended to
meet in one point.
"ROUND" = The lines are joined by a circular arc with r
= half the line width centered on the join point.
"BEVEL" = The outer edges of the lines are joined at the end
points.
Default: "MITER"
LS LINE_STYLE
Specifies how the line is drawn and in which colors.
Values: "SOLID" = The line is continuous (without dashes) and
drawn in the FOREGROUND color.
"ONOFFDASH" = The line is dashed with the dashes drawn in
the foreground color.
"DOUBLEDASH" = The line is dashed with the dashes drawn in
the foreground color and the gaps between
the dashes in the background color.
Default value: "SOLID"
LW LINE_WIDTH
Specifies the width of the line in coordinate units (see section 9.4.). Wide lines are drawn centered between the start and the end point given in the drawing command, seeFigure 14.
Values: Integer or real, >= 0
Default value: 0
LINE_WIDTH = 0 specifies the width to one pixel regardless of the scaling. LW = 0 is the most efficient line width and fastest to draw. However, width 0 is X server dependent and may not match exactly with lines of pixel width 1 (which is X server independent).
255
MicroSCADA
9 Graphics Primitives
9.3.4
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
NA NAME
A freely chosen name of the graphics context. This component is not copied when copying a context.
Value: Text
Colors and Fonts
Colors
The final color of a graphical element displayed on screen depends on the
FOREGROUND, BACKGROUND and FUNCTION components of the graphics context (section 9.3.3.). The colors can be given in four manners:
•
By color names (Windows or X windows). The names of the colors in the semigraphic pictures are: WHITE, BLACK, RED, GREEN, BLUE, CYAN,
MAGENTA, YELLOW.
•
By RGB intensities given as a vector of three elements where the first element defines the red, the second element the green and the third element the blue intensity of the color as an integer or real value in the range 0 ... 65535. Consequently, for example, (0,0,0) is black and (65535,65535,65535) is white.
•
By a color mix number. A color mix number is a dedicated color cell in the color palette of the operating system or X server. The number is defined by the
.COLOR command, see below.
•
With scope and color mix number given as a vector of two elements:
(scope,color_number), e.g., ("M",5).
If the operating system or X-server is not capable to provide the requested color exactly (e.g. because the palette of the server is full due to the use of many different colors on screen), the nearest possible color is used.
256
The .COLOR command below is used for creating and modifying color mix numbers, and the COLOR function for reading the numbers.
.COLOR [scope,] number : color [,SHARED]
.COLOR [scope,] number : color [,PRIVATE]
The .COLOR command defines the color mix number.
’scope’ The scope of the color number. The scope is given in the same way as for graphics contexts in section 9.3.2.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
9 Graphics Primitives
’number’ Color number given as a positive integer expression. Each scope can have the following maximal number of colors: “C": 20, "R":
20, "M": 50, "U": 50.
'color' Color definition given in one of the four manners described above.
The color mix number can be used for color selection in the graphics contexts
(BACKGROUND and FOREGROUND).
The color allocation policy may be private or shared. Private colors allocate a dedicated palette entry for the color, shared colors do not.
If there are several MicroSCADA windows (or other applications requiring many colors) open on a monitor, it may happen that the palette runs out of entries. To avoid this from happening, define the color as SHARED.
A change to a private color appears immediately on screen, i.e., all the pixels drawn with the color are immediately affected. Changes to a shared color affect only pixels drawn with the color after the change. Hence, private colors are needed for color animation (done for example in the color chooser pictures).
The default color allocation policy is specified with the value of the APL:BCP attribute of the application that uses the monitor. The default color allocation policy for a monitor is specified by the new monitor attribute CP. The default color allocation policy for an application (all monitors used by the application) is defined by the application attribute, CP.
The allocation policy is assigned to a color when the color is first defined. The later
.COLOR commands applying to the same color do not change the policy unless explicitly requested.
COLOR([scope,]number)
Returns the RGB values of the color specified by the arguments.
'scope' The scope of the color
'number'
Result:
The number of the color
Vector of three elements
Example:
.COLOR 1: "NAVYBLUE"
.GC : FG = 1
.BOX 100, 100, 200, 200, FILL
@RGB = COLOR(1)
@RGB(1) = %RGB(1) + 10000
.COLOR 1 : %RGB
The example creates a color mix initialized as navy blue, then draws a filled box in the selected color. The color is added with more red, which appears in the color of the box according to the color allocation policy definitions.
257
MicroSCADA
9 Graphics Primitives
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Fonts
The font used in texts is specified by the FONT component of the graphics context
(section 9.3.3.). Fonts can be given as follows:
•
With a font name given as a text, e.g. "KANJI_24".
•
With a font number given as an integer expression, e.g. 3. The font numbers are defined by the .FONT command, see below.
•
With scope and font number given as a vector of two elements:
(scope,font_number), e.g., ("M",3).
•
As a list with one or several of the follwing attributes: FAMILY (FA),
POINT_SIZE (PS), FACE (FC).
The .FONT command below defines font numbers, and the FONT function is used for reading font numbers.
.FONT [scope,] number:font
Defines a font number.
’scope’ The scope of the font number. The scope is given in the same way as for graphics contexts in section 9.3.2.
’number’ Font number given as a positive integer expression. Each scope can have the following maximal number of fonts: "C": 10, "R": 10,
"P": 10, "M": 20, "U": 20. 0 = the MicroSCADA semi-graphic font. Do not change that!
’font’ Font definition given in any of the three manners allowed for the
FONT component, see section 9.3.3.
FONT([scope,] number)
’scope’
’number’
Result:
The scope of the font.
The number of the font.
The font function returns a list with the attributes shown in Figure
17.
258 ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
9 Graphics Primitives
ABB Automation
FA
PS
SS
FC
EN
AS
DE
WI
Figure 17.
The attributes returned by the font function
NA Name
HE Height (number of pixels)
Ascent (logical extent above baseline in number of pixels)
Descent (logical descent below baseline in number of pixels)
Width (width of the widest character in the font in number of pixels)
Family (the name of the font family)
Point size
SCIL size
Face
Encoding
HE is always the sum of AS and DE.
259
MicroSCADA
9 Graphics Primitives
9.3.5
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Reading Graphics Contexts
The defined graphics contexts can be read with the following SCIL functions:
GC([scope,]n)
The function returns the values of the components of the context.
’scope’ The scope of the context, see section 9.3.
’n’ Graphics context number, integer 0 ... 20 or 0 ... 50 depending on the scope, see section 9.3.2.
Value: List, where the abbreviated names of the components are the attributes.
Example:
@GC_DEF = GC(0)
!SHOW INFO "CURRENT DEFAULT FONT IS " + GC_DEF:VFT
COLOR_IN([scope,] n)
The function returns the RGB values of the foreground color in the context as a vector of three elements.
’scope’ Scope of the context.
’n’ Graphics context number.
9.4
260
FONT_IN([scope,] n)
The function returns a list value with the same attributes as for the FONT function, see section 9.3.4.
’scope’ Scope of the context.
’n’ Graphical context number.
Graphics Canvas
General Description
The graphical elements are displayed on the selected canvas which can be:
•
The object (picture, picture function, dialog object) which contains the command
(default).
•
The root object - the main picture or the main dialog.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
9 Graphics Primitives
•
A named window or dialog object.
•
The parent object of the object where the command is executed.
The canvas can be selected with the commands in next section Selecting Canvas (together with the context definitions and the scaling factor) can be temporarily stored.
See section 9.5.
Selecting Canvas
If not changed with any of the commands listed below, the canvas for the graphics commands is the object where the commands are executed. Use the following commands in order to get the elements displayed on another canvas:
.CANVAS object
The command selects the named picture object (window picture or picture function) or dialog object (dialog or dialog object) - for canvas.
’object’ A picture reference or a Visual SCIL object reference, see Chapter
4.
.CANVAS ROOT
The root object is used as canvas. In a picture the root object is the main picture. In a dialog system, the root is the main dialog or picture container.
.CANVAS PARENT
The parent object is used as canvas. In a picture the parent object is the parent picture of the current window picture or picture function. In a dialog system, the parent is ....
.CANVAS CURRENT
The current object is used as canvas, i.e., the object containing the graphics command.
Hence, this command returns the canvas to the default.
.COORDINATE_SYSTEM coordinate_system
Specifies the coordinate system to be used in graphic drawing commands and mouse handling commands.
The coordinate system is specified by one of the following key words: SCIL, VS.
Changes of the coordinate system with the COORDINATE_SYSTEM command are valid only within the SCIL program where the change was made.
261
MicroSCADA
9 Graphics Primitives
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Example:
.COORDINATE_SYSTEM SCIL
The SCIL Coordinate System
Within the SCIL coordinate system, the (0,0) coordinate lies in the upper left corner of the canvas. The relation between SCIL coordinates and pixels on screen depends on the semigraphic font used in the MicroSCADA Monitor and on the scaling factor used by the drawing commands. See Figure 18.
pixel_coord = SCIL_coord *MicroSCADA_Monitor_Width / scaling_factor where
‘pixel_coord = the pixel coordinates as displayed on screen.
SCIL_coord = the coordinates given in the graphics SCIL command.
MicroSCADA_Monitor_Width = 80 * Width of semigraphic character
= 80*8 or 80*12 or 80*15.
scaling_factor = the scaling factor. The default scaling factor is
1280. The scaling factor can be changed with the .SCALING command see section 9.4.4.
Scaling factor x coordinates
(0,0)
Canvas=
Main Picture y coordinates
Canvas=
Window Picture or
Picture function
262
Figure 18.
The SCIL coordinate system
The Visual SCIL Coordinate System
Within the Visual SCIL coordinate system, the (0,0) coordinate lies in the lower left corner of the canvas. The Visual SCIL coordinates are equal to the pixel positions within the canvas. Visual SCIL coordinates can not be used in monitors of X-type.
When handling dialogs, the origin of the coordinate system lies at the bottom left corner of the screen. When handling dialog items, the origin is in the lower left corner of the parent object. A unit in the coordinate system is a pixel.
ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
9 Graphics Primitives
Coordinates are also used, for example, when giving a position with the
_GEOMETRY attribute and when reading a position with the _GET_POINTER_POS method. For more information on VS coordinates, see the section 2.4 in the Visual
SCIL manual.
The Graphics Contexts components LW, DL, DO are defined according to the active coordinate system. These Graphics Contexts components are not affected by the coordinate system used at drawing .
Example:
.COORDINATE_SYSTEM VS
.GC : LW = 5
.LINE 10,10,100,100 ;line width is now 5 units according to
;the VS coordinate system (pixels).
.COORDINATE_SYSTEM SCIL
.LINE 10,10,100,100 ;line width is still 5 units according to
;the VS coordinate system (pixels),
;because the Graphics Components were defined under
;VS coordinate system
Changing Scaling Factor
The scaling factor can be changed by the following command:
.SCALING
[
s
]
Sets the scaling factor to be used in the subsequent SCIL graphics commands.
’s’ is an integer or real expression, the scaling factor. If ’s’ = 0, the coordinates are taken as pixel coordinates of the screen where the graphical element is displayed. If ’s’ is omitted, the scaling factor is returned to the default (= 1280).
For example, a graphical element programmed with s = 0 will have different sizes depending on the resolution of the screen where it is shown.
The scaling factor can be temporarily stored (together with context definitions and canvas selections) by the commands in section 9.5. Note that the scaling factor only affects the SCIL coordinate system.
Mouse Input
The coordinates can be read from the cursor position with the .MOUSE command.
The .MOUSE command can be used with or without tracing. If tracing is OFF, the command reads the cursor position and the current mouse button states. If tracing is on, the command notes the following mouse events: button press and release, movement of mouse (provided that motion event is on, see the .MOUSE ON command). By means of the .MOUSE ON and .MOUSE OFF commands, tracing is switched on and off (default = OFF).
.MOUSE x, y [, button [, buttons [, RELATIVE] ] ]
Reads the SCIL coordinates of the cursor and the mouse button states.
263
MicroSCADA
9 Graphics Primitives
264
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN x and y two variables that get the value of the x and y coordinates respectively (SCIL or VS coordinates).
button buttons a variable that gets the value of the pressed or released mouse button number (1, 2 or 3). If the registered mouse event was a motion event, the variable gets the value 0. If tracing is OFF, the variable gets the value 0.
a variable that receives the current mouse button states if tracing is
OFF, or the button states immediately before the mouse event if tracing is ON. The states are returned as a bit mask, where each bit number represents a mouse button. The bit values have the following meanings: 0 = the button is released, 1 = the button is held down.
RELATIVE an optional keyword. If RELATIVE is given as the last argument of the command, the coordinates are relative to the current canvas
(If the canvas is not explicitly set, the window or picture function executing the .MOUSE command acts as the current canvas). If
RELATIVE is not given, the coordinates returned by .MOUSE
command are relative to the part picture (picture shown in window) executing the command.
Examples:
.MOUSE X, Y, RELATIVE
.MOUSE X, Y, BUTTON, RELATIVE
.MOUSE X, Y, BUTTON, BUTTON_MASK, RELATIVE
.MOUSE ON [,MOTION]
.MOUSE OFF
.MOUSE ON sets the program in tracing state. If the MOTION option is given, also the motion of the cursor is traced.
.MOUSE OFF ends the tracing state. The tracing state is automatically ended when a program is completed.
Example:
The following SCIL sequence draws a line segment from (0,0) to the position pointed by the user. The final position is given by releasing button 1.
.MOUSE ON
@B1_PRESSED = FALSE
#LOOP NOT %B1_PRESSED
.MOUSE X, Y, BUTTON, BUTTONS
#IF (%BUTTON ==1) AND (BIT(%BUTTONS , 1)==0) #THEN #BLOCK
@B1_PRESSED = TRUE
#BLOCK_END
#LOOP_END
The program sequence above waits until mouse button 1 is pressed, then the following is executed:
.MOUSE ON, MOTION
.GC : FUNCTION = "XOR"
.LINE 0, 0, %X, %Y
ABB Automation
1MRS751250-MEN
9.5
9.5.1
9.5.2
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
9 Graphics Primitives
#LOOP %B1_PRESSED
.MOUSE NEW_X, NEW_Y, BUTTON, BUTTONS
.LINE 0, 0, %X, %Y
#IF %BUTTON == 1 #THEN @B1_PRESSED = FALSE
#ELSE #BLOCK
.LINE 0, 0, %NEW_X, %NEW_Y
@X = %NEW_X
@Y = %NEW_Y
#BLOCK_END
#LOOP_END
The line is drawn and erased until the mouse button is released, then the following is executed:
.GC : FUNCTION = "COPY"
.LINE 0, 0, %NEW_X, %NEW_Y
.MOUSE OFF
The line is drawn from (0,0) to the coordinates given be the variables %NEW_X and
%NEW_Y.
Miscellaneous Graphical Commands
Storing and Restoring Selections
.PUSH
.POP
The commands .PUSH and .POP are used for storing temporarily the context definitions, the scaling factor and the canvas selection. They are useful, when there is a need to store standard selections, meanwhile make other selections, and then restore the standard selections after a while. They are used, for example, when a subroutine uses specific values for canvas, scaling and graphics contexts, which should not interfere with the picture that executes the subroutine.
.PUSH stores the current canvas selection, scaling factor and graphics contexts definitions. .POP restores the selections stored with .PUSH. The .POP command must be located in the same program as the corresponding .PUSH command.
Display Handling Commands
.FLUSH
This command forces a blink timing and an immediate updating of the entire application window. However, if there is an ongoing pending, see below, the command has no effect. The command is rather time consuming.
.PEND ON
.PEND OFF
Pending is used to prevent disturbing flickering when drawing related graphics primitives in sequence (for example when changing position of an object in animation).
265
MicroSCADA
9 Graphics Primitives
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
The graphics drawn after PEND ON are not shown on screen until the matching
PEND OFF is encountered. At PEND OFF the resulting output of the intervening commands is shown as a flash (that is the drawn primitives are not displayed one by one). PEND ON and the matching PEND OFF must be located in the same SCIL program. If a SCIL program ends while the output is pending, an automatic PEND OFF is generated by the base software. PEND commands may be nested. In this case, the outermost PEND off triggers the output.
An implicit PEND ON - PEND OFF is set by the base software around the semigraphical background and the draw program when a picture is displayed.
266 ABB Automation
1MRS751250-MEN
10
10.1
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
10 Using Motif Widgets in SCIL
Using Motif Widgets in SCIL
This chapter describes the SCIL interface to the Motif programming, which is supported in the X/OSF/Motif environment. Motif programming is briefly described in section 10.1. Section 10.2 describes the SCIL commands for creating, deleting and modifying widget instances. Section 10.3 describes the use of widget methods for managing and unmanaging widget instances. Section 10.4 describes the handling of widget resources with SCIL.
The reader is assumed to be familiar with Motif programming. Refer to the following
Motif programming manuals: Motif Programming Manual, O’Reilly & Associates,
Inc. and OSF/Motif Programmer’s Reference Manual. Motif support in MicroSCADA
8.4.1 is based on Motif version 1.1.
The Motif Widgets described in this chapter can be used only in MicroSCADA monitors defined as type “X”. Using this monitor type0 excludes the possibility to use Visual SCIL and Visual SCIL based tools. It is therefore not recommendable to use Motif Widgets when building new MicroSCADA 8.4 applications.
General
Motif widgets are standardized components of the Motif user interface, e.g. dialog boxes, buttons, labels, scroll bars, etc. The Motif widgets are organized into classes with similar properties and functions. Figure 19 shows the Motif widget classes and the class hierarchy. The class hierarchy is constructed so that the lower classes (to the right in the figure) have all the properties of the higher classes (to the left in the figure) plus some additional properties. For instance, the PushButton class has all the properties of the Label class, but also some other essential properties which the Label class lacks.
A widget specified for display on screen is called a widget instance or an object. A widget instance is always also an X window, except for the widgets called gadgets.
The top-level window of a MicroSCADA operator process window, i.e. the window directly under the root window (= the screen), is always a widget of the class. ApplicationShell. The MicroSCADA main window is implemented as a DrawingArea widget.
Composite widget classes support the containment of other widgets within them. The contained widgets are called child widgets, and the containing widgets are called parent widgets. Widgets of the classes below Manager - manager widgets - have the ability to manage the position and size of their children. Generally, for space reserving reasons, the descendants of a widget, ie., its children in one or more links, must be managed before the widget itself and its ancestors are managed. When a parent widget is shown, all its managed child widgets are shown as well.
The configurable features of the widgets, e.g. color, position, and function of a widget instance is specified by its resources (section 10.4.). Each widget class has its own set of resources plus some resources inherited from widget classes higher up in the wid-
267
MicroSCADA
10 Using Motif Widgets in SCIL
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN get class hierarchy. The resources can be assigned values when a widget instance is created, or later. Resources can also be set in resource files.
In Motif there are a number of creation routines for creating widget instances or compound objects comprising several widget instances. These routines can be invoked by means of SCIL commands. There are SCIL commands for creating, deleting and modifying widgets (section 10.2.). The SCIL programmer can also manage and unmanage the widgets (sections 10.2. and 10.3.).
The Motif widgets, their resources and the Motif creation routines are described in the
Motif Programming Manuals.
C ore
Object
- Motif
- Xt Intrinsics
RectObj
WindowObj
Constraint
Composit
Gadget
Primitive
M anager
ArrowButtonGadget
LabelGadget
SeparatorGadget
ArrowButton
Label
List
Scrollbar
Separator
Text
TextField
BulletinBoard
DrawingArea
Frame
PanedWindow
RowColumn
Scale
ScrolledWindow
CascadeButtonGadget
PushButtonGadget
TroggleButtonGadget
CascadeButton
DrawnButton
PushButton
ToggleButton
Form
SelectionBox
MessageBox
MainWindow
Command
FileSelectionBox
Shell
OverrideShell
WMShell
MenuShell
VendorShell
TopLevelShell
TransientShell
ApplicationShell
DialogShell
Figure 19.
The class hierarchy of the Motif Widget set.
10.2
Widget Handling Commands
.CREATE [parent/]widget = routine[(resources)]
.CREATE_MANAGED[parent/]widget=routine[(resources)]
Creates a Motif widget instance or a group of instances (compound object).
268 ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
10 Using Motif Widgets in SCIL
’widget’
’parent’
A freely chosen name of the widget instance, i.e., the widget instance whose widget ID is returned. The widget name may be up to
63 characters long.
The "path" to the widget specified by a chain of parent/child relations where the links are separated by slashes. Each link can be either a widget or a semigraphic window. If the last link in the chain is a Motif widget, the window containing it will be the parent. If ’parent’ is omitted, the application shell containing the MicroSCADA main window will be the parent.
Example: MOTHER/MY_PUSH_BUTTON.
’routine’ The Motif creation routine used to create the widget (or gadget) or group of widgets. Any of the 57 Motif creation routines staring with XmCreate may be used along with the TopLevelShell defined in Xt (see appendix A of Motif Programming Manual or OSF Motif Programmer’s Reference Manual). ’routine’ is formed by removing XmCreate from the creation routine name, adding an underscore preceding any upper case letter in the name and prefixing the result with ’MOTIF’.
Example: XmCreateSimpleMenuBar becomes
MOTIF_SIMPLE_MENU_BAR in SCIL.
Note: The XtTopLevelShell widget class can be used in
SCIL under the name MOTIF_TOP_LEVEL_SHELL.
’resources’ A list of resource assignments in the format: resource_name = value
If there are several assignments, they are separated by commas. Read about resources in section 10.4.
The created widget is not displayed on screen until the widget and all its ancestors have been managed. It can be managed and unmanaged by means of widget methods, see section 10.3. If you want the widget to be managed immediately, use the
CREATE_MANAGED command instead of CREATE.
Examples:
.CREATE PB = MOTIF_PUSH_BUTTON (label_string = "Close")
Creating a push button labelled "Close".
.CREATE BAR = MOTIF_SIMPLE_MENU_BAR
Creating a simple menu bar called BAR.
.MODIFY [parent/]widget = expression
Modifies the resource values of a widget instance (corresponds to the XtSetValues function of Xt).
’widget’
’parent’
Widget name.
The "path" to the widget specified by a chain of parent/child relations. If ’parent’ is omitted, the first found widget instance with the given name is modified.
269
MicroSCADA
10 Using Motif Widgets in SCIL
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
’expression’ A list type expression containing the names and values of the resources to be set. See section 10.4.
The modifications come into effect immediately. The resources not included in the list command remains unchanged.
Example:
.MODIFY RUNNING_WIDGET = LIST(X = RUNNING_WIDGET.X + 10,-
Y = RUNNING_WIDGET.Y + 10)
The widget is moved by adding 10 to its x- and y- coordinates.
10.3
.DELETE [parent/]widget
DELETE destroys a widget instance and all its descendants.
’widget’ Widget name.
’parent’ The "path" to the widget specified by a chain of parent/child relations. If ’parent’ is omitted, the first found widget instance with the given name is selected.
The widget(s) are erased from screen and their definitions are deleted. In order to erase the widgets and preserve the widget definitions, use the UNMANAGE widget method (see section 10.3.).
When a MicroSCADA picture is removed from screen, all its widgets are automatically deleted.
Widget Methods
270
[parent/]widget.method
Widget methods are functions that widgets can execute on behalf of the caller. The syntax of a widget method call is as follows:
Executes a widget method.
’widget’ The name of the widget instance.
’parent’ The "path" to the widget specified by a chain of parent/child relations. If ’parent’ is omitted, the first found widget instance with the given name is selected.
’method’ The name of the method. The following four predefined methods are available:
MANAGE Manages a previously created widget. If all its ancestors have been managed, the widget and all its managed children are shown on screen.
ABB Automation
1MRS751250-MEN
10.4
10.4.1
10.4.2
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
10 Using Motif Widgets in SCIL
UNMANAGE Unmanages a widget and all its descendants, but the widget instances are preserved.
MANAGE_ALL_CHILDREN Recursively manages all
SCIL-created descendants of a widget in correct order, i.e. starting from the child widget furthest down in the parent/child chain.
SET_STATE This method corresponds to the Motif routine
XmToggleButtonSetState. It sets the ’state’ and
’notify’ parameters according to the values given to the STATE and NOTIFY resources
(see sections 10.4.2. and 10.4.4.). The resources must be assigned values immediately before the method is executed.
Examples:
.CREATE A
.CREATE A/B
.CREATE B/C
C.Manage
B.Manage
A.Manage
MAIN_DIALOG.MANAGE_ALL_CHILDREN
Widget Resources
General
The widget resources are the configurable features of the widgets, e.g., position, size, color, font, callback routines. The Motif (and Xt) widget classes and their resources are listed and described in Appendix B of the Motif Programming Manual (O’Reilly
Associates, Inc.) and in the OSF/Motif Programmer’s Reference Manual.
All listed resources can be used in SCIL, except those which have data types not implemented in SCIL (see section 10.4.3). In SCIL, the Motif resources are recognized by names which resembles the Motif resource names (see 10.4.2). The data types of the resources are translated to SCIL data types (see 10.4.3). The value of a resource can be written as described in section 10.4.4, and read as an expression as described in 10.4.5.
Resources in SCIL
The SCIL name of a Motif resource is formed by removing the XmN from the Motif resource name and inserting an underscore in front of any upper case letter in the name. For example, the SCIL resource name of the Motif resource XmNhelpLabel-
String becomes HELP_LABEL_STRING.
In addition, each Motif resource whose data type is Dimension or Position has a special SCIL resource name obtained by prefixing the standard name with ’SCIL_’, e.g.:
SCIL_DEFAULT_BUTTON_SHADOW_THICKNESS
271
MicroSCADA
10 Using Motif Widgets in SCIL
10.4.3
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
These resource names function like the standard resource names, but the dimension or position is given in SCIL coordinate units.
Besides the Motif resources, the following non-motif resources are available in SCIL:
PARENT This resource can only be read, see section 10.4.4. It contains the widget identification number of the parent widget as an integer value. The value should only be used as a value of a Widget type resource of another widget in a CREATE, MODIFY or SET command.
STATE The ’state’ parameter (boolean) of the Motif routine XmToggle-
ButtonGetState. In SCIL, the routine corresponds to the
SET_STATE method, see section 10.3.
NOTIFY The ’notify’ parameter (boolean) of the Motif routine XmToggle-
ButtonGetState. In SCIL, the routine corresponds to the
SET_STATE method, see section 10.3.
Resource Data Types
Table 9 shows an overview of the Motif resource data types and the corresponding
SCIL data types. Some Motif resource data types have not been implemented in SCIL and the resources of these datatypes therefore cannot be used.
The function data types, except for callback functions, are not implemented.
The implemented resource value types whose SCIL counterparts are not obvious are briefly described below.
Mnemonic values
All the unsigned char type resources which may have one of the predefined values defined by constant names in Motif, are given as text values in SCIL. The text value is formed by omitting ’Xm’ from the constant name. For example, the value
XmSHADOW_IN of XmNshadowType resource is in SCIL resource list given as
SHADOW_TYPE = "SHADOW_IN".
CallbackList resources
The callback resources may be given as a text or a vector value. If text, the text is interpreted as the name of the named program to be used as the callback procedure (see
1.6). If a vector value is specified, the vector should contain the SCIL program to be used as the callback procedure.
Examples:
DESTROY_CALLBACK = "I_AM_DYING"
OK_CALLBACK = ("@OK = TRUE" , ".SET A.LABEL_STRING = ""Done""")
272 ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
10 Using Motif Widgets in SCIL
Only one callback procedure may be specified for a resource. Currently, the additional info fields that appear in some CallbackStruct structures are not delivered to SCIL callback procedures.
XmFontList resources
Font lists are given as vectors, the elements of which are SCIL font specifications (see section 9.3.4.).
Examples:
@FL(1) = ("M",2) ;Monitor specific font number 2
.CREATE W = MOTIF_LABEL(FONT_LIST = %FL, ...)
The charset attribute of the font is not supported.
Table 9.
Resource Type
(*) ()
Atom
Boolean
Cardinal
Colormap
Dimension int
KeySym
Pixel
The Motif resource data types and the corresponding SCIL data types
Comments
Pixmap
Pointer
Position
Screen short
String
StringTable unsigned int unsigned char
Visual
Widget
WidgetList
Window
XmButtonTypeTable
XmFontList
XmKeySymTable
XmNavigationType
XmString
XmStringCharSetTable
XmStringDirection
XmStringTable
XmTextPosition
XmTextSource
XtAccelerators
XtCallbackList
XtTranslations
SCIL Data Type
Not implemented
Not implemented
Boolean or
Integer: 0 = false, 1 = true
Integer
Not implemented
Integer elements
Integer
Text of one character
SCIL color specification: text, vector or integer
Pixmap
Not implemented
Integers
Not implemented
Integer
Text or text vector
Vector of text elements
Integer
Text
Not implemented
Text or integer
Not implemented
Not implemented
Text vector
Vector
Text vector
Text vector
Text
Not implemented
Not implemented
Vector of text elements
Integer
Not implemented
Not implemented
Text or vector of text elements
Not implemented
See the text
See section 9.3.4.
See section 10.4.6.
See the text.
See the text.
See the text.
See the text.
273
MicroSCADA
10 Using Motif Widgets in SCIL
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Pixel resources
Pixel resources are given as SCIL color specifications (see section 9.3.4.).
Examples:
BACKGROUND = "NAVY BLUE"
FOREGROUND = (10000,20000,30000)
BORDER_COLOR = ("M", 5)
;by name
;by RGB values
;monitor specific color # 5
XmString and XmStringTable resources
XmString resources are given as a text and XmStringTable resources as a vector of text elements. No other properties of XmString type are implemented.
10.4.4
Widget resources
Widget resources are given either by a text value specifying the widget (path) name or by an integer value specifying the widget id (Currently, the only way to get a widget id is to read the PARENT ’pseudoresource’ of a widget. See section 10.4).
Example:
.CREATE W = MOTIF_SCROLLED_WINDOW(-
HORIZONTAL_SCROLL_BAR = "BAR",...)
Writing Widget Resources
274
.SET [parent/]widget.resource = expression
Assigns a value to a widget resource.
’widget’ Widget name.
’parent’ The "path" to the widget specified by a chain of parent/child relations. If ’parent’ is omitted, the first found widget instance with the given name is selected.
’resource’
’expression’
Resource name (see section 10.3).
An expression of the same datatype as the resource.
The value of ’expression’ is assigned to the resource. The new resource value comes into effect immediately, except when writing the STATE and NOTIFY resources. The values given to these resources come into effect when the SET_STATE method is executed (see section 10.3).
Examples:
.SET A/B.BACKGROUND = "NAVY BLUE"
Setting the background color.
.CREATE TB = MOTIF_TOGGLE_BUTTON
.SET TB.NOTIFY = FALSE
.SET TB.STATE = TRUE
TB.SET_STATE
ABB Automation
1MRS751250-MEN
10.4.5
10.4.6
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
10 Using Motif Widgets in SCIL
Reading Widget Resources
The value of a widget resource may be read as a SCIL expression of the following format:
[parent/]widget.resource
where
’parent’
’widget’
The parent/child path to the widget.
The name of the widget.
’resource’ The resource name. When reading the STATE and NOTIFY resources, the resource names must be preceded by GET_, i.e., the names are GET_STATE and GET_NOTIFY.
The value of the expression is the value of the resource, but the resource data type has been transformed to a SCIL data type according to Table 9.
Examples:
The expression
A/B.WIDTH
has the value of the WIDTH resource of the widget called B of the parent A.
The command
.SET A/B.WIDTH = A/B.WIDTH + 10 adds 100 units to the width resource (e.g. 100 pixels if the UNIT_TYPE is pixel).
SET A.Work_Area = S.PARENT
The parent of widget S will be the work area of widget A.
@STATE = TB.GET_STATE
Auxiliary Functions
PIXMAP(name)
Creates a pixmap (a two dimensional array of pixels) of the named library representation. The function, or variables assigned values by means of the function, can be used for all Motif resources of the datatype pixmap.
’name’ Text. Library representation. The representation is given in one of the following ways:
1. Library representation name.
Result:
2. Logical library name/representation name (see the #REP_LIB
command in section 7.10.
Pixmap
Example:
@PIX = PIXMAP("FIG_1")
275
MicroSCADA
10 Using Motif Widgets in SCIL
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
GIF_PIXMAP ( file_name)
GIF_PIXMAP enables the importing of GIF format images in Motif environment.
’file_name’ Text value. The name of the GIF format file to be imported. The name is given in operating system format.
Result: Integer value, which can be used as a pixmap resource value in
Motif.
Example:
.CREATE_MANAGED BUTTON = MOTIF_PUSH_BUTTON(-
SCIL_X = 200,-
SCIL_Y = 200,-
LABEL_TYPE = "PIXMAP",-
LABEL_PIXMAP = GIF_PIXMAP("/USR/SC/GIF/BUTTON.GIF"))
A Motif button is created. The image drawn in the button is imported from a GIF file.
The importing of a GIF picture may fail if all the colors in the X server color palette are reserved and the program does not find a color which is close enough to the desired color. Unless your graphical board supports the use of 65536 colors simultaneously, it is not recommended to use GIF pictures which comprise a wide range of colors.
276 ABB Automation
1MRS751250-MEN
11
11.1
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
11 SCIL Programming Guide
SCIL Programming Guide
This chapter provides a programming guide for the most important SCIL tasks. The guide gives brief instructions for accomplishing various tasks with SCIL and refers to the sections in this manual and other manuals where the used SCIL elements are detailed. The following main subjects are discussed:
•
Picture handling.
•
Visual SCIL object handling.
•
Program execution.
•
Process supervision and control.
•
Alarm and event handling.
•
Calculations and reports.
•
System configuration and communication.
•
Application database management.
•
Error handling.
Picture Handling
Loading Pictures
Task
Loading a new picture
Re-loading the previous picture
Loading an alarm picture
Use
!NEW_PIC command
!LAST_PIC command
!INT_PIC command
Comments
Section 7.2.
Section 7.2.
Section 7.2.
The alarm picture is process object specific and defined in the process object definition.
Window Handling
Task
Showing or updating windows
Erasing windows
Showing window background
Creating windows with SCIL
Positioning windows with SCIL
Defining window expression with SCIL
Defining window representation with SCIL
Defining window picture with
SCIL
Changing window level
Reading window attributes
Use
!SHOW command
!ERASE command
!SHOW_BACK
!WIN_CREATE or
!WIN_NAME
!WIN_POS
!WIN_INPUT or !SHOW
!WIN_REP
!WIN_PIC
!WIN_LEVEL
attribute reference:
{picture}.attribute
Comments
Section 7.2.
Section 7.2.
Section 7.2.
Section 7.2.
Section 7.2.
Section 7.2.
Section 7.2.
Section 7.2.
Section 7.2.
Section 4.4.
277
MicroSCADA
11 SCIL Programming Guide
Programming Language
SCIL
Technical Reference Manual
Task
Writing window attributes
Named Programs
Task
Executing named programs
Using named programs in expressions
Building named programs which use arguments and return a value
1MRS751250-MEN
Use
.SET + attribute reference
Comments
Section 7.4.
Use
Program call:
{picture}.name{(arguments)}
Program call as above.
Use the arguments
ARGUMENT functions to read the arguments given in the program call.
Use the #RETURN command to return a value.
Comments
Section 4.4.
Section 4.4. Possible only for named programs which return values.
The ARGUMENT functions are described in Chapter
8. The #RETURN command in section
7.3.
Updating Pictures
Task
Cyclical updating
Event based updating
Use
Updating program.
Start the updating and define the updating interval with the
!UPDATE command.
#ON blocks + event object activation
Comments
Section 7.2.
The updating program should not be comprehensive.
Section 7.3.
Event object activation from process objects requires that the EE attribute is = 1.
11.2
Miscellaneous
Task
Stopping function key blinking
Hardcopy (semi-graphic) of picture
Closing application windows
Use
!RESTORE
!SEND_PIC
!CLOSE
Visual SCIL Object Handling
Loading, Creating and Deleting Objects
Task
Loading objects stored in a
Visual SCIL object file
Creating objects with SCIL
Deleting objects
Use
.LOAD command
.CREATE command
.DELETE command
Comments
Section 7.2.
Section 7.2.
Section 7.2.
Comments
Section 7.4.
Section 7.4.
Section 7.4.
278 ABB Automation
1MRS751250-MEN
11.3
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
11 SCIL Programming Guide
Executing Methods
Task
Executing methods from SCIL
Using method calls in expressions
Building methods which use arguments and return a value
Use
method call:
{object}.method{(arguments)}
Program call as above
Use the arguments
ARGUMENT functions to read the arguments given in the program call.
Use the #RETURN command to return a value.
Comments
Section 4.4.
Such methods which are executable with
SCIL.
Section 4.4.
Possible only for methods which return values.
The ARGUMENT functions are described in
Chapter 8. The
#RETURN command in section
7.3.
Reading and Writing Attributes
Task
Reading attributes (functions and features)
Use
Attribute reference:
{object}.attribute{(arg:s)}
Modifying attributes .SET command + attribute reference
.MODIFY command + object reference + attribute list
Comments
Section 4.4.
Section 7.4.
Attributes can also be modified with the
.LOAD and
.CREATE
commands.
Program Execution
Executing Programs
Task
Executing command procedures
Use
#EXEC, #EXEC_AFTER
Executing named programs in pictures
Executing methods in Visual
SCIL objects
Executing a program written as text vector, e.g. in a text file
#DO command
DO function
Use READ_TEXT to read a file to a text vector
Miscellaneous
Task
Conditional execution of program block
Use
#IF ... #THEN
#ELSE_IF..... #THEN
#ELSE
Comments
Section 7.3.
Also started by time channels and event channels.
See above.
See above.
Section 7.3.
Chapter 8
Chapter 8
Comments
Section 7.3.
279
MicroSCADA
11 SCIL Programming Guide
11.4
11.5
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Task
Building program blocks within programs
Executing different program blocks depending on the situation
Executing program loops
Use
#BLOCK statements
#BLOCK_END
#CASE
#WHEN
#OTHERWISE
#CASE_END
#LOOP
#LOOP_END
#LOOP_WITH
#LOOP_EXIT
#PAUSE
Comments
Section 7.3.
Section 7.3.
Section 7.3.
Pausing the program execution
User defined functions DO function with arguments
In the program:
Read arguments with the
ARGUMENT functions.
Return values with the
#RETURN command.
#RETURN Stopping program execution, possibly returning a value
Process Supervision and Control
Task
Using process object value in expressions
Use
Process object notation
Controlling process objects #SET command + process object notation
Used in exceptional cases
Chapter 8
Chapter 8
Section 7.3.
Section 7.3.
Comments
Section 4.3.
Process objects are described in the
Application Objects manual.
Section 4.3. and section
7.3.
Alarm and Event Handling
Task
Alarm and event handling features
Building alarm and event lists
Use Comments
Defined in the process objects, see the
Application Objects manual.
Section 7.3.
Chapter 8.
Printing event and alarm information
#INIT_QUERY
PROD_QUERY
NEXT, PREV
Automatically from process object or with #PRINT command and
PRINT_TRANSPARENT if full graphic printout
Defined in process object.
Section 7.3.
Chapter 8.
Requires a printout picture.
280 ABB Automation
1MRS751250-MEN
11.6
11.7
11.8
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
11 SCIL Programming Guide
Calculations and Reports
Task
Executing Command
Procedures
Acquiring Report Data
Use
#EXEC, #EXEC_AFTER
+ command procedure
#EXEC, #EXEC_AFTER
+ data object
Setting system object attributes
#SET + object notation
Starting internal DCP-NET
Starting PC-NET
LOAD_DCP function
Defining link base system object
Application Database Management
Task
Creating application objects
Use
#CREATE + list data
Deleting application objects
Modifying application objects
Searching among objects
Copying objects
#DELETE
#MODIFY
#SEARCH, NEXT, PREV
APPLICATION_OBJECT functions
#CREATE +
FETCH, PHYS_FETCH,
DATA_FETCH
Comments
Section 7.3.
Command procedures detailed in Application
Objects manual.
Also: time channels, event channels.
Section 7.3.
Data objects detailed in Application Objects manual.
Also: time channels, event channels.
Section 4.3.
Section 7.3.
Reading and Using Stored
Data
Editing report data
Data object notation
#SET + data object notation
System Configuration and Communication
Task
Creating base system objects
Defining NET lines
Use
#CREATE command +
LIST function
#SET + NET line attribute
PO
Creating communication system objects
#SET + NET object and device creation attribute
Comments
Section 7.3.
Chapter 8
Section 7.3.
System Objects manual
May also be done in preconfiguration
Section 7.3.
System Objects manual
May also be done in preconfiguration
Section 7.3.
System Objects manual.
Chapter 8.
See above.
Comments
Section 7.3.
Tools
Section 7.3.
Tools
Section 7.3.
Tools
Section 7.3. Chapter 8
Tools
Chapter 8.
Section 7.3.
Chapter 8
Tools
ABB Automation
281
MicroSCADA
11 SCIL Programming Guide
11.9
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Error Handling
Task
Error handling policy
Error handling programs
Use
#ERROR STOP
#ERROR CONTINUE
#ERROR IGNORE
In pictures:
Named program named
ERROR_HANDLER
In Visual SCIL Objects:
Error handling method.
STATUS function
SET_STATUS
Comments
Section 7.3.
See below.
See Visual SCIL User
Interface Design.
Reading and writing error status
Chapter 8.
Status Codes manual.
Argument in error handling programs
Error Handling in Pictures
The error handling in pictures can be defined by a named program with the name
ERROR_HANDLER. When a SCIL error occurs in a picture program, the
ERROR_HANDLER program, if it exists, is started. The following 6 arguments are transferred to the error handler and can be used in the named program by means of the
ARGUMENT functions (see the SCIL manual, Chapter 8):
•
The SCIL status code (integer).
•
The picture and the program where the error occurred (text) given as a picture path starting from the main picture, for example:
.UPDATE (= the update program of the main picture)
WINDOW1/PIC_FUNC_1/WINDOW2.MY_NAMED_PROGRAM
•
The erroneous SCIL line (text).
•
The column position within the line (integer, may be 0).
•
Current error handling policy (text), either "STOP" or "CONTINUE".
•
Program line number (integer).
The error handler program is searched for in the following order:
1
The picture - main picture, window picture or picture function - where the error occurred.
2
The picture functions of the picture where the error occurred.
3
The parent of the picture where the error occurred.
4
The picture functions of the parent picture .
5
The parent of the parent picture, etc., up to the main picture.
The first error handler program found is executed.
282 ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
11 SCIL Programming Guide
If no error handler is found, the standard picture error message is shown on the top line of the main picture. See the Status Codes manual.
ABB Automation
283
1MRS751250-MEN
12
12.1
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
12 SCIL Editor
SCIL Editor
This chapter describes the SCIL Editor when it is accessed from the Tool Manager or from other tools like Picture Editor, Command Procedure Object Definition tool and
Dialog Editor for Visual SCIL.
General
12.2
ABB Automation
Figure 20.
The SCIL editor as accessed from the Tool Manager
The SCIL editor is a text editor designed for editing text files and SCIL programs.
The editor has ordinary editing functions and tools for assisting design of SCIL program code. The assistant tools for SCIL programming are dialogs for inserting SCIL commands, statements and functions as well as syntax checking. Figure 20 shows the
SCIL editor as opened from the Tool Manager. The menu bar and the toolbar are located above the text window and below there is a status bar. The status bar shows current cursor position in terms of rows and columns. The active path is also shown in a field on the status bar. Unsaved changes in the program are indicated with a colored pencil on the status bar. The pencil is dimmed when there are no unsaved changes.
Menus
Commands of the File menu:
New Open a new file with the default name ‘Untitled.txt’. In case there are unsaved changes to the current file a dialog asking if changes are to be saved is shown.
285
MicroSCADA
12 SCIL Editor
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Open...
Save
Save As...
Import...
Open an existing file. Clicking Open displays a File Chooser dialog box for selecting the file to open.
Save the file without changing the filename. The Save command acts as Save As if invoked on a new file.
Save the file. A File Chooser dialog box for choosing path and file name is opened.
Insert the contents of a text file after the current line. Opens a File Chooser dialog box for selecting the file to be imported.
Export...
Print Setup...
Print…
Export the whole text or the selected text. Opens a File
Chooser dialog box, with a default file name ‘Exported.txt’, for selecting the file to export to.
On a VS local monitor this command opens a standard Print
Setup dialog provided by the Windows NT operating system.
On a VS local monitor this command opens a standard Print dialog provided by the Windows NT operating system. On a
VS remote monitor the current text is printed immediately.
File history commands The names and the paths of the most recently opened files.
The maximum number of the file names and paths shown can be determined from the File History Length in the Options menu.
More History This submenu is placed under the 5th file history command and displays the possible commands from 6 to 20. The submenu is visible if File History Length is set to more than 5, and if more than 5 files have been opened after the setting was made. The commands on the submenu do not contain any mnemonics.
Exit Exit the SCIL editor. The user is informed if there are unsaved changes to the text.
The commands of the File menu differ whether the SCIL editor is opened from the
Tool Manager or from within another tool. When the SCIL editor is opened from the
Tool Manager the File menu contains the commands New, Open, Save and Save As..., while opened from within another tool these commands are replaced by the Update command.
Commands of the Edit menu:
Undo
Redo
Cut
Copy
Paste
Undo last executed command.
Redo last executed command.
Cut selected text and place on the Clipboard.
Copy selected text and place on the Clipboard.
Paste the text of the Clipboard at current cursor position.
286 ABB Automation
1MRS751250-MEN
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
12 SCIL Editor
Clear
Select All
Comment
Uncomment
Indent
Unindent
Clear selected text. The cleared text is not placed on the
Clipboard.
Select the whole text.
Insert a semicolon at the beginning of the current or selected line(s). The semicolon acts as sign for commenting and the
SCIL interpreter recognises lines starting with a semicolon as a remark.
Delete the semicolon from the beginning of current or selected line(s).
Increase indent of current or selected line(s).
Decrease indent of current or selected line(s).
Modify All Lines|Upper Case
Modify All Lines|Lower Case
Modify All Lines|Capitalize
Modify All Lines|Left Trim
Modify All Lines|Right Trim
Modify All Lines|Compress Spaces
Converts the lines to upper case letters.
Converts the lines to lower case letters.
Converts the first character to upper case and the rest to lower case letters.
Removes leading spaces from the lines
Removes trailing spaces from the lines
Replaces multiple spaces with a single space.
Modify All Lines|Sort Alphabetically
Modify All Lines|Sort by Length
Modify All Lines|Reverse Order
Sorts the lines in the alphabetical order.
Sorts the lines in the length order.
Reverses the order of the lines.
Modify All Lines|Remove Duplicates
Find/Replace…
Find Next
Find Block
Go To Line
Removes duplicate lines.
Open a Find/Replace dialog with a field for text to find and a field for the optional replacement text.
Performs the last specified find operation from the current cursor position.
Find subsequent blocks of code in a SCIL program. For ex.
blocks delimited by a loop command.
Move cursor to a line which line number is given in the dialog shown by the command.
Commands of the SCIL menu:
Naming Standards
Insert SCIL...
Open a dialog showing naming conventions for SCIL variables and Visual SCIL objects / text identifiers.
Open a dialog for inserting SCIL commands, functions and objects. The dialog shows the different categories in a tree
287
MicroSCADA
12 SCIL Editor
288
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Check Syntax structure. To expand a category click the plus sign in front of the category name. Clicking an item in the tree structure shows the syntax of the SCIL code in the text field to the right in the dialog. Clicking the Insert button inserts the code at current cursor position. Click Close to exit the dialog.
Check the syntax of SCIL code. Information of no found errors is shown as a message. A found error is shown in a dialog along with an error code and the line number of the invalid program code. The line containing invalid syntax is shown in the text field. Edit the program and click the
Check button to verify the correction. If the correction pass the syntax check, the next error is located and shown. When no more errors are found, a ‘syntax checking successful’ message is displayed.
Commands of the Options menu:
Assistant View
Status Updating On On/off option for status bar field, menu bar items and toolbar buttons. Checked means that menu items and toolbar buttons are enabled and the status bar fields are updated according to the current status of the program.
Toolbar Visible Toolbar visible/invisible option. Checked means toolbar is visible.
Check Syntax at Save Toggle item for turning on or off the automatic syntax checking of the program during program saving. Default state is off.
Compilation In Use
Open or update read-only secondary window with a copy of the current program.
File History Length
Indent...
Toggle item for turning on or off the auto-compilation of the program during program saving. Turning off also deletes the possible existing compiled program. Enabled only if the calling tool supports program compilation. Includes syntax checking.
Determines the maximum number of the names and the paths, of the most recently opened files, displayed as file history commands under the File menu. The file history length can be set between 0 and 20. Giving the length 0 means that the file history is disabled.
Open a dialog for setting indent character count and the state for indenting new lines.
Font|Set Font
Font|Enlarge Size
Font|Reduce Size
Brings up a Font Chooser for selecting the editor font. The selected font is saved in the parameter file, and restored when the editor is opened next time. VS Local and VS Remote monitors both have their own font settings.
Find the next larger point size and set the editor font.
Find the next smaller point size and set the editor font.
ABB Automation
1MRS751250-MEN
12.3
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
12 SCIL Editor
Font|Reset Font Set the editor font to the default value: Courier Medium
Modern 10 for VS Local monitor, and Courier Medium 14 for VS Remote monitor.
Commands of the Help menu:
Shortcut Keys Shows a dialog with the sequences of keystrokes that corresponds to certain actions not included in the menus.
User Parameter Saving Shows information about whether tool or user specific parameters are used to save the properties and geometry of the
SCIL editor.
About SCIL editor Shows a dialog with Tool information and System information.
Toolbar
The toolbar of the SCIL editor is a collection of buttons corresponding to commands found in the menus. The toolbar is shown in Figure 21. The corresponding command of each button is explained in Table 10.
12.4
ABB Automation
Figure 21.
Toolbar of the SCIL editor as opened from the Tool Manager
Table 10.
Corresponding commands of the buttons on the toolbar. The last button
‘Evaluate in Test Dialog’ is present on the tool bar when the editor is opened from the Test Dialog.
File|Exit Edit|Copy Edit|Find/Replace
File|New
File|Open
File|Save
Edit|Undo
Edit|Cut
Edit|Paste
Edit|Comment
Edit|Uncomment
Edit|Indent
Edit|Unindent
Edit|Find Next
Edit|Find Block
SCIL|Insert SCIL
SCIL|Check Syntax
Evaluate in Test Dialog
Opening and Closing the SCIL Editor
Opening the SCIL Editor
The SCIL Editor is opened when you select a program for editing in the Picture Editor, Command Procedure object definition tool, Test Dialog or the Dialog Editor. The programs and the procedures for starting the program editing are described in the manuals Picture Editing, Visual SCIL User Interface Design and Application Objects.
289
MicroSCADA
12 SCIL Editor
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
You can also open the SCIL program editor from the Tool Manager by clicking the
SCIL Editor icon in the Miscellaneous page.
When the SCIL Editor is opened from a tool, you have already chosen a program for editing. If it exists, its contents is shown in the editor. If it is new, the editor is empty.
Opening Files
When you have opened the editor from the Tool Manager, you can open a text file for editing or create a new file. This possibility is usually not available when you have opened the editor from an object tool. To open a file:
1
Click Open from the File menu. A file chooser dialox box appears.
2
Select directory from the directory tree. All files are listed as default. Four different path selection modes are supported, as described on page 205. The default is MicroSCADA Relative Paths. The file list can be viewed as a list or with details by clicking on either the List ( ) or the Details ( ) button on the right, above the file list box.
3
Click the name of the text file, or type the file name in the data entry field below the file list. A file can be opened also as a read-only file by selecting the Read-only check box.
4
Click Open.
To close a file and start editing of another file, open another file or click New from the File menu to open a new file. If the previous file was not saved, you are asked to save the changes or abandon them.
In the File Chooser the paths can be selected in four different modes:
Application Relative Paths Path representation in the MicroSCADA path format relative to the current MicroSCADA application home directory. The application home directory itself can’t be referenced.
MicroSCADA Relative Paths Path representation in the MicroSCADA path format relative to the MicroSCADA root directory. The MicroSCADA root directory itself can’t be referenced.
Logical Paths
Operating System Paths
Path representation in the MicroSCADA logical path format.
Path representation in the format used by the operating system.
Creating Files
File name is given when the file is saved. If the file does not exist, a new file is created.
290 ABB Automation
1MRS751250-MEN
12.5
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
12 SCIL Editor
Saving Files
You can save your work any time. To save a file:
1
Click Save or Save As from the File menu. The Save command saves the file with the same name, if it already exists. Use the Save As command to save the file with another name.
2
When selecting Save for the first time or Save As, the file chooser dialog box appears. Select the correct folder from the directory tree and click on the file name, or type it in the Save as text box. Four different path selection modes are supported, as described on page 205. A new folder can also be created by clicking on the Create New Folder button ( ) above the file list.
3
Click Save.
If you have opened the SCIL Editor from an object tool, save the program by choosing Update on the File menu.
Undo Operation
To undo the last editing operation, click Undo on the Edit menu. The undo operation revokes the last editing operation. The maximum number of actions that can be undone is 50.
Closing the SCIL Editor
To close the editor, click Exit on the File menu.
If you have made changes since the last time you saved the program, a dialog box appears asking if you want to save changes.
Typing and Editing Programs and Texts
Typing
The basic function of the SCIL Editor compares to common text editing programs.
Most keyboard keys have their natural functions. The functions of some important keys are explained below:
Insert
Home
<Ctrl>+Home
<Ctrl>+End
←
and
→ toggles between insert and overwrite.
moves the cursor to the beginning of the line and the
End key to the end of line.
moves the cursor to the beginning of the program.
moves the cursor the end of the program or text.
moves the cursor one step to the left and right respectively.
291
MicroSCADA
12 SCIL Editor
292
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
<Ctrl>+
Tab
←
and <Ctrl>+
→ moves the cursor to the beginning of the next/previous word.
inserts a specified number of spaces defined by the user and moves the cursor the same number of steps to the right.
More information on shortcut keys is found by choosing Shortcut Keys from the Help menu.
Selecting Text for Editing
The whole program or parts of it can be selected for moving, copying and deleting as follows:
•
To select a word, double-click it.
•
To select a text section, place the cursor at the beginning of the section, press the mouse button and hold it down while dragging the pointer to the end of the text.
•
To select the whole program or text, press <Ctrl>+A or choose Select All from the Edit menu.
The selected text is shown in reversed colors. It can be moved, copied and deleted as described below. You can also replace text strings in the selected section.
Copying
To copy a text within the program or from one program to another:
1
Select the text you want to copy as described above.
2
Choose Copy from the Edit menu or press the <Ctrl> and C keys at the same time
(<Ctrl>+C). The text is copied to the clipboard.
3
If you want to move text from one program to another, activate the program to which you want to copy.
4
Place the cursor at the position where you want to insert the copied text.
5
Click Paste from the Edit menu or press <Ctrl>+V.
Moving Text
To move text:
1
Select the text you want to move as described above.
2
Choose Cut from the Edit menu or press <Ctrl>+X. The selection is removed from the screen and placed in the clipboard.
3
If you want to move text from one program to another, activate the program to which you want to move.
4
Click the place where you want to insert the text.
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
5
Choose Paste from the Edit menu or press <Ctrl>+V.
Deleting
To delete text:
1
Select the text you want to delete as described above.
2
Click Clear from the Edit menu or press Delete key.
The selected text disappears.
MicroSCADA
12 SCIL Editor
Commenting
A comment in a SCIL program is a line or a part of a line marked by a comment mark
(;) at the beginning. When this sign appears in a program line, the rest of the line is regarded as a comment and not executed. You can use comments, for example, to explain how the program works or to prevent the execution of a program line without deleting it permanently. The comment signs may be inserted and deleted using the ordinary text editing functions. If you wish to mark several subsequent lines as comments, you can also use the Comment and Uncomment commands of the Edit menu.
To mark a program section as comments:
1
Select the lines you want to mark as comments, see above.
2
Click Comment on the Edit menu.
A semicolon is inserted as the first character of each line in the selection.
To remove the comment marks located in the beginning of lines:
1
Select the lines from which you want to remove the comment marks.
2
Click Uncomment on the Edit menu.
All the comment marks that are located at the beginning of the lines are removed.
Semicolons located elsewhere are not removed.
Indenting
Text in paragraphs usually extends from the left margin to the right margin. A paragraph can be indented to set it off from other text. Indenting is used to increase readability of program code. Setting the measurement for indenting is done by choosing
Indent... from the Options menu. The checkbox ‘Auto-indent enabled’ means that a new line is indented according to previous line.
To indent a section:
1
Select the lines you want to indent. If no text is selected, the current line is indented.
2
Click Indent from the Edit Menu.
ABB Automation
293
MicroSCADA
12 SCIL Editor
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
To unindent a section:
1
Select the lines you want to unindent.
2
Click Unindent from the Edit Menu.
Finding Text
The Find/Replace command searches for a given text in the program. It stops when it finds the first match and shows it as a selection. To use the Find/Replace command:
1
To search a certain part of the text, select the text to be searched. Otherwise the whole document is searched. The Find or Replace operation is always started from the current cursor position.
2
Click Find/Replace from the Edit menu. The dialog box shown in Figure 22 appears. Moving the cursor is possible in the main window while the Find/Replace dialog box is open.
294
Figure 22.
You can search for text that is located somewhere in the same program using the Find/Replace command on the Edit menu.
3
In the ‘Find what:’ field, type the text you want to search for. You can either search in an upward or downward direction of the program by selecting Forwards or Backwards under Direction in the dialog. If the case of the text (upper case/lower case) is of importance, select the check box Match Case. If a text was selected in step 1, ‘Selection’ is selected under Scope.
4
Click Find First. If a matching text is found, the first match is shown selected in the text window. If no matching text is found, a dialog box saying “Text not found” appears. After the first find operation the Find First command button is replaced with Find Next command button, which can be used for finding the next occurrence. Find Next may be invoked repeatedly to search for the string until you
Close.
The Find Next operation in the main window is not possible while the Find/Replace dialog is open.
The last twenty items of the Find/Replace word lists are saved and restored when closing and opening the SCIL Editor. The lists are sorted in the chronological order, last used words first.
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
12 SCIL Editor
Replacing Text
To replace the occurrences of a text string with another one:
1
If you wish to replace the occurrences found in a certain text section, select the section. Otherwise the whole document is considered. The Find or Replace operation is always started from the current cursor position.
2
Click Find/Replace from the Edit menu. The dialog shown in Figure 23 appears.
Moving the cursor is possible in the main window while the Find/Replace dialog box is open.
ABB Automation
Figure 23.
With this dialog you can replace one text with another
3
In the first text box, type the text you want to replace, and in the second box, type the text you want to replace it with. You can also select whether the whole document or the selected text section. If the case of the text is of importance, select
Match Case. Select search direction under ‘Direction’.
4
Click Find First to find the first occurrence of the text string without replacing it immediately. After the first find operation the Find First command button is replaced with Find Next command button, which can be used for finding the next occurrence. Find Next may be invoked repeatedly to search for the string until you
Close.
5
When an occurrence to be replaced is found, click Replace. This replaces the selected text and searches the next occurrence of the text string. If the found text is edited manually in the main window during a Find or a Replace operation, clicking
Replace button replaces nothing, but the Find Next operation is performed.
Replace All replaces all occurrences of the text string.
The Find Next operation in the main window is not possible while the Find/Replace dialog is open
The last twenty items of the Find/Replace word lists are saved and restored when closing and opening the SCIL Editor. The lists are sorted in the chronological order, last used words first.
Finding Blocks
If you want to go to a certain SCIL block in the program, click Find Block in the Edit menu. The Find Block command searches for the following Block commands downwards in the program starting from the cursor:
#BLOCK .... #BLOCK_END
#LOOP ....#LOOP_END
#CASE ....#CASE_END
295
MicroSCADA
12 SCIL Editor
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
When a block is found, it is selected in the text window. To find another block, place the cursor after the command that ends the previous block and then click Find Block again.
Finding a Line
If you want to move quickly to a certain line number:
1
Click Go To Line from the Edit menu or pressing <Ctrl>+L on the keyboard.
The dialog shown in Figure 24 appears.
296
Figure 24. You can move to a certain line using this dialog.
2
In the text box, type the number of the line to which you want to move and click
OK.
If the line number is invalid, the cursor is moved to the first line and if the given line number is too big the cursor is moved to the last line.
Importing and Exporting Text
Importing text means that the contents of a text file is inserted after the current line except for the case when the cursor is located at the beginning of the text, then the text is inserted at the beginning. To import a text file:
1
Click Import… from the File menu. The file chooser dialog box appears.
2
Select the correct folder from the directory tree and click on the name of the file.
3
Click OK.
Exporting a file means that the selected or the whole text is stored in a file. To export a text:
1
Select a text if only part of the text is to be exported.
2
Click Export from the File menu. The file chooser dialog box appears with the default file name Exported.txt in the File name text box.
3
Select the correct folder from the directory tree and enter a name for the file in the
File name text box. A new folder can also be created by clicking on the Create
New Folder button ( ) above the file list.
4
Click OK.
If there is an existing file with the same name, the user is asked to confirm overwriting of the existing file.
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
12 SCIL Editor
In the file chooser four different path selection modes are supported, as described on page 205.
Undoing and Redoing Operations
Most editing operations can be cancelled using the Undo command, for example Cut,
Copy, Paste and Replace commands. When you undo typing, undo will affect all that was written since the last editing operation, for example Copy, Undo, Save.
To undo an operation, click Undo from the Edit menu.
The operations that you have cancelled using Undo, can be done again. This means that you are also able to cancel an Undo operation. To do this click Redo from the
Edit menu.
Insert SCIL Commands, Functions and Objects
This assisting tool in the SCIL editor is designed to help writing SCIL code. The dialog below appears as the Insert SCIL... command on the SCIL menu is invoked. The text box to the left in the dialog contains the different categories of commands, functions and objects. Expand the nodes in the tree by clicking the plus sign. Subcategories appear as leafs in the tree structure. Select a subcategory by clicking. When this is done commands, functions or object definition attributes appear in the text box to the right in the dialog. The desired command, function or attribute is selected by clicking.
The status bar at the bottom of the dialog displays a short description of the selected command, function or attribute.
ABB Automation
Figure 25.
The Insert SCIL Commands, Functions & Objects dialog of the SCIL editor
To insert a SCIL command:
1
Place the cursor where the command is to be inserted.
2
Click Insert SCIL on the SCIL menu.
3
Expand one of the categories by clicking the plus sign in front.
297
MicroSCADA
12 SCIL Editor
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
4
Select one of the subcategories by clicking.
5
Select a command by clicking.
6
Click Insert. The command is inserted at current cursor position. Possible arguments are replaced by the user.
7
Repeat steps 3 to 6 to insert next command or click Close to exit the tool. The cursor position may also be moved while the ‘Insert SCIL Commands, Functions
& Objects dialog’ is open.
Syntax Checking of a SCIL Program
The syntax check, independent of current cursor position, always starts at the beginning of the program. A successful syntax check displays ‘Syntax checking successful’ in a message box. The syntax check command itself does not alter the code, changes are made by the user. The first encountered invalid code is displayed in a dialog as shown in the picture below. The erroneous line is shown in the dialog and it is also made the current line of the editor. The error is corrected in the text window and then checked by clicking the Check button in the ‘SCIL Syntax Error’ dialog. If the correction passes the syntax check, the next error is displayed. This procedure continues until no more errors are found and the ‘Syntax checking successful’ message is shown. To exit the dialog while errors still exist, click Close.
298
Figure 26.
The Syntax check command shows a dialog like this, when a syntax error is encountered.
To check the syntax of a SCIL program:
1
Open a SCIL program.
2
Click Syntax Check on the SCIL menu. If an error is found a dialog showing the invalid code is displayed. If no errors are found in the program code, ‘Syntax checking successful’ is displayed.
3
The erroneous line is shown in the ‘SCIL Syntax Error’ dialog and the line is selected in the editor.
4
In the text window, correct the invalid code and click the Check button in ‘SCIL
Syntax Error’ dialog. The next found error is displayed.
5
Repeat steps 3 and 4 until ‘Syntax checking successful’ is displayed in a message box.
ABB Automation
1MRS751250-MEN
13
13.1
13.2
13.3
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
13 The SCIL Compiler
The SCIL Compiler
General
The SCIL programs of pictures and command procedures can be compiled for better performance. Compiling a SCIL program means that it is converted into an operating system independent format which is then executed by a so called virtual SCIL machine. The compiled code is stored, in addition to the original SCIL code, in the picture or in the command procedure. Once a SCIL program is compiled, the compiled version is automatically used instead of the original SCIL code. The compilation is controlled by means of the corresponding tools, picture editor and command procedure tool.
Performance Improvement
By compiling the SCIL code the interpretation time is reduced to only a fraction of the original time. The total time needed to execute a SCIL statement depends however very much on what the statement does and hereby no single performance improvement between executing uncompiled and compiled SCIL code can be given. The perfomance improvement varies between no improvement and up to 50 times faster. Two extreme cases are shown below:
The following program is 50 times faster when compiled compared to uncompiled:
#loop_with i=1..1000
#if TRUE #Then #block
#Block_End
#Loop_end
The following program is not faster when compiled compared to uncompiled:
#pause 1
The picture change time of a typical single line diagram picture built with LIB500, which is compiled, is about 2/3 of the time of the uncompiled version.
Impact on SCIL Programs
In most cases, a valid SCIL program executes exactly in the same way (apart from the speed) whether compiled or not. However, there are some rare cases that must be considered:
1
A valid SCIL program may be impossible to compile.
2
A SCIL program may compile but generates a run-time error when run by the
Virtual SCIL Machine.
3
The compiled and uncompiled program may generate different results.
Case nr 1 is the simplest one to handle as it is discovered during compilation. The program must be corrected and recompiled. Case nr 2 is more difficult, a careful retesting is required to point out the possible problems. Case nr 3 is the most difficult one. Fortunately, it is an almost academic case which is hard to encounter unless de-
299
MicroSCADA
13 The SCIL Compiler
13.3.1
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN liberately written. Because of these possible incompatibilities, a compiled SCIL program must be thoroughly retested.
In most cases, the problems arise from wild usage of variable expansions. The cases are described in more detail below. Recommendations how to avoid this kind of problems are given as well.
A compiled SCIL program may be harder to debug, because source lines are not available at run-time. The error message field in the top left corner of a picture is not able to show the erroneous SCIL line (only the line number is given). The standard error dialog of VS objects is also unable to display the line that caused the error. It is recommended that a SCIL program is first debugged uncompiled, and after that compiled to a product version.
Programs that do not Compile
There are two cases when a valid SCIL program does not compile:
•
MMI commands do not compile. MMI commands are commands that are addressed to the MMI program started by !MODULENAME command (such as the old picture editor program PICG). In normal pictures they generate an error;
896 (PICO_NO_MODULE_TO_SEND_MESSAGE). This restriction is a deliberate choice. MMI commands are needed very seldom and it is easy to write a
MMI command by mistake, e.g. by omitting character # or @ at the beginning of a line.
•
Variable expansions are used in a way that hides the program structure from the reader.
Examples of the second case:
Example 1:
@CONDITION = "#IF A == B"
’A’ #THEN .DO_SOMETHING
Example 2:
@END = "_END"
#BLOCK
.DO_SOMETHING
#BLOCK’END’
Example 3:
@A = "1 + "
@B = ’A’ 2
13.3.2
300
Programs that Generate Run-time Error
There are two cases when a program runs without errors when uncompiled but not when compiled:
•
Alias checking is always performed by the Virtual SCIL Machine regardless of the revision compatibility switch (NO_ALIAS_CHECKING). The SCIL pro-
ABB Automation
1MRS751250-MEN
13.3.3
13.3.4
ABB Automation
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
13 The SCIL Compiler gram design must be corrected to enable compilation if the compiled program fails with error code 580 (SCIL_VARIABLE_ALIASING_ERROR).
•
Variable expansions are used in a way that hides certain syntactical language elements from the reader.
It is impossible to list all the examples of the second case, but here are some:
Example 1:
@V = "AI(%INDEX)"
@POWER = OBJECT:P’V’ ;Index expression hidden
This one works:
@V = "AI5"
@POWER = OBJECT:P’V’
Example 2:
@A = 1
@B = 2
@C = ’A’.’B’ ;The compiler assumes that the right hand
;expression is a VS object or window attribute
;reference
Programs that Produce Wrong Results
If variable expansions are used in a way that hides the correct evaluation order of an expression, the results of compiled and uncompiled program may be different.
Example:
@A = "1 + 2"
@B = "3 + 4"
@C = ’A’ * ’B’
As uncompiled, the meaning of the third line is
@C = 1 + 2 * 3 + 4 after the expansions, which is evaluated as 1 + ( 2 * 3 ) + 4 = 11.
The compiler ’relies on what it sees’, it generates byte code which expands and evaluates A first, then B and finally multiplies the two. The result is (1 + 2) * (3 + 4) = 21.
Recommendations
To avoid the potential problems described above ( and to make SCIL programs more readable ), following recommendations on the use of variable expansions may be given:
•
Use direct variable access instead of expansion whenever possible.
Instead of ’A’ + ’B’, write %A + %B.
Instead of "’A’", write %A ( if A has a text value ).
301
MicroSCADA
13 The SCIL Compiler
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Instead of "X’A’Z", write "X" + %A + "Z" ( if A has a text value ).
As another advantage, the direct variable access is faster than expansion even in uncompiled programs.
•
Use variable expansion mainly for generating various identifiers.
Examples of ’good’ usage of expansions might be:
#SET ’LN’:PBO1 = 1 ;As an object name
#SET ABC’POSTFIX’:PBO1 = 1 ;As a part of an object name
@OLD_ERROR_STATE = ERROR_STATE
#ERROR IGNORE
.DO_SOMETHING
#ERROR ’OLD_ERROR_STATE’ ;As a command keyword value
.SET ’DIALOG’\BUTTON.TITLE = "Push me"
!NEW_PIC ’NEXT_PICTURE’ ;As a picture name
;As a VS object name
When variable expansions are used as recommended above, the compiled and uncompiled program always behave identically. Even most cases of other ’non-pathological’
(or even ’pathological’) use of expansions work as they are expected.
Examples of such cases:
@V = "PBO1"
#SET OBJECT:’V’ = 1
@V = "OBJECT:PBO1"
#SET ’V’ = 1
@V = "DIALOG\BUTTON"
.SET ’V’.TITLE = "Push me"
.SET ’V’_2.TITLE = "Push me too"
@NAME = "ABC"
@’NAME’ = %’NAME’ + 1
302 ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
Index
Index
Page
A
ABS....................................................................................................................................126
absolute value.....................................................................................................................126
accuracy................................................................................................................................20
ADD_INTERLOCKED .....................................................................................................228
addition...........................................................................................................................57, 58 alarm buffer ..........................................................................................................................32
alarm list...............................................................................................................................33
alarm picture.........................................................................................................................69
alarm picture queue ..............................................................................................................69
AM .....................................................................................................................................249
AND .....................................................................................................................................62
APL ................................................................................................................................28, 29
APPEND ............................................................................................................................144
application ......................................................................................................................27, 31 application engineering ..........................................................................................................1
application objects................................................................................................................25
APPLICATION_OBJECT_ATTRIBUTES.......................................................................165
APPLICATION_OBJECT_COUNT .................................................................................161
APPLICATION_OBJECT_LIST.......................................................................................162
arc.......................................................................................................................240, 241, 249
ARC ...........................................................................................................................240, 241
ARC_MODE......................................................................................................................249
ARCCOS............................................................................................................................126
ARCSIN .............................................................................................................................126
ARCTAN ...........................................................................................................................126
argument.......................................................................................................................55, 120
ARGUMENT .....................................................................................................................177
ARGUMENT_COUNT .....................................................................................................177
arguments .....................................................................................................................66, 177
ARGUMENTS ...................................................................................................................177
arithmetical operator ............................................................................................................56
ASCII .................................................................................................................................133
ASCII_CODE ....................................................................................................................133
assignment ............................................................................................................................49
attribute ..............................................................................................................24, 26, 27, 31
Audio alarms ......................................................................................................................228
AUDIO_ALARM...............................................................................................................228
B
BACKGROUND................................................................................................................249
background color................................................................................................................249
background program ............................................................................................................10
base system object ..........................................................................................................26, 28
BCD_TO_INTEGER .........................................................................................................133
BG ......................................................................................................................................249
BIN.....................................................................................................................................134
ABB Automation
MicroSCADA
Index
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
BIN_SCAN........................................................................................................................ 136
BIT..................................................................................................................................... 141 bit function......................................................................................................................... 140 bit string ....................................................................................................................... 22, 140 bit string. .............................................................................................................................. 19
BIT_AND .......................................................................................................................... 141
BIT_CLEAR...................................................................................................................... 142
BIT_COMPL ..................................................................................................................... 142
BIT_MASK ....................................................................................................................... 142
BIT_OR ............................................................................................................................. 141
BIT_SCAN ........................................................................................................................ 134
BIT_SET............................................................................................................................ 143
BIT_STRING .................................................................................................................... 143
BIT_XOR .......................................................................................................................... 141
BLOCK................................................................................................................................ 83
BLOCK_END...................................................................................................................... 83
Boolean .......................................................................................................................... 21, 61 box ..................................................................................................................................... 241
BOX................................................................................................................................... 241 byte string ............................................................................................................................ 23
C
calendar time...................................................................................................................... 131
Canceling in SCIL Program Editor .................................................................................... 293 canvas ........................................................................................ 239, 240, 244, 246, 259, 263
CANVAS ........................................................................................................................... 259
CANVAS CURRENT........................................................................................................ 259
CANVAS PARENT........................................................................................................... 259
CANVAS ROOT ............................................................................................................... 259
CAP_STYLE ............................................................................................................. 249, 250
CAPITALIZE .................................................................................................................... 135
CASE ................................................................................................................................... 83
CASE_END ......................................................................................................................... 83 characters ............................................................................................................................. 16
Child object.......................................................................................................................... 45 circle .................................................................................................................................. 242
CIRCLE ............................................................................................................................. 242
CLASSIFY......................................................................................................................... 144
CLOCK.............................................................................................................................. 129
Close .................................................................................................................................. 287
CLOSE................................................................................................................................. 68
CLOSE_FILE .................................................................................................................... 105
COLLECT ......................................................................................................................... 144 color ........................................................................................................................... 251, 254
COLOR...................................................................................................................... 254, 255
COLOR_IN........................................................................................................................ 258 command................................................................................................................................ 5
OR .................................................................................................................................. 88
command procedure................................................................................................. 12, 30, 36 commands ............................................................................................................................ 55
Comment Mark .................................................................................................................. 289
Commenting in SCIL Program Editor................................................................................ 289 comments ............................................................................................................................. 15 communication function..................................................................................................... 182 communication system object ........................................................................................ 27, 29
Communication System Objects .......................................................................................... 29 communication unit.............................................................................................................. 29
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
Index communication units ............................................................................................................27
COMPILE ..........................................................................................................................177
component ..........................................................................................................247, 248, 256 components ........................................................................................................239, 254, 258 conditional statement............................................................................................................85
CONSOLE_OUTPUT........................................................................................................229
constant ................................................................................................................................49
CONTINUE .......................................................................................................................100
control command..................................................................................................................65
coordinate system...............................................................................................................239
COORDINATE_SYSTEM ................................................................................................259
Copying in SCIL Program Editor.......................................................................................288
COS....................................................................................................................................128
cosine .........................................................................................................................126, 128
Create .................................................................................................................................286
CREATE ..............................................................................................................90, 112, 266
CREATE_FILE..................................................................................................................106
CREATE_MANAGED ......................................................................................................266
CS.......................................................................................................................................249
CSR_BOL ............................................................................................................................79
CSR_EOL ............................................................................................................................79
CSR_LEFT...........................................................................................................................79
CSR_RIGHT ........................................................................................................................79
CUMULATE......................................................................................................................145
CURRENT .................................................................................................................246, 247
CURSOR_POS ....................................................................................................................53
D
DASH_LIST ......................................................................................................................250
DASH_OFFSET ................................................................................................................251
dashed line..........................................................................................................................250
data object ................................................................................................................13, 30, 35 data type .......................................................................................................19, 120, 225, 270
DATA_FETCH ..................................................................................................................169
DATA_STORE ..................................................................................................................170
DATA_TYPE.....................................................................................................................225
DATE .................................................................................................................................129
date and time ......................................................................................................................132
DAY ...................................................................................................................................129
Day of Week ......................................................................................................................129
Day of Year ........................................................................................................................130
DCP-NET...........................................................................................................................182
DDE client..........................................................................................................................204
DDE protocol ...............................................................................................................14, 209
DDE Server ........................................................................................................................209
DDE_CONNECT...............................................................................................................205
DDE_DISCONNECT ........................................................................................................206
DDE_EXECUTE ...............................................................................................................208
DDE_POKE .......................................................................................................................208
DDE_REAL .......................................................................................................................210
DDE_REQUEST................................................................................................................207
DDE_VECTOR..................................................................................................................210
debugging ...........................................................................................................................224
DEC....................................................................................................................................135
DEC_SCAN .......................................................................................................................136
default path names..............................................................................................................103
DELETE...............................................................................................................90, 113, 268
ABB Automation
MicroSCADA
Index
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
E
DELETE_ELEMENT........................................................................................................ 146
DELETE_FILE.................................................................................................................. 106
DELETE_PARAMETER .................................................................................................. 176
Deleting in SCIL Program Editor ...................................................................................... 289 dialog systems ...................................................................................................................... 45 dialogs.................................................................................................................................... 1
DIRECTORY_MANAGER COPY ................................................................................... 187
DIRECTORY_MANAGER COPY CONTENTS ............................................................. 188
DIRECTORY_MANAGER CREATE .............................................................................. 186
DIRECTORY_MANAGER DELETE............................................................................... 186
DIRECTORY_MANAGER DELETE_CONTENTS........................................................ 186
DIRECTORY_MANAGER EXISTS ................................................................................ 187
DIRECTORY_MANAGER GET_ATTRIBUTES ........................................................... 189
DIRECTORY_MANAGER LIST ..................................................................................... 186
DIRECTORY_MANAGER MOVE .................................................................................. 189
DIRECTORY_MANAGER RENAME ............................................................................. 189
DIV ................................................................................................................................ 57, 60 division .......................................................................................................................... 57, 59
DL...................................................................................................................................... 250
DO ....................................................................................................................... 84, 178, 251
DOW.................................................................................................................................. 129
DOY................................................................................................................................... 130 draw program....................................................................................................................... 10
DRIVE_MANAGER EXISTS........................................................................................... 190
DRIVE_MANAGER GET_ATTRIBUTES ...................................................................... 190
DRIVE_MANAGER GET_DEFAULT ............................................................................ 190
DRIVE_MANAGER LIST................................................................................................ 190
DUMP................................................................................................................................ 229
EDIT .................................................................................................................................. 135 element................................................................................................................................. 23
ELEMENT_LENGTH..................................................................................................... 145 ellipse................................................................................................................................. 242
ELLIPSE............................................................................................................................ 242
ELSE.................................................................................................................................... 85
ELSE_IF .............................................................................................................................. 85
END_QUERY ................................................................................................................... 166 endpoints............................................................................................................................ 249
ENTER ................................................................................................................................ 79
ENTER_POS ....................................................................................................................... 54
ENVIRONMENT............................................................................................................. 229
EQUAL.............................................................................................................................. 126 equal to ................................................................................................................................ 61
ERASE................................................................................................................................. 73
ERROR CONTINUE......................................................................................................... 100
ERROR EVENT ................................................................................................................ 100 error handling policy.......................................................................................................... 100
ERROR IGNORE .............................................................................................................. 100
ERROR RAISE.................................................................................................................. 101
ERROR STOP ................................................................................................................... 100
ERROR_STATE .............................................................................................................. 179
EVALUATE ..................................................................................................................... 229
EVEN................................................................................................................................. 128
EVENT .............................................................................................................................. 100 event channel ................................................................................................................. 30, 38 event list............................................................................................................................... 33
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
Index event object ....................................................................................................................30, 39
EXEC .............................................................................................................................36, 91
EXEC_AFTER.....................................................................................................................92
Execute...............................................................................................................................205
execution time ......................................................................................................................38
exit program .........................................................................................................................10
EXP ....................................................................................................................................127
exponent ...............................................................................................................................60
exponential operator.............................................................................................................57
exponents..............................................................................................................................19
Export.................................................................................................................................292
expression.................................................................................................................19, 50, 75 expressions .......................................................................................................................5, 52
F
FALSE..................................................................................................................................21
FAST_PIC............................................................................................................................68
FETCH ...............................................................................................................................166
FG ..............................................................................................................................251, 255 fictitious process objects ......................................................................................................32
file ......................................................................................................................................106
FILE_LOCK_MANAGER.................................................................................................199
FILE_MANAGER COPY..................................................................................................192
FILE_MANAGER DELETE .............................................................................................192
FILE_MANAGER EXISTS...............................................................................................192
FILE_MANAGER GET_ATTRIBUTES ..........................................................................193
FILE_MANAGER LIST ....................................................................................................191
FILE_MANAGER MOVE.................................................................................................193
FILE_MANAGER RENAME............................................................................................193
Finding ...............................................................................................................................290
FLUSH ...............................................................................................................................263
FM_APPLICATION_DIRECTORY .................................................................................195
FM_COMBINE..................................................................................................................197
FM_COMBINE_NAME ....................................................................................................198
FM_DIRECTORY .............................................................................................................194
FM_DRIVE........................................................................................................................194
FM_EXTRACT..................................................................................................................198
FM_FILE ...........................................................................................................................195
FM_REPRESENT..............................................................................................................196
FM_SCIL_DIRECTORY...................................................................................................195
FM_SCIL_FILE .................................................................................................................196
FM_SCIL_REPRESENT ...................................................................................................197
FM_SPLIT_NAME............................................................................................................199
font .............................................................................................................................251, 256
FONT .................................................................................................................251, 256, 258 font number ........................................................................................................................256
FOREGROUND.................................................................................242, 245, 251, 253, 254 format picture .......................................................................................................................98
free type object.....................................................................................................................31
FT .......................................................................................................................................251
FU ......................................................................................................................................252
function ........................................................................................................................55, 120
FUNCTION ...............................................................................................252, 254, 262, 263 function call........................................................................................................................120
function key program ...........................................................................................................10
functions .................................................................................................................................5
ABB Automation
MicroSCADA
Index
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
G
H
GC.............................................................................................................................. 247, 258
GET ..................................................................................................................................... 93
GET_STATUS .................................................................................................................. 230
GIF_PIXMAP.................................................................................................................... 274 global variable ..................................................................................................................... 35 global variables .................................................................................................................... 50
Go To................................................................................................................................. 292 graphical element ....................................................................................... 239, 240, 248, 258 graphics command ....................................................................................................... 65, 259 graphics commands.................................................................................................... 239, 247 graphics context ......................................................................... 239, 246, 247, 248, 254, 258 graphics contexts................................................................................................ 240, 256, 263 greater than .......................................................................................................................... 61 greater than or equal to ........................................................................................................ 61 group .................................................................................................................................... 34
HEADER ............................................................................................................................. 80
HELP ................................................................................................................................... 80
HEX ................................................................................................................................... 136
HEX_SCAN....................................................................................................................... 136
HIGH ................................................................................................................................. 146
HIGH_INDEX ................................................................................................................... 146 history buffer........................................................................................................................ 33
HISTORY_DATABASE_MANAGER CLOSE................................................................ 154
HISTORY_DATABASE_MANAGER GET_PARAMETERS ........................................ 158
HISTORY_DATABASE_MANAGER OPEN.................................................................. 153
HISTORY_DATABASE_MANAGER QUERY .............................................................. 159
HISTORY_DATABASE_MANAGER READ ................................................................. 160
HISTORY_DATABASE_MANAGER SET_ATTRIBUTES........................................... 157
HISTORY_DATABASE_MANAGER SET_COMMENT............................................... 160
HISTORY_DATABASE_MANAGER SET_CONDITION............................................. 157
HISTORY_DATABASE_MANAGER SET_DIRECTION.............................................. 156
HISTORY_DATABASE_MANAGER SET_DIRECTORY ............................................ 155
HISTORY_DATABASE_MANAGER SET_ORDER...................................................... 156
HISTORY_DATABASE_MANAGER SET_PERIOD..................................................... 154
HISTORY_DATABASE_MANAGER SET_TIMEOUT ................................................. 157
HISTORY_DATABASE_MANAGER SET_WINDOW ................................................. 155
HISTORY_DATABASE_MANAGER WRITE ............................................................... 161
HOD................................................................................................................................... 130
HOUR ................................................................................................................................ 130 hours of day ....................................................................................................................... 130 hours of year ...................................................................................................................... 130
HOY................................................................................................................................... 130
HR_CLOCK ...................................................................................................................... 130
I
identifiers ............................................................................................................................. 17
IF 85
IGNORE ............................................................................................................................ 100
Import ................................................................................................................................ 292
IND ...................................................................................................................................... 28 index ............................................................................................................ 23, 27, 31, 34, 52 indexing ............................................................................................................................... 23
INIT_QUERY.............................................................................................................. 95, 168
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
Index initialization time..................................................................................................................38
INPUT_KEY........................................................................................................................79
INPUT_POS ........................................................................................................................80
INPUT_VAR .......................................................................................................................81
Inserting SCIL commands, functions and objects ..............................................................293
INT_PIC...............................................................................................................................69
integer...................................................................................................................................19
INTEGER_TO_BCD .........................................................................................................137
INTERP..............................................................................................................................147
INVERSE...........................................................................................................................147
item.......................................................................................................................................14
Item name...........................................................................................................................205
J
JOIN_STYLE.............................................................................................................251, 253
JS 253
K
KEY_POS ............................................................................................................................54
KEYED_FILE_MANAGER..............................................................................................200
L
M
LAST_PIC ...........................................................................................................................69
LENGTH............................................................................................................................230
less than................................................................................................................................61
less than or equal to ..............................................................................................................61
level parameter ...............................................................................................................72, 76
LIB500 ...................................................................................................................................1
library representation............................................................................................................78
LIN .......................................................................................................................................28
line......................................................................................................................243, 250, 253
LINE...................................................................................................................................243
LINE_STYLE ....................................................................................................................253
LINE_WIDTH ...................................................................................................................253
list...................................................................................................................................19, 24
LIST .......................................................................................................................24, 98, 231
LIST_ATTR.......................................................................................................................231
LN ......................................................................................................................................127
LOAD.................................................................................................................................113
LOAD_DCP .......................................................................................................................182
LOCATE ............................................................................................................................138
logical names........................................................................................................................17
logical operator ..............................................................................................................56, 62 logical path name ...............................................................................................................102
logical representation library name ....................................................................................104
LOOP ...................................................................................................................................86
LOOP_END ...................................................................................................................86, 87
LOOP_EXIT ........................................................................................................................88
LOOP_WITH.......................................................................................................................87
LOW...................................................................................................................................146
LOW_INDEX ....................................................................................................................146
LOWER_CASE .................................................................................................................135
LS .......................................................................................................................................253
LW .....................................................................................................................................253
main picture..........................................................................................................................10
ABB Automation
MicroSCADA
Index
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
MAX .................................................................................................................................. 127
MEAN................................................................................................................................ 148
MEMORY_POOL_USAGE.............................................................................................. 232
MEMORY_USAGE .......................................................................................................... 232 method ......................................................................................................................... 11, 268 method calls ......................................................................................................................... 48 methods................................................................................................................................ 26
MIN ................................................................................................................................... 127
MINUTE............................................................................................................................ 130 mix ............................................................................................................................. 254, 255
MOD .............................................................................................................................. 57, 60
MODIFY.............................................................................................................. 93, 114, 267
MON .................................................................................................................................... 28 monitor................................................................................................................................. 68
MONITOR................................................................................................................. 246, 247 month ................................................................................................................................. 131
MONTH............................................................................................................................. 131
Motif .................................................................................................................................. 265
Motif Widget ..................................................................................................................... 266
Motif widget commands ...................................................................................................... 65
MOUSE ............................................................................................................................. 261 mouse input........................................................................................................................ 261
MOUSE OFF ..................................................................................................................... 262
MOUSE ON............................................................................................................... 261, 262
Moving in SCIL Program Editor........................................................................................ 288 multiplication .................................................................................................................57, 59
N
O
NA ..................................................................................................................................... 254 name............................................................................................................................... 27, 31
NAME................................................................................................................................ 254 named program ........................................................................................................ 10, 43, 44 natural logarithm................................................................................................................ 127
NET ..................................................................................................................................... 29
New Folder ................................................................................................................ 287, 292
NEW_PIC ............................................................................................................................ 70
NEXT................................................................................................................................. 167
NOD............................................................................................................................... 28, 29
Notify windows.................................................................................................................. 229 object ......................................................................................................................... 5, 30, 90 object notation ............................................................................................................... 27, 31 object query ......................................................................................................................... 95 objects.................................................................................................................................. 25
OCT ................................................................................................................................... 138
OCT_SCAN....................................................................................................................... 136 octal form............................................................................................................................. 19 octal number ........................................................................................................................ 19
ODBC functions................................................................................................................. 210
ODD................................................................................................................................... 128
ON ......................................................................................................................... 39, 88, 101
ON ERROR ....................................................................................................................... 101
ON KEY_ERROR ............................................................................................................. 101
OPEN_FILE ...................................................................................................................... 107 operands......................................................................................................................... 55, 59 operator.............................................................................................................. 55, 56, 62, 63
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
Index
OPS_CALL ........................................................................................................................179
OPS_PROCESS .................................................................................................................180
OR ........................................................................................................................................62
OTHERWISE.......................................................................................................................83
P
PACK _TIME ....................................................................................................................131
PACK_STR........................................................................................................................225
parameter files ....................................................................................................................175
PARENT ....................................................................................................................246, 247
Parent object.........................................................................................................................45
PARSE_FILE_NAME .......................................................................................................202
part picture ...........................................................................................................................10
PATH .........................................................................................................................102, 203
PATHS ...............................................................................................................................203
PAUSE .................................................................................................................................89
PEND OFF .................................................................................................................263, 264
PEND ON ..................................................................................................................263, 264 pending...............................................................................................................................263
peripherals equipment ..........................................................................................................29
PHYS_FETCH...................................................................................................................167
PIC_NAME..........................................................................................................................53
PICK ..................................................................................................................120, 148, 151 picture...................................................................................................................................77
Picture commands ................................................................................................................65
Picture Editor .......................................................................................................................10
picture handling commands..................................................................................................67
picture path...........................................................................................................................42
picture programs...................................................................................................................10
picture queue ........................................................................................................................71
pictures .............................................................................................................................1, 41
PIXMAP.............................................................................................................................273
point ...................................................................................................................................244
POINT................................................................................................................................244
Poke....................................................................................................................................204
polygon...............................................................................................................................244
polyline.......................................................................................................................244, 245
POLYLINE ................................................................................................................244, 245
POP ....................................................................................................................................263
predefined picture variable...................................................................................................53
PREV .................................................................................................................................167
PRI .................................................................................................................................28, 29
PRINT ..................................................................................................................................99
PRINT_TRANSPARENT..................................................................................................220
PRINTER_SET ..................................................................................................................223
printout ...................................................................................................................98, 99, 220 printout function .................................................................................................................220
process database ...................................................................................................................31
process object.......................................................................................................................30
process objects .....................................................................................................................32
process queries .....................................................................................................................32
process query........................................................................................................................95
PROD_QUERY .................................................................................................................168
PROGRAM ..........................................................................................................................80
PUSH .................................................................................................................................263
ABB Automation
MicroSCADA
Index
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
R
RANDOM.......................................................................................................................... 233
READ ................................................................................................................................ 108
READ_BYTES.................................................................................................................. 172
READ_COLUMNS ........................................................................................................... 172
READ_KEYS .................................................................................................................... 108
READ_NEXT.................................................................................................................... 109
READ_PARAMETER .............................................................................................. 124, 176
READ_PREV .................................................................................................................... 109
READ_TEXT .................................................................................................................... 174 read-only ............................................................................................................................ 286 real ................................................................................................................................. 19, 20
RECALL_PIC...................................................................................................................... 71
Redoing in SCIL Editor ..................................................................................................... 293 relational operator .......................................................................................................... 56, 61 remote terminal unit ............................................................................................................. 30
REMOVE .......................................................................................................................... 110
REMOVE_DUPLICATES ................................................................................................ 149
RENAME_FILE ................................................................................................................ 110
REP_LIB ................................................................................................................... 104, 203
REP_LIBS ......................................................................................................................... 203
Replace .............................................................................................................................. 291
REPLACE.......................................................................................................................... 139
Replacing in SCIL Program Editor .................................................................................... 290 report database ..................................................................................................................... 31 reporting object.................................................................................................................... 31
Request .............................................................................................................................. 204
RESET ................................................................................................................................. 82 resource.............................................................................................................................. 269 resource data types............................................................................................................. 271 resourcesœ ......................................................................................................................... 265
RESTORE............................................................................................................................ 71 result .................................................................................................................................. 120
RETURN ............................................................................................................................. 89
REVERSE.......................................................................................................................... 149
REVISION_COMPATIBILITY........................................................................................ 233
ROOT ........................................................................................................................ 246, 247
ROUND ............................................................................................................................. 128
RTU ............................................................................................................................. 30, 216
RTU function ..................................................................................................................... 216
RTU_ADDR ...................................................................................................................... 217
RTU_AINT........................................................................................................................ 217
RTU_AREAL .................................................................................................................... 218
RTU_ATIME..................................................................................................................... 218
RTU_BIN .......................................................................................................................... 218
RTU_HEXASC ................................................................................................................. 218
RTU_INT........................................................................................................................... 219
RTU_KEY ......................................................................................................................... 219
RTU_MSEC ...................................................................................................................... 219
RTU_OA............................................................................................................................ 219
RTU_REAL ....................................................................................................................... 220
RTU_TIME ....................................................................................................................... 220
RUBOUT............................................................................................................................. 81
RUBOUT_BOL................................................................................................................... 81
RUBOUT_CUR................................................................................................................... 81
RUBOUT_EOL ................................................................................................................... 81
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
Index
S
Save....................................................................................................................................287
scale................................................................................................................................30, 34
SCALE ...............................................................................................................................234
SCALING ..........................................................................................................................261
scaling factor ..............................................................................................239, 259, 261, 263
SCIL .......................................................................................................................................1
SCIL compiler ....................................................................................................................177
SCIL coordinate .................................................................................................................260
SCIL defined printout.........................................................................................................221
SCIL Editor ........................................................................................................................281
SCIL program.......................................................................................................................15
SCIL Program Editor .....................................................................................................9, 288
SCIL_HOST.......................................................................................................................234
scope ..................................................................................................................................247
SEARCH ......................................................................................................................96, 167
Searching............................................................................................................................290
SECOND............................................................................................................................130
SELECT .............................................................................................................................149
Selecting Text.....................................................................................................................288
SEND_PIC ...........................................................................................................................82
SEPARATE........................................................................................................................139
service ..................................................................................................................................14
Service name ......................................................................................................................205
SET ........................................................................................................................32, 94, 115
SET_CLOCK .....................................................................................................................131
SET_STATUS ...................................................................................................................235
SET_TIME.........................................................................................................................111
SHADOW_FILE................................................................................................................204
SHOW ..................................................................................................................................73
SHOW_BACK .....................................................................................................................74
SHUFFLE ..........................................................................................................................233
SIN .....................................................................................................................................128
sine .............................................................................................................................126, 128 snapshot variables ................................................................................................................50
SORT .................................................................................................................................150
SPACOM ...........................................................................................................................182
SPREAD ............................................................................................................................151
SQL ....................................................................................................................................210
SQL statement ....................................................................................................................213
SQL_BEGIN_TRANSACTION ........................................................................................215
SQL_COMMIT..................................................................................................................216
SQL_CONNECT ...............................................................................................................211
SQL_DISCONNECT .........................................................................................................212
SQL_EXECUTE ................................................................................................................213
SQL_FETCH......................................................................................................................213
SQL_FREE_STATEMENT...............................................................................................214
SQL_ROLLBACK .............................................................................................................216
SQRT .................................................................................................................................128
square root..........................................................................................................................128
STA ................................................................................................................................28, 29 stacking order .......................................................................................................................72
start program ........................................................................................................................10
statement ............................................................................................................................4, 5 statements ...............................................................................................................................5
station ...................................................................................................................................30
ABB Automation
MicroSCADA
Index
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
STATUS .................................................................................................... 127, 148, 152, 180 status code.............................................................................................. 35, 56, 101, 230, 235
STOP ................................................................................................................................. 100
STORE_PIC ........................................................................................................................ 71 string function .................................................................................................................... 133
STY...................................................................................................................................... 28 sub-picture ........................................................................................................................... 10 subroutine ............................................................................................................................ 84
SUBSTR ............................................................................................................................ 140 subtraction...................................................................................................................... 57, 58
SUM................................................................................................................................... 151
SUM_NEG ........................................................................................................................ 152
SUM_POS ......................................................................................................................... 152
Syntax check ...................................................................................................................... 294
SYS ...................................................................................................................................... 28 system objects ...................................................................................................................... 25
System Objects..................................................................................................................... 26 system time ........................................................................................................................ 131
T
U
tangent................................................................................................................................ 126 text ......................................................................................................................... 19, 22, 245
TEXT ................................................................................................................................. 245
Text Selecting .................................................................................................................... 288
THEN................................................................................................................................... 85 time ................................................................................................................................ 19, 21
TIME ................................................................................................................................. 131 time channel ................................................................................................................... 13, 30 time channels ....................................................................................................................... 37 time function ...................................................................................................................... 129 time of day ......................................................................................................................... 132 time stamp............................................................................................................................ 35 time-out.............................................................................................................................. 183
TIMEOUT ......................................................................................................................... 183
TIMES ............................................................................................................................... 131
TOD ................................................................................................................................... 132
TODS................................................................................................................................. 132
TOGGLE_MOD .................................................................................................................. 82 topic ..................................................................................................................................... 14
Topic name ........................................................................................................................ 205
TRACE_BEGIN ................................................................................................................ 224
TRACE_END .................................................................................................................... 224
TRACE_PAUSE................................................................................................................ 224
TRACE_RESUME ............................................................................................................ 224 tracing. ............................................................................................................................... 261
TRANSLATE .................................................................................................................... 236 transparent printout ............................................................................................................ 221
TREND .............................................................................................................................. 152
TRUE................................................................................................................................... 21
TRUNC.............................................................................................................................. 128 type ................................................................................................................................ 27, 31
Type ................................................................................................................................... 287
TYPE_CAST ..................................................................................................................... 227
Uncommenting................................................................................................................... 289
Undo .................................................................................................................................. 287
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
Index
Undoing in SCIL Program Editor.......................................................................................293
unequal .................................................................................................................................61
UNPACK_STR ..................................................................................................................226
UPDATE..............................................................................................................................72
update program.....................................................................................................................10
update time interval ..............................................................................................................72
UPPER_CASE ...................................................................................................................135
USER .........................................................................................................................246, 247 user interface objects............................................................................................................25
User Interface Objects..........................................................................................................41
V
X
XOR .....................................................................................................................................62
Y
value ...................................................................................................................................120
variable.......................................................................................................................5, 23, 49
Variable Assignment ............................................................................................................50
variable expansion................................................................................................................53
variable name .......................................................................................................................50
variable object ................................................................................................................31, 40 vector..............................................................................................................................19, 23
VECTOR............................................................................................................................152
vector aggregate .............................................................................................................23, 51 vector function....................................................................................................................143
vector variable......................................................................................................................52
WEEK ................................................................................................................................132
WHEN..................................................................................................................................83
VIDEO_NR..........................................................................................................................53
widget.................................................................................................................................265
widget methods...................................................................................................................268
widget resource ..................................................................................................................269
widget.method ....................................................................................................................268
WIN_BG_COLOR...............................................................................................................74
WIN_CREATE ....................................................................................................................75
WIN_INPUT........................................................................................................................75
WIN_NAME ........................................................................................................................76
WIN_PIC .............................................................................................................................77
WIN_POS ............................................................................................................................77
WIN_REP ............................................................................................................................78
window...........................................................................................................................72, 73 window level ........................................................................................................................72
Visual SCIL............................................................................................................................1
Visual SCIL Commands.......................................................................................................65
Visual SCIL objects .....................................................................................................44, 111 word ...................................................................................................................................140
workstation ...........................................................................................................................29
WORKSTATION_CALL ..................................................................................................181
WRITE ...............................................................................................................................111
WRITE_BYTES ................................................................................................................172
WRITE_COLUMNS..........................................................................................................173
WRITE_PARAMETER .....................................................................................................175
WRITE_TEXT...................................................................................................................175
YEAR.................................................................................................................................132
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
Appendix A
App. A. NEW SCIL FEATURES IN VERSION 8.4
About this Appendix
This appendix presents a summary of new SCIL features introduced in MicroSCADA version 8.4., related to version 8.2. It also presents some compatibility notes for you who are updating a MicroSCADA application from version 8.2. to 8.4..
Overview of New Features
User Interface Design
MicroSCADA version 8.4 introduces a new method for user interface design, the Visual SCIL method. In SCIL, the new method implicates the introduction of a new object category, the Visual SCIL objects. The Visual SCIL objects are handled by a set of new SCIL commands, the Visual SCIL commands.
The Visual SCIL method is described in the manual Visual SCIL, User Interface Design.
DDE Client/Server Communication
MicroSCADA now supports data exchange with other Windows applications, namely those Windows applications that support the DDE (Dynamic Data Exchange) protocol. Most Windows applications support this protocol. By using DDE a Micro-
SCADA application can read and write data produced by applications such as Microsoft Excel and Word. Likewise, external Windows applications can access Micro-
SCADA applications. In the former case, MicroSCADA works as a client, and in the latter case as a server. The MicroSCADA client communication is implemented through a number of SCIL functions (the DDE Client functions in chapter 8). The MicroSCADA server communication is effectuated by using the DDE functions of the external applications. In MicroSCADA, the data handling is supported by two SCIL functions (the DDE Server functions in chapter 8).
SQL Communication
MicroSCADA supports the access to external databases and applications by means of
SQL statements. Hence, a MicroSCADA application can access databases developed with database management systems such as Access, Oracle and Paradox. Micro-
SCADA uses the ODBC (Open database connectivity) interface and the database access is implemented by means of a number of SCIL functions (the ODBC functions).
Variable and Function Names
Variable names may be up to 63 characters long. Likewise, command and function names may be up to 63 characters long.
ABB Automation
MicroSCADA
Appendix A
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Data Types
A new simple data type has been implemented: byte string. Data of type byte string can be used in additions, and two byte strings can be compared with relational operators. By means of SCIL functions, texts or bit strings can be transformed to byte strings, and vice versa.
Vector Handling
Data of vector type can be created with a new SCIL function, namely the VECTOR function. This enables the programmer to easily create empty and single element vectors. Another new vector function, DELETE_ELEMENT, enables the deletion of individual vector elements in a vector. Text vectors can be created from data of text type and transformed to data of text type using new SCIL functions, SEPARATE and
COLLAPSE.
Window Handling
Windows can now have attributes which are defined and assigned values by a SCIL command (.SET). The window attributes are accessed by means of attribute references which may be used as operands in SCIL expressions.
Windows can be shown on specified levels in relation to other windows. The level is set by a new SCIL command, !WIN_LEVEL.
The creation of new windows using SCIL has been improved by a new command,
!WIN_CREATE.
Variable Expansion
Besides variables, the variable object attributes and the user interface attributes (picture attributes and Visual SCIL object attributes) can be used in variable expansion.
Program Arguments and Return Values
A new command, #RETURN, makes it possible to build programs that return values.
This possibility applies to named programs, methods (the programs of the Visual
SCIL objects) and programs executed with the new SCIL function DO. The programs can be assigned arguments (input data) which are used in the evaluation of the return value. New SCIL functions (the ARGUMENT functions) have been implemented for reading the arguments.
The named program and method calls, like the DO function, can be included as operands in expressions where the return value replaces the program call. Hence, they can be used as user defined SCIL functions.
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
Appendix A
Error Handling
The standard error messages shown in the upper left corner of pictures can now be avoided. Each picture may contain a named program with predefined name,
ERROR_HANDLER, where the programmer can define the error handling to be used in the picture. The ERROR_HANDLER program receives information about the errors.
Reading and Writing Files
Two new SCIL functions (READ_BYTES and WRITE_BYTES) enable importing and exporting binary (non-ASCII) data between MicroSCADA and other applications.
Graphics Primitives
It is now possible to easily reset the graphics contexts to default values.
Color handling has been improved in order to avoid the color palette from becoming full.
The .MOUSE command has been given a new keyword, RELATIVE, which enables the programmer to relate it to the current canvas, e.g. the picture function.
Logical Paths and Libraries
The creation of new directories when using the #PATH command can be avoided by using the new keyword, NO_CREATE.
Up to 255 directories or library files can be used in the logical path and library definitions. The directories and library files can be read by new SCIL functions (PATH and REP_LIB).
Version Compatibility
Compatibility with previous versions can to some degree be selected by means of a new application attribute. The selected compatibility may be temporarily sidestepped with a SCIL function (REVISION_COMPATIBILITY).
Keyed File Maintenance
A new SCIL function, KEYED_FILE_MANAGER, is implemented to retrieve corrupted files and to perform other file maintenance procedures. This function replaces the off-line programs SAVER and REORG.
ABB Automation
MicroSCADA
Appendix A
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Tracing of Program Execution
For debugging purposes, tracing of SCIL program execution is implemented as a number of SCIL functions. Tracing implies recording of the SCIL statements that are executed.
Database Navigation
To support navigation through process and report databases, three new SCIL functions are implemented: APPLICATION_OBJECT_COUNT,
APPLICATION_OBJECT_LIST and APPLICATION_OBJECT_ATTRIBUTES.
The functionality of the functions APPLICATION_OBJECT_LIST and
APPLICATION_OBJECT_ATTRIBUTES resembles that of the command
#SEARCH used with the functions NEXT and PREV. However, there are two important differences. Firstly, the new functions operate in memory, they do not read the database files. Secondly, they return a vector of object names/attributes in one call.
Consequently, they are much faster than the #SEARCH command followed by a loop of NEXT/PREV function calls.
Miscellaneous
Two random number generating SCIL functions (RANDOM and SHUFFLE) have been implemented for system and application testing and other purposes.
Compatibility with Previous Versions
Names and Words
Variable names may now be up to 63 characters long. All the characters are significant. In MicroSCADA version 8.2, only the first 10 characters were significant, and the rest were ignored. This may result in a slight incompatibility. For example, in version 8.2, the variable names LONG_VARIABLE and LONG_VARIABL were considered as identical. In version 8.4, they are two different variables.
Similarly, SCIL command and function names are now up to 63 characters long. In
MicroSCADA version 8.2, only the first 10 characters were significant and the rest were simply ignored. For compatibility reasons, shortened names are still accepted if they are correct. For example, #CREATE_FIL is accepted for #CREATE_FILE, and
PRINT_TRANSPAR or PRINT_TRAN is accepted for PRINT_TRANSPARENT.
However, PRINT_TRANSPRENT is no longer accepted, though the spelling error went undetected in version 8.2.
HEX_SCAN, OCT_SCAN
The result of these functions is always an integer value if the argument lacks a decimal point. If the result falls outside the integer value range (-2.247.483.648 ...
+2.147.483.647), it is shortened. In 8.2, the result was given as a real value if it was outside the integer value range.
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
Appendix B
App. B. ODBC ERROR CODES
About this Appendix
This appendix lists the ODBC error codes which the SCIL SQL interface may return.
General
The character string value consists of a two character class value followed by a three character subclass value. A class value of “01” indicates a warning and is accompanied by a return code of SQL_SUCCESS_WITH_INFO. The class values other than
“01”, except for the class “IM”, indicate an error and are accompanied by a return code of SQL_ERROR. The class “IM” is specific to warnings and errors that derive from the implementation of ODBC itself. The subclass value “000” in any class is for implementation defined conditions within the given class.
Note 1
Note 2
Although successful execution of a function is normally indicated by a return value of SQL_SUCCESS, the SQLSTATE 00000 also indicates success.
Although the SCILSQL interface has only eight functions the user can call, it includes several different ODBC functions. ODBC error codes may also refer to those hidden functions.
List of Codes
SQLSTATE
01000
01002
01004
01006
01S02
01S03
01S04
07001
07006
08001
08002
08003
08004
08007
08S01
21S01
21S02
22003
22005
22008
22012
23000
24000
25000
28000
34000
37000
Error
General warning
Disconnect error
Data truncated
Privilege not revoked
Option value changed
No rows updated or deleted
More than one row updated or deleted
Wrong number of parameters
Restricted data type attribute violation
Unable to connect to data source
Connection in use
Connection not open
Data source rejected establishment of connection
Connection failure during transaction
Communication link failure
Insert value list does not match column list
Degree of derived table does not match column list
Numeric value out of range
Error in assignment
Datetime field overflow
Division by zero
Integrity constraint violation
Invalid cursor state
Invalid transaction state
Invalid authorization specification
Invalid cursor name
Syntax error or access violation
ABB Automation
MicroSCADA
Appendix B
S0002
S0011
S0012
S0021
S0022
S1000
S1001
S1002
S1003
S1008
S1009
S1010
S1011
S1012
S1090
S1092
S1109
S1C00
S1T00
40001
42000
IM001
IM002
IM003
IM004
IM005
IM006
IM009
IM013
S0001
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
Serialization failure
Syntax error or access violation
Driver does not support this function
Data source name not found and no default driver specified
Specified driver could not be loaded
Driver’s SQLAllocEnv failed
Driver’s SQLAllocConnect failed
Driver’s SQLSetConnect-Option failed
Unable to load translation DLL
Trace file error
Base table or view already exists
Base table not found
Index already exists
Index not found
Column already exists
Column not found
General error
Memory allocation failure
Invalid column number
Program type out of range
Operation cancelled
Invalid argument value
Function sequence error
Operation invalid at this time
Invalid transaction operation code specified
Invalid string or buffer length
Option type out of range
Invalid cursor position
Driver not capable
Timeout expired
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
Appendix C
App. C. PARAMETER FILES
About this Appendix
This appendix describes the parameter files used in MicroSCADA. First, it gives a general description, then a detailed description in BNF format.
General
Parameter files contain data in a Windows “ini-file” similar format. One parameter file can contain 0..n number of sections as well as 0..n number of comment lines.
Each section consists of a section header and 0..n number of key-value pairs, 0..n
number of empty lines and 0..n number of comment lines.
Example:
[
SECTION1]
KEY=VALUE
;this is a comment
[SECTION2]
KEY=VALUE
The section begins with the header e.g. “[section name]” and ends at another section beginning or at the end of the file. The enclosing brackets ([]) are required, and the left bracket must be in the leftmost column.
Comment lines begins with a semicolon (;).
BNF Description
ini_file ::= {comment_line}* {section}* section ::= section_header {item}* section_header ::= [ section_name ] new_line section_name ::= name item ::= new_line | key_line | comment_line comment_line ::= comment new_line comment ::= {blank}* ; {blank}* comment_string comment_string ::= character_string key_line ::= {blank}* key_name equal key_value new_line equal ::= {blank}* = {blank}*
ABB Automation
MicroSCADA
Appendix C
Programming Language
SCIL
Technical Reference Manual key_value ::= character_string character_string ::= {string_char {extended_string_char}*} extended_string_char ::= {blank}* string_char string_char ::= ASCII(33) .. ASCII(255) key_name ::= name name ::= name_char {extended_name_char}* extended_name_char ::= {blank}* name_char name_char ::= e_letter | digit | special_char new_line ::= {blank}* (NT_new_line | UNIX_new_line)
NT_new_line ::= CR LF
UNIX_new_line ::= LF blank ::= SP e_letter ::= A .. Z | a .. z digit ::= 0 .. 9
1MRS751250-MEN
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
Customer Feedback
Customer Feedback
About This Chapter
This chapter contains information on how to send customer feedback and how to get technical support from the SA Help Desk.
Customer Feedback Database
Customer Feedback is a Lotus Notes database, using which ABB companies can report errors, make improvement proposals and queries related to products manufactured by ABB Substation Automation Oy. Customer Feedback database is connected to the change management system of ABB Substation Automation Oy, which handles all error corrections and improvements made to the products.
Please note that the Customer Feedback database is primarily intended for writing reports about released products. If you are using for example a beta release in a pilot project, this should be clearly stated.
Writing A Customer Feedback Report
When writing a Customer Feedback report, the following general instructions should be taken in consideration:
•
Write the report in English.
•
Write only one error report, query or improvement proposal in a Customer Feedback report.
•
If you are reporting an error, try to isolate the error as well as possible. Describe the sequence of events and actions that lead to the error. If any error messages or other debug information is provided by the system, please write it down. Include also information of the system, e.g. a system diagram, revision information and configuration data.
•
If you are making an improvement proposal, try to describe how the improved function should work and avoid providing solutions. Information about the importance of the improvement, e.g. number of projects that require the improvement, helps us to make the decision whether and when the improvement should be implemented.
To make a Customer Feedback report, select Feedback Report from the Create menu.
This opens an empty Customer Feedback document. Fill out the fields listed below. A question mark next to a field provides help for filling out the field.
1
Subject. This should contain a short description of the issue. A more detailed description can be given in the Description of Feedback field below.
2
Type of Feedback: Comment/Improvement, Query or Complaint/Error.
3
Customer Information.
ABB Automation
MicroSCADA
Customer Feedback
Programming Language
SCIL
Technical Reference Manual
1MRS751250-MEN
4
Reporting Information. This should contain detailed information of the product the report is about.
5
The person who you want to send the feedback to and whether you want to get a reply from that person.
6
Information related to internal handling of the report (not obligatory).
7
Category.
8
You can issue the report by clicking the Issue Feedback button. This will send the report to the selected person and change its status to “in progress”.
Actions
When ABB Substation Automation Oy receives a Customer Feedback report, it is analysed by a sales person or a representative of the technical support. The analyser may ask for additional information in order to completed the analysis. After the report has been analysed, one of the following actions is taken:
•
In case of a clear error, the report is moved to the change management system of
ABB Substation Automation Oy. In this system, the error is analysed in detail and corrected in a future patch release or major release depending on the severity and impact of the error.
•
In case of an improvement proposal, the report is also moved to the change management system, where it is taken as a requirement to future releases.
•
In case of a query, an answer is provided.
When Customer Feedback reports are handled in the change management system, the outcome can be one of the following:
No Actions It is decided that the report requires no further action. If, for example, the problem is caused by a configuration error, it belongs to this category.
Will be implemented in patch/current release
Moved to future release
This result means that the correction or new feature will be available in the next official program release.
This result means that the new feature will be available in some new program release in the near future.
SA Help Desk
ABB Substation Automation Oy provides a technical support service called SA Help
Desk to support local engineering centres in their system projects. The purpose of SA
Help Desk is to provide support for urgent issues such as:
•
Year 2000 issues.
•
High-priority issues concerning systems at customers’ sites.
ABB Automation
1MRS751250-MEN
Programming Language
SCIL
Technical Reference Manual
MicroSCADA
Customer Feedback
For other kind of technical support, please use the Customer Feedback database. SA
Help Desk is available every day from 06:00 to 21:00 Central European Time.
SA Help Desk can be contacted by telephone. The number is:
+358 50 334 1900
ABB Automation
advertisement
Key Features
- High-level programming language
- Designed for MicroSCADA application engineering
- Comprehensive technical reference manual
- Covers data types, objects, variables, commands, functions
- Includes information on graphics primitives and Motif Widgets
- Provides a programmer's guide
Related manuals
Frequently Answers and Questions
What is SCIL?
What are the main uses of SCIL?
What are the different types of SCIL programs?
advertisement
Table of contents
- 9 1 Introduction
- 9 1.1 Presentation of SCIL
- 12 1.2 SCIL Programs
- 13 1.3 SCIL Statements
- 14 1.4 Organization of this Manual
- 17 2 Programming in SCIL
- 17 2.1 SCIL Programming Environment
- 23 2.2 SCIL Programming Rules
- 27 3 Data Types
- 27 3.1 General
- 27 3.2 Integer
- 28 3.3 Real
- 29 3.4 Boolean
- 29 3.5 Time
- 30 3.6 Text
- 30 3.7 Bit String
- 31 3.8 Byte String
- 31 3.9 Vector
- 32 3.10 List
- 33 4 Objects
- 33 4.1 General
- 34 4.2 System Objects
- 34 4.2.1General
- 36 4.2.2Base System Objects (B)
- 37 4.2.3Communication System Objects
- 38 4.3 Application Objects
- 38 4.3.1General