There is provided a method of controlling aerosol production in an aerosol-generating device, the device including an aerosol-forming substrate, a heater including at least one heating element for heating the aerosol-forming substrate, and a power source for providing power to the heating element, the method including 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, an aerosol with consistent and desirable properties can be produced.