MC&TT Co., Ltd

Part 18. Phần mềm SCADA Cimon Ultimate Access - Toán tử và Câu Lệnh

Chia sẻ:

Part 18. Phần mềm SCADA Cimon Ultimate Access - Toán tử và Câu Lệnh

CIMON-SCADA cung cấp nhiều toán tử và hàm khác nhau. Các yếu tố này cho phép người dùng viết các biểu thức toán tử và biểu thức lệnh. Biểu thức thường được sử dụng như một câu lệnh để thực hiện một hành động tùy chọn và câu thay thế để gán giá trị cho một biến thẻ.

1 Features of Operation Expression

  • Operation expression can be defined with a single or multiple declarative languages.
  • Only one operation expression can be written in a single line.
  • A short description starting with a semicolon(;) can be added to the end of the blank or declarative sentence.
  • The brackets can be used to change the priority of the operation or clarify the formula.
  • In case of the logical decisions, the ‘True’ represents the cases when the value is not 0. The ‘False’ represents the case when the value is 0. If the logical decision is made on the strings, the ‘Space’ represents the ‘False’. The other cases represent the ‘True’.
  • The operation expression does not consider the upper/lower cases.
  • (Except Strings)

2 Definitions

(1) Declarative Statements

Declarative statements are used to define the operation expression. There are three types of declarative statements; substitution sentence, command sentence and expression statements

Type Format
Substitution Sentence Variable = Formula
Command Sentence Subroutine
Expression Statement ; All sentences after semicolon ‘;

(2) Formula

CIMON-SCADA provides various types and formats of the formula such as constants, variables, functions etc. The formula and the operator are usually used as <Formula><Operator><Formula> format.  The <Operator> excludes only ‘=’

