-

Y_RW_DataLogCompare

2024-02-08 12_04_17-iCube Engineer - C__Users_Public_Documents_YRMiecEngineer_DevLibraries_Toolboxes.png

The Y_RW_DataLogCompare function block compares Reference data with comparison data. Data can be read from a file or stored in a data structure. The comparison is performed line by line and differences are reported in the PercentMatching output. An error analysis is performed on data and reported in the ErrorAnalysis output.

Parameters:

* Parameter Data Type Description Default
VAR_INPUT
V RefDataLog Yt_RW_DataLoggingStruct
DataStruct used to store reference data for comparison. RefFileLocation must be set to Undefined to use this input

V CompDataLog Yt_RW_DataLoggingStruct
DataStruct used to store comparison data for comparison. CompFileLocation must be set to Undefined to use this input

B Execute BOOL Upon the rising edge, all other inputs are read and the function is initiated. FALSE
V ReferenceFile STRING The name of the file that is assumed to have good data
V ComparisonFile STRING The name of the file that is being compared
V RefFileLocation STRING Denotes whether the data is in a reference file or in the RefDataLog Input (Undefined). Location of the file can be set to ram or flash. Undefined = 0, Ram = 1,  Flash = 2.
V CompFileLocation Yt_RW_FTB_FileLocation Denotes whether the data is in a comparison file or in the CompDataLog Input (Undefined). Location of the file can be set to ram or flash. Undefined = 0, Ram = 1,  Flash = 2.
V PercentDeviation Yt_LrealArray8 Percentage that the value can be different from the reference value. Should be between 0 and 100
V SampleDeviation Yt_IntArray8 How far ahead or behind the reference index to search. Should be between 0 and 20
V OffsetDeviation Yt_LrealArray8 Offset that the value can be different from the reference value. i.e Value can differ by an offset of 1.0
VAR_OUTPUT
B Done BOOL Set to TRUE when the commanded action has completed successfully.
B Busy BOOL Set high upon the rising edge of the Execute input, and reset when Done, CommandAborted, or Error is true.
B Error BOOL Set high if an error has occurred during the execution of the function block. This output is cleared when 'Execute' or 'Enable' goes low.
B ErrorID UINT If Error is true, this output provides the Error ID. This output is reset when 'Execute' or 'Enable' goes low.
V PercentMatching Yt_RealArray8 Reports how close the two files match.
V ErrorAnalysis Yt_RW_ErrorDataArray Array holding error data for each channel

Notes:

RefDataLog and CompDataLog input are not used if setting Ref/Comp FileLocation to Ram or Flash. If Ref/Comp FileLocation is set to Yt_RW_FiliLocation#Undefined then the respective RefDataLog and CompDataLog input is used for comparison

Following Variables have to be initialized when using RefDataLog or CompDataLog
Percent Deviation is how much the comparison value can deviate from the reference value based of a percentage of the reference value. Setting percent to 0 means values must match exactly.

PrecentDeviation[1] := 10.0;
RefValue = 100, CompValue = 90.0, Match = True
RefValue = 100, CompVaule = 110.0, Match = True
RefValue = 100, CompValue = 89.0, Match = False

Offset Deviation is how much the comparison value can deviate from the reference value based of a value. Setting offset to 0 means values must match exactly.

OffsetDeviation[1] := 10.0;
RefValue = 1000, CompValue = 900.0, Match = False
RefValue = 1000, CompVaule = 990.0, Match = True
RefValue = 1000, CompValue = 1010.0, Match = TRUE

Both PercentDeviation and OffsetDeviation can be used to check if a value matches. If the value is within range for either PercentDeviation or OffsetDeviation then it is counted as a match.

Sample Deviation is the number of samples, ahead or before the current sample, Y_RW_DataLogCompare can use to look for a match.
Used when data might be shifted by a number of samples but matches ref data.

SampleDeviation[1] = 2;
Sample Number    Ref Value Comp Value  Match   Description
1                            10            5                    False     No ref value 2 samples below or ahead that is equal to 5
2                            15            10                  TRUE    Sample is 10 and 1 sample below
3                            20            15                  TRUE    Sample is 15 and 1 sample below
4                            25            20                  TRUE    Sample is 20 and 1 sample below
5                            35            15                  FalseSample is 15 and there is no ref value equal to 15 that is 2 samples below or ahead

PercentMatching output is based on PercentDeviation, SampleDeviation, and OffsetDeviation.

ErrorAnalysis does not look atPercentDeviation, SampleDeviation, and OffsetDeviation. The error analysis is performed based on values without deviation.

SeeYt_RW_ErrorDataArray  for more info on ErrorAnalysis Output and data structure.

Error Description:

See the Function Block ErrorID List.

Examples:

Y_RW_DataLogRecord and Y_RW_DataLogWrite can be used to record and write data for comparison with Y_RW_DataLogCompare. Below are notes on the process followed by steps on setting up a project with Y_RW_DataLogCompare and comparing data written to a file.

Y_RW_DataLogRecord FB records data of interest in Yt_RW_DataLoggingStruct datastruct. Y_RW_DataLogRecord FB should run on the same or faster task as the data to be recorded. See picture below, Main POU has data of interest to be recorded by the Record POU. 

