Is it possible to run asbQuadcopter simulation by making all variables double?

1 回表示 (過去 30 日間)
Jerico
Jerico 2025 年 1 月 1 日
編集済み: praguna manvi 2025 年 1 月 2 日
I'm trying to use the asbQuadcopter Simulink project for simulation to tune for PID gains. However, I am encountering some trouble in my optimization, most likely because all the data points calculated are all in single precision, requiring me to use large step sizes for finite difference approximations. Is there a way to make all computations use double?

回答 (2 件)

praguna manvi
praguna manvi 2025 年 1 月 2 日
編集済み: praguna manvi 2025 年 1 月 2 日
In the "asbQuadcopter " example, to change the computation to "double" precision, you might need to modify the explicit data type casting in the "Sensors" subsystem to "single" and in the "Signal Editor" block which loads values with "single" datatype.
Alternatively, performance bottlenecks can be analyzed using the "Simulink/Solver profilers." For detailed information on profiling and improving performance, refer to the following link:
Hope this helps!

Jaimin
Jaimin 2025 年 1 月 2 日
In Simulink, you have the option to set your model to utilize double precision for all calculations. This can enhance the accuracy of your simulations and may help in addressing any problems with your PID tuning.
Follow these steps to ensure your model operates with "double" precision.
Set the Default Data Type to Double:
  • Open your Simulink model.
  • Go to the Modelling tab in the Simulink toolstrip.
  • Click on Model Settings to open the Configuration Parameters dialog.
  • In the Solver pane, ensure that the solver type and settings are appropriate for your model.
Check Block Data Types:
  • Some blocks might have their data types explicitly set to single precision. You will need to manually change these to “double precision.
  • Right-click on a block and select Block Parameters.
  • Check for any data type settings and change them to double if they are set to single.
Simulink Datatype Inspector:
  • Navigate to the "Debug" pane. From there, choose Information Overlay > Ports > Base Data Types.

カテゴリ

Help Center および File ExchangePID Controller Tuning についてさらに検索

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by