How to bound discrete integrator outputs

1 回表示 (過去 30 日間)
Jonas
Jonas 2019 年 5 月 10 日
コメント済み: Fangjun Jiang 2019 年 5 月 13 日
Hi all
I am working on a simulation model which eventually needs to get deployed on actual hardware in production. One thing that now worries me is the outputs of some discrete integrator blocks. As an example, I have a discrete integrator that receives rotational speed in rad/s as an input, and provides rotational angle as an output in rad. Afterwards, I use a simple modulus block to bound this angle output between 0 and 2*pi.
The concern I am having, is that the output of the discrete integrator block will build up indefinitely, while it actually just needs to overflow to 0 when it reaches the 2*pi bound. In simulation, the discrete integrator's output data type is a double, so it is allowed to become very large, but since this is going into production hardware I would like to limit variable sizes if possible.
What I have tried is to set 0 and 2*pi as saturation limits, then output the saturation port and feed it back into the external reset port.
This provides me the functionality, but it seems to give a delay each time it executes. I have compared a regular discrete integrator, by inserting the output angle into a cosine and count how many times the cosine goes up and down, and over 3000 cycles, the implementation of the screenshot above has done 27 cycles less...
Does anyone have a suggestion for bounding the output of a discrete integrator, without any delay?
Thanks much!
Jonas

採用された回答

Fangjun Jiang
Fangjun Jiang 2019 年 5 月 10 日
When the saturation happends, it should not reset to zero. It should reset to "Value-2*pi".
Don't enable "Limit output" at this "Discrete-time Integrator" block. Instead, Use a Sum block to calculate the difference "Value-2*pi". Compare the difference, if it is great than zero, trig the re-set of the "Discrete-time Integrator" block. Specify the "Initial condition source" as "external" and feed the difference.
  4 件のコメント
Jonas
Jonas 2019 年 5 月 13 日
I am not sure if anyone is interested, but I have added functionality that can initialize the integrator on a non-zero value now. Posting a screenshot for completeness.
Fangjun Jiang
Fangjun Jiang 2019 年 5 月 13 日
Good to learn all the details you've implemented. Thanks!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSchedule Model Components についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by