2024-07-15 11_35_30-iCube Engineer - C__Users_Public_Documents_YRMiecEngineer_DevLibraries_Toolbox T.png

Both Y_RW_DataLogWrite and Y_RW_DataLogCompare is run on a slower task than Y_RW_DataLogRecord. Y_RW_DataLogWrite is executed at the same time as Y_RW_DataLogRecord to begin writing data to file as it is recorded. Yt_RW_DataLogPrms is used as a circular buffer with large data sets so in order to capture all the data it is important that both Y_RW_DataLogWrite and Y_RW_DataLogRecord are executed together to insure all the data recorded is written and stored in the specified file. 

Once Y_RW_DataLogWrite is Done, Y_RW_DataLogCompare can be executed to read data from the file written to the controller by Y_RW_DataLogWrite and compare it to data in a reference file also stored in the controller or RefDataLog structure. It is possible to run into watchdog errors when using Y_RW_DataLogWrite and Y_RW_DataLogCompare due to havening to write/read from files on the controller. If need be, increase the task time of the POU with Y_W_DataLogWrite and Y_RW_DataLogCompare to avoid watchdog errors. 

Steps to setup Y_RW_DataLogRecord, Y_RW_DataLogWrite, and Y_RW_DataLogCompare to compare position profile using Y_AX_MoveAbsolute
  1. Project uses Y_AX_MoveAbsolute for motion and MC_ReadActualPosition to get axis Position
    2024-07-15 12_12_04-iCube Engineer - C__Users_christian_maya_AppData_Roaming_iCube_Engineer_iCube_En.png
  2. Set up Y_RW_DataLogRecord FB in a POU with the same or faster task time than data to be recorded
    2024-07-15 11_35_30-iCube Engineer - C__Users_Public_Documents_YRMiecEngineer_DevLibraries_Toolbox T.png
  3. Initialize RecordLog Data Structure (See Yt_RW_DataLoggingStruct  for more info)
  4. Y_RW_DataLogRecord FB is executed with MoveStart and X_ Position is recorded
    2024-07-15 12_23_12-iCube Engineer - C__Users_christian_maya_AppData_Roaming_iCube_Engineer_iCube_En.png
  5. Set up Y_RW_DataLogWrite and Y_RW_DataLogCompare in a POU with a slower task rate.
  6. Y_RW_DataLogWrite is executed with MoveStart and Y_RW_DataLogCompare is executed with WriteDone.
    2024-07-15 12_22_47-iCube Engineer - C__Users_christian_maya_AppData_Roaming_iCube_Engineer_iCube_En.png
  7. Y_RW_DataLogRecord and Y_RW_DataLogWrite can be used to write a reference file once the motion has been verified for comparison. Change FileName to 'MoveAbs_ReferenceFile' and File location to 'Yt_RW_FTB_FileLocation#Flash' on Y_RW_DataLogWrite
Examples below use Y_RW_DataLogRecord to collect data and Y_RW_DataLogWrite to write data to a file stored in the controller. Yt_RW_DataLoggingStructs can be initialized in structured text or assigned programatically

Comparison of two files in controller

2024-02-08 14_18_29-iCube Engineer - C__Users_Public_Documents_YRMiecEngineer_DevLibraries_Toolbox T.png

RefData and CompData is not used in this case since the the data is coming from ReferenceFile1 and Comparison File1. Files are stored in Ram and Flash respectively.

Comparison of a File and Yt_RW_DataLoggingStruct

2024-02-08 15_06_51-iCube Engineer - C__Users_Public_Documents_YRMiecEngineer_DevLibraries_Toolbox T.png

Data from RefDatalog is used to compare with data from ComparisonFile1. CompDataLog is not used or updated since the data is coming from a file.
Example of variable initialized:

Total Samples and number of channels used if initialized
2024-02-08 15_11_53-iCube Engineer - C__Users_Public_Documents_YRMiecEngineer_DevLibraries_Toolbox T2.png
Data to be compared initialized

2024-02-08 15_13_08-iCube Engineer - C__Users_Public_Documents_YRMiecEngineer_DevLibraries_Toolbox T2.png

Comparison of two Yt_RW_DataLoggingStructs

2024-02-08 15_05_29-iCube Engineer - C__Users_Public_Documents_YRMiecEngineer_DevLibraries_Toolbox T.png

No files will be read from controller. Comparison will be made from values in RefDataLog.Data[0] and CompDataLog[0].
Example of variable initialized:

Total Samples and number of channels used if initialized
2024-02-08 15_11_53-iCube Engineer - C__Users_Public_Documents_YRMiecEngineer_DevLibraries_Toolbox T.png

Data to be compared initialized
2024-02-08 15_13_08-iCube Engineer - C__Users_Public_Documents_YRMiecEngineer_DevLibraries_Toolbox T.png

 


This help information is valid for iCube Engineer Online Help 2025.6

Copyright © 2025 YASKAWA EUROPE GmbH and © 2025 YASKAWA America, Inc.