A thermal management unit for controlling the temperature in an electric vehicle, the unit comprising: a. a heater for heating thermal fluid, b. a cooling unit, c. a heat exchanger, d. a first input port, a second input port, a third input port, a fourth input port, a fifth input port and a sixth input port for connecting external pipes to receive thermal fluid, e. a first output port, a second output port, a third output port, a fourth output port, a fifth output port and a sixth output port for connecting external pipes to output thermal fluid, f. a first three-way valve comprising an inlet, a first outlet and a second outlet, a second three-way valve comprising an inlet, a first outlet and a second outlet, and a third three-way valve comprising an inlet, a first outlet and a second outlet, g. a two-way valve comprising an inlet and an outlet, h. piping for thermal fluid, wherein the heat exchanger is a plate-to-plate heat exchanger that transfers thermal energy from a thermal fluid to another thermal fluid, the thermal management unit comprises a thermal expansion valve integrated in the heat exchanger or arranged before the heat exchanger, the cooling unit is a compressor which, together with a thermal expansion valve is arranged in association with an evaporator or a heat exchanger, forms a refrigeration machine, the first input port is connected via the piping to the inlet of the first three-way valve, the first outlet of the first three-way valve is connected via the piping to the first output port and the second outlet of the first three-way valve is connected via the piping to the input port of the second three-way valve via the heater, the first outlet of the second three-way valve is connected via the piping to the second output port and the second outlet of the second three-way valve is connected via the piping to the inlet of the two-way valve via the heat exchanger, the outlet of the two-way valve is connected via the piping to the first output port, wherein the piping between the heat exchanger and the inlet of the two-way valve is also connected to the second input port and to the piping between the second outlet of the first three-way valve and the heater, the third input port is connected via the piping to the third output port, the fourth input port is connected via the piping to the inlet of the third three-way valve, the first outlet port of the third three-way valve is connected to the piping between the third input port and the third output port via the heat exchanger, and the second outlet of the third three-way valve is connected via the piping to the fourth output port, and the fifth input port is connected via the piping to the fifth output port and to the sixth output port via the heat exchanger and the cooling unit, wherein the sixth input port is connected to the piping between the heat exchanger and the cooling unit. a. a heater for heating thermal fluid, b. a cooling unit, c. a heat exchanger, d. a first input port, a second input port, a third input port, a fourth input port, a fifth input port and a sixth input port for connecting external pipes to receive thermal fluid, e. a first output port, a second output port, a third output port, a fourth output port, a fifth output port and a sixth output port for connecting external pipes to output thermal fluid, f. a first three-way valve comprising an inlet, a first outlet and a second outlet, a second three-way valve comprising an inlet, a first outlet and a second outlet, and a third three-way valve comprising an inlet, a first outlet and a second outlet, g. a two-way valve comprising an inlet and an outlet, h. piping for thermal fluid, wherein the heat exchanger is a plate-to-plate heat exchanger that transfers thermal energy from a thermal fluid to another thermal fluid, the thermal management unit comprises a thermal expansion valve integrated in the heat exchanger or arranged before the heat exchanger, the cooling unit is a compressor which, together with a thermal expansion valve is arranged in association with an evaporator or a heat exchanger, forms a refrigeration machine, the first input port is connected via the piping to the inlet of the first three-way valve, the first outlet of the first three-way valve is connected via the piping to the first output port and the second outlet of the first three-way valve is connected via the piping to the input port of the second three-way valve via the heater, the first outlet of the second three-way valve is connected via the piping to the second output port and the second outlet of the second three-way valve is connected via the piping to the inlet of the two-way valve via the heat exchanger, the outlet of the two-way valve is connected via the piping to the first output port, wherein the piping between the heat exchanger and the inlet of the two-way valve is also connected to the second input port and to the piping between the second outlet of the first three-way valve and the heater, the third input port is connected via the piping to the third output port, the fourth input port is connected via the piping to the inlet of the third three-way valve, the first outlet port of the third three-way valve is connected to the piping between the third input port and the third output port via the heat exchanger, and the second outlet of the third three-way valve is connected via the piping to the fourth output port, and the fifth input port is connected via the piping to the fifth output port and to the sixth output port via the heat exchanger and the cooling unit, wherein the sixth input port is connected to the piping between the heat exchanger and the cooling unit.