
Series 3700A System Switch/Multimeter Reference Manual
Section 10: Instrument programming
3700AS-901-01 Rev. D/June 2018
10-61
Using the data queue for real-time communication
Nodes that are running test scripts at the same time can store data in the data queue for real-time
communication. Each instrument has an internal data queue that uses the first-in, first-out (FIFO)
structure to store data. You can use the data queue to post numeric values, strings, and tables.
Use the data queue commands to:
•
Share data between test scripts running in parallel
•
Access data from a remote group or a local node on a TSP-Link
®
network at any time
You cannot access the reading buffers or global variables from any node in a remote group while a
node in that group is performing an overlapped operation. However, you can use the data queue to
retrieve data from any node in a group that is performing an overlapped operation. In addition, the
master node and the group leaders can use the data queue as a way to coordinate activities.
Tables in the data queue consume one entry. When a node stores a table in the data queue, a copy
of the data in the table is made. When the data is retrieved from the data queue, a new table is
created on the node that is retrieving the data. The new table contains a completely separate copy of
the data in the original table, with no references to the original table or any subtables.
You can access data from the data queue even if a remote group or a node has overlapped
operations in process. See the
dataqueue
commands in the
(on page 11-
1) for more information.
Copying test scripts across the TSP-Link network
To run a large script on a remote node, copy the test script to the remote node to increase the speed
of test script initiation.
The code in the example below copies a test script across the TSP-Link
®
network, creating a copy of
the script on the remote node with the same name.
-- Add the source code from the script
-- testScript to the data queue.
node[2].dataqueue.add(testScript.source)
-- Create a new script on the remote node
-- using the source code from testScript.
node[2].execute(testScript.name ..
"= script.new(dataqueue.next(), [[" .. testScript.name .. "]])")
Removing stale values from the reading buffer cache
The node that acquires the data also stores the data for the reading buffer. To optimize data access,
all nodes can cache data from the node that stores the reading buffer data.
When you run Lua code remotely, it can cause reading buffer data that is held in the cache to
become stale. If the values in the reading buffer change while the Lua code runs remotely, another
node can hold stale values. Use the
clearcache()
command to clear the cache. For additional
detail on the reading buffer cache commands, see
(on page 11-19) and
(on page 11-22).
The following example code demonstrates how stale values occur and how to use the
clearcache()
command to clear the cache on node 2, which is part of group 7.