Data Sampling

Data sampling enables you to record data, such as output values, at fixed intervals into files on an SD card. A Data Sample can contain a number of feeds. You can define multiple Data Samples.

You can also represent Data Samples as Trend graphs on the HMI screen.

Note that when you create a Data Sample, UniLogic creates a struct to enable you to control its functions.

Property Name

Definition

Start/End Sampling

Turn ON to begin a data recording session. Turn OFF to stop the session, close the file, and save it to SD card.
The PLC saves the file with a timestamp. The timestamp provides the date and time that the file closed (bit=OFF).

Pause Sampling

Turn ON to suspend the session, without closing the file. Turn Off to resume sampling.

Force Sample

Use this to sample data without relation to the Sampling Interval. Reset by the OS.

Clear Log

Turn ON to clear all of the data from the current session.

Status

0 = No Error

1 = Sampling Function Start

2 = Function in Progress

-1 = SD card not found

-2 = Reserved for internal use

-3 = Save Sampler File Error (The file name may contain non-English characters)

-4 .csv file not created: No delimiter assigned/Illegal Delimiter character. Legal Delimiters are comma and semicolon.

Sampling Interval

Read-only. This parameter is defined in the Data Sampler Properties.

Missed Sample Bit

Turns ON if no Data Sample has been made during 2 Sampling Interval times. Reset by user.

Missed Sample Counter

Increments each time the Missed Sample Bit turns ON

Samples Count

Read-only. This is the number of times the data is sampled during the session.

Note that a Sampler file can contain up to 60,000 data samples. When this limit is reached, the file is closed and saved; another file is automatically opened and sampling continues.

Delimiter Character

Delimiter character to be used in the CSV file

Decimal Symbol character

Decimal symbol character to be used in the CSV file for Real numbers

File Name

The user can set a filename. If left empty, the PLC will select the name.

User Comment 1

The user can add comments (strings), such as Batch #; these are saved as part of the data file on the SD card.

User Comment 2

 

Defining a Data Sample

  1. Open Data Sampling from the Solution Explorer tree.

  2. Click Add New Data Sample.

    Add Data Sampler

  3. Define the Properties for this Data Sampler.

  4. Add data Feeds: click Add New Feed, and then define the Feed Data Source Tag.
    Note that you can change the default Feed Name by clicking the field and editing it.
     

    You must enter a Folder Name in the Properties Window. The application automatically creates a folder of this name on the SD card, and this folder will contain the data for all the feeds in the Data Sampler.

    Data Sampler files use the file extension .usmp.

    Define Feeds

     

Sampling Data

Use the members of the Data Sampler Struct: Start/End Sampling, Pause Sampling, and Force Sampling tags in your Ladder to control the sampling process.

In the image below, a Data Sampler is displayed as a Trend graph. The HMI buttons under the Trend are linked to the Data Sampler struct.

data Sampler Struct plus Trend

 

If you are connected to the Internet, you can access this UniLogic tutorial:

Data Sampling and Trends

 

Related Topics

Trends