The problem
Auxiliary loads, especially cabin cooling in Indian summers, can take a significant share of battery energy in slow city traffic, where traction power is low. When the battery is nearly empty, a vehicle that keeps every load running may strand the driver a few kilometres short. A load manager that reduces non-essential loads by priority can extend range in a controlled way while keeping safety-relevant loads on.
Objectives
- Model auxiliary loads with power levels, priorities and allowed modes.
- Design a Stateflow load manager with SOC thresholds and hysteresis.
- Integrate it with a vehicle energy model on a city drive cycle.
- Measure range gained and time spent in each mode.
- Verify that safety-relevant loads are never shed.
What you need
Tools and toolboxes
- Simulink — Vehicle energy model, auxiliary load models and the test harness.
- Stateflow — Load-manager modes (Normal, Eco, Limp) with SOC thresholds, hysteresis and driver override.
- MATLAB — Parameter scripts, drive-cycle loading, range calculation and plots.
Software
- MATLAB R2023b or later
- Simulink
- Stateflow
- CSV drive-cycle data (IDC, MIDC)
Extra parts and data
None beyond the software above.
Key concepts
- Load prioritisation
- Each load is classed: safety (lights, wipers, brake vacuum or ABS), comfort (HVAC, seat heaters) and convenience (infotainment, USB). Lower classes are reduced first.
- Hysteresis
- A mode is entered at one SOC and left at a higher one, so small SOC changes from regeneration do not flip the mode back and forth.
- Derating versus shedding
- Derating reduces a load, for example limiting HVAC compressor power, while shedding switches it off. Derating keeps some comfort while saving energy.
- Auxiliary share
- Auxiliary energy divided by total battery energy. It is high in slow traffic because traction energy per hour is low while HVAC power is roughly constant.
Step-by-step guide
- 1
List loads and priorities
Make a table of example auxiliary loads for a compact EV: HVAC compressor 0 to 2.5 kW, blower 150 W, headlamps 100 W, DC–DC and 12 V systems 200 W, infotainment 60 W, rear defogger 150 W. Assign each a priority class and allowed modes (full, reduced, off). Mark safety loads as never sheddable. Store the table as a MATLAB struct array in the parameter script.
Checkpoint: A load table with powers, classes and allowed modes, reviewed so that no safety load can be switched off.
- 2
Build the vehicle energy model
Use a longitudinal model in Simulink with example parameters (1,300 kg, 30 kWh pack, 88 per cent drivetrain efficiency) driven by an IDC trace through From Workspace. Compute traction battery power and integrate total battery power, traction plus auxiliary, to energy and SOC with a Discrete-Time Integrator. Use a fixed step of 0.1 s. Log traction power and auxiliary power as separate signals from the start, because the auxiliary share of total energy is one of the main results of the project.
Checkpoint: With auxiliary loads off, consumption on IDC is in a plausible range for a compact car, roughly 100 to 150 Wh/km with these values.
- 3
Model the auxiliary loads
Create a subsystem with one branch per load. Each takes a mode command and returns electrical power. Model HVAC as power depending on ambient temperature and set-point, for example P = k·(T_ambient − T_set) clamped to the compressor limit, so a hot day drives a heavy load. Lights follow a day/night flag. Sum the branches to auxiliary power. Keep the load models simple and parameter-driven, so changing ambient temperature or a load rating needs only a change in the parameter script, not in the model.
Checkpoint: At 40 °C ambient and a 24 °C set-point, HVAC draws close to its limit and total auxiliary power is a few kilowatts.
- 4
Build the baseline
Run a long city scenario (repeated IDC loops) with all loads at full mode until SOC reaches the cut-off. Record range, auxiliary energy share and the distance where SOC crosses 20 and 10 per cent. This unmanaged baseline is the reference for all comparisons. Repeat the baseline at the three ambient temperatures used later, so each managed run has a matching unmanaged reference. Store each result with its scenario settings so tables can be built automatically.
Checkpoint: Baseline range and auxiliary share recorded, with the auxiliary share noticeably higher in slow city driving than in a WLTP run.
- 5
Design the Stateflow manager
Create a chart with states Normal, Eco and Limp. Enter Eco below 25 per cent SOC and return above 30 per cent; enter Limp below 10 per cent and return above 15 per cent. In Eco, derate HVAC to half power and turn off convenience loads. In Limp, run HVAC blower only and keep safety loads on. Add a driver override input that allows Normal in Eco but not in Limp.
Checkpoint: The chart compiles and its mode output changes only at the designed thresholds when SOC is swept slowly up and down.
- 6
Verify the manager alone
Build a test harness that drives the chart with a scripted SOC ramp down and up, plus a noisy SOC signal around a threshold. Log the active state. Check that each transition happens at its threshold, that hysteresis prevents chattering, and that safety loads stay on in every state. Use the Stateflow animation and the Simulation Data Inspector to inspect the run.
Checkpoint: No more than one transition per threshold crossing in the noisy test, and safety loads on for 100 per cent of the time.
- 7
Integrate and run the scenario
Connect the manager to the load subsystem and the vehicle model. Re-run the long city scenario at 40 °C. Log SOC, mode, each load's power and distance. Look for the point where the vehicle enters Eco and the change in the slope of SOC against distance, which shows the energy being saved. Plot the mode signal on the same time axis as SOC and auxiliary power so each mode change can be linked to the drop in load it causes.
Checkpoint: The SOC-against-distance curve becomes visibly flatter after entering Eco, and the vehicle travels further than the baseline before cut-off.
- 8
Quantify the benefit
Compute the range gained in km and per cent, the auxiliary energy saved and the time spent in each mode. Repeat at ambient temperatures of 25, 35 and 45 °C and on MIDC as well as IDC, scripting the runs with sim() and a SimulationInput array. Tabulate the results to show where load management helps most. Report range gained both in kilometres and as a percentage, since a small percentage can still be a meaningful distance near a depleted battery.
Checkpoint: A results table across temperatures and cycles, with larger gains at high temperature and in slow city driving.
- 9
Tune thresholds
Sweep the Eco entry threshold from 15 to 35 per cent and plot range gained against time spent in Eco, a rough comfort penalty. This shows the trade-off a product team would face. Choose a recommended threshold and justify it in terms of both range and comfort. Compute time in Eco as a share of total trip time for each threshold, and keep the hysteresis band constant during the sweep so only the entry threshold changes.
Checkpoint: A trade-off plot with a marked recommended threshold.
- 10
Report
Present the load table, energy model, chart design with a state diagram, verification tests, scenario results and threshold study. State the limitations: no cabin thermal model, simple HVAC power law and fixed drive cycles. Note that a real vehicle's load management must follow the manufacturer's safety analysis, which is beyond this project. Include the load table and the chart as figures, and list the parameter values used for every scenario so the results can be reproduced.
Checkpoint: A report with the state diagram, verification evidence and quantified range gain.
Testing & validation
- Threshold sweep test shows transitions only at designed SOC values.
- Noisy-SOC test shows hysteresis prevents chattering.
- Safety loads remain on in every state and scenario.
- Range gained against the unmanaged baseline at several temperatures and cycles.
Expected results
A Stateflow auxiliary load manager integrated with an EV energy model, with verified mode logic and quantified range gains at different ambient temperatures and drive cycles.
Take it further
- Add a lumped cabin thermal model so HVAC power follows cabin temperature.
- Make thresholds depend on distance to destination rather than SOC alone.
- Use Simulink Test to turn the verification harness into a test suite.
- Generate C code from the chart and inspect it.
Viva and review questions
Why is the auxiliary share higher in city driving?
Traction energy per hour is low at low speed, but HVAC and other loads draw roughly constant power, so over a slow trip they take a larger share of battery energy.
Why do you need hysteresis on SOC thresholds?
Regeneration and measurement noise make SOC move up and down slightly, so without hysteresis the manager would switch modes repeatedly at the threshold.
Why can the driver override Eco but not Limp?
In Eco there is still margin and comfort may matter more to the driver; in Limp the remaining energy is reserved for reaching a charger safely.
Learn it at DIYguru
These DIYguru courses and programmes teach what this project needs.
