Skip to main content
emobility.academy
M.TechThermal managementAdvanced About 10 weeksMATLAB & Simulink

Integrated Thermal Management with a Heat Pump for Battery and Cabin

Model an integrated EV thermal management system in Simscape Fluids in which one heat pump serves both cabin and battery, with valves switching between cooling, heating and battery-chilling modes under Stateflow control. Compare energy use and range against separate systems.

Tools: Simscape Fluids · Stateflow

Integrated Thermal Management with a Heat Pump for Battery and Cabin: DIYguru EV lab with charging and electrical trainers
Representative photo from DIYguru's EV lab, not of this specific project.

The problem

EVs have little waste heat for cabin heating, and running separate cooling and heating systems wastes energy and space. Integrated systems share one refrigerant circuit between cabin and battery and can move heat in either direction, but their mode logic and component sizing are complex. Simulation lets engineers design the mode switching and quantify the range benefit before building hardware.

Objectives

  • Model a refrigerant circuit with compressor, condenser, evaporator, expansion valves and a battery chiller.
  • Model the coolant loop for the battery and the cabin air side.
  • Design mode logic in Stateflow for cabin cooling, cabin heating, battery chilling and combined modes.
  • Compare energy use and range with a baseline of PTC heating and a separate chiller.
  • Evaluate performance across hot and mild climate cases.

What you need

Tools and toolboxes

  • Simscape Fluids — Two-phase fluid compressor, heat exchanger and valve blocks for the refrigerant circuit, and thermal-liquid blocks for the battery coolant loop.
  • Simscape — Foundation two-phase, thermal-liquid, moist-air and thermal libraries for pipes, cabin air and pack thermal mass.
  • Stateflow — Mode-selection logic with hysteresis, priorities and transition timers.
  • Simulink — Controllers for compressor speed and valve openings, vehicle energy model and logging.
  • MATLAB — Parameters, refrigerant property setup, scripted scenario runs and energy post-processing.

Software

  • MATLAB R2023b or later
  • Simulink
  • Simscape, Simscape Fluids and Stateflow
  • Excel/CSV for drive cycles and climate data

Extra parts and data

None beyond the software above.

Key concepts

Heat pump
A refrigerant cycle that moves heat from a cold side to a hot side. In heating mode it can deliver more heat than the electrical energy it uses, with a COP above one.
Battery chiller
A refrigerant-to-coolant heat exchanger that cools the battery loop below ambient, needed for fast charging in hot weather.
Superheat and subcooling
Superheat at the compressor inlet protects it from liquid; subcooling at the expansion valve inlet ensures stable flow. Both are control targets for the expansion valves.
Mode arbitration
When cabin and battery requests conflict, the controller must decide priorities, for example protecting the battery during fast charging while keeping minimum cabin comfort.

