sample error in simulink if else statement

19 visualizaciones (últimos 30 días)
kpb
kpb el 25 de Feb. de 2016
Comentada: ashwani gupta el 9 de Ag. de 2021
When i am using if loop in matlab simulink it shows the error Sample time 1 of 'bdc_2_CL/Subsystem/If Action Subsystem/PID Controller/u' does not match the sample time [0, 0] of the If block 'bdc_2_CL/Subsystem/If' controlling its execution. this error is coming only when i am trying to connect closed loop simulation. In open loop it is perfectly working.In closed loop i have just added one adder and discrete PID controller
  1 comentario
ashwani gupta
ashwani gupta el 9 de Ag. de 2021
i will suggest a very crude way to tackle this problem. Just add one rate transition block before all the input signals of if block and it will resolve your problems.

Iniciar sesión para comentar.

Respuestas (2)

Sebastian Castro
Sebastian Castro el 25 de Feb. de 2016
Conditionally executed subsystems like your "If" block are not guaranteed to execute at every time step.
According to your error message, the PID Controller block inside this subsystem is set to Discrete mode with at sample time of 1. However, the PID Controller block inside cannot take a deterministic rate because it's inside the "If" block.
Go to the PID Controller block and change its sample time to -1, for "Inherit". Does that work?
- Sebastian

kpb
kpb el 26 de Feb. de 2016
No , I tried it before still it is not working , while in a closed loop system it works perfectly wid sample time -1.
  1 comentario
Sebastian Castro
Sebastian Castro el 26 de Feb. de 2016
Looking at your error again, there seems to be some block "u" in that subsystem set to a sample time of 1. Maybe an Inport/Outport block?

Iniciar sesión para comentar.

Categorías

Más información sobre Event Functions 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