How do I run parallel dependent loops?
显示 更早的评论
I have a simulation that has two parts. A control loop and an identification loop. The control loop runs at a high sampling rate. The identification loop is computationally intensive. The information generated by the identification loop is helpful but not necessary for the control loop to run.
Ideally, I would like to have a simulation where the identification loop sends information to the control loop whenever its done computing. The control loop uses whichever latest identification information it has.
Is there a way I can do this?
2 个评论
José-Luis
2013-5-20
What does your code look like? Could you give an example? How do you intend to perform parallelization of the tasks?
Rushikesh Kamalapurkar
2013-5-23
回答(1 个)
Walter Roberson
2013-5-20
1 个投票
If you were to use smpd then you could use labsend() to send values from the identification worker to the control worker.
The traditional structure would be to construct the control loop as a BytesAvailableFcn callback or timer callback (as appropriate) that would interrupt the main computation as necessary, and would draw upon the current values of variables stored by the identification loop. You would, I figure, need at least two buffers of the variables, one being read from and one being written to.
类别
在 帮助中心 和 File Exchange 中查找有关 Linear Model Identification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!