From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

luc desruelle's Blogue

Navigateur communautaire
annuler
Affichage des résultats de 
Rechercher plutôt 
Vouliez-vous dire : 

zoom sur LabVIEW en mode Client & Serveur OPC

Desruelle_luc
Trusted Enthusiast

1) Introduction Simple : Par OPC il y a la notion de serveur et de client.

pour faire très simple

  • Le serveur gère la publication des informations entre les clients et les équipements (classiquement un driver communique avec des équipements et permet la lecture / écriture des données, via un nom unique le tag),
  • les clients vont se connecter aux Tags du serveur (nom unique) pour faire une lecture ou écriture de la donnée.

 L'article suivant est très bien "Connexion à des systèmes OPC avec LabVIEW"

http://zone.ni.com/reference/fr-XX/help/371361N-0114/lvconcepts/opc_intro/

 

loc_eps_localopc.gif

 

La fondation OPC définit 8 spécifications :

  • OPC Data Access (DA)
  • OPC Alarms and Events
  • OPC Batch
  • OPC Data eXchange
  • OPC Historical Data Access
  • OPC Security
  • OPC XML-DA
  • OPC Unified Architecture (UA)

 

2) LabVIEW en client OPC :

Si vous avez à disposition un serveur OPC, qui permet donc de publier les données d'un équipement, vous avez besoin d'utiliser LabVIEW comme client OPC.

 

Il y a un bon article : Développement de clients OPC dans LabVIEW (Windows uniquement)

http://zone.ni.com/reference/fr-XX/help/371361N-0114/lvconcepts/opc_dev_clients/

 

Pour résumer :

NI LabVIEW gère la compatibilité avec 2 spécifications OPC. Il faut donc identifier si le serveur est de type :

  • DA : OPC Data Access (DA)
  • UA : OPC Unified Architecture (UA)

 

2.1 Si le serveur est OPC DA

OPC DA est la plus ancienne, et il existe 3 versions, en fonction des versions des possibilités avec LabVIEW

  • Version 1.0 : 1 possibilité : il faut utiliser l'API DataSocket pour faire un Client OPC.
  • Version 2.x— 3 possibilités : Possibilité d'utiliser l'API DataSocket, ou (Module DSC payant) DSC OPC Client,
  • Version 3.0 — 2 possibilités : (Module DSC payant) DSC OPC Client.

2.2  Si le serveur est OPC UA

OPC UA : il faudra les toolkits payant DSC ou RT pour utiliser l'API OPC UA (en client ou serveur)

 

 

3) Faire un serveur OPC avec NI LabVIEW

Pour faire un serveur OPC avec LabVIEW il faudra s'orienter vers

  • Serveur OPC DA 2.x et 3.0 utiliser le serveur de variable partagée
  • Serveur OPC UA utiliser DSC ou RT OPC UA

plus d'informations sur le Moteur de variable partagée (MVP) ou Shared Variable Engine (SVE) en serveur OPC Data Access

http://zone.ni.com/reference/en-XX/help/371361K-01/lvconcepts/opc_conn_from_tpclients/

 

LabVIEW 8.0 or later contains an OPC server called the Shared Variable Engine (SVE). The SVE supports OPC Data Access 2.x and OPC Data Access 3.0. You can publish data from the SVE using shared variables.

To connect to the SVE from a third-party OPC client, use the ProgID National Instruments Variable Engine. If the OPC client allows you to browse for OPC servers, you can locate the National Instruments Variable Engine under OPC version 2.x or 3.0, depending on which versions the client supports.

In the third-party OPC client, you can browse all data items published by the SVE. The SVE allows connections to scalars and arrays of scalars but does not recognize data items of complex data types, such as clusters. You can browse FieldPoint and DAQ data items under their device categories.

 

 

4) un exemple de lecture de données OPC : Client OPC LabVIEW via DataSocket

Personnellement pour communiquer avec des serveurs OPC, comme j'ai très souvent des serveurs OPC DA version 1 ou 2.x, alors J'utilise l'API DataSocket

