Ellio Develops Two-Wheel Drive E-Bike with Simulink and Model-Based Design
Challenge
Accelerate the development of an e-bike automatic gear system and its control software
Solution
Use Model-Based Design to model and simulate the drivetrain, create a prototype controller, and generate production code
Results
- Complete drivetrain model developed in three months
- Controller prototyped from model in one day
- Control parameters tuned interactively in real-world tests
Although sales of electric bicycles (e-bikes) have grown steadily for the past several years, everyday commuters have yet to widely embrace e-bikes as a practical alternative to the automobile. Many e-bikes are designed for experienced cyclists skilled at the nuances of riding, such as keeping their eyes on the road while shifting gears. Few are designed for the less experienced riders who make up the mass market.
At Ellio, a start-up headquartered in Belgium, engineers have created a two-wheel drive e-bike with an automatic gear system that makes it easy for riders of all abilities to precisely control their speed. To accelerate the development of the e-bike, Ellio engineers used Model-Based Design with MATLAB® and Simulink® to model and simulate the e-bike’s control software and its innovative drivetrain design, which was based on drivetrains found in hybrid automobiles.
“For us, the greatest benefit of Model-Based Design is that we never have to do anything twice,” says Jorrit Heidbuchel, cofounder of Ellio. “Because we can simulate the complete drivetrain and controller in Simulink, we are able to go from a model to a working prototype in a single day. The prototype worked the first time, and although we continue to improve the controller, we’ve needed no major design iterations.”
Challenge
Among the most significant challenges the engineers faced in designing the fully automatic drivetrain was implementing an impedance control system that accounts for—and responds to—the force that the cyclist applies to the e-bike’s pedals. The engineers recognized that while it would be possible to model the steady-state behavior of the drivetrain, a qualitative assessment of how shifting, braking, and acceleration would feel to a cyclist is difficult to obtain from simulation. Because such an assessment would be most effective on the e-bike itself, the engineers wanted to develop an initial prototype quickly and then adjust control parameters on the fly while the e-bike was in operation.
Another factor driving the need for rapid development was the company’s entry into the market as a startup. With a small team and limited seed funding, the company wanted to have a first prototype ready to show investors in six months. Because lengthy delays or significant redesigns put the entire effort at risk, the team wanted to have a clear path—with minimal manual coding—from the model they used for design verification to production deployment.
Solution
Working in Simulink, Ellio engineers developed models of the e-bike’s drivetrain, the e-bike controller, and a human cyclist.
Built with Simscape™, the drivetrain model was based on work that Heidbuchel had completed for his master’s thesis. It included planetary gear and chain drive blocks from Simscape Driveline™ as well as electric motor blocks from Simscape Electrical™.
The team used a MATLAB Function block to model the load on the e-bike due to aerodynamic resistance and the slope of the road.
They used a combination of Simulink blocks and MATLAB code to implement the impedance control algorithm, which generates target torque values for the motors based on rotation rates and measured torque values from the drivetrain model.
The engineers ran closed-loop simulations with a system model that included the controller, cyclist, and drivetrain models. They used these simulations to evaluate different gear ratios and tune control parameters to improve performance.
After they had validated the controller design via simulation, the team used Simulink Coder™ to generate code from the controller model. To create the e-bike’s first controller prototype, they compiled and deployed this code on a Raspberry Pi™ processor, which communicates with the electric motors via an SPI interface.
They continued to improve controller performance by conducting test rides with this prototype and iteratively adjusting control parameters in Simulink based on how the e-bike felt and responded to the rider.
The control software, built using code generated from the Simulink controller model, is now running on Ellio e-bikes currently in production.
Results
- Complete drivetrain model developed in three months. “With Simscape, it took me just three months to complete the entire drivetrain model—one that we can easily customize using MATLAB,” says Heidbuchel. “For comparison, using other software, it took me about the same amount of time to accurately model a single component.”
- Controller prototyped from model in one day. “Once we had our controller modeled in Simulink, we created a working prototype in a single day by generating code for the Raspberry Pi using Simulink Coder,” notes Heidbuchel. “We estimate that it would have taken at least two weeks to manually code and debug software on the prototype bike, especially since we had no real coding expert on the team.”
- Control parameters tuned interactively in real-world tests. “Simulink made it easy to tune control parameters on the fly,” says Heidbuchel. “For example, we tuned our traction control functionality while riding the bike in circles in the middle of an ice rink. We varied Simulink block parameter values on the spot and saw how the traction control system performance changed.”