Sample time error when CAN Pack block has constant block input

조회 수: 7 (최근 30일)
I am trying to generate C code using a simple model that uses a CAN pack and CAN unpack block. A constant block feeds into the CAN pack block. I ran into the following build error:
The sample time of output port 1 of block 'test_TSnew/CAN Pack1' is constant, yet its data type is 'CAN_MESSAGE';
the sample time of an output port may be constant only if its data type is stored in a builtin type.
If the block has an input port, consider placing a Zero Order Hold block at the input port, to force a non-constant sample time.
Alternatively, if this block is an S-Function, consider using the option SS_OPTION_DISALLOW_CONSTANT_SAMPLE_TIME

채택된 답변

MathWorks Support Team
MathWorks Support Team 2018년 2월 22일
This is intended behavior. A "CAN Pack" block requires a non-continuous sample time. To remove this error, set the constant block’s “Sample time” to a discrete value instead of “inf”. You may double-click on each constant block to set its “Sample time”. This explicit requirement on the "CAN Pack" block began in R2016b.

추가 답변 (0개)

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by