Equipment

When you want to use source properties to change the IP address or unit ID of equipment at run time, use the [Equipment] operation to commit the change.

Note:

For information on the naming convention and script keywords, refer to the following.
Naming Conventions

 

Block
Text

saveEquipment(EQUIPMENT);
                 1

1: Equipment

Note: You can use a single equipment block to save both the IP address and unit ID. Success or failure of each operation is recorded in the operation log.

Example

The following example shows how you can change the IP address for equipment in the project.

The equipment’s current IP address is 192.168.0.1.

Block

Text

onClick($GraphicObject.Switch1, ()=>{

$Device.ModbusTCPDriver1.SchneiderModbusTCPIPEquipment1.IPAddress.OverwriteValue = address('192.168.0.2');

saveEquipment($Device.ModbusTCPDriver1.SchneiderModbusTCPIPEquipment1);

});

 

  1. Set up the above script in your project.
  2. Run the script to:

    1. Set a new IP address (192.168.0.2) to IPAddress.OverwriteValue.

    2. Run the [Equipment] operation.

Equipment1.IPAddress.CurrentValue (192.168.0.2) is now equal to Equipment1.IPAddress.OverwriteValue (192.168.0.2).

Note: You can use 32-bit data (Int) to change the IP address value. The IP address value is changed as shown in the figure below. In 32-bit data, each octet in the IP address is saved in 8-bit units.

Example when IP address is not updated

  1. Set a new IP address (192.168.0.3) to IPAddress.OverwriteValue.
  2. Do not run the [Equipment] operation.
    The equipment’s IP address is not updated. Equipment1.IPAddress.CurrentValue (192.168.0.2) does not equal Equipment1.IPAddress.OverwriteValue (192.168.0.3).
    The IP address is not applied until the [Equipment] operation is executed.

Note: You need to execute the [Equipment] operation to update the equipment IP address and unit ID.