Simulink Switch doesn't propagate rate transition
Mostrar comentarios más antiguos
How can I make a Simulink Switch to propagate rate transition?
Right now I have two signal paths, of variable rates, with the rate determined by some condition:

However, the rest of the chain doesn't work, because the switch doesn't maintain the rate (or so SL thinks)
Also, there isn't a way to have a rate block with an input pin that defines the rate, so I can't adjust the rate via a dynamic input instead.
What's the right way to switch rates while the sim is running?
Respuestas (1)
Fangjun Jiang
el 12 de Mayo de 2023
0 votos
Not sure what you exactly mean, but a Signal Specification block can specify any rate you want.
7 comentarios
John
el 12 de Mayo de 2023
Fangjun Jiang
el 14 de Mayo de 2023
I didn't verify but I think the rate of the Outport 2 is determined by the Switch block, or the system that Outport 2 is in.
The Switch blocks does the "if-else" condition at a certain rate. The two sources provide the value, but not the rate. Imagine both sources are at a very high rate, a slow "if-else" calculation will not be able to pass that high rate. This is not a physical switch.
A Variant Source block might help but it can only change the source per simulation, not during the simulation.
You may try Physical Modeling using SimScape.
Paul
el 14 de Mayo de 2023
As best I can tell, the sample time of the output of the Switch block will be Fixed-in-Minor-Step. Whether or not that's what's desired is a different question.
Sample Time, as a block parameter, "To change a sample time after simulation begins, you must stop the simulation, reset the SampleTime parameter, and then restart execution."
Is the goal to switch between two signals with different sample times? Or is the goal to effectively change the sample time of one signal while the simulation is running? If the latter, and if that signal starts as a continuous sample time signal, one could pass it through a triggered subsystem and control the sampling via the triggering logic.
John
el 15 de Mayo de 2023
Paul
el 15 de Mayo de 2023
To make sure I'm clear .... because I don't think I am ...
We have two signals, the first with sample time T1 and the second with sampe time T2.
Question: Do these signals derive from the same source signal? If so, what is the sample time of that source signal?
Both signals are input to a switch, as shown in the picture in the question.
Question: What determines the middle input to the switch, i.e., the selection of the top or bottom signal?
John
el 30 de Mayo de 2023
Paul
el 1 de Jun. de 2023
What is the concern at the output of the switch? That signal as has an FiM sample time, but will still obey the sample time of the selected signal at the times when the output signal from the switch is used, won't it?
Categorías
Más información sobre Sources 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!