Skip to main content

No project description provided

Project description

  • Project Name

    Python Connect to Delta-SE Series for "Read" and "Write" Functions

  • Preface

    • Why does rk_delta_SE also use the Modbus TCP protocol,and what are its advantages?

      Optimization projects:

        1.Address Jump Issue : Delta PLC Modbus address planning is discontinuous. <br>
                                For example : M1535 (address 0x0Dff) and M1536 (address_0xB000) or 
                                              D4095 (address_0x1FFF) and D4096 (address_0x9000).
                                This limits "batch read/write" operations.
      
        2.Word/Dword Sign : Add Word/Dword calculations for signed/unsigned.
        
      
        3.KeepAlive : By default,the Delta PLC will automatically disconnect if no data is send within 120 seconds.
                      For example,if the "user" writes a program that makes an indicator light blink alternately every 130 seconds, 
                      the PLC will disconnect due to the timeout,add the KeepAlive long-connection feature, users can easily maintain continuous operation and avoid disconnection.
      
  • Support PLC

    Detla SE Series (Ethernet)

  • How to use

    • Step-1 : Configure

          IP   : 192.168.3.100
      

      Example Image

    • Step-2 : Install rk_delta_SE ( Windows )

      pip install dist/rk_mcprotocol-0.0.2-py3-none-any.whl
      

      Example : C:\Users\Downloads\rkmcprotocol-main>pip install dist/rk_mcprotocol-0.0.2-py3-none-any.whl

    • Step-2 : Install / Uninstall rk_delta_SE ( Raspberr PI OS 64-bit )

      pip install dist/rk_mcprotocol-0.0.2-py3-none-any.whl --break-system-packages
      
      pip uninstall rk_mcprotocol --break-system-packages
      

      Example : rk@raspberrypi:~/rkmcprotocol $ pip install dist/rk_mcprotocol-0.0.2-py3-none-any.whl --break-system-packages

      Example : rk@raspberrypi:~/rkmcprotocol $ pip uninstall rk_mcprotocol --break-system-packages

  • Function Overview

                                                                  Delta SE : Memory Range
      Function      Device Code      Length        Device Code     Points     CarrySystem   Max.Points 
      -------------------------------------------| --------------------------------------------------
      read_sign_word     D0           100        |      X         X0 ~ X377        8          256    
                                                 |      Y         Y0 ~ Y377        8          256    
                                                 |      M         M0 ~ M4095       10         4096    
                                                 |      S         S0 ~ S1023       10         1024     
      read_sign_Dword    D0           50         |         
                                                 |      D         D0 ~ D11999      10         12000 
                                                 |
                                                 |  
      read_bit           X0           256        |           
                         Y0           256        |        
                         M0           256        |----------------------------------------------------
                         S0           256        |
                                                 |                                                   
      write_sign_word    D0           100        |
                                                 |
                                                 |
                                                 |
      write_sign_Dword   D0           50         |
                                                 | 
                                                 |
                                                 |
      write_bit          Y0           256        |
                         M0           256        |
                         S0           256        |
                                                 |
                                                 |                
      -------------------------------------------|
    
  • Commands

        # Read M0 ~ M255 , Value : 0 or 1
        print(rk_delta_SE.read_bit(s,headdevice = 'M0' , length = 256 ))
    
        # Read D0 ~ D99              
        # signed_type=True  Value : -32,768 ~ 32,767 
        # signed_type=False Value :       0 ~ 65,535 
        print(rk_delta_SE.read_sign_word(s,headdevice = 'D0' , length = 100, signed_type=True))
    
        # Read (D0,D1) ~ (D98,D99)  
        # signed_type=True  Value : -2,147,483,648 ~ 2,147,483,647 
        # signed_type=False Value :              0 ~ 4,294,967,295       
        print(rk_delta_SE.read_sign_Dword(s,headdevice = 'D0' , length =50 , signed_type=True))
     
    
        # Write Y0 ~ Y377 , Value : 0 or 1
        print(rk_delta_SE.write_bit(s,headdevice = 'Y0' , data_list = [1]*256 )) 
    
        # Write D0 ~ D99              
        # signed_type=True  Value : -32,768 ~ 32,767
        # signed_type=False Value :       0 ~ 65,535 
        print(rk_delta_SE.write_sign_word(s,headdevice = 'D0' , data_list = [-999]*100 ,signed_type =True))
    
        # Write (D0,D1) ~ (D98,D99)  
        # signed_type=True  Value : -2,147,483,648 ~ 2,147,483,647 
        # signed_type=False Value :              0 ~ 4,294,967,295       
        print(rk_delta_SE.write_sign_Dword(s,headdevice = 'D0' , data_list = [9999999]*50 ,signed_type =True))
    
  • Example

        #Example PLC Delta-26SE 
    
        import rk_delta_SE 
        import time
        
        HOST = '192.168.3.100'
        PORT = 502
        s = rk_delta_SE.open_socket(HOST,PORT) 
    
        while True :
            st = time.time()
            
            print(rk_delta_SE.read_bit(s,headdevice = 'M0' , length = 256 ))
            print(rk_delta_SE.read_sign_word(s,headdevice = 'D0' , length = 100, signed_type=True))
            print(rk_delta_SE.read_sign_Dword(s,headdevice = 'D0' , length =50 , signed_type=True))   
            print(rk_delta_SE.write_bit(s,headdevice = 'Y0' , data_list = [1]*256 )) 
            print(rk_delta_SE.write_sign_word(s,headdevice = 'D0' , data_list = [-999]*100 ,signed_type =True))
            print(rk_delta_SE.write_sign_Dword(s,headdevice = 'D0' , data_list = [9999999]*50 ,signed_type =True))
        
            et = time.time()
            elapsed = et -st
            time.sleep(1)  
            
            print (f' elapsed time = {elapsed}')
    
  • Q&A

    • Why use import threading

      A : After connecting to the Delta PLC , if no message is send within 120 seconds , the Delta PLC will automatically disconnect. To maintain a long connection , if the user dose not send a message within 110 seconds , an internal thread will trigger to keep the connection active.

    • Why use import time

      A : The same as above.

    • Is it faster to use threads?

      A : Yes

      Reference : DVP-ES2/EX2/EC5/SS2/SA2/SX2/SE&TP Operation Manual - Programming (Page B-2) :
      Although Modbus TCP operates in half-duplex mode , the PLC itself supports multitasking with 8 available client ports.

      ※Note  : While 8 ports are available , it is genrally not recommended to use them all . 
                Typically,one port is already occupied by the PLC user's connection , User need to know the number of ports in use , otherwise connections may fail .
      

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rk_delta_se-0.0.1.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rk_delta_SE-0.0.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file rk_delta_se-0.0.1.tar.gz.

File metadata

  • Download URL: rk_delta_se-0.0.1.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for rk_delta_se-0.0.1.tar.gz
Algorithm Hash digest
SHA256 717e8b7b7c16e57e5975e66f47fcd060d9489b852dc199686e5f90025d97b398
MD5 5a67d37e887909771a70c6e1337adf3a
BLAKE2b-256 44fed46701c9d5448b464b3b4e08e0400c2144c8832fe0881d59382c0c58ab0b

See more details on using hashes here.

File details

Details for the file rk_delta_SE-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: rk_delta_SE-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for rk_delta_SE-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ead606c136e9e4210fe7fa91f00a155b568e76799528b61af9ef20bc7fde506c
MD5 d4fd4fd4ce2291e83728d9eb18991709
BLAKE2b-256 e0b40752d0854bd644367c581784017a9538ea65908284aaf2b59d3db1a41ad4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page