Section 6: Instrument programming
Models 707B and 708B Switching Matrix Reference Manual
6-54
707B-901-01 Rev. A / August 2010
Copying test scripts across the TSP-Link network
To run a large script on a remote node, it is recommended that you copy the test script to the remote
node to increase the speed of test script initiation.
Use the code below to copy test scripts across the TSP-Link network. This example creates a copy of
a script on the remote node with the same name:
Note the following:
•
Replace
N
with the number of the node that receives a copy of the script
•
Replace
scriptName
with the name of the script that you want to copy from the local node
-- Adds the source code from scriptName to the data queue.
node[N].dataqueue.add(scriptName.source)
-- Creates a new script on the remote node
-- using the source code from scriptName.
node[N].execute(scriptName.name ..
"= script.new(dataqueue.next(), [[" .. scriptName.name .. "]])")
Removing stale values from the reading buffer
The node that acquires the data 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.
Running Lua code remotely can return stale values from the reading buffer to the cached data. 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.
The following code demonstrates how stale values occur and how to use the
clearcache
command
to clear the cache.
Note the following:
•
Replace N with the node number
•
Replace G with the group number
-- Creates a reading buffer on a node in a remote group.
node[N].tsplink.group = G
node[N].execute("rbremote = dmm.makebuffer(20)" ..
"dmm.measure.count = 20 " ..
"dmm.measure(rbremote)")
-- Creates a variable on the local node to
-- access the reading buffer.
rblocal = node[N].getglobal("rbremote")
-- Access data from the reading buffer.
print(rblocal[1])