Multiple Stateflow Charts Algebraic Loop Error
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Is there a way to have two separate stateflow charts that interact without adding unit delays?
I am using the diagrams for HDL code generation and I do not want extra registers added by unit delays.
The state machines themselves are unrelated in the design and cannot be nested in the same stateflow chart.
I can attach a screenshot and a simple example if my question is unclear.
Réponses (1)
Zack Peters
le 13 Mar 2015
There needs to be an order for the two chart calls. Let's assume for a second that chart_1 get's called first and is followed by a call to chart_2. If this is the case then the question is, what will chart_1 use as its input? The current value of the signal will be whatever chart_2 output on the previous time step - This is effectively a delay. If you want the input of chart_1 to be the output of chart_2 at the current time step then that's a bit impossible because chart_2 hasn't executed yet (reading values from the future?).
If you sit down and work out what the expected behavior of the system is then I think you'll find that a solution exists for you. Sometime I find that it helps to write some pseudo code of how you would expect for this to behave if it were written in a programming language (like MATLAB or C).
One idea to break the loop (other than the delays) is to implement a function call for each block and link them with a Feedback Latch block:
But again, the pseudo code will look something like:
step()
{
out1 = chart_1(in1);
in2 = out1;
out2 = chart_2(in2);
in1 = out2;
}
0 commentaires
Voir également
Catégories
En savoir plus sur Complex Logic dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!