Type Description
Constant Includes integer, real number, string and internal constant.
Integer
[Sign][Digit]Numeral
Sign +, - (Omitted sign represents +.)
Numeral 0 1 2 3 4 5 6 7 8 9 A B C D E F
Digit Assign as 2 (Binary), 8 (Octal), 16#(Hexadecimal) format. Omitted digit represents decimal.
Real Number
Mantissa[Exponent]
Mantissa Part Assign as shown below.
[Sign [Numbers].Numbers
[Sign]Numbers.[Numbers]
[Sign]Numbers
Exponent Part Assign as shown below.
E[Sign]Numbers
e[Sign]Numbers
String Assign as shown below.
“ASCII Codes”
Internal Constant There are 2 predefined internal constants in CIMON-SCADA as shown below.
CONSTANT_P1: � (3.1415...)
CONSTANT_EXP: e (2.7183…)
Variable Tag Tag The tag name defined in the database.
Tag Variable The variable/constant related to the tags defined in the database.
Internal variable The internal variable defined in the CIMONSCADA
Function Function A function for the arithmetic operation.
Subroutine An internal command function of CIMONSCADA
Operator Followings are the operators provided by CIMON-SCADA.
=, ~, !, +, -, *, /, %, |, ^, &&, <<, >>, ||, <, >, <=, >=, ==, !=

3 Tag Variable

The tag variable represents the variables or constants related to the tags defined in the database. The tag variables are used as shown below.

TagName:TagVariable

The list of tag variables is as shown below

Tag Variable Description Read/Write
VALUE Displays the current value of the tag. Operates same as the case when only the tag name is assigned. R/W
NAME Displays the name of the tag. (String) R
DESC Displays the description of the tag. (String) R/W
TYPE Displays the type of the tag. (String)
Types: Group, Analog, Digital, String
R
UNIT Displays the unit of the analog tag. (String) R/W
MIN Displays the internal minimum value of the tag. R/W
MAX Displays the internal maximum value of the tag. R/W
RAWMIN Displays the site minimum value of the tag. R/W
RAWMAX Displays the site maximum value of the tag. R/W
DEADBAND Displays the deadband of the analog tag. R/W
OFFLABEL Displays the Off Label of the digital tag. (String) R/W
ONLABEL Displays the On Label of the digital tag. (String) R/W
LABEL Displays the label of the digital tag according to the
current state. (String)
R
ALARMTYPE Displays the assigned alarm type. R
INALARM1 Displays the Alarm On Label of the digital tag.
In case of Analog Tag:
Displays HiHi Alarm, Major Dev, ROC Label.
R/W
INALARM2 Displays Hi Alarm, Minor Dev Label of the analog tag. R/W
INALARM3 Displays Lo Alarm Label of the analog tag. R/W
INALARM4 Displays LoLo Alarm Label of the analog tag. R/W
OUTALARM Displays Alarm Off Label. R/W
ALARMHIHI Displays the boundary value of HiHi alarm. R/W
ALARMHI Displays the boundary value of Hi alarm. R/W
ALARMLO Displays the boundary value of Lo alarm. R/W
ALARMLOLO Displays the boundary value of LoLo alarm. R/W
ALARMTARGET Displays the target value of the deviation alarm. R/W
ALARMMAJOR Displays the Major Dev of the deviation alarm. R/W
ALARMMINOR Displays the Minor Dev of the deviation alarm. R/W
ALARMROC Displays the ROC of ROC alarm. R/W
ALARMACK Displays the alarm acknowledgement state. R/W
ALARMVALUE Displays the tag value when the alarm state changes. R
ALARMTIME Displays the time when the alarm state changes. R
ALARMLABEL Displays the label according to the current alarm
state.
R
ALARMOCCTYPE

Displays the following value according to the alarm type.
0 : No Alarm
1 : OFF Alarm (Digital Tag)
2 : ON Alarm (Digital Tag)
3 : OFF->ON Alarm (Digital Tag)
4 : ON->OFF Alarm (Digital Tag)
5 : OFF<->ON Alarm (Digital Tag)
6 : HIHI Alarm (Analog Tag)
7 : HI Alarm (Analog Tag)
8 : LO Alarm (Analog Tag)
9 : LOLO Alarm (Analog Tag)

10 : Major Dev Alarm (Analog Tag)
11 : Minor Dev Alarm (Analog Tag)
12 : ROC Alarm (Analog Tag)

R
RAWVALUE Displays the tag value of the Real/Analog tag in
which the ‘Scale/Offset’ is not applied.
If minimum/maximum value of the ‘Eng. Data’ is not
assigned, the variable will display the same value as
the actual tag value.
R
TAGKIND Displays the tag type.
[Group(0)/Digital(1)/Analog(2)/String(3)]
R
REALTAG Displays the tag type; Real tag(1) or Virtual tag (0). R
DEVICE Displays the name of the I/O Device. (String) R
ADDRESS Displays the I/O Address. (String) R
DATALOG Displays if the tag is registered to the Data Logging.
(1: Registered, 0: Not Registered)
R
ALARMOCCTIME Displays the time when the alarm occurred. R
ALARMFREETIME Displays the time when the alarm is cleared. R
NAME2 Displays the tag name without the group tag name. R
ALARMENABLE Displays if the tag alarm is enabled(1) or disabled (0). R/W
ACKLABEL Displays the alarm ACK Label. R/W
HYSTERESIS Displays the hysteresis of the alarm. R/W

4 Operator

The operator is a key element of the operation expressions. The system starts calculating from the operator with higher priority. If the priorities are same, the operators are calculated from left to right. Be aware of that the substitution operator “=” is calculated from right to left.
In case of the string calculation, the both sides must be composed of strings. You can use the operators such as =, +, <, >, ,+, >=, ==, != for the string calculation.

The result of the internal operations (except the string) is processed as 8 Byte Double

Operator Function Example Description
= Substitution
Operator
TAG_A = 3 + 4 Substitutes the result of ‘3+4’ (=7) to the
TAG_A.
~ One’s
Complement
~TAG_A When the TAG_A’s value is 00110101b, the
result is 11001010b.
! Logical NOT !TAG_A If the TAG_A is 0, the result is 1. If the value is
not 0, the result is 0.
+ Addition TAG_A+4
"ABC" + "123"
Represents the result of adding the TAG_A and
4. In case of the sum of two strings, it indicates
the "ABC123".
- Subtraction TAG_A – 4 Represents the result of subtracting 4 from the
TAG_A.
* Multiplication TAG_A * 7 Represents the result of multiplying TAG_A and
7.
/ Division TAG_A / 7 Represents the result of dividing TAG_A by 7.
% Remainder TAG_A % 7 Represents the remainder of the TAG_A divided
by 7.
& Bitwise AND TAG_A &
0101b
If the TAG_A is 0011b, the result is 0001b.
| Bitwise OR TAG_A | 0101b If the TAG_A is 0011b, the result is 0111b.
^ Bitwise XOR TAG_A ^ 0101b If the TAG_A is 0011b, the result is 0110b.
&& Logical AND Formula1 && Formula2 If both Formula 1 and 2 are true, the result is 1.
In other cases, the result is 0.
|| Logical OR Formula1 || Formula2 If both Formula 1 and 2 are false, the result is 0.
In other cases, the result is 1.
<< Shift to Left TAG_A << 3 Represents the bits of TAG_A which are shifted 3 bits to the left side. The right side of the bits are filled with 0.
If TAG_A is 00110101b, the result is 10101000b.
>> Shift to Right TAG_A >> 3 Represents the bits of TAG_A which are shifted 3 bits to the right side. The left side of the bits are filled with 0.
If TAG_A is 00110101b, the result is 0000110b.
< Less than TAG_A < 7 If the TAG_A is less than 7, the result is 1. If not, the result is 0.
> Greater than TAG_A > 7 If the TAG_A is greater than 7, the result is 1. If not, the result is 0.
<= Less than or
Equal to
TAG_A <= 7 If the TAG_A is less than or equal to 7, the result is 1. If not, the result is 0.
>= Greater than
or Equal to
TAG_A >= 7 If the TAG_A is greater than or equal to 7, the
result is 1. If not, the result is 0.
== Equal to TAG_A == 7 If the TAG_A is 7, the result is 1. If not, the result is 0.
!= Not Equal to TAG_A != 7 If the TAG_A is not 7, the result is 1. If not, the result is 0

5 Subroutine

The subroutine is a function which executes a specified action on the occurrence of events, such as pressing the button or clicking the object.

The subroutine can be utilized in diverse functions of CimonD as follows; Script, touch feature of the object, action in the button object, hot-key, page open/close action, schedule action, and user LogIn/LogOut action.

To use several commands in a single action, you may write the subroutines in different lines as shown below.

If you wish to enter the commands in a single line, you may use two semicolons (;;) to distinguish the subroutines.

You can also use the subroutine in the CimonX. Select [Work] – [Command Window] – [Commands] to write the subroutines. Then press [Run] to execute the command.

You can also enter several commands using two semicolons (;;) to distinguish them.

6 Function

The function is used to display a value on the window or as a part of the decision making statements. Unlike the subroutines, the functions have return values in numbers or strings. Also, the functions cannot be used in the several lines.

The functions can be utilized in diverse functions of CimonD as follows; Script, Tag Name field of object control features (except trend, slider, EntryData), Cell data in the Report [Register Tag], subroutine, and parameter of the function.

You can also use the function in the CimonX. Select [Work] – [Command Window] – [Operations] to write the function. Then press [=] to execute the function. The return values will appear on the right side of the [=] button.

Bạn đang xem: Part 18. Phần mềm SCADA Cimon Ultimate Access - Toán tử và Câu Lệnh
Bài trước Bài sau
Đăng nhập
Đăng ký
Hotline: 0904251826
x