OPC SERVER/CLIENT

Dear Sir
I try to connect the opc server.And I have connected the server successed.But there is question confused me as below:
code as below that for additems after connected the OPC server
If WriteItemIndex > 0 Then
            WtInputItemColl.AddItems(WriteItemIndex, WriteItem, ClientHandles1, ServerHandlesWtIn, ErrorsWtIn)
            WtInputGrp.IsSubscribed = True
End If
Running code, vb2013 show the message:"
An unhandled exception of type 'System.Runtime.InteropServices.SafeArrayTypeMismatchException' occurred in OPC_CLIENT1.exe
Additional information:The specified array was not of the expected type.
I checked the AddItems.Syntax
AddItems (Count As Long, ItemIDs() As String, ClientHandles() As Long, ByRef
ServerHandles() As Long, ByRef Errors() As Long, Optional RequestedDataTypes As Variant,
Optional AccessPaths As Variant)
I can not find the error,I have defined all the variants as syntax
    Dim ServerHandlesWtIn(100) As VariantType
    Dim ServerHandlesRdOut(100) As VariantType
    Dim WithEvents WtInputGrp As OPCGroup
    Dim WithEvents RdOutputGrp As OPCGroup
    Dim WtInputItemColl As OPCItems
    Dim RdOutputItemColl As OPCItems
    Dim ClientHandles1(100) As Long
    Dim ReadItem(100) As String
    Dim ReadValue(100) As VariantType
    Dim WriteItem(100) As String
    Dim WriteValue(100) As VariantType
    Dim ErrorsWtIn(100) As VariantType
    Dim ErrorsRdOut(100) As VariantType
    Dim WriteItemIndex As Long
    Dim ReadItemIndex As Long
Please help me find it,thank you!

Hello Yu Du,
This looks like VB6 code. This forum is only for VB.Net since 2002. VB6 is not supported anymore. Have a look at this page and post to the linked forum:
Visual Basic 6.0 Resource Center
Armin

