“The primary business benefits of Model-Based Design are shorter development times and lower costs. For me, the biggest advantage comes from knowing that we could use generated code, which made it possible to debug at the model level in Simulink, not at the code level.”Daniel Baumgärtner, Bosch eBike Systems
In just three years, Bosch eBike Systems grew from a market newcomer to an industry leader in the electric bike business. Today, Bosch eBike Systems drive units are used by more than 50 European bike brands.
From the start, Bosch eBike Systems engineers used Model-Based Design with MATLAB® and Simulink® to speed the design, implementation, and testing of the control systems for its drive units.
“Our team had just nine months to design and produce customer samples of the drive system, and just five more months before the system was introduced at the Eurobike trade fair,” says Daniel Baumgärtner, lead engineer at Bosch eBike Systems. “Model-Based Design was instrumental in enabling us to deliver the embedded eBike drive system controller within this deadline.”
Bicycle manufacturers launch new models each spring, when most bicycles are purchased. Bosch and other suppliers provide manufacturers with new systems in the summer preceding each launch; otherwise, a full year passes before the systems can be incorporated.
Bosch engineers had a little more than a year to design, implement, test, and prepare the eBike system for demonstration at the prestigious Eurobike trade show.
Because they were building an entirely new system, the team needed a way to simulate their controller design and then quickly deploy it to an embedded microcontroller or prototyping hardware for testing on an actual bike. They wanted to shorten design iterations in which the engineers deploy a design to hardware, either ride the bike or use a test bench to evaluate its performance, refine the design, and then redeploy it for further testing. At the same time, they needed to ensure rider safety.
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.
Designs updated and ready for retest in five minutes. “After riding the eBike to get a feel for how our system performed, we adjusted the control algorithm and parameters in Simulink and then re-generated code for prototype hardware,” says Baumgärtner. “In as little as five minutes, we were ready for a test ride with the updated controller.”
Code generated to meet safety standards. “The code we generated with Simulink Coder and Embedded Coder had zero defects,” Baumgärtner says. “It was developed in accordance with our internal processes for functional safety standards.”
Crucial market deadline met. “Our drive system had to be ready to be introduced at the Eurobike trade fair to capitalize on a once-a-year market opportunity,” says Baumgärtner. “Model-Based Design was vital in enabling us to meet this goal by accelerating design iterations via code generation.”
Join the Customer Reference Program