Triggering a subsystem to run for set duration
Mostra commenti meno recenti
Hello, I want to trigger a subsystem that will then run for 0.25 time units (more than once) at points through the simulation but I do not know how to trigger a clock. Can anyone help?
Roger
Risposta accettata
Più risposte (2)
Fangjun Jiang
il 24 Mag 2011
0 voti
I am not fully understand your question. Let's see if this is the case. Set your simulation step size as 0.01 second. Drag a "Pulse Generator" block, set the period as 1 second and the pulse width as 25 (percent). Use the output of the "Pulse Generator" to trig an "Enabled Subsystem". The subsystem will be running every 0.25 second out of 1 second.
1 Commento
Roger
il 25 Mag 2011
Mark
il 24 Mag 2011
0 voti
Fangjun's approach is probably the best way if the interval between the 0.25 pulses is also known in advance. If it is not, I would recommend using Stateflow instead.
The general idea is that you would still use an "Enabled Subsystem" like above, but in this case, Stateflow would output a Boolean signal to drive it. Inside Stateflow, you could read any relevant inputs, and use them to enter a state that sets the output as "true", only exits after 0.25 (check the documentation for "temporal logic" to see the Stateflow keywords for defining time intervals), and then sets the output to "false" upon exiting the state.
5 Commenti
Roger
il 25 Mag 2011
Mark
il 25 Mag 2011
What sort of trigger/event are you looking for to indicate that the subsystem is supposed to run?
Fangjun Jiang
il 25 Mag 2011
In other words, what is the logic to trig your subsystem? I understand that your subsystem needs to run more than once and every time it runs, it runs for the duration of 0.25 second, right?
Roger
il 26 Mag 2011
Fangjun Jiang
il 26 Mag 2011
The use of Matlab function block is not needed. You could just use a switch block.
Categorie
Scopri di più su Subsystems in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!