Similar Messages

  • OPC Server (Matrikon) and LabVIEW2009 (Client)

    Hello,
    In one of application, I am going to use OPC Server may be from Matrikon etc  and LabVIEW 2009 would be a client.
    So could anybody help me to start this with respective to following?
       1) Which software/Modules else required?
       2) How to get Server connection In Application for data exchange ?
       3) Any startup code?
       4) Any tutorial (Other than NI)?
    Thanks in Advance With RegardsHemant

    Hello
    I am to communicate with LabVIEW using the OPC Server's and OPC server´s Matrikon, I have all my varibles in Labview OPC Client, but to run my program my VI. I have an error someone can help me.
    Attachments:
    eror1.doc ‏73 KB

  • How to make SVE a visible OPC server to third party OPC clients?

    I've read SVE works as an OPC sever, but when I try to browse it with a third-party OPC client I get no items.
    Is there any configuration needed? Is DSC needed?
    http://zone.ni.com/reference/en-XX/help/371361E-01/lvconcepts/opc_conn_from_tpclients/

    Hi Keptat
    DCOM shouldn’t be the problem because you are not using the OPC server from an external computer or from other PC user, nevertheless, you can always try to do it.
    I’m attaching some links with information about the DCOM privileges and how to configure de SVE.
    Are you able to see others OPC servers with your clients?
    http://zone.ni.com/devzone/cda/tut/p/id/3371
    http://zone.ni.com/devzone/cda/tut/p/id/4679#toc3
    http://digital.ni.com/public.nsf/allkb/5C8A90CD57B279F286256C2C006F1EB4?OpenDocument
    Coamín Cruz
    NI México
    Mensaje editado por Coamín

  • LV OPC client cannot get value from remote Matrikon OPC server

    Trying to use LV DSC OPC client connect to remote OPC server. Both running on win7.
    It seems the link is up, but cannot get data. As the attached screen, the msg is 
    CoCreateInstanceEx: CLSID=F8582CF2-88FB-11D0-0C0F010435, InstanceType=CLSCTX_ALL, ServerName=\\172.16.5.38, CMQ=1 (FAILed, HRESULT=0x80070005 Access is denied. 
    While using the MatrikonOPCexplorer can link to remote server and refresh value automatically. But also got error when start up as the attached.
    Any suggestion, thanks.
    Attachments:
    ss.png ‏43 KB
    ss2.png ‏214 KB

    Likely this is an issue related to DCOM configuration. Can you double check tagsrv.exe ("NI Variable Engine" service ) has the correct DCOM configuration talking to the remote OPC Server?

  • LabVIEW DSC 2011 / OPC Client IO Server / Can I write to the OPC Server using OPC Groups?

    Hi
    I am using LabVIEW DSC module as a OPC client. My Shared Variables are binded to automation system OPC Server via "OPC Client IO Server".
    On the OPC Server side it seems that the every write commands comes like one item at time, not like grouped.
    Now I have tested this with the NI OPC Server as server and KepServer and LabVIEW DSC IO Server as OPC Clients.
    When I use the NI OPC Server : OPC Diagnostics there are different events messages when the update request comes from KepServer or LabVIEW DSC.
    There are log files on attachements for both write events.
    Attachments:
    Data from the KepServer.txt ‏6 KB
    Data from the LabVIEW DSC OPC Client.txt ‏18 KB

    Hello Pentsi,
    I have received confirmation (from the PSE in the US) that DSC doesn't support group writes
    There however work-arounds that might provide a solution:
    - The first solution I had in mind was like this. Update the 50 OPC items as fast as possible.
    Then use a 51st item as synchronization OPC item to check/indicate if new data has arrived/has been set/is available.
    So LabVIEW sets 50 OPC values as fast as possible. The 51st value becomes goes from false to true when the first 50 values are written.
    When this (51st) value is true on the OPC server you can read out the first 50 values (from the non-LabVIEW side). When you've read out these values, then you can set the 51st value back to false (from the non-LabVIEW side).
    In the meanwhile at the LabVIEW side you wait until the 51st value goes back from true to false.
    When it becomes false, then you write again those 50 values and afterwards set the 51st synchronization value from false to true.
    And this keeps on going...
    Note: Keep in mind that you only have to monitor one event at the side of the Automation System OPC Server in this case (the 51st) and based on an event occuring over there you can just do a group read of the 50 others. Also keep in mind that the maximum rate (6500 updates per second) from inside LabVIEW with the DSC Module OPC client I/O server was also mentioned in this document (http://digital.ni.com/public.nsf/allkb/63C043359F1​E12538625726E005BCD0C?OpenDocument).
    Could this be a possible solution for your problem?
    If you're using one of the OPC servers in this list (http://zone.ni.com/devzone/cda/tut/p/id/6417#toc19), then you can also use NI OPC Servers to update tags instead, which supports a faster update rate.
    Kind Regards,
    Thierry C - Applications Engineering Specialist Northern European Region - National Instruments
    CLD, CTA
    If someone helped you, let them know. Mark as solved and/or give a kudo.

  • How can I write to a Siemens S7-300 PLC tag from OPC Server.vbai page by using a Knob object ?

    I am using NI OPC Server and I can read Siemens S7-300 PLC tags such as thermocouple values from the PLC. Additonally I can write manually a constant value to that tag by selecting it in the NI Distributed System Manager. And I can read the written value from NI Distributed System Manager or from NI OPC Server. But I can not write any value to the S7300 PLC tags such as by using a knob object at the NI Vision Builder AI Inpection (.vbai) page.
    Any help is welcomed. Thanks in advance.
    Attachments:
    manual_writing_to_plc.png ‏298 KB

    The tutorial at the following location explains how to use Vision Builder AI as a OPC server.
    https://decibel.ni.com/content/docs/DOC-18647
    http://www.ni.com/white-paper/13574/en
    To allow VBAI to connect to an OPC Server (i.e. act as an OPC client), you need to purchase and install the DSC Run-time System.
    Once installed, you can create an OPC I/O client using the Distributed System Manager, create variables bound to OPC tags, then create VBAI network variables that are bound to these variables.
    Another possible technical solution to connect to OPC Servers supporting Data Access 2.0 is to use the datasocket API in a Run LabVIEW step.
    http://forums.ni.com/t5/Machine-Vision/Read-and-Write-with-OPC-through-NI-Vision/m-p/2048278/highlig...
    Hope this helps.
    -Christophe

  • How do I browse an OPC Server's Namespace with Teststand ActiveX Steps?

    Hello
    I use Teststand as the client of an OPC Connection. At the Moment I'm trying to realize an browse funktionality by using the "OPC Automation 2.0" automation server in the
    ActiveX adapter.
    What I can create is the OPCBrowse object by using the "CreateBrowser" method. But then there's no method to browse the OPC server's namespace for the ItemID's.
    Does someone have an idea how I can go on further?
    thx, Michael   

    For your information, there is a new TestStand Add-on "OPC DA Connect" which adds a StepType Palette dedicated to OPC Data Access.
    You can configure each step by browsing the OPC servers on your network and browsing variables within these servers.
    The browsing functionnality that you where looking for as been implemented in this toolkit.
    Hoping this helps.
    Jean-Louis SCHRICKE
    ├ CTA - Certified TestStand Architect (2008 & 2010 & 2014)
    ├ CTD - Certified TestStand Developer (2004 & 2007)
    └ CLD - Certified LabVIEW Developer (2003 & 2005)

  • Is Shared Variable Engine with LV8 an OPC server ?

    Hello
    Is the shared variable engine with LV8 an OPC server ?
    Does any OPC client can acces to Variable Engine OPC server an read shared variable ?
    Can I build an installer and deploy my application with Variable Engine OPC server on other PC without LV8.
    Thank you 

    Hi
    You can communicate between an OPC serveur and LV8 and use shared variable. To deploy an LV8 exe application, you must have the run time engine installed on the PC without installing LV8. You can create a setup with LV 8 in which you can integrate the run time engine.
    Kamal
    NIF

  • Shared Variable Engine OPC Server & Matrikon OPC Explorer

    Hello All
    I have a shared variable Engine OPC server running on my IPC. I am querying NI OPC Server through Matrikon OPC Client. My situation is if shared variable engine process is switched forcefully off (NI DSM) or communication between server and client is lost then client is crashing which is quite obvious. But the problem is if Server is Up again then the client is not connecting to server automatically.
    First of all is it  possible, that if server is up again then it will try to send some signals to the priviously connected clients ? If yes then do i have to make changes in shared variable engine properties ? How i can do this ?
    I hope you all will understand my problem, if not please post you doubts. I will try to clear my points.
    Thanks & Regrad´s
    Varun Garg

    Hi, just now I face a similar problem. When clients restart connection, the variable engine crash, for now the only way founded is restart the program programmatically, but I'm interested in how fix that.

  • OPC Server for Labview/PXI-RT

    Hi all,
    can i access Labview on a PC/WinXP or a PXI/RT System  with a
    OPC-Client (eg.:WinCC/Siemens) like a Compact Fieldpoint over the NI
    OPC Server (NationalInstruments.OPCFieldPoint). Exist a OPC-Server for
    Labview/PC/PXI?
    Thanks
    Achim

    Here you can find information concerning this issus:
    http://digital.ni.com/public.nsf/websearch/CC9CDD577F041786862572120061EB5A?OpenDocument
    Hope this helps!

  • OPC Server PLC

    Hallo,
    I am doing right now the tutorial from NI " Connect LabVIEW to Any PLC Using OPC". And the first capital was everything richt, "View Existing PLC Tags with NI OPC Servers 2012".
    But in the second capital "Connect LabVIEW to OPC Tags by Creating an I/O Server" I can't get the picture as the 4. step "Select OPC Client in the Create New I/O Server Window and click Continue. ".
    The problem is, there is no option for "National Instruments.NIOPCServers.V5" to choose by me. How can I get the pic as the tutorial?? Why I can't get the "configure OPC Client I/O setup" menu??
    My system:
    LV 2012,  Win7, 
    Does somebody know the problem?? 
    Thanks a lot!
    Cabio

    But I think my OPC Server is running, the tool OPC Quick Client can connect to server "National Instruments.NIOPCServers.V5", it is also showed in the Pic.
    And I have fund a VI "C:\Program Files (x86)\National Instruments\LabVIEW 2011\vi.lib\variable\tagger\opcClient\GetOPCServerList.vi", this VI can find the "National Instruments.NIOPCServers.V5". But NI-DSM cant find it.
    I am confused~~~
    Attachments:
    OPC_Quick_Client_2014-01-21_14-58-00.jpg ‏342 KB
    GetOPCServerList_VI _2014-01-21_15-45-33.jpg ‏45 KB

  • Problem to connect with OPC Server opc.sinumerik.machineswitch using DS_Open

    Hi,
    I want to connect to an Siemens OPC server type opc.sinumerik.machineswitch using DS_Open calls (CVI 6.0) to read few tags. Running my client software (as well as the NI- sample test client) locally on the same computer as the server the connection works and I can access the tags.
    Running the client-software on a remote PC then the DS_Open call "hangs-up" (not even an error message). All the DCOM settings etc should be ok, since I can access the tags using the Siemens Client OPC-Scout as test client.
    I have used the same calls in several previous applications and it works with other servers (Bachmann, WinCC), so I am pretty sure that I use the correct URLS etc.
    What can be the reason for a specific incompatibility?
    Any idea is highly appreciated.
    Cheers,
    Ronald

    Hi Roland,
    as experience shows, Remote DataSocket is hard to implement.
    The best way to implement this communication is the following:
    First of all, check the DCOM -Settings
    Using OPC via DCOM with Windows XP
    http://www.opcfoundation.org/DownloadFile.aspx?RI=326
    Use the “NI-OPC Server” to create a tunnel between the Siemens OPC server and your PC.
    Install the NI-OPC Server on your PC and use the “OPC DA Client Driver” to access the tags on the Siemens OPC server.
    After that you can access the created tags in the NI-OPC Server with CVI and DataSocket.
    Please download the NI OPC Servers Evaluation-Version to test communication.
    NI OPC Servers
    http://sine.ni.com/nips/cds/view/p/lang/en/nid/209059
    Download NI OPC Servers Evaluation
    https://lumen.ni.com/nicif/us/evalopc/content.xhtml
    Regards
    Ulrich

  • Is it possible to connect labview with opc server without using NI dsc Module ?

    Hellow sir,
    I want to get data over labview using OPC server and i am not using any dsc module vi (Alams, print, GUI, security).I am using share variable to get data from OPC server to labview. Now i want to deploy that application to third party computer. (where there is no NI software is installed)
    i am using labview 8.6 and 2009.
    Many ? like....
    1) what is the procedure to install that application in third party computer.
    2) Do i need to use my dsc run time licence..?
    waiting for your valuable feed back.
    Thank you.
    CLAD
    Labiew programmer

    Hi, When you connect to NI OPC Server by creating New I/O Server > OPC Client. You will see all registered OPC Servers running on local machine or remote machine. I used KepServerEx from Kepware and LSIS OPC Server from LG with no problems. Just make sure that the OPC server is running.
    Hope it helps
    Waleed El-Badry MSc.,MCPD, ISTQB Certified Tester
    Assistant Lecturer
    Mechatronics Department
    Faculty of Engineering
    Misr University for Science & Technology
    Attachments:
    LG.png ‏57 KB

  • I have an existing application need to add LabVIEW OPC Server

    I have an existing application written in LabVIEW which controls a Device. The data from the device is currently logged to the local drive. 
    It is desired to upgrade this application to become an OPC Server so that the manager can remotely acquire data and control the Application.
    What would be the easiest approach to accomplish this task?
    Thanks and Best Regards,
    Gary

    Hello Dan,
    1. The operator specifies a time interval to save the data to disk. The data is stored in a csv file.
     2. The manager is the Engineer who is managing the data collection system remotely.
    3.The desired end result is to have the LabVIEW with an OPC server provide the connectivity to an OPC client so that they can collect the data, that they desire from the system, and control the system.
    4. Controlling the system is secondary. Providing the connectivity so that an OPC client can specify what data is to be sent and the update interval is the first priority.  For example, they may only be interested
    in 10 of say 30 parameters, and want that data sent over every 10 seconds or so. The data once they receive it will be logged to a central data base.
    We suggested using TCP/IP but they do not want a custom interface.
    We also suggested Modbus, but they perfer to use OPC. The want to integrate it with their OSI PI.
     Thanks and Best Regards,
    Gary

  • What is the best way to disable tags in SVE when a OPC server is not available?

    I have a LV2009 DSC app with SVE that reads tags (1100 spread acrross them) from 4 PLC's through NI OPC server.  From time to time the PLC will lose power because that test machine will be powered down.  The NI OPC  loses the OPC link then to that particular machine/PLC and this error is transferred through to the SVE. 
    Is there an any/efficient way to stop the reading of tags if/when this happens?  The only way I can think of is to undeploy/re-deploy from the app when it is necessary. 
    In the same way is it possible to prevent the SVE acting on this error?
    I also have a longstanding problem with updates of tag values to the frontend of the LV VI.  The update rate into SVE seems OK, but the tag values are slow to update onto the page.  I have reduced the amount of tags on the pages as well as reducing the amount of code on a page.  It becomes better, but I would like to have an update of less than 2 seconds at least to properly display plant status.  I'm running a heartbeat timer from a PLC and in some cases this takes up to 15 seconds to update.
    Any assistance will be appreciated.
    Pierre

    PierreN,
    In order to set the timeout value of a Shared Variable, you may Right-Click, and select 'Show Timeout':
    Implementing Timeouts through your application variables will allow you to gage which variables are, and are not updating. This troubleshooting stepp will allow you to better characterize the source of the slowed update rate. You also may take a closer look at the OPC Server configuration, and the deadnband settings you have implemented on the I/O Clients. 
    Snowforest has offered good advice in terms of implementing a State-Machine architecture to handle the 'Power Down' system status. Also, if you know the specific error that is propagated, you may choose to implement implicit error handling using the data contained in the Error Cluster.
    Cheers,
    Pcorcs
    Patrick Corcoran
    Application Engineering Specialist | Control
    National Instruments

