1
0
mirror of https://github.com/Ahp06/SUMO_Emissions.git synced 2024-11-23 03:56:29 +00:00

Removed wrong comparison with the reference simulation

This commit is contained in:
Ahp06 2019-02-10 15:30:25 +01:00
parent 370719d275
commit 84f2656b97
2 changed files with 1 additions and 24 deletions

View File

@ -20,11 +20,6 @@ class Config:
The Config class defines all simulation properties that can be changed
"""
# Total of emissions of all pollutants in mg for n steps of simulation without acting on areas
# These constants are simulation dependant, you must change them according to your simulation
ref200 = Emission(co2=42816869.05436445, co=1128465.0343051048, nox=18389.648337283958, hc=6154.330914019103,
pmx=885.0829265236318)
def __init__(self,config_file, data : Data):
"""
Default constructor
@ -92,10 +87,3 @@ class Config:
self._SUMOCFG = os.path.join(simdir, f)
sumo_binary = os.path.join(os.environ['SUMO_HOME'], 'bin', self._SUMOCMD)
self.sumo_cmd = [sumo_binary, "-c", self._SUMOCFG]
def get_ref_emissions(self):
"""
:return: Return the sum of all emissions (in mg) from the simulation of reference
"""
if self.n_steps == 200:
return self.ref200

View File

@ -148,17 +148,6 @@ class RunProcess(multiprocessing.Process):
value = total_emissions.__getattribute__(pollutant)
self.logger.info(f'{pollutant.upper()} = {value} mg')
if not self.config.without_actions_mode: # If it's not a simulation without actions
ref = self.config.get_ref_emissions()
if not (ref is None): # If a reference value exist (add yours into config.py)
global_diff = (ref.value() - total_emissions.value()) / ref.value()
self.logger.info(f'Global reduction percentage of emissions = {global_diff * 100} %')
for pollutant in ['co2','co','nox','hc','pmx']:
reduc_percentage = emissions.get_reduction_percentage(ref.__getattribute__(pollutant),
total_emissions.__getattribute__(pollutant))
self.logger.info(f'-> {pollutant.upper()} reduction = {reduc_percentage} %')
simulation_time = round(time.perf_counter() - start, 2)
self.logger.info(f'End of the simulation ({simulation_time}s)')