필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Glen Tallarek
Glen Tallarek 2022년 8월 23일
답변: Glen Tallarek 2022년 8월 23일
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!

답변 (1개)

Glen Tallarek
Glen Tallarek 2022년 8월 23일
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!

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by