White Paper

AI for Electrified Vehicle Development with MATLAB and Simulink

Surrogate Modeling, Virtual Sensors, Reinforcement Learning, and Embedded Deployment

Introduction

Engineers developing electrified vehicles (EVs), including hybrid electric vehicles (HEVs), plug-in hybrid electric vehicles (PHEVs), and battery electric vehicles (BEVs), use AI to build models that estimate quantities that sensors cannot measure directly, optimize control strategies, and simulate faster. These techniques integrate directly into Model-Based Design workflows, augmenting the physics-based models, control algorithms, and verification processes that teams already use.

Teams can train these AI models directly in MATLAB® and Simulink®, or import models trained in open-source frameworks such as PyTorch, then run them through simulation and verification before deployment.

This shift is already underway in production vehicle programs. Hyundai, Cummins, Subaru, Schaeffler, Yanmar, Mercedes-Benz, and other automotive companies have incorporated AI into their EV development workflows. The case studies in this white paper, based on the work engineering teams at these companies are doing, show that AI-based automotive engineering is not a future possibility but is already being deployed. Organizations relying on traditional methods alone may struggle to keep pace with compressed vehicle development cycles.

Diagram showing an AI-integrated Model-Based Design workflow across five development stages with a continuous testing layer, highlighting three AI application areas: plant modeling, control design, and deployment/verification.

AI-based approaches for plant modeling, control design, deployment, and verification in the context of Model-Based Design.

AI fits into distinct stages of electrified vehicle development workflows:

  • Plant modeling: System identification creates dynamic models directly from measured data, while reduced-order modeling  (ROM) replaces computationally expensive component models, including slow cosimulations with third-party tools, with fast, accurate surrogates. Together, these approaches enable efficient simulation and real-time execution for controls development, optimization, trade studies, and hardware-in-the-loop (HIL) testing.
  • Control design: Virtual sensors estimate quantities the controller depends on from signals already available on the vehicle bus. Reinforcement learning, model predictive control, and other advanced control methods help optimize control strategies and calibration.
  • Deployment and verification: Deploying AI models to automotive ECUs and verifying their behavior in safety-critical systems requires a workflow that extends beyond training: compression, code generation, robustness testing, and run-time monitoring.

After a vehicle enters service, AI-based anomaly detection spots degradation in its battery and hardware before failures occur. Operational data becomes an early warning of faults and an estimate of remaining useful life.

The sections that follow show how AI techniques address these engineering challenges across the EV development workflow.

Five AI capability areas and the respective engineering challenge they help address: reduced-order modeling, virtual sensors, reinforcement learning for controls, anomaly detection and predictive maintenance, and embedded AI and AI verification.

Applications of AI to address engineering challenges across the EV development workflow.

Generative and agentic AI are also starting to impact engineering workflows, from generating artifacts quickly to executing tasks based on engineer-defined goals. This white paper does not cover these use cases. Instead, it focuses on the use of AI models that engineers build and verify inside Model-Based Design, then deploy to production hardware.

Get an overview of generative and agentic AI capabilities in MATLAB and Simulink.

Reduced-Order Modeling and System Identification

High-fidelity physics models built for component design, including those from third-party tools, are often cosimulated with Simulink because they provide the detailed component behavior needed to evaluate controls, architecture choices, and system-level interactions. These component models can be too computationally expensive for the rapid iterations needed in system-level simulation and control design optimization, and they may not be real-time capable for HIL testing or online estimation. These models serve their original design purpose well, but they do not scale to the broader engineering workflow.

AI-based plant modeling addresses this challenge through two related approaches: system identification and reduced-order modeling. System identification uses measured lab, dyno, or field data to build dynamic models when a physical component is available but no suitable simulation model exists; for example, an engineering team may receive a component from a supplier and need to create a model for system-level simulation or control design. Reduced-order modeling uses data from a high-fidelity model to train a faster surrogate that preserves the input-output behavior needed by the surrounding system.

MATLAB and Simulink support both workflows. Engineers can use system identification techniques, including nonlinear ARX and neural state-space models, to create AI-based dynamic models from measured data. They can also use Design of Experiments (DOE) studies on high-fidelity models to generate training data for reduced-order models, including lookup tables and AI-based surrogates built with deep learning or machine learning techniques.

