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.
.
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,

采纳的回答

Chris Dyer
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.
  1 个评论
umichguy84
umichguy84 2017-8-18
Yes, that was it, there was a company created library block being used where the memory block didn't the have inherit ticked under a mask. It was used in both the if action and the if enable subsystem in this case.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Schedule Model Components 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by