What is the Memory Block actually useful for?
24 ビュー (過去 30 日間)
古いコメントを表示
In the Aerospace Blockset example :
asbSkyHogg
Why are these Memory blocks used? How do they affect the simulation?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1266880/image.png)
0 件のコメント
採用された回答
Paul
2023 年 1 月 18 日
Hi Islam,
Memory blocks are often used to remove algebraic loops. The doc talks about this concept, just do a search. Here's a doc link that shows how to use unit delays, which are similar to memory blocks in this context, to remove algebraic loops.
My hypothesis is as follows:
In the model asbSkyHogg, if you trace the signal "alpha_dot,beta_dot" you will see that it is divided into alpha_dot and beta_dot in the PlantData bus, which goes to the Aerodynamics block. alpha_dot then gets pulled out of the bus and goes into the Datcom model to compute F and M. Typically, alpha_dot is only needed to compute M, not F. However, it looks like that block doesn't really allow for that division of labor. Anyway F and M come back around and if you trace F carefully (ignoring the memory blocks), you'll see that alpha_dot,beta_dot is a function of F. So without the memory blocks, alpha_dot is a function of F and Simuink thinks that F is a function of alpha_dot through that Datcom block. Hence, an algebraic loop. There really wouldn't be an algebraic loop if F and M were computed separately, Becuase the sequnce could then go as: compute F, compute alpha_dot, compute M.
Simulink can solve algebraic loops, but it can slow down simulation time. If a Memory block is required, as may be the case here because of how the Datcom block is implemented, the way this 2022a model is implemented is not good, to say the least. Without getting into my educated guess as to why the implementer did it that way, the net result is that the algebraic loop is removed, but at the expense of messing up ALL of the dynamic equations, with various quantities not obeying the fundamental dynamic and kinematic equations of motion. The degree to which this impacts the results is wholly dependent on the solver step size. Qualitatively, large steps more problematic than small steps.
A MUCH BETTER approach would have been to only put a memory block on the output of the calc_alpha_dot block or on the alpha_dot input to the Datcom block. Maybe this approach is done in the 2022b version that @Abhinav is looking at.
Summary: In this model the memory blocks are introduced to remove an algebraic loop. It could have been done mucy, much, much better.
Having said all that, my analysis is based only on looking at the model. I didn't actually try to run it or experiment with modifying it.
4 件のコメント
その他の回答 (1 件)
Abhinav
2023 年 1 月 17 日
The Memory block holds and delays its input by one major integration time step. When placed in an iterator subsystem, it holds and delays its input by one iteration. This block accepts continuous and discrete signals. The block accepts one input and generates one output. Each signal can be a scalar, vector, matrix, or N-D array. If the input is non-scalar, the block holds and delays all elements of the input by the same time step.
Refer to the following documentation to learn more about memory block :
3 件のコメント
参考
カテゴリ
Help Center および File Exchange で Simulink Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!