Branching diagram categorizing modeling approaches into four types: AI-based data-driven, physics-based (Simulink/Simscape), linearization (LPV), and model-based (FEA state space).

AI-based and non-AI-based approaches to creating ROMs in MATLAB and Simulink.

Hyundai America Technical Center: Neural State-Space Surrogate for EV Thermal Management

Hyundai America Technical Center (HATCI) needed a simulation environment for thermal control development on the Ioniq 5 AWD that could run faster than real time with a fixed-time-step solver. The existing GT-SUITE reference model was too slow for iterative control design and could not be deployed to other simulation environments.

The team reconstructed the full vehicle in MATLAB and Simulink: a map-based powertrain model in Simulink and a complete thermal system in Simscape® covering the power electronics and battery coolant loops along with the refrigerant loop. They validated the model against standard dynamometer cycles and on-road data from an instrumented Ioniq 5, confirming energy consumption within 1.3% of measured values.

The compressor switching transients and expansion valve dynamics in the refrigeration loop created stiff numerical behavior that caused the simulation to fail when using a fixed-time-step solver. To resolve this, the team replaced the entire refrigerant loop with a neural state-space model trained in the Reduced Order Modeler app. The ROM takes system temperatures, valve positions, and pump speeds as inputs and predicts refrigerant temperature at the water condenser—the interaction point between the refrigerant loop and the rest of the cooling system. Training data came from 35 on-road drive sessions across ambient temperatures of -20 to 35 degrees Celsius, and training completed in less than one hour.

Simscape model of a vehicle thermal management system showing battery and PE coolant loops, with a highlighted DD-ROM and water condenser subsystem.

Thermal model architecture showing the power electronics and battery coolant loops retained in Simscape, with the refrigerant loop replaced by the data-driven ROM outputting water condenser temperature. (Image credit: Hyundai America Technical Center, Inc.)

With the ROM in place, the Ioniq 5 model runs up to five times faster than real time using a fixed 0.1-second time-step solver. Validation against test data in both A/C mode (30 degrees Celsius) and heater mode (-5 degrees Celsius) confirmed accuracy across the full operating range. 

Eight validation plots comparing test versus simulation results for thermal parameters in a vehicle thermal system, including motor, inverter, oil pan, battery, and refrigerant temperatures.

Simulated versus measured temperatures for key thermal components—motors, battery, oil loops, power electronics coolant, and refrigerant—in A/C mode at 30 degrees Celsius ambient temperature. (Image credit: Hyundai America Technical Center, Inc.)

Cummins: Neural Network Surrogates for Engine Performance Prediction

Cummins needed to predict 26 engine response parameters such as flow, temperature, pressure, torques, and NOx emissions during engine cycle simulation. Existing 3D-to-1D simulations with third-party tools ran at more than 20 times real time, too slow for iterative development and calibration.

The Cummins India team evaluated two approaches using Deep Learning Toolbox™. A standard feedforward neural network (six hidden layers, five neurons per layer) ran 1,500 times faster than real time but produced unacceptable accuracy on temperature predictions, with R-squared values as low as 0.85. A long short-term memory (LSTM) enhanced architecture with dropout layers achieved R-squared values above 0.95 for all 26 responses while still running 800 times faster than real time.

Bar chart showing R² values near or above 0.95 for six engine output variables, indicating high accuracy of a surrogate model for exhaust flow, turbo speed, temperatures, pressure, torque, and NOx.

Bar chart comparing R-squared values across six engine response parameters (exhaust flow, turbo speed, exhaust temperature, peak cylinder pressure, brake torque, and engine-out NOx) for the LSTM model, all exceeding 0.95. (Image credit: Cummins)

The trained models support applications across the engine development workflow: real driving emission modeling, combustion knock detection, combustion mode transition in multimode engines, and engine calibration. Cummins used Statistics and Machine Learning Toolbox™ alongside Deep Learning Toolbox, with Parallel Computing Toolbox™ and MATLAB Parallel Server™ accelerating the training process.

Subaru: Neural ODE Surrogates for Transmission Analysis

Subaru used Deep Learning Toolbox to build a neural ordinary differential equation (ODE) surrogate model that reproduces hydraulic pressure waveforms for automatic transmission control analysis. The surrogate takes source pressure, oil temperature, and current as inputs and replaces a computationally intensive third-party 1D physical simulation.

