Using Simulink Merge with MotoHawk Blocks

What Changed?

Most MotoHawk™ blocks have had their output signal attribute changed. Versions prior to MotoHawk 2020b use SS_REUSABLE_AND_LOCAL, where as SS_NOT_REUSABLE_AND_LOCAL is used in MotoHawk 2020b and beyond.

This change was made to tackle an issue where global variables that had been back propagated by Embedded Coder as an optimization were then re-used. The re-use was legal from a data flow perspective, but was found to be problematic in multithreaded applications (which most MotoHawk™ applications tend to be).

The impact to models built using MotoHawk 2020b and beyond

A side effect of moving to SS_NOT_REUSABLE_AND_LOCAL relates to the use of a Simulink Merge block with a MotoHawk™ block. Prior to this change most MotoHawk™ blocks could be connected directly to a Simulink Merge block. Such a connection is not legal once an output signal's attribute is set to SS_NOT_REUSABLE_AND_LOCAL and an error relating to signal persistence will probably result when a Diagram Update (CTRL-D) or build (CTRL-B) is performed.

The error might look something like: "The signal ... is required to be persistent, hence this signal cannot be connected to a Merge block"

For example the following simple Merge example will error in MotoHawk 2020b and later, but will build without issue in MotoHawk 2020a and earlier.

Where the subsystem is of this form:

How to Handle the Issue

Use Signal Conversion blocks

To achieve a successful build a Simulink Signal Conversion block needs to be used to buffer the output like so:

Alter Configuration Settings

Anecdotal evidence suggests that newer versions of MATLAB, like R2020a, have a Configuration Setting that will allow MotoHawk™ blocks that have had their output signal attribute changed to continue to function with the Merge block. Alter the Diagnostics/Data Validity/Advanced parameters/Underspecified initialization detection Configuration Setting (access using CTRL-E) to be Simplified.

The MotoHawk team has not conducted an in depth study on the impact of this setting, but it does appear to allow Merge to be used without having to add Signal Conversion blocks.