Omron TMFlow Expression Editor and Listen Mode Owner's manual

  • Hello, I'm your chat assistant. I have analyzed the user manual for the Robot Expression Editor and Listen Node and understand its functionalities. This document provides detailed information on data types, string and array manipulation, file, math and robot motion functions, as well as external script usage. I am ready to assist with your questions!
  • What data types are supported?
    What is the maximum index number for arrays?
    What is the purpose of the Ctrl() command?
    What kind of operation can be performed on strings?
TM Robot
Expression Editor and Listen Node
User Manual
Software Version: 1.82
Document Version: 1.00
Release date: 2021-01-08
Expression Editor and Listen Node Software Version: 1.82 Document Version: 1.00
2
The information contained herein is the property of Techman Robot Inc. (hereinafter referred to as the
Corporation). No part of this publication may be reproduced or copied in any way, shape or form without
prior authorization from the Corporation. No information contained herein shall be considered an offer
or commitment. It may be subject to change without notice. This Manual will be reviewed periodically.
The Corporation will not be liable for any error or omission.
and logos are registered trademarks of TECHMAN ROBOT INC. and the company reserves
the ownership of this manual and its copy and its copyrights.
Expression Editor and Listen Node Software Version: 1.82 Document Version: 1.00
3
REVISION HISTORY TABLE ........................................................................................... 11
1. EXPRESSION ......................................................................................................... 12
1.1 Types ................................................................................................................................................. 12
1.2 Variables and Constants ................................................................................................................... 12
1.3 Array ................................................................................................................................................. 16
1.4 Operator Symbols ............................................................................................................................. 17
1.5 Data type conversion ........................................................................................................................ 19
1.6 Warning ............................................................................................................................................ 21
2. FUNCTIONS .......................................................................................................... 23
2.1 Byte_ToInt16() .................................................................................................................................. 23
2.2 Byte_ToInt32() .................................................................................................................................. 24
2.3 Byte_ToFloat() .................................................................................................................................. 25
2.4 Byte_ToDouble() ............................................................................................................................... 26
2.5 Byte_ToInt16Array() ......................................................................................................................... 27
2.6 Byte_ToInt32Array() ......................................................................................................................... 28
2.7 Byte_ToFloatArray() ......................................................................................................................... 29
2.8 Byte_ToDoubleArray() ...................................................................................................................... 30
2.9 Byte_ToString() ................................................................................................................................. 31
2.10 Byte_Concat() ................................................................................................................................... 32
2.11 String_ToInteger() ............................................................................................................................ 35
2.12 String_ToFloat() ................................................................................................................................ 37
2.13 String_ToDouble() ............................................................................................................................ 39
2.14 String_ToByte() ................................................................................................................................. 41
2.15 String_IndexOf() ............................................................................................................................... 42
2.16 String_LastIndexOf() ......................................................................................................................... 43
2.17 String_Substring() ............................................................................................................................. 43
2.18 String_Split() ..................................................................................................................................... 46
Contents
Expression Editor and Listen Node Software Version: 1.82 Document Version: 1.00
4
2.19 String_Replace() ............................................................................................................................... 47
2.20 String_Trim() ..................................................................................................................................... 48
2.21 String_ToLower() .............................................................................................................................. 50
2.22 String_ToUpper() .............................................................................................................................. 50
2.23 Array_Append() ................................................................................................................................ 51
2.24 Array_Insert() ................................................................................................................................... 52
2.25 Array_Remove() ................................................................................................................................ 53
2.26 Array_Equals() .................................................................................................................................. 54
2.27 Array_IndexOf() ................................................................................................................................ 56
2.28 Array_LastIndexOf() .......................................................................................................................... 57
2.29 Array_Reverse() ................................................................................................................................ 58
2.30 Array_Sort() ...................................................................................................................................... 60
2.31 Array_SubElements() ........................................................................................................................ 61
2.32 ValueReverse() .................................................................................................................................. 62
2.33 GetBytes() ......................................................................................................................................... 66
2.34 GetString() ........................................................................................................................................ 71
2.35 GetToken() ........................................................................................................................................ 79
2.36 GetAllTokens() .................................................................................................................................. 88
2.37 GetNow() .......................................................................................................................................... 90
2.38 GetNowStamp() ................................................................................................................................ 91
2.39 GetVarValue() ................................................................................................................................... 94
2.40 Length()............................................................................................................................................. 95
2.41 Ctrl() .................................................................................................................................................. 97
2.42 XOR8() ............................................................................................................................................... 98
2.43 SUM8() ............................................................................................................................................ 100
2.44 SUM16() .......................................................................................................................................... 101
2.45 SUM32() .......................................................................................................................................... 103
2.46 CRC16() ........................................................................................................................................... 104
Expression Editor and Listen Node Software Version: 1.82 Document Version: 1.00
5
2.47 CRC32() ........................................................................................................................................... 106
2.48 ListenPacket() ................................................................................................................................. 108
2.49 ListenSend() .................................................................................................................................... 109
2.50 VarSync() ......................................................................................................................................... 111
3. MATH FUNCTIONS ............................................................................................... 113
3.1 abs() ................................................................................................................................................ 113
3.2 pow()............................................................................................................................................... 114
3.3 sqrt() ............................................................................................................................................... 116
3.4 ceil() ................................................................................................................................................ 116
3.5 floor() .............................................................................................................................................. 117
3.6 round() ............................................................................................................................................ 118
3.7 random() ......................................................................................................................................... 120
3.8 d2r() ................................................................................................................................................ 121
3.9 r2d() ................................................................................................................................................ 122
3.10 sin() ................................................................................................................................................. 122
3.11 cos() ................................................................................................................................................ 123
3.12 tan() ................................................................................................................................................ 124
3.13 asin() ............................................................................................................................................... 125
3.14 acos() .............................................................................................................................................. 125
3.15 atan() .............................................................................................................................................. 126
3.16 atan2() ............................................................................................................................................ 127
3.17 log() ................................................................................................................................................. 128
3.18 log10() ............................................................................................................................................. 129
3.19 norm2() ........................................................................................................................................... 130
3.20 dist() ................................................................................................................................................ 131
3.21 trans() ............................................................................................................................................. 131
3.22 inversetrans() .................................................................................................................................. 132
3.23 applytrans() .................................................................................................................................... 134
Expression Editor and Listen Node Software Version: 1.82 Document Version: 1.00
6
3.24 interpoint() ..................................................................................................................................... 136
3.25 changeref() ..................................................................................................................................... 136
3.26 points2coord() ................................................................................................................................ 138
3.27 intercoord() .................................................................................................................................... 140
4. FILE FUNCTIONS .................................................................................................. 142
4.1 File_ReadBytes() ............................................................................................................................. 143
4.2 File_ReadText() ............................................................................................................................... 143
4.3 File_ReadLines() .............................................................................................................................. 144
4.4 File_NextLine() ................................................................................................................................ 146
4.5 File_NextEOF() ................................................................................................................................ 149
4.6 File_WriteBytes() ............................................................................................................................ 150
4.7 File_WriteText() .............................................................................................................................. 155
4.8 File_WriteLine() .............................................................................................................................. 158
4.9 File_WriteLines() ............................................................................................................................. 161
4.10 File_Exists() ..................................................................................................................................... 164
4.11 File_Length() ................................................................................................................................... 164
4.12 File_Delete() ................................................................................................................................... 165
4.13 File_Copy() ...................................................................................................................................... 166
4.14 File_CopyImage() ............................................................................................................................ 167
4.15 File_Replace() ................................................................................................................................. 169
4.16 File_GetToken() .............................................................................................................................. 170
4.17 File_GetAllTokens() ........................................................................................................................ 175
5. SERIAL PORT FUNCTIONS ..................................................................................... 178
5.1 com_read() ..................................................................................................................................... 178
5.2 com_read_string() .......................................................................................................................... 184
5.3 com_write() .................................................................................................................................... 190
5.4 com_writeline() .............................................................................................................................. 192
6. SOCKET FUNCTIONS ............................................................................................. 195
Expression Editor and Listen Node Software Version: 1.82 Document Version: 1.00
7
6.1 socket_read() .................................................................................................................................. 195
6.2 socket_read_string() ....................................................................................................................... 201
6.3 socket_send() ................................................................................................................................. 207
6.4 socket_sendline() ........................................................................................................................... 209
7. PARAMETERIZED OBJECTS ................................................................................... 212
7.1 Point ............................................................................................................................................... 213
7.2 Base ................................................................................................................................................ 214
7.3 TCP .................................................................................................................................................. 215
7.4 VPoint ............................................................................................................................................. 216
7.5 IO .................................................................................................................................................... 217
7.6 Robot .............................................................................................................................................. 219
7.7 FT .................................................................................................................................................... 220
8. EXTERNAL SCRIPT ................................................................................................ 223
8.1 Listen Node ..................................................................................................................................... 223
8.2 ScriptExit() ...................................................................................................................................... 224
8.3 Communication Protocol ................................................................................................................ 224
8.4 TMSCT ............................................................................................................................................. 226
8.5 TMSTA ............................................................................................................................................. 228
8.6 CPERR.............................................................................................................................................. 231
8.7 Priority Commands ......................................................................................................................... 233
9. ROBOT MOTION FUNCTIONS ............................................................................... 237
9.1 QueueTag() ..................................................................................................................................... 237
9.2 WaitQueueTag() ............................................................................................................................. 238
9.3 StopAndClearBuffer() ..................................................................................................................... 240
9.4 Pause() ............................................................................................................................................ 240
9.5 Resume() ......................................................................................................................................... 241
9.6 PTP()................................................................................................................................................ 241
9.7 Line() ............................................................................................................................................... 245
Expression Editor and Listen Node Software Version: 1.82 Document Version: 1.00
8
9.8 Circle() ............................................................................................................................................. 247
9.9 PLine() ............................................................................................................................................. 249
9.10 Move_PTP() .................................................................................................................................... 251
9.11 Move_Line() .................................................................................................................................... 253
9.12 Move_PLine() .................................................................................................................................. 255
9.13 ChangeBase() .................................................................................................................................. 257
9.14 ChangeTCP() ................................................................................................................................... 258
9.15 ChangeLoad() .................................................................................................................................. 261
9.16 PVTEnter() ....................................................................................................................................... 262
9.17 PVTExit() ......................................................................................................................................... 263
9.18 PVTPoint() ....................................................................................................................................... 263
9.19 PVTPause() ...................................................................................................................................... 264
9.20 PVTResume() .................................................................................................................................. 265
Pose Configuration Parameters: [Config1, Config2, Config3] .............................................................................. 266
9.21 Vision_DoJob() ................................................................................................................................ 266
9.22 Vision_DoJob_PTP() ........................................................................................................................ 267
9.23 Vision_DoJob_Line() ....................................................................................................................... 268
9.24 Vision_IsJobAvailable() ................................................................................................................... 269
10. MODBUS FUNCTIONS .......................................................................................... 270
10.1 modbus_read() ............................................................................................................................... 270
10.2 modbus_read_int16() ..................................................................................................................... 273
10.3 modbus_read_int32() ..................................................................................................................... 275
10.4 modbus_read_float() ...................................................................................................................... 277
10.5 modbus_read_double() .................................................................................................................. 279
10.6 modbus_read_string() .................................................................................................................... 281
10.7 modbus_write() .............................................................................................................................. 283
11. TM ETHERNET SLAVE ........................................................................................... 288
11.1 GUI Setting ...................................................................................................................................... 288
Expression Editor and Listen Node Software Version: 1.82 Document Version: 1.00
9
11.2 svr_read() ....................................................................................................................................... 289
11.3 svr_write() ...................................................................................................................................... 289
11.4 Data Table ....................................................................................................................................... 290
11.5 Communication Protocol ................................................................................................................ 292
11.6 TMSVR ............................................................................................................................................ 293
0. Mode = 0 (the status the server responds to the client command processing) ............................ 295
1. Mode = 1 BINARY ............................................................................................................................ 297
2. Mode = 2 STRING ............................................................................................................................ 299
3. Mode = 3 JSON ............................................................................................................................... 300
11. Mode = 11 BINARY (Request read) ................................................................................................. 301
12. Mode = 12 STRING (Request read) ................................................................................................. 302
13. Mode = 13 JSON (Request read) ..................................................................................................... 303
12. PROFINET FUNCTIONS ......................................................................................... 305
12.1 profinet_read_input() ..................................................................................................................... 306
12.2 profinet_read_input_int() .............................................................................................................. 310
12.3 profinet_read_input_float() ........................................................................................................... 313
12.4 profinet_read_input_string() ......................................................................................................... 315
12.5 profinet_read_input_bit() .............................................................................................................. 316
12.6 profinet_read_output() .................................................................................................................. 319
12.7 profinet_read_output_int() ............................................................................................................ 322
12.8 profinet_read_output_float() ......................................................................................................... 325
12.9 profinet_read_output_string() ....................................................................................................... 327
12.10 profinet_read_output_bit() ............................................................................................................ 328
12.11 profinet_write_output() ................................................................................................................. 330
12.12 profinet_write_output_bit() ........................................................................................................... 339
13. ETHERNET/IP FUNCTIONS .................................................................................... 345
13.1 eip_read_input() ............................................................................................................................. 346
13.2 eip_read_input_int() ...................................................................................................................... 349
Expression Editor and Listen Node Software Version: 1.82 Document Version: 1.00
10
13.3 eip_read_input_float() ................................................................................................................... 352
13.4 eip_read_input_string() .................................................................................................................. 354
13.5 eip_read_input_bit() ...................................................................................................................... 355
13.6 eip_read_output() .......................................................................................................................... 358
13.7 eip_read_output_int() .................................................................................................................... 362
13.8 eip_read_output_float() ................................................................................................................. 364
13.9 eip_read_output_string() ............................................................................................................... 366
13.10 eip_read_output_bit() .................................................................................................................... 367
13.11 eip_write_output() ......................................................................................................................... 370
13.12 eip_write_output_bit() ................................................................................................................... 378
Expression Editor and Listen Node Software Version: 1.82 Document Version: 1.00
11
Revision History Table
Revision
Date
00
Jan, 2021
Expression Editor and Listen Node Software Version: 1.82 Document Version: 1.00
12
1. Expression
1.1 Types
Different data types of variable can be declared in Variables Manager.
byte
8bit integer
unsigned
0 to 255
significant digit 3
int
32bit integer
signed
-2147483648 to 2147483647
significant digit 10
float
32bit floating-
point
signed
-3.40282e+038f to 3.40282e+038f
significant digit 7
double
64bit floating-
point
signed
-1.79769e+308 to 1.79769e+308
significant digit 15
bool
boolean
true or false
string
string
For int type variable, both int16 and int32 are supported. The default type is int 32.
int16
16bit integer
signed
-32768 to 32767
significant digit 5
int32
32bit integer
signed
-2147483648 to 2147483647
significant digit 10
1.2 Variables and Constants
1. Variables
In the naming rule of variables, only the numbers, under line and the upper case and lower case English
characters are supported.
Numbers 0123456789
Characters a-z, A-Z, _
Example
Int var_i = 0
string var_s = "ABC"
string var_s1 = "DEF"
string var_s2 = "123"
Without double quotation marks, strings will be taken as variables.
var_s = var_s1 + " and " + var_s2 // var_s = "DEF and 123"
// var_s, var_s1, var_s2 are variable, and " and " is a string.
Expression Editor and Listen Node Software Version: 1.82 Document Version: 1.00
13
In addition to variables, the naming rule also applies to constants, numbers, strings, and Booleans except
that string constants need to be enclosed in double quotes.
When a variable is generated in TMflow, a prefix is added based on the source. To use the variable for writing
or reading, users must enter the full name including the prefix word. For the rules of adding prefixes, refer
to the respective description in variable setting pages.
2. Numbers
Decimal integer, decimal floating-point, binary, hexadecimal integer and scientific notation are
supported.
Decimal integer 123
-123
+456
Decimal float 34.567
-8.9
Binary 0b0000111
0B1110000
Hexadecimal integer 0x123abc
0X00456DEF
Scientific notation 3.4e5
2.3E-4
For binary and hexadecimal notation, there is no floating-point.
The notation of number is not case sensitive.
For example:
0b0011 equals to 0B0011
0xabcD equals to 0XABCD, 0xABCd, 0Xabcd etc.
3.4e5 equals to 3.4E5
The transforming between floating-point and byte array may cause discrepancy in value
For example:
float 5.317302E+030 float to byte[] {0x72,0x86,0x3A,0x42}
byte[] {0x72,0x86,0x3A,0x43} byte[] to float 5.317302E+030
Byte can only present unsigned numbers from 0 to 255. As a result, if negative number is assigned to
Expression Editor and Listen Node Software Version: 1.82 Document Version: 1.00
14
byte type variable directly or through calculation, only 8 bit unsigned value will be kept.
For example:
byte var_b = -100 // var_b = 156 // -100 is present as 0xFFFFFF9C by 16bit notation.
// Because byte can only keep 8 bit data, that is 0x9C (156), b will equals to 156
3. String
When inputting string constant, double quotation marks shall be placed in pairs around the string to avoid
the recognition error of variable and string.
For example
"Hello World! "
"Hello TM""5" (If " is one of the character in the string, use two ("") instead of one (").
Control character in double quotation mark are not supported.
For example:
"Hello World!\r\n" (the output would be Hello World!\r\n string)
Without double quotation marks, the compiling will follows the rules below
1. Numbers will be view as numbers
2. The combination of numbers and characters will be view as variable as long as the variable does
exist.
3. If the variable does not exist, it will be compiled as string with warning message.
The combination of string and variable
1. Inside double quotation marks, variables will not be combined as variables
For example:
var_s = "TM5" // var_s = "TM5"
var_s1 = "Hi, s Robot" // var_s1 = "Hi, s Robot"
2. To input the combination of variables and strings, double quotation marks needs to be placed
around the string, and plus sign (+) shall be used to link variables and numbers
Example:
var_s1 = "Hi, " + var_s + " Robot" // var_s1 = "Hi, TM5 Robot"
3. To be compatible with the old version software, the single quotation marks can be placed around
the variables, but a warning message will be send out
For example:
Expression Editor and Listen Node Software Version: 1.82 Document Version: 1.00
15
single quotation marks "Hi, ’s’ Robot" // var_s1 = "Hi, TM5 Robot"
"Hi, ’x’ Robot" // var_s1 = "Hi, x Robot" // Because variable x does not exist, ‘x’ is
viewed as string
4. Single quotation marks do not support element value retrieval with array indexes. The standard
format with double quotation marks should be used.
For example
string[] var_ss = {"Techman", "Robot"}
"Hi, var_s ss[0] Robot" // var_s1 = "Hi, TM5 ss[0] Robot" // ‘ss[0]’ is invalid
"Hi, " + var_ s + " " + var_ss[0] + " Robot" // var_s1 = "Hi, TM5 Techman Robot"
5. Single quotation marks cannot be presented by ". If users would like to input ’(variable name)’,
The standard format with double quotation marks should be used.
For example
"Hi, ‘s’ Robot" // var_s1 = "Hi, TM5 Robot"
// If var_s1 = "Hi, ‘s Robot" is what you want, please use the following syntax.
"Hi, " + "s" + " Robot" // var_s1 = "Hi, s Robot"
For control character, e.g. new line, please use Ctrl() command.
For example
var_s1 = "Hi, " + Ctrl("\r\n") + s + " Robot" or "Hi, " + NewLine + var_s + " Robot"
Hi,
TM5 Robot
Reserved characters is similar to variables, no double quotation marks is needed. (But single quotation
mark is not supported)
1. empty empty string, equals to ""
2. newline or NewLine new line, equals to Ctrl("\r\n") or Ctrl(0x0D0A)
4. Boolean
True or false value of logic.
Denote true value
true
True
Denote false value
false
False
The Boolean value is case sensitive. Misuses of capital letters such as TRue will be taken as a variable or a
string.
Expression Editor and Listen Node Software Version: 1.82 Document Version: 1.00
16
1.3 Array
Array is a set of data with the same data type. The initial value is assigned with {}, and every element remains
the characteristic of its data type.
For example
int[] var_i = {0,1,2,3} // elements in number data type
string[] var_s = {"ABC", "DEF", "GHI"} // elements in string data type
bool[] var_bb = {true, false, true} // elements in boolean data type
By utilizing index, the value of specified element can be get, the index is start from 0
For example
index 0 1 2 3 4 5 6 7
array eight elements in total
A[0] A[1] A[2] A[3] A[4] A[5] A[6] A[7]
Valid index values [0] .. [7], an error will occur with invalid index number.
Only one degree array is supported. The maximum index number is 2048.
The array size may alter according to the return value of functions or assigned values. The maximum
element number is 2048. This feature makes array meet the needs of different functions and applications
in Network Node.
For Example:
string[] var_ss = {empty, empty, empty} // The initial size of string array is 3 elements
var_ss = String_Split("A_B_C_D_F_G_H", "_") // After splitting string, the string array has 7 elements
var_len = Length(var_ss) // var_len = 7
var_ss = String_Split("A,B", ",") // After splitting string, the string array has 2 elements
var_len = Length(var_ss) // var_len = 2
Expression Editor and Listen Node Software Version: 1.82 Document Version: 1.00
17
1.4 Operator Symbols
The operator table is listed below.
The calculation follows the precedence of operator first then the associativity.
For example
left-to-right associativity
A = A * B / C % D ( A = ( ( ( A * B ) / C ) % D ) )
right-to-left associativity
A -= B += 10 && ! !D ( A -= ( B += ( 10 && ( ! (!D) ) ) ) )
The calculation will proceed by the type of the operand.
1. When both values come as the integer type, the calculation will proceed by the integer type such as
int var_a = 10
int var_b = 3
float var_c = var_a / var_b
By the operator priority, the calculation goes / first and then =.
var_a / var_b = 10 / 3 = 3 (both var_a and var_b are integers)
var_c = 3 (The integer 3 assigns to the floating point number var_c)
2. When one of the two values comes as the floating-point type, the calculation will proceed by the
floating-point type such as
int var_a = 10
float var_b = 3
float var_c = var_a / var_b
var_a / var_b = 10 / 3 = 3.333333 (for var_b is a floating-point number)
var_c = 3.333333 (the floating-point number 3.333333 assigns to var_c)
var_c = var_a / 3
var_a / 3 = 10 / 3 = 3 (both var_a and 3 are integers)
var_c = 3
var_c = var_a / 3.0
var_a / 3.0 = 10 / 3.0 = 3.333333 (for 3.0 is a floating-point number)
var_c = 3.333333
1
2
3
4
1
2
3
4
5
Expression Editor and Listen Node Software Version: 1.82 Document Version: 1.00
18
Precedence
High to low
Operator
Name
Example
Requireme
nt
associativity
17
++
Postfix increment
i++
Integer
variable
left-to-right
--
Postfix decrement
i--
()
Function call
int x = f()
[]
Allocate storage
array[4] = 2
Array
variable
16
++
Prefix increment
++i
Integer
variable
right-to-left
--
Prefix decrement
--i
+
Unary plus
int i = +1
Numeric
variable,
Constant
-
Unary minus
int i = -1
!
Logical negation (NOT)
if (!done) …
Boolean
variable
~
Bitwise NOT
flag1 = ~flag2
Integer
variable
14
*
Multiplication
int i = 2 * 4
Numeric
variable,
Constant
left-to-right
/
Division
float f = 10.0 / 3.0
%
Modulo (integer
remainder)
int rem = 4 % 3
13
+
Addition
int i = 2 + 3
Numeric
variable,
Constant
-
Subtraction
int i = 5 - 1
12
<<
Bitwise left shift
int flags = 33 << 1
Integer
variable,
Constant
>>
Bitwise right shift
int flags = 33 >> 1
11
<
Less than
if (i < 42) …
Numeric
variable,
Constant
<=
Less than or equal to
if (i <= 42) ...
>
Greater than
if (i > 42) …
>=
Greater than or equal to
if (i >= 42) ...
10
==
Equal to
if (i == 42) ...
!=
Not equal to
if (I != 42) …
9
&
Bitwise AND
flag1 = flag2 & 42
Integer
variable,
Constant
8
^
Bitwise XOR
flag1 = flag2 ^ 42
7
|
Bitwise OR
flag1 = flag2 | 42
6
&&
Logical AND
if (conditionA &&
conditionB)
5
||
Logical OR
if (conditionA ||
conditionB)
4
c ? t : f
Ternary conditional
int i = a > b ? a : b
right-to-left
3
=
Basic assignment
int a = b
+=
Addition assignment
a += 3
-=
Subtraction assignment
b -= 4
Expression Editor and Listen Node Software Version: 1.82 Document Version: 1.00
19
*=
Multiplication assignment
a *= 5
Left side:
Numeric
variable
Right side:
Numeric
variable,
Constant
/=
Division assignment
a /= 2
%=
Modulo assignment
a %= 3
<<=
Bitwise left shift
assignment
flags <<= 2
Left side:
Integer
variable
Right side:
Integer
variable,
Constant
>>=
Bitwise right shift
assignment
flags >>= 2
&=
Bitwise AND assignment
flags &= new_flags
^=
Bitwise XOR assignment
flags ^= new_flags
|=
Bitwise OR assignment
flags |= new_flags
1.5 Data type conversion
Data types can be converted to each other and used in variables/constants or arrays.
Conversions must be in the same format of the containers such as variable/constant conversions or array
conversions. It is not permitted to convert a variable to an array or an array to a variable.
Expression Editor and Listen Node Software Version: 1.82 Document Version: 1.00
20
Native type
Conversion type
Example
Result
byte
int
int i = (int)100
i = 100
float
float f = (float)100
f = 100
double
double d = (double)100
d = 100
bool
bool flag = (bool)0
flag = true (not null)
string
string s = (string)100
s = "100"
int
byte
byte b = (byte)1000
b = 232
float
float f = (float)1000
f = 1000
double
double d = (double)1000
d = 1000
bool
bool flag = (bool)1000
flag = true (not null)
string
string s = (string)1000
s = "1000"
float
byte
byte b = (byte)1.23
b = 1
int
int i = (int)1.23
i = 1
double
double d = (double)1.23
d = 1.23
bool
bool flag = (bool)1.23
flag = true
string
string s = (string)1.23
s = "1.23"
double
byte
byte b = (byte)1.23
b = 1
int
int i = (int)1.23
i = 1
float
float f = (float)1.23
f = 1.23
bool
bool flag = (bool)1.23
flag = true
string
string s = (string)1.23
s = "1.23"
bool
byte
byte b = (byte)True
Error
int
int i = (int)False
Error
float
float f = (float)true
Error
double
double d = (double)false
Error
string
string s = (string)True
s = "True"
string
byte
byte b1 = (byte)"1.23"
byte b2 = (byte)"XYZ"
1
Error
int
int i = (int)"1.23"
1
float
float f1 = (float)"1.23"
float f2 = (float)"XYZ"
1.23
Error
double
double d = (double)"1.23"
1.23
bool
bool flag1 = (bool)"1.23"
bool flag2 = (bool)""
flag1 = true (not null)
flag2 = false (null)
The conversion method of arrays is in accordance with the table above. The conversion is performed for
each element in the array.
string[] var_ss = {"1.23", "4.56", "0.789"}
int[] var_i_array = (int[])var_ss // var_i_array = {1, 4, 0}
float[] var_f_array = (float[])var_ss // var_f_array = {1.23, 4.56, 0.789}
/