The neural ODE model reduced calculation time by 99% while maintaining waveform accuracy—including in oil temperature ranges where the model was not trained, demonstrating generalization beyond the original training data.

Key Takeaways

  • Replace slow high-fidelity physics with fast surrogate models, built either with DOE-based lookup tables or with AI architectures such as LSTM and neural state-space; when no component model exists, identify a dynamic model directly from measured data.
  • Integrate these surrogates into Simscape and Simulink for system-level simulation and real-time HIL testing, and share them across teams without exposing the intellectual property in the original model.

Virtual Sensors: Estimate Difficult-to-Measure Quantities

Physical sensors cannot always be placed where measurements are needed most. E-motor winding hotspots sit deep inside laminated stacks. Individual cell temperatures in a large battery pack are impractical to instrument at every location. Exhaust gas composition varies along the aftertreatment system. AI-based virtual sensors use trained models to estimate these quantities from signals already available on the vehicle bus—motor speed, torque commands, coolant temperatures, ambient conditions—augmenting physical instrumentation with computed measurements that add observability and redundancy without adding hardware.

The design space for AI-based virtual sensors ranges from lightweight machine learning models such as decision trees and support vector machines to deep learning architectures such as LSTMs and fully connected networks, as well as physics-informed neural networks (PINNs) that incorporate domain knowledge. Virtual sensors can also be built with established observer-based methods such as Kalman filters, sliding mode observers, and extended state observers. In practice, AI-based virtual sensors should be evaluated against these conventional approaches, because the best choice may vary across the operating envelope. Hybrid designs are also possible: for example, an AI model such as a neural state-space model can serve as the prediction model inside an extended or unscented Kalman filter.

Physics-informed models constrain the AI to behave consistently with known governing equations, improving robustness and interpretability but requiring upfront effort to define the physics involved. Pure data-driven models need less domain-specific setup but offer less insight into why a prediction is made and less robustness to valid operating conditions outside the training data.

Schaeffler: Physics-Informed Temperature Estimation for E-Motors

Schaeffler developed a virtual sensor for an e-motor prototype with a novel direct winding cooling scheme, where accurate temperature knowledge at multiple internal locations is critical to prevent permanent magnet demagnetization. Rather than instrument every thermal hotspot with a physical sensor, the team built a thermal neural network (TNN), which is a physics-informed AI approach based on lumped parameter thermal networks.

The TNN embeds a core engineering principle: temperature at any node changes due to local power loss (heat generated) and heat flows proportional to the temperature difference between nodes. Neural networks estimate the power losses and thermal conductance at each time step. These estimates feed into the physics-based update equation that advances the temperature state. The result is a hybrid model: neural networks handle the nonlinear parameter estimation while the update equation enforces thermodynamically consistent behavior.

Composite image showing a DISC-O electric motor with labeled sensor measurement points, a lumped-parameter thermal node equation, and a color-coded thermal network map of the motor cross-section.

Schaeffler DISC-O e-motor with example measuring points where PT100 temperature sensors were built into the prototype to gather training data (left), and an example update equation that uses estimated power losses, P, and conductance, C, via neural nets that feed into the physics-based temperature state update (right). (Image credit: Schaeffler)

Schaeffler trained the TNN on 300 hours of drive cycle data recorded from 12 temperature sensors on the prototype, using Deep Learning Toolbox with a custom network definition. Training completed in approximately one and a half hours. The trained model predicts temperatures across all 12 sensor locations with accuracy well within the +/-5 degrees Celsius requirement. The TNN outperformed pure LSTM and multilayer perceptron approaches on the same data.

Beyond accuracy, the TNN offers three practical advantages for production deployment:

  • Explainability: Engineers can inspect the learned power losses and conductance over time, verifying that heat flow patterns and generation sources match physical intuition.
  • Robust initialization: Even when initialized 20 degrees Celsius off from the true temperature, the model recovers within approximately 300 seconds, which is critical for vehicle startup where initial conditions are unknown.
  • Variable inference rate: A model trained at one-second sampling performs accurately at 5-second or 10-second intervals, accommodating different ECU scheduling constraints without retraining.
Machine learning temperature prediction validation plots showing multiple model predictions versus true values over time, plus residual error plots comparing two model variants.

