Korean English Chinese Czech Dutch French German Hungarian Italian Japanese Polish Portuguese Spanish
Korean English Chinese Czech Dutch French German Hungarian Italian Japanese Polish Portuguese Spanish

Modbus TCP WCI Writer

Create WCI using Workcell Item Writer.

image2021-8-19_18-17-26.png

  • WCI can be newly created, or existing WCI can be modified.

  • Create new WCI: Add New

  • Modify existing WCI: Check one of existing WCI → Edit

image2021-8-19_18-17-55.png


Write and modify WCI (General Info)

image2021-11-23_16-53-33.png

  1. Select WCI Category.EndEffector → Gripper

  2. Enter WCI Name and Description in WCI Info.Modbus_TCPModbus TCP gripper

  3. Enter the name or Language Code of WCI in Multi-language input field (The name written here will appear on teach pendant).Choose: (none)Enter: Modbus_gripper

  4. Select WCI icon.gripper

  5. Enter WCI version.0.1

  6. Select Visibility Type.Internal


Write and modify WCI (Workcell Item Setting)

  • Workcell I/O Component: Communication Component

  • DRL Component: Component that writes the functions of WCI Action

  • UI Component: Component that provides user input connection function

image2021-8-19_18-21-42.png


Workcell I/O Component

1. Add Modbus TCP in Communication Component and enter the Property values as follows.

  • IP Adress : 192.168.137.253

  • Port Number : 502

  • Slave ID : 255

image2021-11-23_16-55-17.png


2. Add Output Signal and enter the Property values as follows.

  • Write Signal Name : ctrlword

  • Signal Type : Write Multiple Registers

  • Signal Address Index : 2049

  • Signal Initial Value : 0

  • Custom Data : 0,0,0,0

image2021-11-23_16-59-48.png


3. Add Input Signal and enter the Property values as follows.

  • Write Signal Name : statusword

  • Signal Type : Red Registers

  • Signal Address Index : 1


DRL Component

1.  Mandatory WCI Action: Set up essential functions related to WCI.

  • Gripper → Grasp

image2021-11-23_17-9-19.png

Python
def Grasp():
    # get gripper status, split and return the 2,1,0 bit of first byte of the status word     .
    # 0(0b xxxx.x000): Error
    # 1(0b xxxx.x001): Out of specification
    # 2(0b xxxx.x010): Maintenace required
    # 3(0b xxxx.x011): Ready for operation (= there is no error)
    def get_gripper_status(_status_bin):
        _status_bin_list = []
        for n in _status_bin:
            tp_log("pos SW002: " + str(bin(n)[2:]))
            _status_bin_list.append(bin(n)[2:])    
        
        status_bin_buf = _status_bin_list[0][5:8]
        status_bin2int = int(status_bin_buf, 2)
        
        return status_bin2int
    
    set_modbus_output_multi("ctrlword",[int('0000010000000000',2),int('0000001100000000',2),0,0]) 
    wait(0.1)
    set_modbus_output_multi("ctrlword",[int('1000010000000000',2),int('0000001100000000',2),0,0]) #grasp
    wait(2)        
    status = get_modbus_input_multi("statusword")     #StatusWord
    #tp_log("pos SW002: " + str(status))
    now_gripper_status = get_gripper_status(status)
    tp_log("gripper_status: " + str(now_gripper_status))    
    while True:
        if now_gripper_status == 3:
            break
        else: 
            tp_popup("Error: Wrong gripper status!, (CW, 512)", DR_PM_MESSAGE)


2. Mandatory WCI Action: Set up essential functions related to WCI.

  • Gripper → Release

image2021-11-23_17-11-27.png

Python
def Release():
    # get gripper status, split and return the 2,1,0 bit of first byte of the status word     .
    # 0(0b xxxx.x000): Error
    # 1(0b xxxx.x001): Out of specification
    # 2(0b xxxx.x010): Maintenace required
    # 3(0b xxxx.x011): Ready for operation (= there is no error)
    def get_gripper_status(_status_bin):
        _status_bin_list = []
        for n in _status_bin:
            tp_log("pos SW002: " + str(bin(n)[2:]))
            _status_bin_list.append(bin(n)[2:])    
        
        status_bin_buf = _status_bin_list[0][5:8]
        status_bin2int = int(status_bin_buf, 2)        
        
        return status_bin2int
	set_modbus_output_multi("ctrlword",[int('0000010000000001',2),int('0000001100000000',2),0,0]) 
    wait(0.1)
    set_modbus_output_multi("ctrlword",[int('1000010000000001',2),int('0000001100000000',2),0,0])   #release
    wait(2)
    status = get_modbus_input_multi("statusword")     #StatusWord    
    now_gripper_status = get_gripper_status(status)
    tp_log("gripper_status: " + str(now_gripper_status))    
    while True:
        if now_gripper_status == 3:
            break
        else: 
            tp_popup("Error: Wrong gripper status!, (CW, 512)", DR_PM_MESSAGE)


3. User Defined WCI Action: Optional functions related to WCI can be added.

  • Init_comm_gripper

image2021-11-23_17-14-26.png

Python
def init_comm_gripper():
    # Initialize Acknowledging,Referencing,Position words
    set_modbus_output_multi("ctrlword",[int('0000000100000000',2),0,0,0]) #00 00 00 01 00 00 00 00
    wait(0.05)
    set_modbus_output_multi("ctrlword",[int('1000000100000000',2),0,0,0]) #10 00 00 01 00 00 00 00
    wait(0.05)
    set_modbus_output_multi("ctrlword",[int('0000001000000000',2),0,0,0]) #00 00 00 10 00 00 00 00
    wait(0.05)
    set_modbus_output_multi("ctrlword",[int('1000001000000000',2),0,0,0]) #10 00 00 10 00 00 00 00
    wait(0.05)
    set_modbus_output_multi("ctrlword",[int('0000010000000000',2),int('0000000000000000',2),0,0]) 
    wait(0.1)
    set_modbus_output_multi("ctrlword",[int('1000010000000000',2),int('0000000000000000',2),0,0]) 
    wait(2)        
    set_modbus_output_multi("ctrlword",[int('0000010000000001',2),int('0000000000000000',2),0,0]) 
    wait(0.1)
    set_modbus_output_multi("ctrlword",[int('1000010000000001',2),int('0000000000000000',2),0,0]) 
    wait(2)    
    
    status = get_modbus_input_multi("statusword")     #StatusWord
    tp_log("log SW: " + str(status)) 


UI Component

Add Line Edit in UI Component and enter the Property values as follows.

  • Component Name : Wait Time

  • Component Label Name : Wait Time

  • Default Value : 0.5

  • Value Type : Double

  • Double Range

    • Min Value : 0

    • Max Value : 10000

    • Value Type: SI Unit

    • Unit Type: Second

  • Variable Name

    • Component sub-variable name : waitTime

image2021-11-23_17-17-42.png

The following UI Components can be used as user input.

  • Label

  • Text Edit

  • Toggle Switch

  • Radio Button

  • Button – Define DRL

image2021-11-23_17-21-56.png


The following DRL Components can be used

  • Global Variable

  • Global Function

image2021-11-23_17-24-32.png

Write and modify WCI (Workcell Item Setting)

  • Save WCI → Confirm

  • WCI list can be checked as follows.

image2021-11-23_17-26-18.png