Effacer les filtres
Effacer les filtres

How can I force the encoder to calculate both upstream branches of a switch?

1 vue (au cours des 30 derniers jours)
Glen Tallarek
Glen Tallarek le 23 Août 2022
I have a Simulink model that has a switch block that chooses to pass the output of lookup table "A" or the output of lookup table "B" based on a switch condition. In the C-Code that the encoder produces, it (logically) only calculates and passes the output from the table that is "selected" and does not determine the output from the other table. For purposes of data collection for debugging and analysis, I would like the outputs from both tables to be calculated all the time and then have the switch pass the selected value. What is the easiest way for me to force the encoder to generate code that will calculate the output from both tables all the time?
Simularily (and again, for debug and analysis purposes), I would like to know how to force the encoder to create "global" variables for any intermediate signal I would like to monitor. I have had some luck with just giving signals a specific name but I wanted to find out if there were any other ways.
Thank you!

Réponses (1)

Glen Tallarek
Glen Tallarek le 23 Août 2022
I think I found a way and it seems to work.
In the "Signal Properties" box and the "Logging and accessibility" tab for the table look-up output signals, I checked the "Test point" box. When I saved the model and then generated the code I got what I wanted -- each table output value was calculated and the values were stored to the RAM variables (that were created with the output signal names) and then the switch chose the appropriate value to pass.
I think I am all set. However, if anyone can confirm that this is the best method or can provide an alternative method, I would appreciate it. Thanks in advance!

Catégories

En savoir plus sur Simulink Coder dans Help Center et File Exchange

Produits


Version

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by