Temperature esults showing robustness of the TNN to both initialization errors (left) and varying sample times (right). (Image credit: Schaeffler)

Renault: Deep Learning for Emissions Estimation

Renault developed an LSTM-based virtual sensor to estimate engine-out NOx emissions across operating conditions including WLTC, NEDC, and RDE drive cycles. Existing lookup-table approaches achieved only 60–70% accuracy. A physics-based combustion model could improve accuracy but was too complex for real-time ECU execution.

The final architecture—one LSTM layer, three ReLU layers, three fully connected layers, and a regression output—takes engine torque, speed, coolant temperature, and gear number as inputs. The team iteratively balanced network depth against ECU memory constraints using Deep Learning Toolbox, arriving at a design that predicts NOx with 85–90% accuracy.

Renault generated C code from the trained network as a proof-of-concept for ECU deployment using MATLAB Coder™ and Simulink Coder™.

Key Takeaways

  • Estimate quantities you can’t measure directly from signals already on the vehicle bus, choosing physics-informed networks where the physics is well understood or data-driven architectures where it isn’t, and weighing both against observer-based methods like Kalman filters and hybrid approaches.
  • Validate the virtual sensor against physical measurements across the full operating envelope before deploying it.

Reinforcement Learning and Advanced Control

Model predictive control (MPC) and other advanced control methods can support EV control problems where constraints and operating conditions vary widely and constraints matter. MPC is well suited to multi-input, multi-output (MIMO) control with constraints, including battery thermal management, heat-pump and coolant-loop coordination, regenerative braking and torque blending, and supervisory energy management. In AI-enabled workflows, a learned prediction model can be used inside an MPC controller. Other learning-based and adaptive methods can be implemented in MATLAB and Simulink and are well suited to support specific EV development workflows.

Benefits and Use Cases of Advanced Control Methods for EV Development Workflows

  Virtual Reference Feedback Tuning (VRFT) Model Reference Adaptive Control (MIRAC) Active Disturbance Rejection Control (ADRC) Iterative Learning Control (ILC)
Definition Direct tuning of fixed PI or PID controllers from input-output data Online adaptation to match a desired response as plant behavior changes Control estimates and ability to compensate for unknown load changes Learning from repeated runs to improve tracking performance
Benefit Recalibrate quickly from measured data rather than rebuild a plant model Maintain control performance across changing operating conditions Improve robustness when disturbances are difficult to predict Improve control accuracy across repeated tests or operating profiles
Use cases
  • Traction motor speed loops
  • DC-DC voltage loops
  • E-pump or e-compressor thermal actuators
  • Traction torque tracking
  • Engine-start control in HEVs
  • Converter regulation with changing SOC, temperature, etc.
  • E-drive speed control
  • Boost or bidirectional converter loops
  • Launch or grade-event refinement
  • Battery preconditioning sequences
  • Repeated drive-cycle or dyno optimization

The remainder of this section focuses on reinforcement learning (RL). RL is especially useful when control problems involve so many coupled parameters that engineers cannot derive an optimal strategy manually. Energy management in hybrid and battery electric powertrains must balance battery state of charge, energy consumption, and drivability across unpredictable driving profiles. Emissions aftertreatment calibration requires tuning 20 or more interdependent dosing maps to simultaneously minimize NOx, ammonia slip, and reagent cost. These are multi-objective optimization problems where the interactions between parameters make it difficult to derive effective control strategies or optimal calibrations through manual methods.

RL trains a control agent by letting it interact with a simulation environment, receive rewards for desired behavior, and iteratively improve its policy. When that environment is a Simulink plant model, engineers can train RL agents against validated system dynamics without hardware risk, then evaluate the learned policy in desktop simulation and software-in-the-loop testing before deploying to a target controller. Reinforcement Learning Toolbox™ provides value-based algorithms such as deep Q-network (DQN), policy-based methods such as proximal policy optimization (PPO), and actor-critic algorithms such as deep deterministic policy gradient (DDPG) and soft actor-critic (SAC), with direct integration into Simulink for training against plant models.

Because RL agents train against a model of the plant rather than the physical system, the trained policy must be robust to differences between simulated and real-world dynamics. Techniques such as domain randomization, which varies plant parameters across training episodes, help produce policies that generalize across modeling uncertainty and real-world variability. Once validated, trained policies can be deployed as generated C/C++ code on embedded targets using Embedded Coder®.

