Sample Time Issue Using Pulse Generator Inside a If Action Subsystem
20 次查看(过去 30 天)
显示 更早的评论
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166736/image.png)
.
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 个评论
采纳的回答
Chris Dyer
2017-8-18
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Schedule Model Components 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!