From 84f2656b973eaa8e82b12c5a379e711ccb8b8999 Mon Sep 17 00:00:00 2001 From: Ahp06 Date: Sun, 10 Feb 2019 15:30:25 +0100 Subject: [PATCH] Removed wrong comparison with the reference simulation --- sumo_project/config.py | 14 +------------- sumo_project/runner.py | 11 ----------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/sumo_project/config.py b/sumo_project/config.py index 0e40dfe..02eefe8 100644 --- a/sumo_project/config.py +++ b/sumo_project/config.py @@ -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 @@ -91,11 +86,4 @@ class Config: if f.endswith('.sumocfg'): 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 + self.sumo_cmd = [sumo_binary, "-c", self._SUMOCFG] \ No newline at end of file diff --git a/sumo_project/runner.py b/sumo_project/runner.py index 9b4d6da..6d5175a 100644 --- a/sumo_project/runner.py +++ b/sumo_project/runner.py @@ -147,17 +147,6 @@ class RunProcess(multiprocessing.Process): for pollutant in ['co2','co','nox','hc','pmx']: 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)')