Yanmar America: Deep RL for Emissions Calibration

Yanmar America needed to meet CARB Tier 5 emissions standards, which require a 90% reduction in NOx from previous levels. The Selective Catalytic Reduction (SCR) aftertreatment system’s calibration involves more than 20 interdependent maps, with each influencing NOx conversion efficiency, ammonia slip, and reagent consumption. Manual calibration of this system required over 240 engineering hours with no systematic method to determine whether the result was optimal.

Working with MathWorks Consulting Services, Yanmar trained a deep Q-network agent against a Simulink model coupled with third-party catalyst simulation software. The agent learned to optimize urea dosing profiles across the operating envelope by maximizing a reward function that penalized NOx emissions and ammonia slip while minimizing reagent usage. Each training run completed in approximately 30 minutes.

Frequency-domain plot comparing system default (yellow) versus AI-optimized (blue) performance, showing the AI solution achieves a significantly reduced peak in a specific frequency band.

Simulink scope screenshot depicting the amount of NOx emission while simulating with Yanmar’s system default value (yellow line) vs. the deep RL model developed in this project (blue line). (Image credit: Yanmar America)

The RL agent achieved a 60% reduction in NOx from the baseline calibration. It also found dosing strategies that the engineering team had not identified through manual methods. Total calibration time was halved, total project hours were reduced by 30%, and costs were 41% lower than with the manual calibration process. The project was completed in six months.

Schaeffler: Deep RL for Powertrain Control

Vitesco Technologies (now part of Schaeffler) applied reinforcement learning to develop a control strategy for an exhaust gas aftertreatment system. After creating a detailed Simulink model of the plant consisting of the engine and exhaust gas system, the team used Reinforcement Learning Toolbox to prototype and optimize RL agents that make real-time control decisions based on current system state.

Key Takeaways

  • Reach for advanced control methods when the control problem is dominated by constraints, repeated scenarios, or shifting operating conditions and for reinforcement learning when coupled parameters make an optimal strategy impractical to derive analytically, as in emissions calibration or energy management.
  • Train RL agents against a validated Simulink plant model, then evaluate the learned policy in desktop and software-in-the-loop simulation before committing it to hardware.

Anomaly Detection and Predictive Maintenance

Electric vehicles generate large volumes of operational data from batteries, motors, inverters, and thermal systems. Each of these subsystems degrades over time: battery cells lose capacity or develop conditions that lead to battery aging or thermal runaway, motor bearings wear, and power electronics experience thermal fatigue. The degradation patterns are often detectable in sensor data well before a component fails. AI-based anomaly detection identifies deviations from expected behavior that no single sensor would flag in isolation, often as multivariate patterns across correlated signals such as cell voltage and current alongside temperature. Remaining useful life (RUL) estimation predicts when maintenance will be needed, enabling condition-based maintenance scheduling rather than fixed-interval service.

These capabilities can be deployed at different points in the data pipeline. Edge-based models run directly on vehicle onboard computers, processing sensor data locally for real-time fault detection. Cloud-based models aggregate fleet data for deeper analysis, trend detection, and model retraining. Some systems combine both: edge models flag anomalies and extract features onboard, then transmit compressed feature data to the cloud for fleet-level analysis and RUL estimation. Cloud-hosted models can also adapt incrementally as the fleet ages, updating the definition of “normal” as systems degrade gradually over their service life.

Most anomaly detection models are trained only on normal operating data, meaning they learn what healthy behavior looks like and flag deviations without requiring labeled examples of every possible fault mode. This unsupervised approach sidesteps a persistent difficulty: vehicles are designed not to fail, so real-world fault data sets are small and imbalanced. When labeled failure data is needed for RUL estimation or fault classification, digital twins built in Simscape can simulate degradation scenarios and fault conditions, generating synthetic training data that augments the limited real-world observations.

Tata Consultancy Services: Distributed Predictive Maintenance for Software-Defined Vehicles

Tata Consultancy Services (TCS) developed a distributed machine learning architecture for vehicle predictive maintenance, deploying AI models across both onboard edge computers and cloud infrastructure on Microsoft Azure. The system processes data from multiple powertrain subsystems—detecting anomalies, classifying fault types, and extracting diagnostic features from sensor time-series data.

