Skip to main content
emobility.academy
B.Tech / BEMotor drivesIntermediate About 5 weeksMATLAB & Simulink

Generating Motor and Drive Efficiency Maps for EV Range Simulation

Build a MATLAB script that computes motor and inverter losses over a torque–speed grid and produces efficiency maps, torque envelopes and lookup tables. Plug the maps into a Simulink vehicle model and show how drive efficiency changes the energy used on IDC and WLTP cycles.

Tools: MATLAB · Simulink

Generating Motor and Drive Efficiency Maps for EV Range Simulation: Students handling a two-wheeler BLDC hub motor at DIYguru
Representative photo from DIYguru's EV lab, not of this specific project.

The problem

Range simulations need the motor and inverter efficiency at every operating point, yet many student vehicle models use a single fixed efficiency. That hides the fact that urban driving spends a lot of time at low torque where efficiency drops. Building maps from physical loss components shows where losses come from and makes vehicle range estimates more credible.

Objectives

  • Model copper, iron, mechanical and inverter losses as functions of torque and speed.
  • Compute the torque–speed envelope from current and voltage limits.
  • Generate motor, inverter and combined efficiency maps.
  • Export maps as lookup tables and use them in a Simulink vehicle model.
  • Compare drive-cycle energy with map-based and fixed-efficiency models.

What you need

Tools and toolboxes

  • MATLAB — Loss model, grid evaluation, envelope calculation and contour plots.
  • Simulink — Vehicle model using 2-D Lookup Table blocks for drive efficiency.
  • Powertrain Blockset — Optional: Mapped Motor block takes the generated maps directly. A plain 2-D Lookup Table works without it.

Software

  • MATLAB R2023b or later
  • Simulink
  • IDC, MIDC and WLTP speed–time data as CSV

Extra parts and data

None beyond the software above.

Key concepts

Copper loss
3·Rs·I²rms in the windings, which dominates at high torque because current scales with torque.
Iron loss
Hysteresis and eddy-current loss in the laminations, which grows with electrical frequency and flux, so it dominates at high speed and light load.
Inverter loss
Conduction loss grows with current; switching loss grows with current, DC-link voltage and switching frequency.
Motoring and generating quadrants
In motoring, electrical input exceeds mechanical output; when regenerating, mechanical input exceeds electrical output, so efficiency is defined the other way round.

Step-by-step guide

  1. 1

    Define the example drive

    Choose a labelled example: a surface PMSM with 4 pole pairs, Rs = 0.05 ohm, ψm = 0.012 Wb, peak current 150 A on a 48 V DC link, maximum speed 6000 rpm. Set loss coefficients: iron loss as kh·f·B² + ke·f²·B² simplified to a speed-dependent term, mechanical loss as a friction-plus-windage polynomial, and inverter MOSFET Rds(on) and switching energy from an example datasheet.

    Checkpoint: A parameter script with every coefficient labelled with its unit and source.

  2. 2

    Compute the torque envelope

    For each speed on a grid, find the maximum torque limited by peak current below base speed and by available voltage above it. For a surface PMSM, use id = 0 below base speed; above it, compute the id needed to keep the voltage vector within Vdc/√3 and the remaining iq within the current limit. Plot maximum torque and power against speed.

    Checkpoint: The envelope shows a constant-torque region then a falling-torque region, with base speed matching a hand calculation.

  3. 3

    Evaluate losses on the grid

    Create a meshgrid of torque (positive and negative) and speed inside the envelope. At each point compute currents, then copper, iron, mechanical and inverter losses. Vectorise the calculation instead of looping so the whole grid evaluates in under a second. Mask points outside the envelope with NaN. Store the results in a structure with the torque and speed axes so later scripts and Simulink lookup tables read the same data without reshaping.

    Checkpoint: Loss arrays have no negative values, and each loss component peaks where theory says it should.

  4. 4

    Plot efficiency maps

    Compute motor efficiency, inverter efficiency and combined efficiency for motoring and generating. Use contourf with labelled contour lines (for example 70, 80, 85, 90, 93 per cent) and overlay the torque envelope. Plot each loss component separately to show which dominates in which region. Mark the rated point and the base speed on each map, and keep colour scales identical between maps so that readers can compare them directly.

    Checkpoint: Peak efficiency sits at medium speed and medium torque, with low efficiency at low torque and high speed.

  5. 5

    Check against a simulation point

    Pick three operating points and check them against a Simscape Electrical PMSM drive model or a hand calculation of the same equations. Verify that electrical input power equals mechanical output plus total losses. This energy-balance check catches sign and unit mistakes in the generating quadrant. If you have no Simscape licence, recompute the same points by hand from the equations; the aim is an independent check, not a second model.

    Checkpoint: Energy balance closes within 0.5 per cent at every checked point in both quadrants.

  6. 6

    Build the vehicle model

    In Simulink, build a backward-facing longitudinal model: speed from the drive cycle, road-load force F = m·g·Crr·cosθ + ½·ρ·Cd·A·v² + m·g·sinθ + m·a, wheel torque and speed through a fixed gear ratio to motor torque and speed. Look up efficiency with a 2-D Lookup Table, and compute battery power with the correct direction for motoring and regeneration. Use example scooter values, labelled as such.

    Checkpoint: Over IDC the model reports energy in Wh/km within a sensible range for a light scooter.

  7. 7

    Compare map-based and fixed efficiency

    Run IDC, MIDC and WLTP Class 1 or 3 (whichever suits the vehicle) with the map and with a fixed 85 per cent efficiency. Script the runs with sim() and collect energy per kilometre. Plot a histogram of operating points over the map to explain the difference, since urban cycles cluster at low torque. Keep vehicle parameters identical across runs so that only the efficiency model changes.

    Checkpoint: A table of Wh/km for each cycle and both models, with the percentage difference explained by the operating-point histogram.

  8. 8

    Report and export

    Export the maps as MAT and CSV files with axis vectors so other projects can reuse them. Write up the loss model, envelope, maps, energy-balance check and drive-cycle comparison. State what the model ignores, for example temperature-dependent resistance, magnet temperature and PWM harmonic losses. Include a short table of loss coefficients and their sources so a reader can judge how far the maps can be trusted for other motors.

    Checkpoint: Exported tables load into a fresh Simulink model and reproduce the same drive-cycle energy.

Testing & validation

  • Torque envelope base speed matches a hand calculation.
  • Energy balance closes at sampled points in both quadrants.
  • Efficiency map shape is physically consistent.
  • Drive-cycle energy computed with map-based and fixed efficiency.
  • Exported tables reproduce results in a new model.

Expected results

Motor, inverter and combined efficiency maps with a torque envelope, exported as lookup tables, plus a quantified comparison showing how much a fixed-efficiency assumption misestimates drive-cycle energy.

Take it further

  • Add temperature-dependent winding resistance and compare hot and cold maps.
  • Generate maps for an interior PMSM with MTPA control.
  • Optimise gear ratio to minimise energy on IDC using the maps.
  • Compare two motor designs on the same vehicle and cycle.

Viva and review questions

Why is efficiency low at low torque and high speed?

Output power is small while iron and mechanical losses, which depend mainly on speed, stay large, so they form a big share of the input.

How did you handle regeneration?

In the generating quadrant efficiency is electrical output divided by mechanical input, so battery power is mechanical power times efficiency rather than divided by it.

Why does the fixed-efficiency model differ more on urban cycles?

Urban cycles spend much of their time at low torque, where real efficiency is well below a single average value.

Learn it at DIYguru

These DIYguru courses and programmes teach what this project needs.

Related EV projects

All 100 MATLAB & Simulink EV projects