How model-based design drives an algorithm that silently works under an EV's hood
There are two aspects to FOC development for a motor control system. One, where one mimics the control model which is essentially the FOC algorithm component. Another is the plant model responsible for testing the algorithm in a simulated environm...
An average electric vehicle (EV) user has no idea about Field-Oriented Control (FOC) algorithm that works silently under the hood. But people in the know of things will swear by its ability to drive electric motors with utmost efficiency and accuracy. Though FOC is not specific to EV motor control, its implementation in the automotive domain calls for special skills and expertise. It entails a gamut of complex calculations that get quite tricky at times. Whether it is Park and Clarke transform or the space vector modulation, implementation of FOC algorithm is a coder’s nightmare.

Such calculations with manual coding is time-consuming, a luxury in the automotive domain because of the pressure to go to the market ahead of the competition. Several OEMs work simultaneously on refining such algorithms and the one who rolls out the feature first gets a bigger chunk of sales revenue.

Thanks to the Model Based Design paradigm, implementation of FOC becomes a lot easier as code is generated by creating models. The complicated calculations like the above one, are performed by a set of block libraries and simulation techniques that model physical motor control systems in a simulation environment.
There are two aspects to FOC development for a motor control system. One, where one mimics the control model which is essentially the FOC algorithm component. Another is the plant model responsible for testing the algorithm in a simulated environment.
Development of FOC algorithm using model-based design approach entails creating and testing the algorithm in a simulation environment. Once the control algorithm model is developed, it can be validated, and C code can be generated.
The most commonly used environment for model-based development in the automotive domain is MATLAB/SIMULINK. Modelling a physical system in the Simulink environment is made even easier with tools like SIMSCAPE.
It has a set of block libraries and simulation features that are highly useful in modeling physical systems in the Simulink environment. These blocks represent basic mathematical operations to be performed by the software. In the context of FOC algorithm development, the tool provides blocks for Park and Clarke transformation as well as space vector modulation.

Modelling works on the principle that if physical elements of a system can be connected, their models can be connected as well.

How does MBD help?
Using the MBD approach implies creating models that mimic the control system. The following lines answer the question: what exactly does the FOC algorithm require and how does MBD help fulfill it?
— Design algorithm for Proportional Integral (PI) controllers for feedback signals.
— Overcome speed error by tuning the gains of PI controllers
— Design a space vector modulator to control the PWM signal fed to the inverter
— Develop field weakening control algorithm in order to regenerate Iq_ref and Id_ref as the input to PI controllers
— Implement Park, Inverse Park and Clarke transform
— When model-based design along with all its tools and technologies come into the picture, most of these tasks get easier. From designing and testing to tuning the control algorithm, all activities are performed in a simulation environment.
With MBD at the helm, the engineers can:
— Model current and speed controllers as well as the space-vector modulators and inverters
— Create a plant model with a motor-inverter which could be used across various systems by configuring/changing the specifications.
— Tune PI gains easily using techniques such as automated tuning and linear control design techniques like Bode plot
— Implement Park and Clarke transform using Simulink blocks that just need to be configured based on specific parameters
— Design signal conditioning and processing algorithms with much ease
— Test the motor operation using the FOC algorithm in a closed-loop simulation before the hardware is ready
— Generate automated C code for prototyping, HIL Testing, etc. from the control model.
Steps involved in creating physical model
When creating a physical model, energy flow is the most important aspect to understand. Each element in a physical model is connected via ports that allow energy transfer. In the case of a Park Transform block (shown in the diagram below), there are 6 ports, 4 for inputs and 2 for outputs.

Step 1: The first step is to create a new model using ssc_new.Creates model with default settings which needs to be updated further before code generation. Commonly used blocks are made available on the canvas.
Step 2: Assembling the physical system is the next step. It begins by adding the required blocks from the library and adding to the model. The lines that connect the blocks represent the actual physical connection.
Step 3: The blocks in the SIMSCAPE libraries have default values for variables and parameters. These values based on the data sheet of the motors, inverters, etc. can easily be adjusted.
Step 4: The sensors at play in the physical system are added to the model. For a BLDC motor control scheme, a hall-effect sensor might be added for sensing the rotor position and feeding it to the PI controller. Input and output loads as well as sensor blocks are provided by the tool and can be added to the model in either series or parallel connection, depending on the quantity to be measured.
Step 5: When both control model and plant model are ready, the developed control is simulated. The solver configured in the first step will evaluate the model and run the simulation.
The bottom line
An efficient motor control system utilises the FOC algorithm in some form or the other. And getting this algorithm right is a tough nut to crack. When engineers approach FOC using model-based design paradigm, things become easier. Close to 6 months’ worth of development and testing effort can be reduced by using MBD for FOC development. And on top of that, the motor control system can be tested even before the hardware is ready!
What one gets at the final stage is a fool-proof motor control system to drive one’s electric vehicle programme or build the best powertrain in the industry.
The author is Swathi Ramaswamy, Embitel Technologies, part of the Volkswagen group of companies.
The Economic Times News App for Quarterly Results, Latest News in ITR, Business, Share Market, Live Sensex News & More.