![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1424878/image.png)
How to trigger function call at a user defined periodic rate when using the "Show enable port" option in a Function-Call Generator
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Andrew Frank
il 29 Giu 2023
Commentato: Andrew Frank
il 6 Lug 2023
Attached is a simulink model that represents the functionality that I am trying to end up with. At this point I can get everthing to work as intended except for having my functionA and functionB run at different periodic rates when using the "Show enable port" option in the Function-Call Generators.
How can I get these two subsystems to run at different user defined periodic rates using function calls? Specifically, I want to be able to run FunctionA at 0.2 sec timesteps, and Function B at 0.5 sec timesteps. Currently both systems are running at the base simulation rate of 0.1 seconds.
I tried creating a stateflow graph (commented out) with output events that would trigger the functions at different rates, however each function ends up getting reset inbetween function calls. I only want them to be reset when the resettable subsystem is triggered by the enable logic at the root level.
Another solution I had tried instead of function calls was using enabled & triggered subsystems with a square wave generator, but this introduces other issues that would also need to be resolved.
0 Commenti
Risposta accettata
Adit Kirtani
il 3 Lug 2023
Hi Andrew,
From what I understand, you wish to modify the sample rate at which the function call subsystem “checks” if there is a function call or not.
In that case, I would recommend the rate transition block. Simply connect it between your enable signal and the function call generator as such:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1424878/image.png)
The rate transition block can be set to operate at a multiple of the input signal’s sample rate. In your case, you can set it to multiples of 2 and 5 respectively. Here’s a link to the documentation of the rate transition block, it should help your model operate as intended:
I hope this helps,
Adit Kirtani.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Schedule Model Components 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!