Step-by-step guide

  1. 1

    Define architecture and requirements

    Draw an example architecture: an electric compressor, a front heat exchanger acting as condenser or evaporator, a cabin evaporator, a cabin condenser for heating, a battery chiller and electronic expansion valves. Define requirements such as cabin at 24 °C, battery between 20 and 35 °C, and fast charging at 40 °C ambient with battery inlet coolant at a set temperature. Choose R1234yf or R134a from the Simscape refrigerant property data as an example.

    Checkpoint: An architecture diagram with each mode's flow path marked and a requirements table.

  2. 2

    Build the refrigerant circuit for one mode

    Start with cabin cooling only. Assemble the compressor, condenser, expansion valve and evaporator from the two-phase libraries, with a Two-Phase Fluid Properties (2P) block for the refrigerant. Size components from example capacities and set initial pressures sensibly. Use a stiff solver such as ode23t and expect to spend time on initialisation; start with conservative operating conditions. Save the converged state as an operating point to use as the initial condition for later runs.

    Checkpoint: The cooling-only circuit reaches a steady state with plausible pressures and superheat, and a COP in a reasonable range for the conditions.

  3. 3

    Add expansion valve control

    Close a PI loop on evaporator outlet superheat using the expansion valve opening, with a target such as 5–8 K. Add a compressor speed controller on cabin supply air temperature. Tune both on step changes in cabin load and check they do not fight each other by keeping the superheat loop faster than the temperature loop. Log valve opening and compressor speed so saturation of either actuator is visible.

    Checkpoint: Superheat holds near target within about 2 K after a load step, and cabin supply temperature settles without sustained oscillation.

  4. 4

    Add the battery coolant loop and chiller

    Model the battery loop in the thermal-liquid domain with a pump, cold plate attached to a lumped pack thermal mass and a chiller heat exchanger linking it to the refrigerant circuit through its own expansion valve. Check the chiller energy balance: heat leaving the coolant must equal heat absorbed by the refrigerant at steady state. Size the chiller from the fast-charge heat load with a stated margin.

    Checkpoint: Chiller heat balance closes within a few per cent, and the battery coolant can be held below ambient during a fast-charge heat load.

  5. 5

    Add heat-pump heating mode

    Add valves that reverse the role of the front heat exchanger and route hot refrigerant to the cabin condenser. Model the cabin air side with moist-air or thermal blocks. Test heating at a mild cold ambient, for example 5 °C, and record heating COP. Include a PTC heater model as the baseline for comparison. Record heating capacity as well as COP, because heat-pump capacity falls at low ambient and may need PTC support.

    Checkpoint: Heating mode delivers the required cabin heat with a COP above one at the test ambient, while the PTC baseline has an effective COP of one.

  6. 6

    Design mode logic in Stateflow

    Write a Stateflow chart with states for off, cabin cooling, cabin heating, battery chilling, cooling plus chilling and heating plus battery heat recovery. Use cabin and battery temperature errors, ambient temperature and a charging flag as inputs, with hysteresis and minimum dwell times to avoid rapid switching. Add a priority rule, for example battery protection first during fast charging. Test the chart alone first with a Signal Editor input.

    Checkpoint: A scenario test with changing ambient and charging state passes through each intended mode, with no transitions faster than the minimum dwell time.

  7. 7

    Integrate with the vehicle energy model

    Connect the thermal system to a longitudinal vehicle model and battery energy integrator, adding compressor, pump and fan power to the auxiliary load. Define scenarios: a hot summer drive on MIDC, a fast charge at 40 °C ambient and a mild winter drive. Run each with the integrated system and with the baseline of separate chiller and PTC heater. Use the same initial conditions for both architectures.

    Checkpoint: All scenarios complete with requirements met, and energy logs show every auxiliary component's contribution.

  8. 8

    Compare energy and range

    Compute thermal-system energy, range and battery temperature statistics for each scenario and architecture. Present a table of savings and explain where the integrated system gains, mainly heating COP and heat recovery, and where it gives little benefit, such as pure hot-climate cooling where both architectures use similar compressors. Report the share of total vehicle energy used by thermal management in each case, and state which component assumptions most affect the size of the saving.

    Checkpoint: A comparison table with energy and range differences and an explanation for each scenario.

  9. 9

    Sensitivity and robustness

    Vary compressor size, heat exchanger effectiveness and ambient over ranges and record requirement compliance and energy. Check mode-logic robustness by adding sensor noise and delays. Identify any conditions where the system cannot meet both cabin and battery demands and how the priority rule handles them. Use a scripted grid of sim() runs and present results as a feasibility map. Record solver failures as well, since they often indicate unrealistic component combinations rather than real limits.

    Checkpoint: A map of operating conditions showing where requirements are met, with conflict cases documented.

  10. 10

    Report

    Present the architecture, component models, controllers, mode logic, scenario results and comparison. State the limitations: component maps are generic, refrigerant charge distribution is simplified and transient start-up is approximate. Discuss what component test data would be needed to make the absolute numbers reliable. Attach the Stateflow chart, controller gains and scenario scripts, and describe how each component was sized so readers can judge how general the comparison is. Present savings as ranges across scenarios rather than one headline number.

    Checkpoint: A report with a defensible comparison between architectures and a clear list of assumptions.

Testing & validation

  • Steady refrigerant states, superheat and COP in plausible ranges for each mode.
  • Chiller and condenser energy balances.
  • Stateflow scenario test covering all modes with dwell-time compliance.
  • Cabin and battery temperature requirements met in each scenario.
  • Energy and range comparison with the baseline architecture.

Expected results

An integrated heat-pump thermal management model with validated mode logic, showing the energy and range effect of sharing one refrigerant circuit between cabin and battery across hot and mild climates.

Research angle for your M.Tech thesis

Research questions: how much range does an integrated heat-pump system recover over a separate chiller and PTC heater across Indian climate profiles, and what mode-arbitration rules give the best trade-off between battery protection and cabin comfort? Metrics: thermal energy per kilometre, range, time outside battery temperature window and comfort deviation. Baselines: separate systems and a simple fixed-priority supervisor. Publishable contributions include climate-specific evaluation for Indian conditions, which is less covered than cold-climate studies, and a systematic comparison of supervisory strategies with transparent component assumptions.

Take it further

  • Recover motor and inverter waste heat through the coolant loop in heating mode.
  • Replace rule-based mode logic with an optimisation-based supervisor.
  • Add refrigerant charge and component mass to estimate cost and weight trade-offs.
  • Generate code for the Stateflow supervisor and test it in software-in-the-loop.

Viva and review questions

Why does a heat pump save energy in heating compared with a PTC heater?

A PTC heater converts electrical energy to heat one-for-one, while a heat pump moves additional heat from outside air, delivering more heat than the electrical energy it uses.

Why control superheat?

Superheat ensures only vapour reaches the compressor, protecting it, and a stable small superheat keeps the evaporator well used.

Why add minimum dwell times in the Stateflow chart?

Rapid switching between modes upsets refrigerant pressures and wears valves and the compressor, so dwell times and hysteresis keep the system stable.

Learn it at DIYguru

These DIYguru courses and programmes teach what this project needs.

Related EV projects

All 100 MATLAB & Simulink EV projects