There is provided a method of controlling aerosol production in an aerosol-generating device, the device comprising an aerosol-forming substrate, a heater comprising at least one heating element for heating the aerosol- forming substrate, and a power source for providing power to the heating element, comprising the steps of: determining the temperature of the heating element; and adjusting the power to the heating element to maintain the temperature of the heating element within a desired temperature range, wherein the desired temperature range is dynamically calculated based on a measured flow rate of gas through or past the device. By controlling the temperature of the heating element, aerosol with consistent and desirable properties can be produced.