Maybe you are looking for

  • ERS Settlement Problem for movment type 102

    Hi All, There is an scheduling agreement created with ERS check mark. When I do the goods receipt in MB01 against 101 movement type, MRRL is triggering for the goods movement. When I reverse the goods movement in MB01 against 102 movement type, MRRL

  • AirPort WiFi on 2010 MBA won't stay connected to 5Ghz band since latest 10.6.7 update.

    I updated my 2010 MBA 11" to the latest/greatest of everything in prep for Lion. So, I now have 10.6.7 of course. But ever since the updates, I noticed that my wifi on the MBA won't stay connected to the 5 Ghz band of my router. It'll connect fine to

  • Material group with classification

    Dear Friends     I have a requirement like below: For a Plant ABCD I have 5000 materials in which i maitained 30 material groups. under each material group again i classified into sub material groups. also need an authorisation control based on mater

  • £ currency symbol preceded by 'A'

    Each time I include a £ currency symbol in iWeb and upload to my site the online version shows a 'A" (with a hat on) symbol in front of the £. Probably a simple answer to this but I can't find it. I have no problems with $ but unfortunately £ is my c

  • Itunes update locks phone to usb/itunes logo screen

    So for the past year whenever apple has an update it messes with my phone. This as I said first happened about a year ago. I updated my phone and in the middle of doing so itunes errored out and I was unable to continue with the update. My phone was