Global variables in 'Attribute Function' block (Simulink - Sim events)

3 vues (au cours des 30 derniers jours)
Max
Max le 6 Mai 2012
I want to use 'Attribute Function' block (Simulink, SimEvents) to set attribute value of entities, but I need a some global variables to store data. How I can do this?
I tried to use 'Data Store' block but I guess there is no ability to use this block for the 'Attribute Function' block.

Réponse acceptée

Devdatt Lad
Devdatt Lad le 6 Mai 2012
Currently, it's not possible to use global data, signal input/output or parameters with the Attribute Function block. The attribute function must be used with attribute input/output only. It's a limitation that we're working to remove.
In the meantime, you can do one of the following:
1. Set the global data as an attribute of the entity so that you can access it in the Attribute Function block.
2. Use the MATLAB Function block instead of the Attribute Function block. For this case, you will have to add an additional Get Attribute before the MATLAB Function to get the attributes that you want to use in your function. You also need an additional Set Attribute block to set the result of the function back as attributes of the passing entity. And finally you wil need a zero delay server block between the Get and Set Attribute blocks to hold each entity while the attribute value is computed.

Plus de réponses (0)

Catégories

En savoir plus sur Discrete-Event Simulation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by