Use of interface stereotype data in Simulink simulations

1 visualizzazione (ultimi 30 giorni)
Hi, I have been trying to integrate the use of System Composer in my company's workflow but I have encountered problems and am not sure of the appropriate solution.
In the functional architecture diagram, we need to define additional properties associated with an input bus (interface) and its elements and capitalize on this information in our Simulink design models.
For exemple, a bus element might be refreshed at a given frequency that would usually be defined in the architecture model. This frequency would be used in the design model (Simulink model) to determine the confirmation period of data invalidity.
I have tried the following two approaches:
1) Create the property in a stereotype that is applied on the interface's element. However, stereotypes cannot be applied on interface elements (only on the interface) and there seems to be no way to access this data from the Simulink model. I tried saving the interface in a data dictionary but the stereotypes don't seem to be available in the data dictionary GUI or command line API.
2) Create my own signal or parameter classes that inherit from Simulink.Signal or Simulink.Parameter and where I added the needed user-defined properties. The objects defined in the data dictionary don't appear in System Composer.
Is it planned to make stereotype data available in the underlying simulink models and is it planned to allow stereotype information on Interface elements? Or maybee, I have missed some feature of System Composer?

Risposte (1)

Josh Kahn
Josh Kahn il 7 Set 2021
Modificato: Josh Kahn il 7 Set 2021
Hi Sami,
You are correct, there is currently not native support in Simulink for accessing stereotype data. As a workaround, you can use a custom MATLAB script to propagate the necessary data either manually or as a model callback.
Here's something to get you started:
% myBlock is the handle to the block that needs to be updated based on the
% stereotype.
interfaceName = get_param(myBlock, 'OutDataTypeStr');
archMdl = systemcomposer.loadModel('myArchitecture');
dictionary = archMdl.InterfaceDictionary;
interface = getInterface(dictionary, interfaceName);
sampleRate = getProperty(interface, 'myProfile.myStereotype.mySampleRate');
set_param(myBlock, 'SampleRate', sampleRate);

Categorie

Scopri di più su System Composer in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by