Find Source of Warning: This model contains blocks that do not handle sample time changes at runtime.

3 次查看(过去 30 天)
I am getting the following warning when building a model for Simulink RealTime:
Warning: This model contains blocks that do not handle sample time
changes at runtime. To avoid incorrect results, only change
the sample time in the original model, then rebuild the model.
There are no other warnings when building the model. How can I find which block(s) are responsible for this warning or the reason for the warning?
More Info:
I am using the following system target file:
System Target File: C:\Program Files\MATLAB\R2019a\toolbox\slrt\rtw\slrt.tlc
I am using the Microsoft Visual C++ 2019 (C) compiler
The warning is generated by the following private function:
function xpcSampleTimeWarning
% Simulink Real-Time private function
% Copyright 2008 The MathWorks, Inc.
warning(message('xPCTarget:sampleTime:sampleTimeInvariance'));
Runing various model advisor checks yielded no help.

回答(1 个)

Tejas
Tejas 2025-2-25
The warning message mentioned above is triggered during the build process for Simulink Real-Time compilation. This occurs when a model contains blocks whose sample time cannot be modified at runtime. The warning simply highlights that these blocks sample time cannot change at runtime, even if the sample time for the entire model is adjusted at runtime.
This warning does not indicate an issue with the model. It merely serves as a reminder that the model must be rebuilt whenever changes are made to the sample time. Therefore, it seems there is no specific solution for this issue.
As a workaround, consider disabling the warning message using the following command:
>> warning('off', 'xPCTarget:sampleTime:sampleTimeInvariance');

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by