How can I use a different Sample Time in a model that is referencing a Configuration Set from the top-level model in Simulink 7.7 (R2011a)?

16 views (last 30 days)
My model is part of a larger model in which all of the model references use a configuration set reference from the top-level model. My section of the model does not need to execute as often as specified by the sample time in the top-level model. How can I specify a slower sample time for my model while still using the configuration set reference for the top-level model?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 14 Nov 2011
It is possible to use different sample times in model referencing the same configuration set by using a variable for the sample time in the configuration set and specifying the value for that variable in the Model Workspace for each model. This will require that the sample time for the configuration set be set to a variable, for example “Ts”. Different values for "Ts" can be specified in the Model Workspaces (which can be viewed from the Model Explorer) for the different models in the project.
Attached below is an example that shows how this can be done. In the example there is a configuration set that is loaded into the base workspace via a model callback. The model to open is topLevel.mdl, which contains a reference model refModel.mdl. Both of these models reference the configuration set that is loaded in when topLevel is opened. In the configuration set, the sample time has been set to “Ts”. In the Model Explorer, both topLevel and refModel have variables defined in their Model Workspaces. It is in these workspaces that the values for Ts are defined for each model.
After running the model and viewing the scope, you’ll notice that the sine wave coming from the refModel has been sampled with a 0.5 second sample time and the sine wave that comes straight from topLevel has been sampled at 0.1 seconds. Please note that in order for this technique to work, the sample rates for all of the referenced models in the top-level model will need to be scalar multiples of the top-level model sample rate.

More Answers (0)

Products


Release

R2011a

Community Treasure Hunt

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

Start Hunting!