Beispiel #1
0
    def on_import_trips_from_scenario(self, event=None):
        """Select xml file and import new vehicle types.
        """
        filepath = self.get_scenario().get_rootfilepath()
        # defaultFile = os.path.dirname(filepath)
        dirpath = os.path.dirname(filepath)
        wildcards_all = "All files (*.*)|*.*"
        wildcards_obj = "Python binary files (*.obj)|*.obj"
        wildcards = wildcards_obj + "|" + wildcards_all
        dlg = wx.FileDialog(self._mainframe,
                            message="Open scenario file",
                            defaultDir=dirpath,
                            defaultFile=filepath + '.obj',
                            wildcard=wildcards,
                            style=wx.OPEN | wx.CHANGE_DIR)
        if dlg.ShowModal() == wx.ID_OK:
            filepath = dlg.GetPath()

        else:
            return
        scenario2 = load_scenario(filepath, logger=None)
        self._demand.trips.import_trips_from_scenario(scenario2)
        self._mainframe.browse_obj(self._demand.trips)
Beispiel #2
0
    def on_import_trips_from_scenario(self, event=None):
        """Select xml file and import new vehicle types.
        """
        filepath = self.get_scenario().get_rootfilepath()
        # defaultFile = os.path.dirname(filepath)
        dirpath = os.path.dirname(filepath)
        wildcards_all = "All files (*.*)|*.*"
        wildcards_obj = "Python binary files (*.obj)|*.obj"
        wildcards = wildcards_obj+"|"+wildcards_all
        dlg = wx.FileDialog(
            self._mainframe, message="Open scenario file",
            defaultDir=dirpath,
            defaultFile=filepath+'.obj',
            wildcard=wildcards,
            style=wx.OPEN | wx.CHANGE_DIR
        )
        if dlg.ShowModal() == wx.ID_OK:
            filepath = dlg.GetPath()

        else:
            return
        scenario2 = load_scenario(filepath, logger=None)
        self._demand.trips.import_trips_from_scenario(scenario2)
        self._mainframe.browse_obj(self._demand.trips)
Beispiel #3
0
sys.path.append(os.path.join('..', '..'))

from coremodules.scenario import scenario
from coremodules.simulation import sumo
from agilepy.lib_base.logger import Logger

resultfilepath = None
if len(sys.argv) >= 2:
    simfilepath = sys.argv[1]
    if len(sys.argv) == 3:
        resultfilepath = sys.argv[2]
else:
    print __doc__
    sys.exit(0)

myscenario = scenario.load_scenario(simfilepath)
rootfilepath = myscenario.get_rootfilepath()
if resultfilepath is None:
    resultfilepath = rootfilepath + '.res.obj'

mylogger = Logger(  #filepath = os.path.join(dirpath,logfilepath),
    is_stdout=True,  #False
)

microsim = sumo.Sumo(
    myscenario,
    guimode='nogui',  # 'sumopy','sumopy+map','native','openscene','nogui',  
    simtime_start=0,
    simtime_end=600,
    time_to_teleport=-1,
    time_step=0.2,  #s
Beispiel #4
0
fraction = 0.6
decrease = 0.1


# other
seed= 1234
logfilepath = 'log.txt'
sumologfilepath = 'log_sumo.txt'
###########################################################
print 'script_vp: initialize sim cmlfilepath=',cmlfilepath

# Load the scenario

#print 'Load scenario "%s"'%filepath

myscenario = scen.load_scenario(filepath)
rootfilepath = myscenario.get_rootfilepath()
if filepath_simstats is None:
    filepath_simstats = rootfilepath+'.vpiterres.obj'
dirpath = os.path.dirname(filepath)
mylogger = Logger(filepath = os.path.join(dirpath,logfilepath),
                  is_stdout = True,#False
                  )

is_not_first_iter = os.path.isfile(cmlfilepath)

##############################################################################
# choose from lanechange-models['LC2013','JE2013','DK2008','SL2015']
myscenario.demand.vtypes.lanechangemodel.set_value('SL2015')

simtime_start = myscenario.demand.get_time_depart_first()