The TCS team used the Diagnostic Feature Designer app in Predictive Maintenance Toolbox™ to extract and rank features from raw sensor signals, then trained classification and regression models using Statistics and Machine Learning Toolbox. Edge-deployed models perform initial anomaly detection on the vehicle, reducing the volume of data transmitted to the cloud. Cloud-hosted models handle fleet-level aggregation and more computationally intensive analysis.

System architecture for predictive maintenance showing a pipeline from vehicle asset data through edge processing, MATLAB Production Server, and Docker containers to OT/IT dashboards for remaining useful life estimation.

Diagram showing TCS’s model and algorithm creation workflow from archived data using MATLAB and Simulink to the deployment of these algorithms to both edge systems and cloud-hosted models using Docker. (Image credit: Tata Consultancy Services)

This architecture reduces cloud computing costs by processing data locally where possible, while retaining the ability to perform fleet-wide pattern recognition in the cloud. TCS deployed the cloud components using MATLAB Production Server™ on Azure, with web interfaces built using MATLAB Web App Server™.

HL Mando: Predictive Maintenance for Autonomous Vehicle Components

HL Mando developed a “Smart Lab” system that combines connected test benches and IoT monitoring with AI-driven predictive maintenance for autonomous vehicle component testing equipment such as X-by-wire steering and braking systems. Collecting life and degradation data from real vehicles would take years, so the team implemented accelerated life testing on custom in-house test benches, loading and unloading components on controlled duty cycles correlated to real-world mileage.

Simscape digital twins of the test bench components supported the development of control algorithms and provided a parallel virtual data path for simulation and tuning alongside real test data. Edge computers extract features from live bench data and train AI models, while a web-based platform built with MATLAB Production Server displays real-time condition monitoring and RUL estimates. The team applied AI-based analysis for similarity and degradation models and physics-of-failure methods (Miner’s rule) for survival models where engineering knowledge of fatigue mechanisms was available.

Five-stage ML pipeline for tie rod RUL estimation, including data acquisition, preprocessing, feature extraction, model training, and RUL deployment with predicted degradation output plots.

HL Mando’s workflow for developing AI-driven RUL estimation using Predictive Maintenance Toolbox. (Image credit: HL Mando)

Key Takeaways

  • Run anomaly detection at the edge for real-time fault detection and in the cloud for fleet-level analysis and remaining-useful-life estimation, using the Diagnostic Feature Designer app to pull features from raw sensor data automatically.
  • Train RL agents against a validated Simulink plant model, then evaluate the learned policy in desktop and software-in-the-loop simulation before committing it to hardware.

Embedded AI: Verify and Deploy AI to Production ECUs

Training a neural network that performs well on a workstation does not guarantee it will run on automotive embedded hardware or that it will behave correctly under all operating conditions. The path from trained network to embedded deployment requires compression, verification, and code generation—with verification applied iteratively at each stage.

The embedded deployment workflow begins with AI model compression using techniques such as quantization, projection, and pruning, reducing the memory footprint, and increasing inference performance. Next comes simulating the compressed AI algorithm within a Simulink system model and testing integration with surrounding components before any hardware commitment.

Code generation then produces optimized C/C++ for the target hardware. Throughout this process, verification confirms that compression and quantization have not degraded model behavior beyond acceptable limits. Deep Learning Toolbox, Fixed-Point Designer™, and Embedded Coder support this workflow within MATLAB and Simulink.

Many automotive teams also start with models trained in open-source frameworks such as PyTorch. These models can be imported into MATLAB and Deep Learning Toolbox for compression, Simulink integration, verification, and deployment. For larger models or models with nonstandard layers that are not practical to import, code generation workflows can provide another path from PyTorch-trained models to deployable C/C++ code.

AI Verification

As AI models move into safety-critical automotive systems such as battery management and motor control, verification must extend beyond accuracy on test data. A neural network is not guaranteed to behave correctly under adversarial inputs, out-of-distribution operating conditions, or edge cases not represented in the training set. Automotive standards such as ISO/PAS 8800 help engineers construct safety assurance claims that address these risks.

The W-shaped development process adapts the traditional V-model for AI components by adding verification activities specific to machine learning. Activities like robustness testing against input perturbations, out-of-distribution detection, verification of network properties, and explainability analysis can verify that model behavior aligns with engineering intent. This process applies at each stage of the AI lifecycle—from initial model training through model compression, code generation, and deployment.

