Hi,
I wanted to convert an array of booleans to Integer or Long using the binEnc functions to handle alarms in one value using the bit state.
binEnc fails to handle more than 31 bits when the value is higher than 2147483647 (Int8).
It does not work for Integer nor with Long datatype on the tag.
Here is the UDT example
{
"name": "BooleanArrayAlarm",
"parameters": {
"Tag": {
"dataType": "String"
}
},
"tagType": "UdtType",
"tags": [
{
"opcItemPath": {
"bindType": "parameter",
"binding": "{Tag}"
},
"valueSource": "memory",
"dataType": "BooleanArray",
"name": "BooleanArray",
"value": [
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
],
"tagType": "AtomicTag",
"opcServer": "Ignition OPC UA Server"
},
{
"valueSource": "expr",
"expression": "binEnc(\r\n\t{[.]BooleanArray}[0],\r\n\t{[.]BooleanArray}[1],\r\n\t{[.]BooleanArray}[2],\r\n\t{[.]BooleanArray}[3],\r\n\t{[.]BooleanArray}[4],\r\n\t{[.]BooleanArray}[5],\r\n\t{[.]BooleanArray}[6],\r\n\t{[.]BooleanArray}[7],\r\n\t{[.]BooleanArray}[8],\r\n\t{[.]BooleanArray}[9],\r\n\t{[.]BooleanArray}[10],\r\n\t{[.]BooleanArray}[11],\r\n\t{[.]BooleanArray}[12],\r\n\t{[.]BooleanArray}[13],\r\n\t{[.]BooleanArray}[14],\r\n\t{[.]BooleanArray}[15],\r\n\t{[.]BooleanArray}[16],\r\n\t{[.]BooleanArray}[17],\r\n\t{[.]BooleanArray}[18],\r\n\t{[.]BooleanArray}[19],\r\n\t{[.]BooleanArray}[20],\r\n\t{[.]BooleanArray}[21],\r\n\t{[.]BooleanArray}[22],\r\n\t{[.]BooleanArray}[23],\r\n\t{[.]BooleanArray}[24],\r\n\t{[.]BooleanArray}[25],\r\n\t{[.]BooleanArray}[26],\r\n\t{[.]BooleanArray}[27],\r\n\t{[.]BooleanArray}[28],\r\n\t{[.]BooleanArray}[29],\r\n\t{[.]BooleanArray}[30],\r\n\t{[.]BooleanArray}[31]\r\n)\r\n",
"dataType": "Int4",
"name": "Integer",
"tagType": "AtomicTag"
}
]
}