mirror of
https://github.com/Ahp06/SUMO_Emissions.git
synced 2024-11-26 21:36:30 +00:00
Removed wrong comparison with the reference simulation
This commit is contained in:
parent
370719d275
commit
84f2656b97
@ -20,11 +20,6 @@ class Config:
|
|||||||
The Config class defines all simulation properties that can be changed
|
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):
|
def __init__(self,config_file, data : Data):
|
||||||
"""
|
"""
|
||||||
Default constructor
|
Default constructor
|
||||||
@ -91,11 +86,4 @@ class Config:
|
|||||||
if f.endswith('.sumocfg'):
|
if f.endswith('.sumocfg'):
|
||||||
self._SUMOCFG = os.path.join(simdir, f)
|
self._SUMOCFG = os.path.join(simdir, f)
|
||||||
sumo_binary = os.path.join(os.environ['SUMO_HOME'], 'bin', self._SUMOCMD)
|
sumo_binary = os.path.join(os.environ['SUMO_HOME'], 'bin', self._SUMOCMD)
|
||||||
self.sumo_cmd = [sumo_binary, "-c", self._SUMOCFG]
|
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
|
|
@ -147,17 +147,6 @@ class RunProcess(multiprocessing.Process):
|
|||||||
for pollutant in ['co2','co','nox','hc','pmx']:
|
for pollutant in ['co2','co','nox','hc','pmx']:
|
||||||
value = total_emissions.__getattribute__(pollutant)
|
value = total_emissions.__getattribute__(pollutant)
|
||||||
self.logger.info(f'{pollutant.upper()} = {value} mg')
|
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)
|
simulation_time = round(time.perf_counter() - start, 2)
|
||||||
self.logger.info(f'End of the simulation ({simulation_time}s)')
|
self.logger.info(f'End of the simulation ({simulation_time}s)')
|
||||||
|
Loading…
Reference in New Issue
Block a user