LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a OPC Server

Graig - thank you.
It look funny 🙂
Can you answer more?
Ok, I see I can add Shared variable to project. But I can't understand ... how I can write vi that use future Shared variable ...?
0 Kudos
Message 11 of 18
(2,784 Views)
Hey,
 
The best way to do that is to use data socket.  There is a shipping example that comes with LabVIEW that shows how data socket works with shared variables.  Open LabVIEW and go to Help >>  Find Examples.  This will open the NI Example Finder.  From the Browse tab, go to Networking >> Data socket >> General.  Open the Shared Variable Client - Server.lvproj.  The Data Socket API Client.vi shows how to write and read from shared variables with data socket.  This VI is in the clients.lvlib.
 
Hope this helps! 
Daniel Eaton
National Instruments
Systems Engineering
Embedded and Industrial Control
0 Kudos
Message 12 of 18
(2,748 Views)

Daniel E
Thank you very much. Unfortunately, it doesn't help. I didn't ask about client that would be connect to server that creates Shared variable on fly.

My question was about server. Server creates Shared variable on fly and how it can use these Shared variable to get/put new values? NI example has server.lvlib and the example uses static Shared variables (waveform and command). This way I knew also.

0 Kudos
Message 13 of 18
(2,742 Views)

This can be done in Variable Manager.  In Windows, this can be accessed through Start»Programs»National Instruments»Variable Manager and selecting the Variable Manager.  This will show all deployed libraries and variables. 

You can drag the variables you'd like to write values to from the tree view over to the watched variables list and double click on the value to write a new value.

Regards,

Craig D
Applications Engineer
National Instruments

0 Kudos
Message 14 of 18
(2,723 Views)

Graig,

I know that way. That is manual way.

The question was another.

Let say, I have first PC with system1 that has ONE subsystemA (3 SharedVariable). I have second PC with system2 that has TWO subsystemA (6 Shared variable). So I create subsystemA. System1 and system2 are identical. These read ini file and create subsystemA one time or twice. Can I do that (of course, I don't wish to put program system1 and system2 twice twice and I don't like to create SharedVariable manually) programmaticly (on fly).

0 Kudos
Message 15 of 18
(2,719 Views)
I Have the same problem. I need to create an OPC Server to distribuite to the final user (just an .exe)
0 Kudos
Message 16 of 18
(2,613 Views)

Thanks.

I knew this example. But I can't understand how I can use it.

Let take the simplest example. I have 20 computers with the same program. Program uses the same set of variables with prefix ComputerName. So I generate 20 files with filenames as computernames and file are the same (forget about data base)

Now LabVIEW. I need to do 3 steps.

First step, first vi creates shared variables for project (example)

Second step ... Actually, I don't know ... how second vi (real program) will connect to have created shared varilables???

Third step, I need to create application.

If I was right it doesn't look useful.

0 Kudos
Message 17 of 18
(2,600 Views)

Hi,

In order to programmatically create and publish shared variables, you will need the LabVIEW Datalogging and Supervisory Control (DSC) Module.  With this module, VIs are included for creating and publishing shared variables, which you could do in the server VI.  The LabVIEW DSC Module also provides functionality for acquiring an array of all the shared variables on the server, so your other VIs can access all of them.

 

If you don’t know what data types the variables are going to be, once you have the array of all the shared variables, you can use data sockets in a for loop to access the data in these shared variables.
Donovan
0 Kudos
Message 18 of 18
(2,582 Views)