Is there any way to use a block that uses absolute time (e.g., Discrete-Time Integrator) in a referenced model executed by a function-call subsystem?

조회 수: 7(최근 30일)
Aaron
Aaron 2016년 3월 21일
답변: Guy Rouleau 2016년 12월 7일
I am developing a Simulink model that makes use of model referencing. The application is an automotive engine controller, making use of code generation.
Because of the requirements of the development platform, all of my model blocks need to be inside function-call subsystems, which are executed periodically by third-party code. I want to use model referencing inside these function-call subsystems.
This presents an issue when I use, e.g., the Discrete-Time Integrator block inside the referenced model. The referenced model is a discrete-time model and the Discrete-Time Integrator block requires absolute time. But the referenced model cannot inherit its sample time [1], so code generation fails when the Discrete-Time Integrator block is used.
The referenced model will be run periodically at a specified rate, so it would be completely acceptable to specify a sample time for the model. But if I specify a sample time for the referenced model as described in [2], code generation fails because referenced models are not allowed to specify their sample time priority.
It is possible to use the Discrete-Time Integrator block inside the function-call subsystem if it is not inside a referenced model, so it seems technically possible to achieve this goal -- perhaps I am missing some configuration.
How can I use the Discrete-Time Integrator block inside a referenced model in a function-call subsystem? Is there any documentation available that would help me understand the concepts and limitations more clearly?
Thank you in advance for your assistance.

답변(1개)

Guy Rouleau
Guy Rouleau 2016년 12월 7일
If you know what sample time at which the Discrete-Time Integrator will be triggered, you can use it in Accumulator mode. This will make it sample time independent. Then you can multiply the input signal by the known sample time to get the correct scaling.

Community Treasure Hunt

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

Start Hunting!

Translated by