Error using SimulinkRe​alTime.tar​get/getsig​nal

조회 수: 4(최근 30일)
Scott
Scott 2020년 12월 7일
댓글: Scott 2020년 12월 14일
I have already seen the answer to a similar question without success.
I'm using Simulink Real-Time and am trying to use the getsignal command to find the current value of a signal in the model. I have successfully used this for a number of other signals with no problems but a few of the recently added signals report the error "Error using SimulinkRealTime.target/getsignal Invalid Signal".
I have tried the following
  • Adding a unit gain block and reading the output of that signal
  • Making the signal a "Test Point"
  • Using the Data Inspector and logging the signals (they appear in the Data Inspector but not with getsignal)
When I show the signals for the target using
tg = slrt;
tg.ShowSignals = 'on';
The signals that I am looking for do not appear in the list.
What can I do to force the signals to be visible to the host PC?
  댓글 수: 2
Scott
Scott 2020년 12월 14일
HI Jon, It was R2019b as indicated. I found the solution, see below. Unexpected data type conversion meaning that it was too large to become a valid signal.

댓글을 달려면 로그인하십시오.

채택된 답변

Scott
Scott 2020년 12월 14일
Found the solution.
The signal was a scalar value from a CAN Read block which was of type uint32. The normal advice to get signals to be visible is to use a Gain block with a value of 1 and this approach had worked for other signals. However in this scenario Simulink was converting the data type from uint32 to a large fixed point value (128 bits) after the Gain block.
Checking all the data types and converting the value back to a double before the unity gain block and the subsequent scaling and offset made the signal visible using getsignal.
Any data type that takes up more than 64 bits, apparently won't be visible.

추가 답변(0개)

범주

Find more on Prepare Model Inputs and Outputs in Help Center and File Exchange

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by