A method for controlling combustion of a fuel in an engine, the method comprising: - estimating a quality of the fuel based on one or more parameters of the engine by i) measuring, by a pressure sensor, a pressure within a combustion chamber of the engine during a combustion of the fuel; ii) determining a duration of the combustion of the fuel based on the pressure measurement, wherein an increase in the duration of the combustion is indicative of a decrease in the quality of the fuel, and a decrease in the duration of the combustion is indicative of an increase in the quality of the fuel; and iii) determining a temperature of an exhaust gas of the engine, wherein an increase in the temperature of the exhaust gas is indicative of a decrease in the quality of the fuel, and a decrease in the temperature of the exhaust gas is indicative of an increase in the quality of the fuel; - increasing an amount of the fuel injected into the engine in response to the quality of the fuel falling below a desired quality value and decreasing the amount of the fuel in response to the quality of the fuel exceeding the desired quality value; and - increasing a pressure of air in an intake manifold of the engine based on the increased amount of the fuel and decreasing the pressure of air based on the decreased amount of fuel. - estimating a quality of the fuel based on one or more parameters of the engine by i) measuring, by a pressure sensor, a pressure within a combustion chamber of the engine during a combustion of the fuel; ii) determining a duration of the combustion of the fuel based on the pressure measurement, wherein an increase in the duration of the combustion is indicative of a decrease in the quality of the fuel, and a decrease in the duration of the combustion is indicative of an increase in the quality of the fuel; and iii) determining a temperature of an exhaust gas of the engine, wherein an increase in the temperature of the exhaust gas is indicative of a decrease in the quality of the fuel, and a decrease in the temperature of the exhaust gas is indicative of an increase in the quality of the fuel; i) measuring, by a pressure sensor, a pressure within a combustion chamber of the engine during a combustion of the fuel; ii) determining a duration of the combustion of the fuel based on the pressure measurement, wherein an increase in the duration of the combustion is indicative of a decrease in the quality of the fuel, and a decrease in the duration of the combustion is indicative of an increase in the quality of the fuel; and iii) determining a temperature of an exhaust gas of the engine, wherein an increase in the temperature of the exhaust gas is indicative of a decrease in the quality of the fuel, and a decrease in the temperature of the exhaust gas is indicative of an increase in the quality of the fuel; - increasing an amount of the fuel injected into the engine in response to the quality of the fuel falling below a desired quality value and decreasing the amount of the fuel in response to the quality of the fuel exceeding the desired quality value; and - increasing a pressure of air in an intake manifold of the engine based on the increased amount of the fuel and decreasing the pressure of air based on the decreased amount of fuel.