Main Content

slrealtime.EtherCAT.filterNotifications

Display EtherCAT notifications in human-readable format

Since R2020b

Description

slrealtime.EtherCAT.filterNotifications() prints the valid EtherCAT notification values and their text descriptions.

example

slrealtime.EtherCAT.filterNotifications(tlog, olog, suppress) extracts from olog the notification values from the EtherCAT Get Notifications block, and from tlog, the times at which these values occurred.

If the suppress vector is nonempty, the function removes from the output list the notification values that appear in the vector. For each notification listed in the suppress vector, the function prints the total number of occurrences and the time range over which they occurred.

When you are debugging EtherCAT® issues, use this function. You must have advanced knowledge about EtherCAT functionality.

example

filtered_values = slrealtime.EtherCAT.filterNotifications(tlog, olog, suppress) returns a structure vector containing the filtered values.

example

[filtered_values suppressed_values] = slrealtime.EtherCAT.filterNotifications(tlog, olog, suppress) returns a structure vector containing the filtered values and a structure containing a summary of the suppressed values.

example

Examples

collapse all

Print the valid notification values and their text descriptions. This example shows a partial listing of notifications. Run the slrealtime.EtherCAT.filterNotifications function to view a current list of notifications.

slrealtime.EtherCAT.filterNotifications
slrealtime.EtherCAT.filterNotifications
(     1): State changed
(     2): Cable connected
(     3): Scanbus finished
    .
    .
    .

(262148): HC topology change done
(262149): Subordinate device disappears
(262150): Subordinate device appears

Export time log and data log for a simulation run from the Simulation Data Inspector. Apply the slrealtime.EtherCAT.filterNotification command to the log data.

In this example, the output of the EtherCAT Get Notifications block connects to a File Log block. After the simulation run stops, Simulink Real-Time uploads the file log data to the Simulation Data Inspector. You can use the slrealtime.EtherCAT.filterNotification command on the log data.

  1. In your model, connect the output of the EtherCAT Get Notifications block connects to a File Log block.

  2. Build the model, and then download and run the real-time application.

  3. Open the Simulation Data Inspector.

    While the real-time application is running, the Simulation Data Inspector lists any signals that are marked for logging, for example as Run 1:<modelname>@TargetPC1. When model execution stops, the Simulation Data Inspector moves that run to the archive. Then, Simulink Real-Time uploads the signal data from the File Log block to the Simulation Data Inspector. This data appears, for example as Run 2:<modelname>@TargetPC1[FileLog][Current].

  4. To apply use the slrealtime.EtherCAT.filterNotification command on the log data, export the whole data set as a single data set to the MATLAB workspace. These steps create a 1x1 data set that contains the variable notifications.

    1. In the Simulation Data Inspector, right-click the Run 2: line.

    2. Select Export Data …. That opens a dialog.

    3. For Export:, select Selected runs and signals.

    4. For To:, select Base workspace and provide a variable name for the export, such as notifications.

  5. To get the timelog and the datalog use:

    timelog = notifications{1}.Values.Time;
    datalog = notifications{1}.Values.Data;
  6. To print notifications from normal operations, run the filterNotifications command with this data:

    slrealtime.EtherCAT.filterNotifications(timelog, datalog, [])
     Time      Code     Description
    0.040000 (     3) Scanbus finished
    0.045000 (     1) State changed
    1.199000 (     4) Distributed clocks initialized
    1.202000 (     1) State changed
    4.198000 (     9) DCM inSync
    4.200000 (     5) DC subordinate device synchronization deviation received
    4.350000 (     1) State changed
    4.357000 (     1) State changed

Filter and return the notifications that appear during normal operation. Filter notification ( 1) State Change.

There are cases in which message filtering or suppression is useful. In certain error situations, you may see many notifications about one particular situation that can hide other significant notifications. This situation could be a large number of working count errors or frame response errors, for example, that hide other notifications that you may need to identify how to recover from the situation.

For information about creating the timelog and datalog variables, see Get Time and Data Log from EtherCAT Get Notifications Block.

[filtered_values suppressed_values] = ...
    slrealtime.EtherCAT.filterNotifications(timelog, datalog, [1])
 Time      Code     Description
0.040000 (     3) Scanbus finished
1.199000 (     4) Distributed clocks initialized
4.198000 (     9) DCM inSync
4.200000 (     5) DC subordinate device synchronization deviation received

Suppressed notifications:

      1: 4 times [0.045000 : 4.357000]
State changed

Input Arguments

collapse all

Use exported time log data from signal data displayed in the Simulation Data Inspector. See Get Time and Data Log from EtherCAT Get Notifications Block.

Example: timelog

Data Types: double

Use exported data log data from signal data displayed in the Simulation Data Inspector. See Get Time and Data Log from EtherCAT Get Notifications Block.

Example: outputlog

Data Types: double

For each code, the function reports the total number of occurrences and the time range over which they occurred. If you do not want to suppress notification codes, pass in an empty vector ([]).

Example: 65546

Example: []

Data Types: double

Output Arguments

collapse all

Each element of filtered_values is a structure containing:

  • time (double) — Timestamp of notify code

  • code (double) — Notify code

  • notifystring (character vector) — Text description

Each element of suppressed_values is a structure containing:

  • val (double) — Notify code

  • first (double) — Timestamp of first occurrence

  • last (double) — Timestamp of last occurrence

  • count (double) — Number of instances found

Tips

  • Common error conditions, such as an unplugged Ethernet cable, can cause thousands of unwanted notifications that hide useful notifications. To filter unwanted notifications, use the suppress vector.

Version History

Introduced in R2020b