How to edit C++ code of a Simulink block?

1 view (last 30 days)
Ben Milne
Ben Milne on 28 Apr 2020
Answered: Ayush Gupta on 8 Jun 2020
Hello,
I've been working on creating a rocket 6DoF and I'm using the 'Simple Variable Mass 6DoF ECEF Quaternion' block from the Aerospace Blockset.
However, after using the Simulink Coder to read the code (generated as C++) I have noticed it uses an ODE2 (Bogacki-Shampine) differential equation solver. My question is: after editing the generated code to upgrade the ODE solver method, how do I go about updating the block itself in my Simulink file?
Does this involve generating an s-function from the 6DoF block -> generating the code -> editing the code -> creating a new s-function block from the edited code?

Answers (1)

Ayush Gupta
Ayush Gupta on 8 Jun 2020
There is no need to edit the code of the Simulink block. The ODE Solver can be changed in the Simulink model by going to the Configuration Parameters > Solver > Solver selection and setting the solver to the required one. This will adjust the generated code output to use the required solver.

Categories

Find more on Simulink Coder in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!