When I saw my graduate students competing to see who could maintain the highest average speed on the electric motor-powered skateboard they had built, I knew that I had achieved my two most important goals for their project. Not only had they gained a deep understanding of Model-Based Design principles, they also had a great deal of fun doing so.
Kevin Leiffels and Raphael-David Volmering designed and built the e-longboard as a final project for my course on electric drives and field-oriented control (vector control). Powered by two independent brushless DC motors (BLDCs), the longboard can carry a rider up to 25 km (15.5 miles) with a top speed of more than 40 km/hour (25 mph) (Figure 1).
Figure 1. Kevin Leiffels taking the e-longboard on a test run.
The Value of Hands-On Projects with Model-Based Design
Students acquire a much deeper understanding of engineering concepts by completing hands-on projects than by listening to a lecture. Even students who get excellent grades on tests don’t truly understand concepts such as field-oriented control for electric motors until they have applied those concepts in the real world.
Model-Based Design enables students to tackle meaningful projects in the limited time available. For example, in a single semester Raphael completed the e-longboard’s printed circuit board design while Kevin designed, implemented, and tested the controller. Kevin generated more than 15,000 lines of code—much more code than he could have written by hand in one semester.
HS Bochum’s acquisition of a Total Academic Headcount (TAH) license was a major milestone for the university and a boon to my course. The students are free to use MATLAB® and Simulink® on assignments both inside and outside the lab. This flexibility is highly motivating. MATLAB and Simulink are industry standard tools, and the students know that to develop the skills required in industry they need more practice with the tools than they can get just by working in the lab. The TAH license also makes my job easier because I no longer have to keep track of individual licenses.
For all student projects I establish a set of basic requirements and then let the students come up with their own ideas. The e-longboard project had to include a power device, two separate motors that are not mechanically connected, and a DSP on which the field-oriented control is implemented (Figure 2). The control part of the project must be challenging but simple enough for a student to complete in a single semester. Each student must use Model-Based Design. In my view, Model-Based Design is state of the art for control system development because it enables early and thorough verification of the design, low implementation costs, portability to multiple hardware platforms, and short development times.
Before Model-Based Design became a requirement, the students did not learn as much about how real engineering projects are conducted. For example, they would often start with a prepackaged third-party motor controller, hack a few lines of C code together to get the motor spinning, and then move directly to constructing the rest of the system for trial-and-error testing. When they were done they would find out that the system did not meet their power demands or satisfy all the real-time requirements. Because they had not verified their designs via simulation, they only discovered these problems when it was too late to do anything about them.
Supplementing the basic project requirements, the students included several requirements specific to the e-longboard. In addition to specifying a minimum range for a single battery charge, these requirements defined a maximum braking distance and a minimum hill grade that the e-longboard would need to be able to climb.
Designing and Implementing the Controller
A principal design challenge in field-oriented control is maintaining a 90° angle between the rotor and stator field in the motor. In addition to minimizing changes of the magnetic flux to enable fast transient responses, maintaining this angle maximizes motor torque for a given current. Kevin used hall sensors to measure rotor position, which is a key input to both the field-oriented control and the board’s speed control loop.
Kevin based his controller design on an example field-oriented control project from a MathWorks® webinar. The example included a Simulink model for controlling the speed and torque of a three-phase permanent magnet synchronous machine (PMSM), which was modeled using Simscape Electronics™ (Figure 3). We found the example to be a good implementation of field-oriented control.
After downloading the example project from mathworks.com, Kevin modified the parameters for the e-longboard, removed unneeded parts, and added features. After running simulations in Simulink, Kevin used Embedded Coder® to generate C code for the board’s TI F28069 microcontroller. At that point, he began evaluating the real-time response of the system to see if it met the real-time requirements he had established.
Kevin and Raphael worked largely on their own, meeting me once a week so that I could monitor their progress. On this project, Kevin applied and expanded the basic knowledge of Model-Based Design with MATLAB and Simulink that he had acquired in earlier control design electives at HS Bochum. He relied on technical support from MathWorks to resolve any technical issues that he encountered, and that enabled him to work with surprisingly little assistance from me.
Once the rest of the e-longboard had been constructed and the printed circuit board was ready (Figure 4), Kevin and his classmates began test runs in and around the HS Bochum campus.
Kevin rode around a nearby lake—a distance of more than 25 km—to test the board’s range. It wasn’t long before the students were competing to see who could deplete the batteries fastest by maintaining the top average speed. Following test runs, Kevin post-processed metrics captured during the runs. To visualize the e-longboard’s speed response, for example, he created a combined graph of desired speed and actual speed in MATLAB (Figure 5).
Next Steps for the Student and the Course
When Kevin completed his studies at HS Bochum he began working for an engineering company that uses Model-Based Design. When the company learned of Kevin’s success with the e-longboard they hired him on the spot.
One of the most valuable lessons Kevin learned is the importance of verifying requirements as thoroughly as possible via modeling and simulation before the actual implementation. The company that he now works for will be supporting our upcoming use of Simulink Verification and Validation™ (transitioned at R2017b) because they, too, are seeking to verify requirements at earlier stages in development.
I am planning a few changes for the next group of students taking the field-oriented controls course. I will still require hands-on projects with Model-Based Design, and I will be encouraging more students to build an enhanced version of the e-longboard. Next year’s version of the course will place a stronger emphasis on requirements, logical modes, and physical modeling using Simulink Verification and Validation, Stateflow®, and Simscape Electronics™, respectively.
I plan to use the board to inspire next year’s students. I will bring the board to class and let the students take a test drive outside to stir their interest before they head to the lab to begin their own projects using Model-Based Design and field-oriented control.
Article featured in MathWorks News & Notes