Simulink: Two simulation steps within one
Mostrar comentarios más antiguos
Hello everyone,
Here is the problem: I have a simulink block-diagram scheme which represents a simple stepper motor control system. It consist of two parts - first is stepper itself with power source and controlled H-bridge, second part prepares control signals for that bridge. Input for the whole scheme is a sequence (1xN vector) of rotation values in degrees. Now how it should work: having the stepper motor step size (0.045 deg for example) system should compute how many steps should be done by stepper to achieve next position (next rotation value in sequence) and (let's say 2 steps should be done) output 2 corresponding control signals to H-bridge. The problem is, that if on let's say first simulation step motor should do two steps, that means that within one simulation step motor should do two simulation steps...
I tried to do that with For Loop, but it seems that For Loop performs all its iterations within one simulation step, which is not suitable in my case. Is it possible to solve such problem?
Many thanks in advace for an answer!
Best regards, Peter.
1 comentario
Peter
el 29 de Abr. de 2011
Respuestas (1)
Kaustubha Govind
el 29 de Abr. de 2011
0 votos
What have you set as "Iteration limit source" in the For Iterator block? It seems like all you need to do is make this "external" and connect the number_of_iterations signal to this input. Please elaborate on how your Iterator block is configured if have misunderstood your use-case.
4 comentarios
Peter
el 29 de Abr. de 2011
Kaustubha Govind
el 29 de Abr. de 2011
In that case, the Iterator Subsystem should execute 'n' time in a given time-step if the input value is 'n'. Is this not the behavior you observe?
Peter
el 30 de Abr. de 2011
Kaustubha Govind
el 2 de Mayo de 2011
Ah! So what you want to do is concatenate the output of each iteration, such that S1 has a width of 'N'?
One way I can think of is using the Iterated Assignment block (see http://www.mathworks.com/help/toolbox/simulink/slref/assignment.html), and assign one element of the output at a time. However, since the output needs to be fixed dimensions, you could set the output size to be the maximum number of iterations possible.
Categorías
Más información sobre Specialized Power Systems en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!