Skip to content

Batch Tag Writing

Writing to Multiple Tags

Canvas offers support for writing to multiple tags using the tag.writeBatch() script. The script requires two parameters: an array of tags and an array of values. The script will write the values in the second array to the tags in the first array in order.

Here is an example of the tag.writeBatch() script:

var tags = ["Tag 1", "Tag 2", "Tag 3"]; // Tag Array
var vals = [0, 100, "Hello"]; // Values to write: 0 to Tag 1, 100 to Tag 2, "Hello" to Tag 3

tag.writeBatch(tags, vals); // Perform batch write

The above script writes 0 to Tag 1, 100 to Tag 2, and "Hello" to Tag 3.

Protocol Support

The batch-writing script is a versatile tool when dealing with many different I/O communication protocols.

Requests

Characteristics

Two characteristics can describe the type of request:

  1. Specification of Data:
    • Address-Based: The request data contains only an address, and the response will contain the value of that individual address.
    • Block-Based: The request data contains both a start address and a range/size, and the response will contain the value(s) of all addresses from the start address to the end of the range.
    • Variable-Based: The protocol uses variables defined by the PLC rather than the addresses, which may have more complex size/struct information. In general, one tag correlates to one variable, and there is no concept of "continuous" variables like with blocks.
  2. Number of Data Components:
    • Single-Component: The request will contain only a single address/block/variable.
    • Multi-Component: The request can contain multiple addresses/blocks/variables, allowing for multiple non-continuous addresses/blocks/variables to be read in a single request.

Types

Since the characteristics can be combined in any way, there are six general request types (listed in order of preference):

  1. Multi-Block (Block-Based, Multi-Component)
  2. Single-Block (Block-Based, Single-Component)
  3. Multi-Address (Address-Based, Multi-Component)
  4. Single-Address (Address-Based, Single-Component)
  5. Multi-Variable (Variable-Based, Multi-Component)
  6. Single-Variable (Variable-Based, Single-Component)

Drivers

Write requests for each driver fall under the following categories:

Multi-Block

  • CIMON UA Net Client
  • CIMON UA Bus Master
  • Fatek FBS Client
  • Mitsubishi MELSEC Ethernet Client
  • Mitsubishi MELSEC Serial Master
  • Siemens S7 Client

Single-Block

  • BACnet/IP Client
  • LSIS XGT Cnet Master
  • LSIS XGT FEnet Client
  • Modbus RTU Master
  • Modbus TCP Client
  • Panasonic FP7 Master
  • Proface GPEthernet Client
  • Yokogawa FA-M3 Master

Single-Variable

  • Allen Bradley DF1 Master
  • Allen Bradley EtherNet/IP Client (PCCC)
  • Allen Bradley EtherNet/IP Client (Tag)
  • ODVA EtherNet/IP Client
  • Omron FINS Client
  • Omron Host Link Master
  • OPC UA Client