dsread.gif

 

avec

URL Exemple

opc

opc:\National Instruments.OPCTest\élément1

opc:\\computer\National Instruments.OPCModbus\Modbus Demo Box.4:0

opc:\\computer\National Instruments.OPCModbus\Modbus Demo Box.4:0?updaterate=100&deadband=0.7

 

Un exemple dans les exemples de LabVIEW

C:\Program Files (x86)\National Instruments\LabVIEW 2015\examples\Data Communication\DataSocket\DataSocket OPC\Monitor OPC Items with DataSocket.vi

Clinet OPC.png

 

Ou via l'aide

http://zone.ni.com/reference/fr-XX/help/371361N-0114/lvcomm/datasocket_read/

 

Exemple Reportez-vous au fichier Simple DataSocket.lvproj, dans le répertoire labview\examples\Data Communication\DataSocket\Simple DataSocket, pour obtenir un exemple d'utilisation de "DataSocket Lire".

 

5) Décoder le code qualité OPC de la valeur

 

Utilisez la valeur du code qualité pour obtenir des informations sur l'état de la valeur OPC (192 = Good)

 

Il existe des OPC DA Quality Codes que nous pouvons lire via la variable "qualité" de l'API DataSocket

dsread.gif

 

0

0x00000000

Bad [Non-Specific]

4

0x00000004

Bad [Configuration Error]

8

0x00000008

Bad [Not Connected]

12

0x0000000c

Bad [Device Failure]

16

0x00000010

Bad [Sensor Failure]

20

0x00000014

Bad [Last Known Value]

24

0x00000018

Bad [Communication Failure]

28

0x0000001C

Bad [Out of Service]

64

0x00000040

Uncertain [Non-Specific]

65

0x00000041

Uncertain [Non-Specific] (Low Limited)

66

0x00000042

Uncertain [Non-Specific] (High Limited)

67

0x00000043

Uncertain [Non-Specific] (Constant)

68

0x00000044

Uncertain [Last Usable]

69

0x00000045

Uncertain [Last Usable] (Low Limited)

70

0x00000046

Uncertain [Last Usable] (High Limited)

71

0x00000047

Uncertain [Last Usable] (Constant)

80

0x00000050

Uncertain [Sensor Not Accurate]

81

0x00000051

Uncertain [Sensor Not Accurate] (Low Limited)

82

0x00000052

Uncertain [Sensor Not Accurate] (High Limited)

83

0x00000053

Uncertain [Sensor Not Accurate] (Constant)

84

0x00000054

Uncertain [EU Exceeded]

85

0x00000055

Uncertain [EU Exceeded] (Low Limited)

86

0x00000056

Uncertain [EU Exceeded] (High Limited)

87

0x00000057

Uncertain [EU Exceeded] (Constant)

88

0x00000058

Uncertain [Sub-Normal]

89

0x00000059

Uncertain [Sub-Normal] (Low Limited)

90

0x0000005a

Uncertain [Sub-Normal] (High Limited)

91

0x0000005b

Uncertain [Sub-Normal] (Constant)

192

0x000000c0

Good [Non-Specific]

193

0x000000c1

Good [Non-Specific] (Low Limited)

194

0x000000c2

Good [Non-Specific] (High Limited)

195

0x000000c3

Good [Non-Specific] (Constant)

216

0x000000d8

Good [Local Override]

217

0x000000d9

Good [Local Override] (Low Limited)

218

0x000000da

Good [Local Override] (High Limited)

219

0x000000db

Good [Local Override] (Constant)

 

 

banniere Luc Livre NXG Champion.png

Luc Desruelle | Mon profil | Mon blog LabVIEW | Auteur livre LabVIEW : Programmation et applications - G Web
Certified LabVIEW Architect (CLA) & Certified TestStand Developper (CTD) | LabVIEW Champion

MESULOG - LinkedIn site | NERYS - NERYS Group
| directeur CEO MESULOG
| CODIR - NERYS group

Commentaires