pulse block in conditional subsystem

2 visualizaciones (últimos 30 días)
Jasmin
Jasmin el 23 de Ag. de 2013
Hi,
I have a Simulink model which uses solver ode45 with variable step size. In Matlab I set an index, that determines, which of two different subsystems shall be executed. A conditional block in Simulink checks, based on this index, which subsystem shall be executed. The subsystems generate a signal, which I merge with a Merge-block for the same variable in the further model.
My problem is, that I have pulse blocks in one of these subsystems. Because of that I get an error saying ".../Pulse' is not allowed within conditionally executed subsystems since it contains a variable step size sample time."
I have two different solutions right now:
1) Make two separate Simulink models and execute the right one in Matlab. Disadvantage: The most of these both models is the same and I have to apply any changes to both models.
2) Execute both subsystems and choose the right signal by a multiplexer made of basic Simulink blocks. Compare the index with its possible values by a Compare-to-constant-block. If it has value 1, multiply 1 with the signal from subsystem 1 and multiply zero with the signal from subsystem 2. Disadvantage: Very slow, because both subsystems are executed
Does anybody have another idea to solve this problem with the possibility to still use accelerator mode?
Thank you very much, Jasmin

Respuestas (1)

Guy Rouleau
Guy Rouleau el 24 de Ag. de 2013
Change the Pulse Generator from Time-Based to Sample-based. That way the block will take a fixed-step size and the error should go away.
Another option is to implement the funcitonality using basic blocks. Sum, Unit Delay and a Comparison should be all you need.

Categorías

Más información sobre General Applications en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by