Download OPC Toolbox User`s Guide
Transcript
Log OPC Server Data
itm2 = additem(grp,'Saw-Toothed Waves.Boolean');
Step 2: Configure the logging duration
This example sets the UpdateRate value to 1 second, and the RecordsToAcquire
property to 6. See “Control the Duration of a Logging Session” on page 7-18 for more
information on this step.
grp.UpdateRate = 1;
grp.RecordsToAcquire = 6;
Step 3: Configure the logging destination
In this example, data is logged to disk and memory. The disk filename is set to
LoggingExample.olf. The LogToDiskMode property is set to 'overwrite', so that if
the filename exists, the toolbox engine must overwrite the file. See “Control the Logged
Data Destination” on page 7-19 for more information on this step.
grp.LoggingMode = 'disk&memory';
grp.LogFileName = 'LoggingExample.olf';
grp.LogToDiskMode = 'overwrite';
Step 4: Start the logging task
Start the dagroup object. The logging task is started, and the group summary updates
to reflect the logging status. See “Start a Logging Task” on page 7-21 for more
information on this step.
start(grp)
grp
Step 5: Monitor the Logging Progress
After about 3 seconds, retrieve and show the last acquired value. After another second,
obtain the first two records during the logging task. Then wait for the logging task
to complete. See “Monitor the Progress of a Logging Task” on page 7-21 for more
information on this step.
pause(3.5)
sPeek = peekdata(grp, 1);
% Display the local event time, item IDs and values
disp(sPeek.LocalEventTime)
disp({sPeek.Items.ItemID;sPeek.Items.Value})
pause(1)
sGet = getdata(grp, 2);
7-17