match hardware update frequency in simulation

4 ビュー (過去 30 日間)
Nathaniel Goldfarb
Nathaniel Goldfarb 2022 年 2 月 22 日
回答済み: Chetan 2023 年 9 月 27 日
Hello,
I am trying to tune my Simulink controller for a system I built. My communication speed is about 350Hz using Serial communication to my off board controller. What I want to do is design a simulation that replicated my hardware, I have design all the dynmic models but I am having trouble replicating my communication speed. How can I make sure that my controller updates at 350Hz? I cannot find a good Simulink block that does this. I can add delays but that seems incorrect.

回答 (1 件)

Chetan
Chetan 2023 年 9 月 27 日
I understand that you are trying to tune a controller and trying to replicate the communication speed.
To ensure that your Simulink controller updates at a specific frequency, such as 350Hz, you can follow these steps:
  1. Configure the solver settings in Simulink to use a fixed-step solver with a step size of 1/350 seconds (approximately 2.86 ms). This ensures that the simulation runs at a consistent rate.
  2. Use the Rate Transition block in Simulink to control the rate at which signals are passed between different parts of your model. Set the sample time of the Rate Transition block to match the desired update frequency of 350Hz: https://www.mathworks.com/help/simulink/slref/ratetransition.html
By combining these techniques, you can control the timing and synchronization of your Simulink controller to match the desired update frequency of 350Hz.
I hope these suggestions help you resolve the issue you are facing.

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by