Sample Time Issue Using Pulse Generator Inside a If Action Subsystem

25 visualizaciones (últimos 30 días)
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,

Respuesta aceptada

Chris Dyer
Chris Dyer el 18 de Ag. de 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.
  1 comentario
umichguy84
umichguy84 el 18 de Ag. de 2017
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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Schedule Model Components 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!

Translated by