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

Workcell Item Writer를 이용하여 WCI를 생성할 수 있습니다.

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

  • WCI를 새로 생성하거나, 기존 WCI를 수정할 수 있습니다.

  • 새로운 WCI 생성: Add New

  • 기존 WCI 수정: 기존 WCI 중 하나 체크 → Edit

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


WCI 작성 및 수정 (General Info)

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

  1. WCI Category를 선택합니다.EndEffector → Gripper

  2. WCI Info에 WCI Name과 Description을 입력합니다.Modbus_TCPModbus TCP gripper

  3. Multi-language 입력 란에 WCI의 이름이나 Language Code 를 입력합니다(이곳에 기록한 이름이 티치 펜던트에 나타납니다).Choose: (none)Enter: Modbus_gripper

  4. WCI의 icon 을 선택합니다.gripper

  5. WCI의 버전을 입력합니다.0.1

  6. Visibility Type을 선택합니다.Internal


WCI 작성 및 수정 (Workcell Item Setting)

  • Workcell I/O Component : 통신 모듈

  • DRL Component: WCI Action 의 기능을 작성하는 Component

  • UI Component: 사용자 입력 연결 기능을 제공하는 Component

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


Workcell I/O Component

1. Communication Component에서 Modbus TCP를 추가하고 다음과 같이 Property를 입력하십시오.

  • IP Adress : 192.168.137.253

  • Port Number : 502

  • Slave ID : 255

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


2. Output Signal을 추가하고 다음과 같이 Property를 입력하십시오.

  • 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. Input Signal을 추가하고 다음과 같이 Property를 입력하십시오.

  • Write Signal Name : statusword

  • Signal Type : Red Registers

  • Signal Address Index : 1


DRL Component

1. Mandatory WCI Action: 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: 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: WCI와 관련된 옵션 기능을 추가할 수 있습니다. 

  • 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

UI Component에서 Line Edit을 추가하고 다음과 같이 Property를 입력하십시오.

  • 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

다음과 같은 UI Components들을 사용자 입력으로 사용할 수 있습니다.

  • Label

  • Text Edit

  • Toggle Switch

  • Radio Button

  • Button – Define DRL

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


다음과 같은 DRL Components들을 사용할 수 있습니다.

  • Global Variable

  • Global Function

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

WCI 작성 및 수정 (Workcell Item Setting)

  • WCI 저장 → Confirm

  • 다음과 같이 WCI list를 확인할 수 있습니다.

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