Can I use double precision floating point math with OpenECU?


Normally, OpenECU does not allow the use of double-precision floating point values. OpenECU tries to restrict floating point numbers to 32-bit single floating points.

During the build process, most signals of type double will be automatically converted to type single. However, some built-in Simulink math blocks will not be automatically converted and this may result in your code running much slower than it would with single precision calculations. These functions can be converted to single-precision versions using the custom code tab in the Simulation Configuration dialog. The following figure shows how to do this.


Note to Embedded Coder users

Embedded coder users must have Data Type Replacement turned on in order to automatically substitute 32-bit floats in place of double floats. The image below shows how Data Type Replacement must be configured for automatic floating point substitution.

Note: When your model is configured for Embedded Coder using the OpenECU setup scripts (or by double clicking the prtw_ConfigUsingRtwEc block), then Data Type Replacement is automatically enabled.


Further information

In most cases, 32-bit floating point numbers are sufficient. If 64-bit floating point math is absolutely required, please contact Pi Innovo for more information.

      Copyright © 2016 Pi Innovo, All rights reserved