No Output from Repeating Sequence Stair when Running Simulink
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Abhishek Chakram
el 16 de Feb. de 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 comentarios
Ver también
Categorías
Más información sobre Sources en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!