########################################################################## # HIGHWAY ########################################################################## if not runTransitOnly: #highway skimming #%1% /0 - initialize split matrices mf131-mf174, 1 - start with the previous set #%2% /MSA factor for averaging matrices 0-1 (0-no update, 1.0 full update) #%3% /0 - skip final assign., 1 - implement final assign. (last global iter.) #%4% /base scenario for assignment (9999 - for skimming) #%5% /number of assignment iterations #%6% /0 - include auto split, 1 - exclude (when applied with CT-RAMP) p.run_macro( "~< %s %i %f %i %i %i %i" % (hwySkimMacro, 0, 1.00, 0, scen, 25, 0), m.emmebank.path, scen) #p.run_macro("~< %s %i %f %i %i %i %i" % (hwySkimMacro, 1, 0.75, 0, scen, 50, 0), m.emmebank.path, scen) p.run_macro( "~< %s %i %f %i %i %i %i" % (hwySkimMacro, 1, 0.667, 0, scen, 40, 0), m.emmebank.path, scen) p.run_macro( "~< %s %i %f %i %i %i %i" % (hwySkimMacro, 1, 0.333, 0, scen, 60, 0), m.emmebank.path, scen) # Get list of IDs for low & high-income skim matrix pairs hwy_skims = [] mfs_tod = [] hwy_skims.extend([("mf%i181", "mf%i186"), ("mf%i182", "mf%i187"),
########################################################################## # HIGHWAY ########################################################################## if not runTransitOnly: #create scenario if needed (scenario 1 created when creating bank) if m.emmebank.scenario(scen) == None: m.emmebank.create_scenario(scen) else: m.emmebank.delete_scenario(scen) m.emmebank.create_scenario(scen) #modes, functions, highway network #%1% /tod p.run_macro("~< %s %i" % (hwySetupMacro, tod), m.emmebank.path, scen) #input daily highway matrices 1-99 #%1% /previous bank with matrices if i==0: p.run_macro("~< %s %s" % (hwyMatImportMacro, os.getcwd() + "\\" + previousBank), m.emmebank.path, scen) #tod tables, extra attributes, and toll field (which is currently not by tod) #%1% /tod p.run_macro("~< %s %i" % (todTablesMacro, tod), m.emmebank.path, scen) p.run_macro("~< %s %i" % (extraAttrsMacro, tod), m.emmebank.path, scen) p.run_macro("~< %s %i" % (tollAttrMacro, tod), m.emmebank.path, scen) ########################################################################## # TRANSIT ##########################################################################
mfs_tod.append(aMat % (tod)) for mf in mfs_tod: mat, zoneNames, name = EMXtoZMX.readZMX("outputs\\" + mf + ".zmx") EMXtoZMX.setMf(m.emmebank, mat, name) print("Load highway matrix into databank %s" % (name)) if not runTransitOnly: #highwy assign and skim with new demand #%1% /0 - initialize split matrices mf131-mf174, 1 - start with the previous set #%2% /MSA factor for averaging matrices 0-1 (0-no update, 1.0 full update) #%3% /0 - skip final assign., 1 - implement final assign. (last global iter.) #%4% /base scenario for assignment (9999 - for skimming) #%5% /number of assignment iterations #%6% /0 - include auto split, 1 - exclude (when applied with CT-RAMP) p.run_macro("~< %s %i %f %i %i %i %i" % (hwySkimMacro, 1, 1.00, 0, scen, 25, 1), m.emmebank.path, scen) p.run_macro("~< %s %i %f %i %i %i %i" % (hwySkimMacro, 1, 0.75, 0, scen, 50, 1), m.emmebank.path, scen) p.run_macro("~< %s %i %f %i %i %i %i" % (hwySkimMacro, 1, 0.50, 0, scen, 75, 1), m.emmebank.path, scen) p.run_macro("~< %s %i %f %i %i %i %i" % (hwySkimMacro, 1, 0.25, 1, scen, 100, 1), m.emmebank.path, scen) #read taz and tap demand matrices and write to bank matNames = ["mf%i359","mf%i360","mf%i361","mf%i362","mf%i363","mf%i364"] #tap mfs_tod = [] for aMat in matNames: mfs_tod.append(aMat % (tod)) for mf in mfs_tod: mat, zoneNames, name = EMXtoZMX.readZMX("outputs\\" + mf + ".zmx") EMXtoZMX.setMf(m.emmebank, mat, name) print("Load transit matrix into databank %s" % (name))
tranScen = transitScenarios[i] tod = tods[i] ########################################################################## # HIGHWAY ########################################################################## if not runTransitOnly: #delete scenario if it exists so that import is possible if m.emmebank.scenario(scen): m.emmebank.delete_scenario(scen) #modes, functions, highway network (directly from trip-based model) #%1% /tod p.run_macro("~< %s %i" % (hwySetupMacro, tod), m.emmebank.path, scen) #input daily highway matrices 1-99 #%1% /previous bank with matrices if i==0: p.run_macro("~< %s %s" % (hwyMatImportMacro, os.getcwd() + "\\" + previousBank), m.emmebank.path, scen) #tod tables and extra attributes #%1% /tod p.run_macro("~< %s %i" % (todTablesMacro, tod), m.emmebank.path, scen) p.run_macro("~< %s %i" % (extraAttrsMacro, tod), m.emmebank.path, scen) ########################################################################## # TRANSIT ##########################################################################