Creating a Shared Variable
Complete the following steps to create a shared system variable.
- Select Tools»Variable Manager.
- Select the System Variables tab.
- Click Add.
- Enter a name for your variable and select a Type and Initial Value.
- Enable the Publish on Network checkbox.
- Click OK.
- Click OK to exit the Variable Manager.
Setting the Value of a Shared Variable
Use a Set Variable step to set the value of a shared variable. The Set Variable step is located on the Use Additional Tools palette.
Complete the following steps to set the value of a shared variable.
- Add a Set Variable step to the inspection. The property page for the step opens.
- Select a variable in the Variable list.
- Use the Operation controls to change the value of the shared variable or to set the value of the shared variable to a measurement.
Creating Tags to Be Shared by the OPC Server
This section applies only if Vision Builder AI is running on a remote target. If Vision Builder AI is running on Windows, continue to the next section.
If Vision Builder AI is running on a remote target, you must use a Windows computer to create tags and link them to shared system variables. For example, you might use the same computer that you used to configure the remote target. The Windows computer must meet the following requirements:
- Either Vision Builder AI or NI LabVIEW is installed.
- Distributed System Manager 2010 or later is installed. Distributed System Manager 2010 is available here.
- The computer must remain available on the network in order to use an OPC client to access the data published by Vision Builder AI running on the remote target.
Complete the following steps to create the tags to be shared by the OPC Server.
- Launch the NI Distributed System Manager. From the Start Menu, select All Programs»National Instruments»Distributed System Manager 2010.
- Expand My Systems.
- Right-click localhost and select Add Process.
- Enter a Process Name, for example VBAI OPC Server.
- Click OK. The VBAI OPC Server process is listed under localhost.
- Right-click VBAI OPC Server and select Add Variable.
- Enable the Enable Aliasing checkbox.
- Click Browse and expand the IP address of the remote target where the inspection is running.
- Expand the Vision Builder item and select the variable that you want to share.
- Ensure that the Make properties match selection? checkbox is enabled and click OK.
- Click OK to create the OPC tag and link the tag to the Vision Builder AI variable.
- In the Name field, enter the name of the OPC tag you want to create. To prevent confusion, use the name of the selected variable.
- When you are finished creating tags, close Distributed System Manager.
Tags that you create are listed in your OPC client when when you connect to Vision Builder AI as an OPC server.
Distributed System Manager is only required to add or delete tags. You do not need to launch Distributed System Manager to enable OPC communication. Do not use Distributed System Manager to delete any variables listed under the Vision Builder process.
Connecting to Vision Builder AI as an OPC Server
Configure your OPC client to connect to the following OPC server: National Instruments.Variable Engine.
Use your OPC client to locate the shared variable tags:
- Vision Builder AI running on Windows—The shared variable tags are listed in the Vision Builder folder.
- Vision Builder AI running on a Remote Target—The shared variable tags are listed in a folder with the same name as the process you created in Distributed System Manager 2010, for example, VBAI OPC Server