NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
kalcutt
Posts: 30
0 Kudos

Connection to server OPC NI

Hello,

 

I need help, I try to connect a software developped with LabWinows/CVI 9.0 to the opc server of National Instrument.

 

The tag is "opc://localhost/National Instruments.Variable Engine.1//./QGAPro/5_2" or "opc://localhost/National Instruments.Variable Engine.1//./QGAPro/5_4" for example.

 

But the program returns "Error: Can't add item to OPC Group. The item ID is not defined in the server address space or no longer exists in the server address space."

I can check the tag with client opc like :

 

test.JPG



How can I know where is the problem please?

Do you know where is the problem?

 

Thank you.

 

Bye. Karine.

Active Participant
Audrey_P
Posts: 224
0 Kudos

Re : Connection to server OPC NI

Hi Karine,

There is very few information on this error, and I have never encountered it. Can I have further information on your problem:
1. What is the instruction that causes the error, are you trying to add new variable to the group on the server? (perhaps can you post a piece of code?)
2. Is there an error code associated to the error you encounter?
3. Have you ever succeeded in connecting to the OPC server with simplier example or without using group for the variable?

Thank you in advance,

 

Audrey_P
National Instruments France


Journées techniques : des fondamentaux aux dernières technologies pour la mesure et le contrôle/comm...


Member
kalcutt
Posts: 30
0 Kudos

Re : Connection to server OPC NI

[ Edited ]

You can find below a piece of code.

I can connect to the server OPC with a client test, but I can't in my program.

 

char opc_target[] = { "opc://localhost/National Instruments.Variable Engine.1//./QGAPro/            " };

 

static DSEnum_Status status_inline = DSConst_Unconnected;

static DSHandle dsHandle[512] = { 0 };

static void ShowDataSocketError(HRESULT errorCode);

 

/* This is the callback function for the DataSocket */

void CVICALLBACK DSCallback (DSHandle dsHandle, int event, void *callbackData);

 

void fieldbus_init(void)

{

    HRESULT hr = S_OK;

                char chaine_temp[50];

                int i, j;

               

                opc_target[65] = '\0';

                strcat(opc_target, "5_2");

    hr = DS_Open (opc_target, DSConst_ReadAutoUpdate, DSCallback, NULL, &dsHandle[0]);                  //=> hr : « Opération réussie »

}

 

void DSCallback (DSHandle localDSHandle, int event, void *pUserData)

{

    HRESULT hr = S_OK;

    char message[1000];

 

    switch (event) {

        case DS_EVENT_DATAUPDATED:

            break;

        case DS_EVENT_STATUSUPDATED:

            DS_GetStatus (localDSHandle, &status_inline);

            hr = DS_GetLastMessage (localDSHandle, message, 1000);                                                              //=> message : « Can't add item to OPC Group.  The item ID is not defined in the server address space or no longer exists in the server address space. »

            break;

    }

   

    return;

}

 

I can't modify tags because this is another software that generates and which is developed by another company.

I have to read these tags to retrieve the associated values (values of a gas analyzer).

Can you help me with these informations please?

Thank you!

Karine

 

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page