|Download Help (Windows Only)|
You can use shared variables to share data among VIs in a project or across a network. The Real-Time FIFO of network-published shared variables enables you to share data between VIs on different targets across a network without affecting the determinism of the VI. However, network-published shared variables transfer data across the network non-deterministically. The following illustration shows a network-published shared variable that is sharing data with another VI on a different RT target:
When the RT FIFO is enabled, a network-published shared variables transfers data to the Shared Variable Engine (SVE) in a way that maintains the determinism of the VIs, but does not guarantee that the most recently written value is available to other VIs across the network within a specific amount of time. If the RT FIFO buffer is empty when a VI attempts to read from it, the Shared Variable Node issues a warning but the VI does not wait for the most recently written value to arrive. Instead, the VI reads the last value received. The data includes a timestamp indicating the time at which the value was written, which you can use in conjunction with the warning to detect if the Shared Variable Node returns a duplicate value. As a result, network-published shared variables work well for logging data from deterministic VIs, but are not recommended for control and automation tasks.
Time-triggered shared variables transfer data across a closed private network to ensure that network traffic never delays data transmission. Thus, time-triggered network communication is deterministic, which means you can guarantee that each value written to the time-triggered shared variable will be available to other VIs across the network within a deterministic amount of time. For control and automation tasks involving multiple devices, deterministic network communication can be crucial.
|Note If the time-triggered network connection is lost, the targets lose synchronization and communication becomes non-deterministic. To re-establish the deterministic network connection, you must restart the application.|
Time-triggered communication with the LabVIEW Real-Time Module requires you to configure RT targets for time-triggered communication, create and configure time-triggered shared variables, and configure the settings of the time-triggered network.
|Note You can only use time-triggered networks with RT PXI and RT desktop targets, and each target must be configured with two Ethernet devices.|
|Note Synchronizing a time-triggered network to an external time server is not supported.|
Deterministic network communication using time-triggered shared variables requires you to configure RT targets with two Ethernet devices. One Ethernet device, the primary, connects to the public Ethernet network and communicates with LabVIEW on the host computer. You can deploy software and applications to the RT target through this connection from the host computer. If the RT target has an onboard Ethernet device, that device is the primary device by default.
A second Ethernet device connects RT targets to a closed private network, or time-triggered network, that you must then configure for time-triggered communication. The secondary Ethernet device connects to the secondary Ethernet devices of other RT targets using a crossover cable, network hub, or non-blocking Ethernet switch to create the time-triggered network. All time-triggered communication is done across the time-triggered network of the secondary Ethernet devices.
The following illustration shows a network of PXI RT targets that are set up as a time-triggered network. Notice that the closed private network is used for the time-triggered communication between the RT targets, and the public network is used to communicate with the host computer.
You can create time-triggered shared variables under an RT target in the Project Explorer window. A time-triggered shared variable can use one of two different communication styles.
|Note You cannot specify a specific order for the transmission of data using time-triggered shared variables configured with the As part of the shared memory blocks option. However, the During a dedicated time slot within the network cycle option requires a small added overhead in the transmission times for each variable. The overhead is minor but might be significant when working with smaller data types such as scalars.|
After configuring the RT target for time-triggered communication and creating time-triggered shared variables, you must configure the time-triggered network.
Use the Network Configuration dialog box to configure the time-triggered network. Select Tools»Real-Time Module»Configure Time-triggered Network from the Project Explorer window to open the Network Configuration dialog box. The Network Configuration dialog box displays a tree view of the time-triggered network. The top-level parent node is the Network node which represents the time-triggered network. The Network node contains child nodes for each RT target on the time-triggered network that is configured for time-triggered communication. Each Target node contains a node for each time-triggered shared variable hosted on that RT target.
You can click the Network, Target, and Shared Variable nodes on the Network Configuration dialog box to display a configuration page for the node on the right side of the dialog box. The Network Configuration dialog box displays a timeline graph at the bottom of the window that represents the current configuration of the time-triggered network cycle.
The following illustration shows a time-triggered network configured with a 300 microsecond network cycle that begins the transmission of shared memory block variables 100 microseconds into the network cycle and then transmits a dedicated block variable 189 microseconds into the network cycle:
To share data using time-triggered shared variables, drag the shared variable from the Project Explorer window to a block diagram. You also can place a Shared Variable node on the block diagram and then right-click the node and select Select Variable from the shortcut menu to select the time-triggered shared variable.
By default, the Shared Variable node is set to read. To change the Shared Variable node on the block diagram to write, right-click the Shared Variable node and select Change to Write from the shortcut menu. The following block diagram shows a Shared Variable node, TT_Var1, that reads the value of a time-triggered shared variable and then adds a value of 10. The block diagram then writes the results to a Shared Variable node, TT_Var2, that can be read by other RT targets on the time-triggered network.
You can create a time-triggered timing source to control the execution of a timed structure in a VI running on an RT target. Time-triggered timing sources trigger when a specified event in the time-triggered network occurs. Use the Create Time Triggered Network Timing Source VI to detect the events of a time-triggered network timing source and then control the timing of a timed structure.