## 4 The Simulation Framework
### Vehicles and \(\text{CO}_{2}\) Emissions' Estimation  
The vehicle JavaScript classes model the behaviour of vehicles, from kinematics to \(\text{CO}_{2}\) emissions, and are the most important classes in the simulator. The class structure is based on a superclass called classVehicle that models the characteristics that are common to all the vehicles. This superclass has a set of properties that are defined in the class constructor, which include  
* carLength: car length in meters; this is used for modelling the space that the vehicle takes in the lane. * carWeight: car weight in kg, which is used to calculate the energy needed to accelerate the vehicle and therefore the fuel consumption and \(\text{CO}_{2}\) emissions. * initialCarSpeed: initial car speed in m/s (the speed of the vehicle when it is inserted into a lane). * hasStartStop: a true/false flag that indicates whether the vehicle is equipped with a start-stop system. * carAcceleration: the maximum acceleration capability of the vehicle in m/s\({}^{2}\). * noGasAcceleration: the vehicle deceleration in m/s\({}^{2}\) (negative value) if no pressure is applied on the acceleration pedal. * lowBrakingAcceleration: car deceleration in m/s\({}^{2}\) (negative value) in a soft braking. * mediumBrakingAcceleration: car deceleration in m/s\({}^{2}\) (negative value) in a normal braking. * hardBrakingAcceleration: car deceleration in m/s\({}^{2}\) (negative value) in a strong braking. * fullBrakingAcceleration: car deceleration in m/s\({}^{2}\) (negative value) in an emergency braking. Besides these common characteristics, seven subclasses were created to model different types of vehicles and fuel: smallPetrolCarClass, smallDieselCarClass, bigPetrolCarClass, bigDieselCarClass, mediumVanClass, bigVanClass, and busClass. As a result of a direct observation of the intersection, these different vehicle types are the most prevalent in normal city traffic. A different icon is associated with each vehicle type, to create a visual distinction on the map. Each one of these classes has a different method to calculate the fuel consumption and \(\text{CO}_{2}\) emissions, because these calculations depend on the type of fuel and type of vehicle. The next section describes how \(\text{CO}_{2}\) emissions are calculated. One crucial feature of the simulator is the estimation of fuel consumption and emitted \(\text{CO}_{2}\) by each vehicle, in its different operation modes, e.g., accelerating, decelerating, braking, idling, or cruising. This estimation is based on the concept of vehicle specific power (VSP) [40], which can be described as the instantaneous tractive power per unit vehicle mass. The VSP parameter reflects most of the dependence of vehicle emissions on driving conditions; thus, it has been extensively used to estimate second-by-second emissions and fuel consumption, given the roadway grade (slope), vehicle speed, acceleration, or deceleration [41]. One major advantage of using the VSP as the fundamental parameter for emission models is that it is calculated independently from the type of vehicle, type of fuel, or even the vehicle weight. Therefore, VSP allows significant comparisons to be made between data from different dynamometer driving cycles, vehicles, and emission models; hence, it is widely used in vehicle emission models, such as EPA's MOVES model [42]. The VSP is expressed as \(\mathrm{W/kg}\) (or \(\mathrm{kW/metric}\) ton) and calculated with Equation (1). \[\mathrm{VSP}=\mathrm{v}(1.1a+9.81\mathrm{s}+0.132)+0.000302\mathrm{v}^{3} \tag{1}\]  
VSP: vehicle-specific power in \(\mathrm{W/kg}\)  
v: vehicle velocity in \(\mathrm{m/s}\)  
a: vehicle acceleration in \(\mathrm{m/s^{2}}\)  
s: road slope in percentage  
This formula is based on [40] (p. 55), excluding the headwind effect, which is not considered in the simulator, because the wind factor is not relevant to the goal of this study. The VSP is a general parameter for every vehicle; therefore, it is calculated in the Vehicle JavaScript super class.