Multiple Stateflow Charts Algebraic Loop Error

2 ビュー (過去 30 日間)
Aaron
Aaron 2015 年 3 月 12 日
回答済み: Zack Peters 2015 年 3 月 13 日
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.
  1 件のコメント
Aaron
Aaron 2015 年 3 月 12 日
Here is a snapshot of the diagram, chart_1 and chart_2 are the same

サインインしてコメントする。

回答 (1 件)

Zack Peters
Zack Peters 2015 年 3 月 13 日
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;
}

カテゴリ

Help Center および File ExchangeComplex Logic についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by