How to Integrate Built-In Simulink Data with Raptor

From NewEagleWiki
Jump to navigation Jump to search

Introduction

Prior to Raptor 2019a, if a Raptor Data Store was needed in Stateflow, then something like this had to be done:



Adding Raptor Data in Stateflow can be very useful for logging/debugging purposes in Raptor-Cal. Also, specifying extra properties such as NonVolatile, access level, etc., are helpful when developing a production application. This solution, while functional, would be better if the data didn’t have to pass through ports on the Stateflow diagram. Also, the chart mode enumerated output must be converted before a Raptor Measurement block can read it.

What is an alternative?

In Raptor 2019a, there is a new feature present that further integrates the Raptor build environment with Simulink.

How do I use it?

First, the data needs to be modified in the Symbol editor in Stateflow to be a data store memory:


A data store must be placed in the Simulink editor:


This data store must be configured for Raptor in the Signal Attributes tab of the Data Store Memory block:


You can also adjust the properties in the Simulink editor with the Model Data Editor or the Property Editor. These are enabled under the Simulink “View” menu:


Additionally, the chart mode can be mapped to a measurement by “resolving” the data in a Simulink Data Object:


To resolve the data object, a definition must appear in the appropriate workspace for the model:


This same process is required for parameters as well. Instead of specifying a Data Store Memory, Parameter Data is specified in the Symbol editor and the data object is placed in the appropriate workspace.


In the end, the model looks like this:



What else can you do with this feature?

Generally speaking, using this feature will make the model more Simulink-generic and thus migrating between different Simulink-based tools will be simpler. The Raptor Data Objects can be replaced by Simulink Data Objects with the same name to accomplish this.

Does it work with existing Raptor data blocks?

Yes. Name conflicts will be detected at build time.

Can I monitor data from Simulink blocks?

Yes. There is a subset of Simulink blocks that expose the configuration of their states/parameters as Simulink.Signal/Parameters. The Unit Delay block is one of them:



Is it possible to use other Simulink data types?

Yes. You can specify measurements, parameters and data stores with enumerated and fixed-point data types that are compatible with Simulink blocks. The “HystMode” output in the example demonstrates how this will work.

Is it possible to use Simulink Data Management features?

Yes. The properties can be managed with the Simulink Data Dictionary, Model Workspace or the Base Workspace. Refer to the MathWorks help for more information.

What are the limitations?

  • Any limitations present on Simulink data definition will be present in this feature as well.
    • For example, Simulink Lookup Table Objects do not have an extension mechanism (as of MATLAB R2019a), so they are not available for Raptor customization.
  • Simulink Bus/Structure types are not supported by Raptor R2019a.
  • Fixed NonVolatile data cannot be used with this functionality in Raptor R2019a.


Want to hear more?

If you want to hear more or want more details on how to use this feature, go to our Product Support page for more information.