No Output from Repeating Sequence Stair when Running Simulink
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
When running a simulation on Simulink where the Start Time is not zero, the output from a Repeating Sequence Stair block or other similar sources is "no data yet". The block sample time is different from the default sample time. The issue has to do with the block sample time offset which I had to set as follows to make it work:
[scanPeriod ceil(rem(str2double(get_param('LineScanSimulation','StartTime')),scanPeriod)/samplingTime)*samplingTime]
Is there an easier way to set the time offset such that the output starts when the simulation Start Time is set to a value other than zero?
0 commentaires
Réponses (1)
Abhishek Chakram
le 16 Fév 2024
Hi Sonoma Rich,
When you are working with blocks like the Repeating Sequence Stair in Simulink, and you want them to output data starting at a simulation start time other than zero, you indeed need to adjust the sample time offset to align with the simulation start time. Here is another way for the same:
% Get the simulation start time
startTime = str2double(get_param('LineScanSimulation','StartTime'));
% Calculate the offset as the nearest lower multiple of the sample time
offsetTime = floor(startTime / scanPeriod) * scanPeriod;
% Set the sample time and offset in the block
set_param('YourBlockPath', 'SampleTime', num2str(scanPeriod), 'OffsetTime', num2str(offsetTime));
Replace “YourBlockPath” with the actual path to your Repeating Sequence Stair block.
Best Regards,
Abhishek Chakram
0 commentaires
Voir également
Catégories
En savoir plus sur Sources dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!