Vous êtes sur la page 1sur 3

8/23/13

Tech Note 119 Collecting Data Samples With SPCPro

Tech Note 119

Collecting Data Samples With SPCPro


All Tech Notes and KBC D documents and software are provided "as is" without warranty of any kind. See the
Terms of Use for more information.
Topic#: 000727
C reated: October 1998
Updated: May 2003

When you set up an SPCPro application, you need to consider how and when you want to
collect data. The SPCPro dataset configuration offers different ways to collect data:

Automatic Data Collection:


Time-based
Event-based

Manual Collection:
Chart entry
StartCollection DDE item
Manual Input Measurements
Script functions

Automatic Collection
Time-based and event-based datasets require that an agent or user be configured for it. For
the dataset to collect, the agent must be connected using the function SPCConnect:

SPCConnect("Agent", "Password");
Note that the SPCConnect function password is case-sensitive. If you do not see the message
"Successful connection for user XXXX" in the WWLogger, then the agent was not connected
and no data will be collected for the dataset.
Although an agent can be tied to multiple datasets, each dataset can only have one agent
assigned to it, and only one agent can be connected at a time from each InTouch application.
Every dataset that agent is configured for will collect as long as that agent remains connected.
The current agent must disconnect using the SPCDisconnect() function before another agent
can connect to the SPCPro engine or the same agent can connect from another InTouch node.

Time-Based Collection
This was the only automatic collection mode available prior to SPCPro/FactorySuite 2000; Timebased collection allows you to configure your dataset to collect at intervals (in minutes) and
specify how much time there will be between measurements. For example, a time-based dataset
could be set up to collect a sample once every 5 minutes with 10 seconds between
measurements.
To keep one particular time-based dataset from collecting without doing an SPCDisconnect
(which would prevent all datasets with that Agent from collecting), set the I/O item
AutoCollection to 0. This will prevent only that particular dataset from collecting until
AutoCollection is set back to 1.
https://wdnresource.wonderware.com/support/kbcd/html/1/collecti.htm

1/3

8/23/13

Tech Note 119 Collecting Data Samples With SPCPro

Event-Based Collection
Event-based collection is a new type of data collection for SPCPro. This type of collection
requires that a triggering discrete tag be configured for it. When this discrete tag is set to
"true," the dataset will collect one measurement and then reset the discrete tag to "false." The
sample will be posted after the last measurement is taken. Each event-based dataset must have
a unique discrete tag assigned as the trigger. If more than one dataset is configured to use the
same trigger tag, only one of the datasets will collect a measurement.

Manual Collection
Manual collection is one of the selectable methods from the dataset configuration, but it
actually has four ways to collect data, not just one. Some of the manual collection methods do
not require the SPCConnect() function to collect the data.

Chart Entry
Unless the control chart has been disabled, it is possible to click on a control chart and enter a
new sample. If you click on a blank section of the chart, you will go directly to the sample entry
dialog box. If there is no blank portion on the control chart, you can click on an existing sample
to get the information for it and then click on the New button to enter a new sample. To disable
this method of sample entry, click on the control chart in Window Maker and select Disable
Manual Entry.

StartCollection DDE Item


This method requires that an agent is assigned and connected to the dataset for the
StartCollection item to work. When the DDE Item StartCollection is set to one, a collection
cycle will start based on the time-based collection rule of "seconds between measurements."
The measurements will be taken at the configured time interval until all measurements are
collected. At that time, the sample is saved and the StartCollection item is reset to zero.
The DDE Item StartCollection can also be used when a dataset is configured for time-based
collection to trigger a collection cycle before the time between samples has expired. If this is
done, then the next collection cycle will collect again based on the normal collection cycle time.

Manual Input Measurements


This method requires the creation of several I/O tags for data collection. The tag MI_Mx
(where x is the measurement number) represents the value for the measurement. Other tags,
such as MI_Date, MI_Time, MI_Comment, allow you to make modifications to the sample
before you save it. By entering values for MI_Time and MI_Date, you can manually record
samples out of date/time order. Setting the item MI_Save to 1 will save and record the sample.
The order that the MI_Mx is entered does not matter, nor does each one have to have a value.
If there is no new value entered for a MI_Mx, it will assume the last value entered is still valid
and continue using it. For example, if the MI_M1 was last set to 25, it will continue to be 25 for
every sample until it gets a new value. If the value for MI_Mx is not set, then it will assume a
value of 0.

Script Functions
There are also script functions that can be used to take measurements and record samples.
SPCSetMeasurement allows you to save a set a measurement value for a sample. For
https://wdnresource.wonderware.com/support/kbcd/html/1/collecti.htm

2/3

8/23/13

Tech Note 119 Collecting Data Samples With SPCPro

example, SPCSetMeasurement("Dataset1", 1, 25) would record a value of 25 for


measurement 1 for dataset "Dataset1." SPCSaveSample("Dataset1") would then be used to
save the sample for the dataset.

Summary
As you can see, there are more methods for collecting samples than are immediately obvious.
While each method ultimately does the same thing, it is important to choose the sample
collection method that best suits your needs.
D. Knight
F. Gonzalez
Tech Notes are published occasionally by Wonderware Technical Support. Publisher: Invensys Systems, Inc.,
26561 Rancho Parkway South, Lake Forest, C A 92630. There is also technical information on our software
products at Wonderware Technical Support
For technical support questions, send an e-mail to support@wonderware.com.

back to top
2003 Invensys Systems, Inc. All rights reserved. No part of the material protected by this copyright may be
reproduced or utilized in any form or by any means, electronic or mechanical, including photocopying,
recording, broadcasting, or by any information storage and retrieval system, without permission in writing from
Invensys Systems, Inc. Terms of Use.

https://wdnresource.wonderware.com/support/kbcd/html/1/collecti.htm

3/3

Vous aimerez peut-être aussi