Organization Type
Individual Developer
Organization Name (Optional)
No response
Primary Domain/Industry
IoT/Embedded Systems
Other Domain (if selected above)
No response
Project Stage
Production/Deployed
Development Team Size
Just me (1)
Use Case Description
I am using mp_units to do have a proper abstraction layer for quantity handling in an embedded system.
The current project is a throttle position controller, where I implemented my own derived quantities for angular positions and speeds expressed in percent but degree.
Because the used microcontroller, STM32F1, has no floating point unit I am using custom representation types based in CNL.
This combination enables my to calculate with quantities without the hassle of conversions, without the runtime cost of floating point calculations.
This is a hobby project, that is not distributed anywhere, but in my car on a race track ;)
Features Used
Key Benefits Experienced
- much more expressive code, because I removed all the magic numbers to "convert" numbers after each calculation
- simpler to write correct calculations, because using the unit symbols is enough, to get the expected result
- output of unit tests is simpler to understand with unit symbols in text output
- my old implementation with raw numbers and fixedpoint with base 10 took 120us to execute my main control loop. The switch to mp_units + CNL lowered it to 85us. The main impact was the switch from fixedpoint base 10 to base 2 (divisions turned into bit shifts) but mp_units was the enabler to do this change. (Debug build on target hardware STM32F103)
Impact on Your Project
Very helpful - Significant improvements
Usage Permissions
Organization Type
Individual Developer
Organization Name (Optional)
No response
Primary Domain/Industry
IoT/Embedded Systems
Other Domain (if selected above)
No response
Project Stage
Production/Deployed
Development Team Size
Just me (1)
Use Case Description
I am using mp_units to do have a proper abstraction layer for quantity handling in an embedded system.
The current project is a throttle position controller, where I implemented my own derived quantities for angular positions and speeds expressed in percent but degree.
Because the used microcontroller, STM32F1, has no floating point unit I am using custom representation types based in CNL.
This combination enables my to calculate with quantities without the hassle of conversions, without the runtime cost of floating point calculations.
This is a hobby project, that is not distributed anywhere, but in my car on a race track ;)
Features Used
Key Benefits Experienced
Impact on Your Project
Very helpful - Significant improvements
Usage Permissions