AI Verification Library for Deep Learning Toolbox supports this workflow with capabilities for:

  • Robustness verification: Test AI model sensitivity to input perturbations and adversarial examples. Estimate output bounds to confirm that small input changes do not produce large, unexpected prediction errors.
  • Run-time monitoring: Create distribution discriminators that detect when deployed models encounter inputs outside their training distribution, enabling the system to flag uncertain predictions or fall back to conventional algorithms.
  • Explainability: Visualize which inputs drive model predictions using techniques such as Grad-CAM and D-RISE.
  • Constrained deep learning: Integrate domain-specific constraints into network training to enforce physical or safety boundaries by construction, rather than relying solely on post-training verification.

Mercedes-Benz Research & Development India: Neural Network Compression and Quantization for Cabin Comfort

Mercedes-Benz Research & Development India (MBRDI) developed an onboard virtual sensor to estimate cabin air mass flow in real time for thermal comfort, humidity regulation, and air quality control. An earlier cloud-based approach introduced latency, bandwidth costs, and privacy concerns. The team needed the AI model to run directly on the vehicle’s ECU.

The original trained network was too large for the target hardware. MBRDI applied neural network projection—a compression technique that identifies and removes redundant neurons while preserving the network’s predictive accuracy. After compression, the team applied 8-bit quantization using Fixed-Point Designer, converting the remaining weights and activations from 32-bit floating-point to 8-bit integers. Embedded Coder then generated C/C++ code from the compressed, quantized model for deployment to the ECU.

Embedded AI development workflow using MATLAB tools across four phases (data collection and NN training, optimization and quantization, code generation, and ECU performance validation) contrasted with a conventional MBD workflow.

Mercedes-Benz embedded AI workflow showing the progression from trained neural network through neural network projection (compression), 8-bit quantization (Fixed-Point Designer), C/C++ code generation (Embedded Coder), and deployment to ECU. (Image credit: Mercedes-Benz Research & Development India)

The results: the virtual sensor reduced mean absolute error by 50% compared with the previous physics-based model, while increasing RAM usage by only 1% on the target ECU. The model runs entirely onboard with no cloud connectivity required.

Mercedes-Benz: Automated Fixed-Point Conversion for Powertrain Virtual Sensors

Mercedes-Benz deployed a deep neural network to estimate in-cylinder pressure directly on a production powertrain ECU, a microcontroller that does not support floating-point operations or standard deep learning frameworks. The team trained a quantized LSTM using the QKeras library in Python, then imported the network into MATLAB using Deep Learning Toolbox. Fixed-Point Designer converted the model from floating-point to fixed-point representation, and the team verified accuracy in Simulink before handing off for ECU integration.

The automated workflow improved development speed by 600% compared with the previous manual fixed-point conversion process, which required weeks of effort and was prone to transcription errors. The pipeline has been adapted to two different powertrain controllers and extended to additional neural network architectures including GRUs and fully connected networks.

Key Takeaways

  • Prepare trained AI models for embedded deployment by importing networks from MATLAB or external frameworks (Python, QKeras, TensorFlow™), compressing them with projection or pruning, and quantizing them to 8-bit or fixed-point representations to reduce memory use and execution time.
  • Validate models by comparing compressed and quantized models against the original in Simulink, assessing behavior under adversarial and out-of-distribution conditions, and applying run-time monitoring, before generating production C/C++ code using Embedded Coder.

Conclusion

The techniques described in this paper—reduced-order models, system identification, virtual sensors, reinforcement learning, and anomaly detection—integrate into Model-Based Design from plant modeling through control design and deployment. Engineers can train AI models directly in MATLAB and Simulink or import networks trained in TensorFlow, PyTorch, and other open-source frameworks. Regardless of where a model originates, MATLAB and Simulink provide a unified workflow for model compression, verification, and code generation to production ECUs.

The case studies in this paper demonstrate that AI for electrified vehicle development is shipping in production programs today. Teams have achieved 800x simulation speedups, 600% faster deployment workflows, and control strategies that outperform manual calibration. These results are accessible within existing workflows for engineers using Model-Based Design, with a clear path from trained model to verified, deployed code.