Sample Time Issue Using Pulse Generator Inside a If Action Subsystem
20 views (last 30 days)
Show older comments
I have a Simulink model running in discrete time. Inside one portion of a subsystem I have a if action subsystem, inside of this is a pulse generator running a Stateflow chart. I get the following error:
Sample time 0.05 of 'System/SystemPerCar/Determine/Protection/Level Protection/Pulse Generator2' does not match the sample time [0, 1] of the If block 'System/SystemPerCar/Determine Mode/Level Protection/If' controlling its execution.
It's a bit unusual that I had this working previously, until a coworker added some work in another subystem (if-enabled) that uses some of the outputs, and then I started receiving this error. His subsystem is within the same reference model as mine and everything is running at the same Sample Time.
The image below is the two different set of settings I have tried to get this working. I had the TimeBased one previously working, but including the Sample Based to show I had tried.
.
As the issue didn't start until my co-worker added his work I am unsure if fixing it at the generator is even the issue.
Edit: The attached model is a very simple example I created, the actual model is much more complicated, but I cannot upload it since its for work.
Thank you for any help,
0 Comments
Accepted Answer
Chris Dyer
on 18 Aug 2017
In your simple example, if you check the box for "Inherit sample time" on the memory block in the enable subsystem, the model will compile.
Maybe look for similar situations in your main model.
I think this issue often comes about when something gets added that forces the sample time nature of a signal, where other signals are inheriting sample time. Suddenly they all inherit a different sample time (sometimes continuous) that is not compatible with an existing block.
More Answers (0)
See Also
Categories
Find more on Schedule Model Components in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!