Large automakers invest billions of dollars in the design and development of a new vehicle. At Tesla, we developed the 2008 Tesla Roadster, the world’s first 100-percent electric production sports car, on a budget of just $145 million. Because our budget is tiny in comparison to that of traditional car companies, we were compelled to optimize engineering resources and make smart design decisions.
To help meet these objectives, we used MathWorks tools for Model-Based Design to model the entire vehicle and its major subsystems, run detailed simulations, analyze performance, and evaluate design trade-offs.
Optimizing Power and Fuel Efficiency
In a standard internal combustion engine, more horsepower means more fuel consumption, and two-thirds of the energy generated in the engine is dissipated as heat. As a result, designers are forced to sacrifice power to gain fuel efficiency.
With the Roadster, we did not need to make this trade-off. More than 85 percent of the energy in the batteries is used to propel the vehicle, and when we make the vehicle more powerful, we are also making it more efficient. Our design goals focused on making a car that was fast, safe, and energy-efficient. The Roadster can accelerate from 0 to 60 mph in under four seconds, but it is also environmentally friendly: it has a range of 244 miles per charge on EPA combined cycle, and recharge electricity consumption of only 28 kWh per 100 miles of driving.
Developing System Models
Tesla engineers began using MATLAB® about three years ago for a variety of tasks, including analyzing test data and developing early dynamic thermal models of the battery. Over time, we developed MATLAB models for each major system in the car, including the transmission, motor, power electronics, brakes, tires, and control systems. We also developed models for aerodynamic factors and for battery dynamics, cooling, and power loss in cables.
We combined these models into a full-system model of the entire car, which we used to simulate the overall vehicle performance, including its potential speed and range, how much heat would be generated from individual components, and how much energy was lost to tires, wind resistance, and other factors. By comparing simulated results against the measured results from road tests of prototype vehicles, we validated the model and modified it to improve its accuracy.
Documenting and Refining Models in Simulink
As the number of MATLAB models grew, it became more difficult for a single engineer to fully understand how all the components interacted with each other. After we adopted Model-Based Design with Simulink®, we were able to develop a top-level Simulink model of the vehicle that invoked the individual MATLAB subsystem models that we had already validated. This hierarchy helped us to visualize the vehicle-level structure of our simulations and provided live documentation of the model contents (Figure 1).
We have since replaced the MATLAB subsystem models with equivalent Simulink models. At the same time, we refined the simulation architecture so that we could more easily separate design from development. The top-level Simulink model references each component as an independent Simulink model file, enabling us to apply version control to each component. Engineers can then work on different components in parallel. For example, one engineer can edit the model of the battery while another works on the transmission.
Simulating the Full Vehicle
Using Simulink, we have architected the vehicle model so that it is flexible at the component level, which enables us to support multiple component models at different levels of detail. Careful partitioning of the model across component-level boundaries enabled us to use less detailed component models to speed up simulations of the entire vehicle. For example, we have detailed Simulink models of the Roadster’s power electronics and motor. We run simulations to characterize the performance of these two components using time steps of just 50 microseconds.
We incorporate the results from the detailed simulation into a lookup table, which we can plug in as a higher-level model for longer vehicle-level simulations. An engineer designing an inverter can run a detailed dynamic simulation in the complete vehicle while another engineer uses a less detailed model of the inverter to predict the vehicle’s maximum range. This approach helps us acquire the information we need to make design decisions much faster.
We use our parametric vehicle model to simulate vehicles that are in production, vehicles about to go into production, and even future designs. We do this by capturing all the characteristics of the car in a standardized inputs template that we modify from simulation to simulation. This approach is particularly efficient for component sizing. For example, to simulate different transmission configurations, instead of substituting transmission blocks or changing the Simulink model we simply define the necessary parameters as input vectors. We then use a MATLAB script to invoke multiple simulations that sweep through the design options.
Recently, Tesla began an initiative to improve the Roadster’s total range per change. We had some ideas on how to improve the system but lacked real evidence that our ideas would work. Because we had a well-calibrated Simulink model of the vehicle and we trusted the simulation results it produced, we could quantify the effect of design changes with actual data.
Enhancing the Powertrain
During road tests on Roadster prototypes, we collected enough real data to refine and validate our models. Using the validated model of the original Roadster, we mapped out the entire design space for the Roadster 1.5 powertrain. We had a large matrix of different powertrain configurations that included various motor sizes, transmission configurations, battery chemistries, and inverter sizes. We used MATLAB scripts to sweep through hundreds of combinations in multiple rounds of simulation that became progressively more detailed.
This effort would have taken years and been prohibitively expensive without modeling and simulation. Each physical prototype takes six months or a year to produce. We could not afford to iterate through hundreds of gear ratios in hardware. The enhanced powertrain is now working as designed in prototype vehicles.
Spanning Multiple Disciplines
With Simulink we can tackle problems in domains that would typically require specialized—and more expensive—analysis tools. For example, many of our initial battery models were empirical, with an ideal voltage source and a fixed impedance. We now use much more sophisticated first-principles models, and as a result, have gained invaluable insights into the battery as an electrochemical device. We used Simulink to build advanced equivalent circuit models that can predict performance at different states of charge, discharge rates, temperatures, and levels of aging.
We used a similar approach to perform safety-critical simulations to predict cooling performance within the battery and ensure that the battery packs would not overheat. To capture all the multidomain physical, chemical, and heat-transfer effects would typically require a finite-element analysis tool and significant effort. With MathWorks tools we performed analyses and gained insights that lead to dramatic advances in battery technology. The Roadster has more than twice the energy storage density of any other production electric vehicle.
As we generate more and more road-test data, we are once again using MATLAB to process, visualize, and incorporate analysis results into ever more accurate models of the Roadster. We couldn’t have built this car without MathWorks tools. It would have taken resources that our new automotive startup company simply did not have. We will continue to rely on MATLAB and Simulink to help us make informed design decisions for the next generation of Tesla vehicles.