Motor control

How Model-Based Design Helps FOC Algorithm Execution in Electric Vehicles, Auto News, ET Auto

Although FOC is not specific to EV motor control, its implementation in the automotive field requires special skills and expertise.

By Swathi Ramaswamy

An average electric vehicle (EV) user has no idea of ​​the Field Oriented Control (FOC) algorithm that operates quietly under the hood. But connoisseurs swear by its ability to drive electric motors with maximum efficiency and precision. Although FOC is not specific to EV motor control, its implementation in the automotive field requires special skills and expertise. It involves a range of complex calculations that sometimes get quite tricky. Whether it’s the Park and Clarke transform or spatial vector modulation, implementing the FOC algorithm is a coder’s nightmare.

Example: The Clarke transformation transforms a three-phase system into a two-phase system with orthogonal axes in the same stationary frame of reference. The new two-phase variables are denoted α and β.

Opinion: How Model-Based Design Helps FOC Algorithm Execution in Electric Vehicles
Opinion: How Model-Based Design Helps FOC Algorithm Execution in Electric VehiclesSuch calculations with manual coding are time-consuming, a luxury in the automotive field due to the pressure to go to market before the competition. Multiple OEMs are simultaneously working to refine these algorithms, and whoever deploys the feature first gets a bigger share of the revenue.

Thanks to the Model Based Design paradigm, the implementation of FOC becomes much easier because the code is generated by creating models. Complicated calculations like the one above are performed by a set of block libraries and simulation techniques that model physical motor control systems in a simulation environment.

Developing a FOC for a motor control system has two aspects. One, where we mimic the control model which is basically the component of the FOC algorithm. Another is the factory model responsible for testing the algorithm in a simulated environment.

Pre-designed blocks

Developing the FOC algorithm using a model-based design approach involves 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 field is MATLAB/SIMULINK. Modeling a physical system in the Simulink environment is even easier with tools like SIMSCAPE.

It has a set of block libraries and simulation features that are very useful for modeling physical systems in the Simulink environment. These blocks represent basic mathematical operations to be performed by the software. For the development of FOC algorithms, the tool provides blocks for Park and Clarke transformation as well as spatial vector modulation.

Opinion: How Model-Based Design Helps FOC Algorithm Execution in Electric Vehicles

By connecting the required blocks, they get a schematic which is a mathematical model representing the physical system.

Opinion: How Model-Based Design Helps FOC Algorithm Execution in Electric Vehicles

By adopting the model-based design approach, engineers can create a network representation of the system being designed. The diagram shows that every system has various functional elements that interact with each other through ports. The connection between each element is analogous to the physical connection in the corresponding physical system. In a brushless direct current (BLDC) electric motor drive system, these connections could be between the position sensors and the inverter, PID controller, etc.

Modeling works on the principle that if the physical elements of a system can be connected, so can their models.

Pre-designed blocks for creating and tuning field-oriented control for BLDC motors make it easy for engineers. Blocks include Park and Clarke transforms, field weakening, a spatial vector generator, automatic PID tuning and a few others. In the modeling environment, these blocks can be configured according to the motor-drive required or the motor-drive control algorithm. Once the control model is developed by connecting the blocks, we can easily verify the control algorithms in a closed-loop simulation (factory model) where motors and inverters are also represented as models.

Once the control model is developed by connecting the blocks, we can easily verify the control algorithms in a closed-loop simulation (factory model) where motors and inverters are also represented as models.~

How does MBD help?

Using the MBD approach involves 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?

When engineers develop an FOC algorithm for a BLDC motor control, they:

  • Design algorithm for proportional integral (PI) controllers for feedback signals.
  • Overcome speed error by adjusting gains of PI controllers
  • Design a spatial vector modulator to control the PWM signal sent to the inverter
  • Develop a field weakening control algorithm to regenerate Iq_ref and Id_ref as input to PI controllers
  • Implement the Park, Inverse Park, and Clarke transformation

When model-based design with all its tools and technologies comes into play, most of these tasks become easier. From design and testing to tuning the control algorithm, all activities are performed in a simulation environment.

  • With MBD at the helm, engineers can:

  • Model current and speed regulators as well as space vector modulators and inverters

  • Create an installation model with a motor-inverter that can be used in various systems by configuring/changing the specifications.

  • Tune PI wins easily using techniques such as automated tuning and linear control design techniques like the Bode diagram

  • Implement the Park and Clarke transformation using Simulink blocks that simply need to be configured according to specific parameters

  • Easily design signal conditioning and processing algorithms

  • Test motor operation using the FOC algorithm in a closed-loop simulation before the hardware is ready

  • Generate automated C code for prototyping, HIL testing, and more. from the control model.

Steps involved in creating a physical model

When creating a physical model, the energy flow is the most important aspect to understand. Each element of a physical model is connected through ports that allow the transfer of energy. In the case of a Park Transform block (shown in the diagram below), there are 6 ports, 4 for inputs and 2 for outputs.

Opinion: How Model-Based Design Helps FOC Algorithm Execution in Electric Vehicles

Since SIMSCAPE is the most widely used modeling tool, the steps followed in the SIMSCAPE tool are discussed here.

Step 1: The first step is to create a new model using ssc_new. Creates a model with default settings that must be updated before code generation. Commonly used blocks are made available on the canvas.

Step 2: Assembling the physical system is the next step. It starts by adding the required blocks from the library and adding them to the model. The lines that connect the blocks represent the actual physical connection.

Step 3: SIMSCAPE library blocks have default values ​​for variables and parameters. These values ​​based on the datasheet of motors, inverters, etc. can be easily adjusted.

Step 4: The sensors in play in the physical system are added to the model. For a BLDC motor control scheme, a hall effect sensor can be added to detect the position of the rotor and feed it to the PI controller. Input and output loads and sensor blocks are provided by the tool and can be added to the model in series or in parallel, depending on the quantity to be measured.

Step 5: When the 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.

Nearly 6 months 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!~

The bottom line

An effective motor control system uses the FOC algorithm in one form or another. And obtaining this algorithm is a difficult problem to solve. When engineers approach FOC using the model-based design paradigm, things become easier. Nearly 6 months 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 you get in the final step is a foolproof motor control system to drive your electric vehicle program or build the best powertrain in the industry.

Note: The author is Swathi Ramaswamy, Embitel Technologies, part of the Volkswagen group of companies.

DISCLAIMER: The opinions expressed are those of the author alone and ETAuto.com does not necessarily endorse them. ETAuto.com will not be responsible for any damage caused to any person/organization directly or indirectly.)