Entry type: FAQ, Entry ID: 7915182, Entry date: 07/30/2001

General information on the OPC server

  • Entry
  • Associated product(s)

What information is there available on the OPC server of WinAC?

General information on OPC, creating items, synchronous and asynchronous reading, writing and monitoring of items is available on the Customer Support pages in Entry ID 6077526 or in the Internet under http://www.opcfoundation.org.

  1. Information on monitoring items with the WinAC OPC server
    Monitoring items is restricted to the logging on of items and enabling the group concerned. The OPC server then checks the items and if there is a change of value, then an event is triggered to the application. The OPC server works with an internal cycle time that you can set yourself. In the case of the WinAC OPC server the smallest value is 100ms. In this cycle the OPC server checks the items and where appropriate triggers an event to the application. This procedure is only useful if the items can be read from the OPC cache and their contents make no noise. Since with the OPC server of WinAC the items are always read from the device and never from the OPC cache, this option is not recommended. Likewise, you should not forget that there is always noise with process control (e.g. at the analog outputs). For this reason the number of events cannot be predicted.
    The WinAC OPC server sporadically generates two events for a change in value. The first event provides the preliminary contents and the second event the proper contents. This property interferes when using soft direct keys if feedback is needed in the application. Applying the button triggers synchronous writing and the contents are fed back by Monitoring of items.
  2. Synchronous reading / writing
    Calling this method keeps the application waiting until the communication is completed. You should only use this method for critical signals such as soft direct keys for the non-maintained command mode.
  3. Asynchronous reading / writing
    This method is the best for communications. The data transfer is triggered and the applications runs again. There is feedback per vent about the successful transfer. You should use this method for large volumes of data and simultaneous low loading of the operating system.
  4. Increasing performance
    Set operations are one of the most effective means of design high-performance applications.
    Tasks such as creating items in a group or reading and writing items can be executed by calling a method. For this you must know as programmer that this results in a change of cycle to the OPC server and the lower-level driver interfaces. Summing up, a large number of cycle changes can cause an extreme deterioration in performance. The OPC interface also offers set operations for this. In other words, creating 1000 items can be done in a loop for each individual item or in one set operation. The latter gives maximum performance.
    In VB, 1000 items are created in a group. This can look like this:
    FOR i=1 TO 1000
    Item="MB" & i ‚ a variable is added to the Item string -> MB1 to MB1000
    MyGroup.OPCItems.AddItem (Item, ... )
    Each AddItem call creates a change of cycle. The following formula is significantly faster:
    FOR i=1 TO 1000
    Items(i)="MB" & i
    MyGroup.OPCItems.AddItems (1000, Items, ... )
    The items are configured in an array and stored in a group with a method call to the OPC server.

    You can increase performance not only by using set operations, but also through the definition of items used.
    In VB, a data buffer of 1000 bytes is requested. The buffer is organized in a coherent area in the CPU.
    FOR i=1 TO 1000
    Items(i)="MB" & i
    MyGroup.OPCItems.AddItems (1000, Items, gServerHandles, ... )
    MyGroup.AsyncRead (1000, gServerHandles, ... )
    Creating of items and reading of items are done by set operation. Asynchronous reading is used and the data is supplied per event. The program can continue to work.
    MyGroup.OPCItems.AddItems (1, Items, gServerHandles, ... )
    MyGroup.AsyncRead (1, gServerHandles, ... )
    Another optimization is to define single item as an array. This optimization step is for when transferring a coherent data area from the controller.

OPC specification, OPC foundation, OPC communications, Client-server