FB_SamplingDataRealTime

Overview

Type:

Function block

Available as of:

V1.0.0.0

Functional Description

The function block FB_SamplingDataRealTime retrieves data from the drive in real-time. It must be called in a cyclic task. A continuous stream of data packages is transferred in 1 ms intervals. It contains data in a 125 μs time grid.

The number of samples to be recorded is limited to 80,000. Thus, the maximum sampling time is 10 s. Consider that the recording of 80,000 samples requires an ARRAY which is capable to hold 320,000 values of type LREAL (ARRAY [1..80000] OF ARRAY [0..3] OF LREAL). For the memory size, refer to Function Blocks Using Dynamic Memory Allocation.

After the function block is enabled and is ready for operation, the sampling process is started upon a rising edge at the xStartSampling property. The property can be located in a different task than the task where the function block is called.

To allow real-time sampling of data, perform the following settings in the configuration of the drive:

  1. Double-click the drive node to open the drive editor.

  2. Select the Sercos Cyclic Data Exchange tab.

  3. Select the option Enable expert settings.

  4. Click the plus sign (Add a parameter) from the Acknowledge Telegram (Slave -> Master) section on the right-hand side of the drive editor.

    Result: The Select parameters for cyclic exchange dialog box opens.

  5. Select the FastSamplingChannels row and click OK.

    Result: A FastSamplingChannels row is added to the Acknowledge Telegram (Slave -> Master) section.

Interface

Input

Data type

Description

i_xEnable

BOOL

Activation and initialization of the function block.

Refer to Behavior of Function Blocks with the Input i_xEnable.

i_aetParameter

ARRAY [0...3] OF ET_Parameter

Specify the parameters to be sampled.

i_etPositionTrend

ET_PositionTrend

Specifies whether set positions of the axis are considered for sampling.

i_udiNumberOfSamples

UDINT

Specifies the number of samples to be recorded.

Value range: 0...80,000

The samples are saved to an internal array in allocated memory. For further information, refer to Function Blocks Using Dynamic Memory Allocation.

i_xUseTracePlot

BOOL

If TRUE, the sampled data is plotted to an IEC trace graph, also refer to Displaying Sampled Data in a Trace Plot.

i_ifDrive

SystemConfigurationItf.IF_Drive

Specifies the axis from which data is sampled.

Input/Output

Data type

Description

iq_aalrSampledData

ARRAY [*] OF ARRAY [0..3] OF LREAL

Array for storing the sampled data. The meaning and the order of the parameters per data record corresponds to the specified parameter at i_aetParameter. This IN_OUT parameter provides an array with variable length, the amount of data records you want to store must correspond to the size of the array assigned.

Output

Data type

Description

q_xActive

BOOL

If this output is set to TRUE, the function block is active.

q_xReady

BOOL

If this output is set to TRUE, the activation was successful.

q_xError

BOOL

If this output is set to TRUE, an error has been detected. For details, refer to q_etResult and q_sResultMsg.

q_xSamplingDone

BOOL

If this output is set to TRUE, the sampling process is finished and the recorded data are provided in the array at iq_aalrSampledData.

q_etResult

ET_Result

Provides diagnostic and status information as a numeric value.

q_sResultMsg

STRING [80]

Provides additional diagnostic and status information as a text message.

Property

Data type

Access

Description

xStartSampling

BOOL

Read/write

Input that initiates the start of the sampling process.

The input can be called in a fast task. For further information, refer to Behavior of the Property xStartSampling.

NOTE:

While the sampling process is in progress, an Online Change of the application cannot be performed. The sampling process is outsourced to a separate task. As long as this task is not completed, a requested online change is rejected. If this is the case, Logic Builder issues a message informing you that an online change cannot be performed.