# A Crowdsensing Platform for Monitoring of Vehicular Emissions: A Smart City Perspective
## 4 Soft Sensor for Pollution Monitoring
### Estimation of CO\({}_{2}\) Mass Flow  
The basic idea behind the method used to obtain the amount of CO\({}_{2}\) emitted by the vehicles, which is employed in this work, is the amount of air entering the engine at the moment of combustion. Obtaining this value, we can apply it to the method presented in the next paragraphs. Initially, we have to understand the concept behind the air-fuel ratio. For a certain amount of fuel, there is an ideal amount of oxygen required for the combustion to be optimal. This factor is called the Air-Fuel Ratio (AFR). For the combustion of gasoline, the proportion considered to be an ideal mix of fuel and oxygen has an AFR of 14.7 to one. That is, it takes 14.7 kg of air for every 1 kg of fuel entering the combustion chamber. In alcohol vehicles, this ratio is nine to one, while in diesel vehicles, it is 14.6 to one. The AFR can be mathematically described by Equation (1), being only a division between the mass of air and the mass of the fuel in the mix. \[AFR=\frac{m_{air}}{m_{fuel}} \tag{1}\]We can rewrite Equation (1) as a relation between the air mass flow rate and the fuel mass flow rate, as both values are measured in units of mass over time (g/s). The new formula is shown in Equation (2), where \(\dot{m}_{air}\) represents the air mass flow rate and \(\dot{m}_{fuel}\) represents the fuel mass flow injected in the engine. \[AFR=\frac{\dot{m}_{air}(\text{g/s})}{\dot{m}_{fuel}(\text{g/s})} \tag{2}\]  
The OBD-II standard establishes codes to obtain the mass air flow directly, or, in case the vehicle does not have an MAF sensor, it also gives access to other sensors that can be used to obtain such a value. However, it does not provide a method to directly obtain the amount of fuel injected in the combustion chamber, which would be ideal for this study. Considering that the AFR is a known value and that it is possible to extract the MAF through the OBD-II, the mass of fuel can be found by reordering Equation (2) as presented in Equation (3). As stated earlier, the unit of measure of both air and fuel flow rates is g/s, and the value of AFR is a constant. \[\dot{m}_{fuel}(\text{g/s})=\frac{\dot{m}_{air}(\text{g/s})}{AFR} \tag{3}\]  
The main fuels used in vehicles today are gasoline, diesel, and ethanol. Table 3 shows the amount of carbon dioxide generated by the combustion of one liter of each fuel, the AFR constant for the fuel mix, and the density of the fuel itself, according to [51; 52; 53]. The term \(\dot{m}_{fuel}\) in Equations (2) and (3) represents the fuel mass flow rate, but we need the fuel volume flow rate (represented in units of volume over time) to find the relation between the volume of fuel and the mass of CO\({}_{2}\) generated. To get this value, we need to divide the fuel mass flow rate by the respective fuel density (shown in Table 3), as described in Equation (4). \[\dot{V}_{fuel}(L/s)=\frac{\dot{m}_{fuel}(g/s)}{\rho_{fuel}(g/L)} \tag{4}\]  
As stated previously, the mass of emitted CO\({}_{2}\) is closely linked to the volume of fuel burned. This relationship is expressed in the Equation (5), where the fuel volume flow rate is multiplied by the mass of CO\({}_{2}\) generated by the combustion of one liter of fuel (constant shown in Table 3). The result of this equation is the estimate of the CO\({}_{2}\) mass flow rate emitted per second. \[\dot{m}_{CO_{2}}(\text{g/s})=\dot{V}_{fuel}\cdot CO_{\text{2 per liter}} \tag{5}\]  
Recombining the Equations (3)-(5), we can obtain the estimate in terms of the air mass flow (which can be obtained by the MAF sensor), AFR, fuel density, and the ratio of CO\({}_{2}\) emitted by a liter of fuel. This final formula is shown in Equation (6):  
\[\dot{m}_{CO_{2}}(\text{g/s})=\frac{\dot{m}_{air}}{ARF\cdot\rho_{\text{fuel}}} \cdot CO_{\text{2 per liter}} \tag{6}\]