For Classic OPC remote connection:
Use OPC Client I/O Server (DSC Module) to access remote OPC tag. See Create Shared Variables that Connect to the OPC Tags through the I/O Server
in Connect LabVIEW to Any PLC Using OPC
. However, DCOM setting is required before using this I/O Server. For OPC UA remote connection:
At server computer, use NI OPC Server to act as OPC DA Client to access data from FSGateway. Whereas at client computer, use OPC UA API to act as OPC UA Client to access data from remote NI OPC Server (server computer).
- In server computer, open NI OPC Server and create new communication channel by clicking New Channel icon and key in appropriate name for it.
- Select OPC DA Client from the Device driver drop down menu.
- Configure appropriate write optimization setting.
- Click Select server and navigate to FSGateway.
- Configure appropriate connection setting.
- Add device to the new created channel and key in appropriate name for it.
- Configure appropriate settings and choose desired tags that you would like to access.
- Open OPC UA Configuration Manager to obtain server endpoint URL, set desired security policies and export server certificate.
- Reinitialize NI OPC Server. You can do this by right clicking the NI OPC Server icon at taskbar and select Reinitialize. If it doesn't exist, you can open OPC Server Administration, NI OPC Server icon will be displayed at taskbar.
- Transfer the server certificate from server computer to client computer. Double click the certificate and install the certificate. Usually the certificate will be installed in Trusted Root Certification Authorities.
- In client computer, program your LabVIEW application using OPC UA API and establish connection by using server endpoint URL, security policies and server certificate that you obtain in step 8.
- At first run, you may receive an error, because OPC server doesn't trust the OPC client. However, after the first run, certificate is generated by Create Certificate.vi and is located at C:\ProgramData\National Instruments\certstore\opcua.
- Transfer the client certificate from client computer to server computer. Double click the certificate and install the certificate.
- In server computer, open OPC UA Configuration Manager and import the client certificate.
- Repeat step 9.
- In client computer, run the LabVIEW program again.
The remote communication via OPC UA interface might not be able to establish although you follow the step above. Please refer page 16 of OPC UA Configuration Manager - Kepware
for the detail. At server computer, please kindly add an exception (TCP port).