Git Product home page Git Product logo

openopc-python3.6's Introduction

OpenOPC-python3.6

OpenOPC for python3.6 enviroment
This porcedure is for OpenOPC functional test,set your localhost as OPC server.
MatrikonOPC Server for Simulation is recommended,you can download from here. Make sure these environment variables in your Windows box are set as shown:

OPC_CLASS=Matrikon.OPC.Automation;Graybox.OPC.DAWrapper;HSCOPC.Automation;RSI.OPCAutomation;OPC.Automation OPC_CLIENT=OpenOPC OPC_GATE_HOST=127.0.0.1
OPC_GATE_PORT=7766 OPC_HOST=localhost OPC_MODE=dcom OPC_SERVER=Hci.TPNServer;HwHsc.OPCServer;opc.deltav.1;AIM.OPC.1;Yokogawa.ExaopcDAEXQ.1;OSI.DA.1;OPC.PHDServerDA.1;Aspen.Infoplus21_DA``.1;National Instruments.OPCLabVIEW;RSLinx OPC Server;KEPware.KEPServerEx.V4;Matrikon.OPC.Simulation;Prosys.OPC.Simulation

Please download and install the following packages in order to develop your own Python programs.

  1. Python 3.6+
    http://www.python.org/download/

  2. Python for Windows Extensions (pywin32)
    You can do pip install through command line by running :pip install pywin32

  3. Pyro4
    You can do pip install through command line by running :pip install pyro4

  4. Clone or download the repository,extract the compressed file to a folder in your windows box (i.e.C:\OpenOPC36).

  5. Change to lib folder,register the OPC automation wrapper(gbda_aut.dll) by running this in commmand line:
    C:\OpenOPC36\lib>regsvr32 gbda_aut.dll

  6. Change to lib folder,copy python36.dll to your python installation folder if the dll is not existed,folder path as:
    Lib->site-packages->win32
    i.e. C:\Users\Administrator\AppData\Local\Programs\Python\Python36\Lib\site-packages\win32

  7. Change to src folder,copy OpenOPC.py to your python installation folder,folder path as: Lib->site-packages
    i.e. C:\Users\Administrator\AppData\Local\Programs\Python\Python36\Lib\site-packages

  8. Install OpenGatewayService

  • Change to src foldre through command line
    i.e.``C:\OpenOPC36\src>

  • Install OpenOPCService through command line
    python OpenOPCService.py install

  • Wait while the following message is shown
    Installing service zzzOpenOPCService
    Service installed

  1. Start Open Gateway Service
    net start SERVICE through command line as below:
    C:\OpenOPC36\bin>net start zzzOpenOPCService

  2. Functional test

  • using the OpenOPC Gateway Service mode(both win32 platform and non-windows platform)

    client code as below:

    import OpenOPC
     def readopc():
         opchost = 'localhost'
         taglist = ['Random.Int1']
         opc = OpenOPC.open_client(host = opchost)
         opc.connect()
         while True:
             v = opc.read(taglist)
             for i in range(len(v)):
                 (name, val, qual, time) = v[i]
                 print('% -15s % -15s % -15s % -15s'% (name, val, qual, time))
     if __name__=='__main__':
         readopc()
    
  • using DCOM mode(only win32 platform)

    client code as below:

      import OpenOPC
      opc = OpenOPC.client()
      opc.connect("Matrikon.OPC.Simulation.1")
      while True:
          data = opc.read('Random.Int1')[0]
          print(data)
    
  1. The authors of this package are:
    Copyright (c) 2008-2012 by Barry Barnreiter ([email protected])
    Copyright (c) 2014 by Anton D. Kachalov ([email protected])
    Copyright (c) 2017 by José A. Maita ([email protected])
    For more details please check Mr.joseamaita's repository about OpenOPC here

openopc-python3.6's People

Contributors

alexhll avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.