Bosch engineers used Model-Based Design to develop the eBike drive system, which was completed in accordance with the company’s functional safety standards.
They partitioned the drive system controller into two components: a drive controller and a motor controller.
The drive controller, modeled in Simulink, uses inputs such as the rider’s cadence, the torque applied at the crank, and the bike’s speed to determine how much torque is required from the motor to assist the rider.
The motor controller, modeled with Simulink and Stateflow®, operates at a higher clock frequency than the drive controller. It sends signals to the motor in response to torque commands from the drive controller.
Bosch engineers developed a plant model for each component in Simulink. The drive controller plant model incorporates the rider’s mass and pedaling behavior, as well as environmental factors such as the slope of the ground. The motor controller plant model captures the characteristics of the drive system’s brushless DC motor.
To verify the control algorithms, the team performed separate closed-loop simulations of the drive and motor controllers in Simulink.
For real-time testing, they generated code from the drive control model using Simulink Coder™, compiled it, and deployed it to rapid prototyping hardware. They generated code from the motor control model using Embedded Coder® and deployed it to the microcontroller.
Using a second rapid prototyping unit, the engineers built a test bench equipped with actuators for pedaling a bicycle and sensors to gather performance metrics. They developed test suites for this setup by modeling scenarios in Simulink and using Simulink Coder to generate code for the test hardware.
Working in MATLAB, the team analyzed simulation and test results, creating plots of torque and velocity to visualize key performance characteristics.
Bosch engineers generated production code for the microcontroller from the drive control and motor control models using Embedded Coder.