200 likes | 418 Views
TRANSIMS Version 5 Software Architecture. January 20, 2011 David Roden – AECOM. Topics. Goals and objectives Standard template library extensions Code organization and consolidation Program service hierarchy Typical program linkages Path building and simulation services
E N D
TRANSIMS Version 5Software Architecture January 20, 2011 David Roden – AECOM
Topics • Goals and objectives • Standard template library extensions • Code organization and consolidation • Program service hierarchy • Typical program linkages • Path building and simulation services • Multiple threads, DLL, and MPI Chicago RTSTEP TRANSIMS Model
Goals and Objectives • Make the code easier for new programmers to understand, modify and build upon • Standard Template Library • Centralize codes, standardize and automate processing • Expand and simplify programmer support services • Make the code safer and more robust • Eliminate re-defined data classes and application differences • Improve performance and reduce run times • Utilize multiple cores and MPI clusters • Create DLL services for linkages to other software Chicago RTSTEP TRANSIMS Model
Standard Template Library Extensions • Custom data containers C++ STL • vectors, maps, iterators, streams, and strings • Encapsulate and extend STL methods • string String • Case insensitive comparisons, trimming, parsing, type conversions, and type safe printf-like formating • streams Message, Print, Write, XML • Managed output to the screen and print files • char array Buffer • Dynamic character arrays for binary and text file input and output • time Dtime • Day-time data object with input and output formatting Chicago RTSTEP TRANSIMS Model
Code Organization and Consolidation • Enumerations consolidated into one place with static conversion services (textcode, codetext) • Standard containers and iterators defined in a central TypeDefs library • SysLib re-grouped and organized as files, data classes, read and write methods, and a series of program services • Control key structure and processing methods standardize, simplify, and automate user interface and help functions Chicago RTSTEP TRANSIMS Model
SysLib Db-File Hierarchy ArcGIS Files System Files • Memory file Arcview_File Db_Header Db_Array • Shape file processing • File header and definition files • Record array Projection Points Db_Base Buffers • Coordinate projection services • XYZ point array • Field creation and I/O • File handle, reads and writes • Delimiter processing • Field name and attributes Db_Field Db_File • Record buffers and nesting data • Delimiter processing Db_Record • File status code and messages • File ID and File Type Db_Status • Code-Text conversions, Round/UnRound • Internal-External Unit conversions • Default file format and time format Execution_Service *exe Static Service Chicago RTSTEP TRANSIMS Model
Low Level Program Services Execution_Service *exe • Control key and report specifications • Command line processing • Program execution process Execution Service TITLE REPORT_FILE REPORT_FLAG PROJECT_DIRECTORY DEFAULT_FILE_FORMAT TIME_OF_DAY_FORMAT MODEL_START_TIME MODEL_END_TIME UNITS_OF_MEASURE RANDOM_NUMBER_SEED MAX_WARNING_MESSAGES MAX_WARNING_EXIT_FLAG MAX_PROBLEM_COUNT NUMBER_OF_THREADS PROGRAM_REPORTS • Control file processing • Key processing and validation services • Help services Control Service • Report/XML output • Problem services • Partitioning flags Report Service • Screen messages • Program/Version • Exit codes Message Service Static Service • Code-Text conversions, Round/UnRound • Internal-External Unit conversions • Default file format and time format Chicago RTSTEP TRANSIMS Model
File and Data Services Data_Service *dat Data Service • Read system files into data structures • Write data structures to system files • Record indexing and sorting DAILY_WRAP_FLAG SUMMARY_TIME_RANGES SUMMARY_TIME_INCREMENT CONGESTED_TIME_RATIO PLAN_SORT_TYPE HIGHEST_ZONE_NUMBER File Service (System File and Format Keys) • System file selection • Open existing and create new files • File status and format information NOTES_AND_NAME_FIELDS FLOW_UNITS SKIM_OD_UNITS SKIM_TIME_PERIODS SKIM_TIME_INCREMENT SKIM_TOTAL_TIME_FLAG SKIM_TRAVEL_TIME_FORMAT SKIM_TRIP_LENGTH_FORMAT NEAREST_NEIGHBOR_FACTOR MERGE_TIME_PERIODS Execution Service Chicago RTSTEP TRANSIMS Model
System File and Format Keys NODE_FILE NODE_FORMAT ZONE_FILE ZONE_FORMAT SHAPE_FILE SHAPE_FORMAT LINK_FILE LINK_FORMAT POCKET_FILE POCKET_FORMAT LANE_USE_FILE LANE_USE_FORMAT CONNECTION_FILE CONNECTION_FORMAT TURN_PENALTY_FILE TURN_PENALTY_FORMAT PARKING_FILE PARKING_FORMAT LOCATION_FILE LOCATION_FORMAT ACCESS_FILE ACCESS_FORMAT SIGN_FILE SIGN_FORMAT SIGNAL_FILE SIGNAL_FORMAT PHASING_PLAN_FILE PHASING_PLAN_FORMAT TIMING_PLAN_FILE TIMING_PLAN_FORMAT DETECTOR_FILE DETECTOR_FORMAT TRANSIT_STOP_FILE TRANSIT_STOP_FORMAT TRANSIT_FARE_FILE TRANSIT_FARE_FORMAT TRANSIT_ROUTE_FILE TRANSIT_ROUTE_FORMAT TRANSIT_SCHEDULE_FILE TRANSIT_SCHEDULE_FORMAT TRANSIT_DRIVER_FILE TRANSIT_DRIVER_FORMAT SELECTION_FILE SELECTION_FORMAT HOUSEHOLD_FILE HOUSEHOLD_FORMAT LINK_DELAY_FILE LINK_DELAY_FORMAT PERFORMANCE_FILE PERFORMANCE_FORMAT RIDERSHIP_FILE RIDERSHIP_FORMAT VEHICLE_TYPE_FILE VEHICLE_TYPE_FORMAT VEHICLE_FILE VEHICLE_FORMAT TRIP_FILE TRIP_FORMAT PROBLEM_FILE PROBLEM_FORMAT PLAN_FILE PLAN_FORMAT SKIM_FILE SKIM_FORMAT NEW_NODE_FILE NEW_NODE_FORMAT NEW_ZONE_FILE NEW_ZONE_FORMAT NEW_SHAPE_FILE NEW_SHAPE_FORMAT NEW_LINK_FILE NEW_LINK_FORMAT NEW_POCKET_FILE NEW_POCKET_FORMAT NEW_LANE_USE_FILE NEW_LANE_USE_FORMAT NEW_CONNECTION_FILE NEW_CONNECTION_FORMAT NEW_TURN_PENALTY_FILE NEW_TURN_PENALTY_FORMAT NEW_PARKING_FILE NEW_PARKING_FORMAT NEW_LOCATION_FILE NEW_LOCATION_FORMAT NEW_ACCESS_FILE NEW_ACCESS_FORMAT NEW_SIGN_FILE NEW_SIGN_FORMAT NEW_SIGNAL_FILE NEW_SIGNAL_FORMAT NEW_PHASING_PLAN_FILE NEW_PHASING_PLAN_FORMAT NEW_TIMING_PLAN_FILE NEW_TIMING_PLAN_FORMAT NEW_DETECTOR_FILE NEWDETECTOR_FORMAT NEW_TRANSIT_STOP_FILE NEW_TRANSIT_STOP_FORMAT NEW_TRANSIT_FARE_FILE NEW_TRANSIT_FARE_FORMAT NEW_TRANSIT_ROUTE_FILE NEW_TRANSIT_ROUTE_FORMAT NEW_TRANSIT_SCHEDULE_FILE NEW_TRANSIT_SCHEDULE_FORMAT NEW_TRANSIT_DRIVER_FILE NEW_TRANSIT_DRIVER_FORMAT NEW_SELECTION_FILE NEW_SELECTION_FORMAT NEW_HOUSEHOLD_FILE NEW_HOUSEHOLD_FORMAT NEW_LINK_DELAY_FILE NEW_LINK_DELAY_FORMAT NEW_PERFORMANCE_FILE NEW_PERFORMANCE_FORMAT NEW_RIDERSHIP_FILE NEW_RIDERSHIP_FORMAT NEW_VEHICLE_TYPE_FILE NEW_VEHICLE_TYPE_FORMAT NEW_VEHICLE_FILE NEW_VEHICLE_FORMAT NEW_TRIP_FILE NEW_TRIP_FORMAT NEW_PROBLEM_FILE NEW_PROBLEM_FORMAT NEW_PLAN_FILE NEW_PLAN_FORMAT NEW_SKIM_FILE NEW_SKIM_FORMAT File Service Chicago RTSTEP TRANSIMS Model
Select Service • Support service class for selecting data records SELECT_HOUSEHOLDS SELECT_MODES SELECT_PURPOSE SELECT_START_TIMES SELECT_END_TIMES SELECT_ORIGINS SELECT_DESTINATIONS SELECT_TRAVELER_TYPES SELECT_FACILITY_TYPES SELECT_VEHICLE_TYPES SELECT_SUBAREA_POLYGON SELECT_ORIGIN_ZONES SELECT_DESTINATION_ZONES PERCENT_TIME_DIFFERENCE MINIMUM_TIME_DIFFERENCE MAXIMUM_TIME_DIFFERENCE SELECTION_PERCENTAGE MAXIMUM_PERCENT_SELECTED Execution_Service *exe Select Service • Read selection keys • Maintain selection flags and data ranges Chicago RTSTEP TRANSIMS Model
Typical Program Linkages RandomSelect • Select a random set of travelers or trips • Randomly distribute travelers to partitions NUMBER_OF_PARTITIONS Data Service Select Service MERGE_PLAN_FILE MERGE_PLAN_FORMAT MAXIMUM_SORT_SIZE PlanPrep • Select a random set of travelers or trips • Randomly distribute travelers to partitions Data Service Select Service Chicago RTSTEP TRANSIMS Model
Path Building and Simulation Services • Builds private data structures for algorithm needs • No longer re-defines or over-writes data in SysLib services • SysLib creates internal record IDs for all datasets and programs • Re-defining data structures not permitted by STL containers • Important for DLL and on-the-fly path building • Path Builder and Simulator modules in SysLib • Available to multiple programs and as DLL services to other software • Path Builder includes two basic options • Construct a path for a specific trip of a specific traveler • Construct paths or path skims between a user-defined set of origins, destinations, times of day, modes, and vehicle types Chicago RTSTEP TRANSIMS Model
Router Services IMPEDANCE_SORT_METHOD SAVE_ONLY_SKIMS WALK_PATH_DETAILS IGNORE_VEHICLE_ID LIMIT_PARKING_ACCESS IGNORE_TIME_CONSTRAINTS END_TIME_CONSTRAINT IGNORE_ROUTING_PROBLEMS PERCENT_RANDOM_IMPEDANCE WALK_SPEED BICYCLE_SPEED WALK_TIME_VALUES BICYCLE_TIME_VALUES FIRST_WAIT_VALUES TRANSFER_WAIT_VALUES PARKING_TIME_VALUES VEHICLE_TIME_VALUES DISTANCE_VALUES COST_VALUES FACILITY_BIAS_FACTORS LEFT_TURN_PENALTIES RIGHT_TURN_PENALTIES U_TURN_PENALTIES PARKING_PENALTY_FILE TRANSIT_PENALTY_FILE TRANSFER_PENALTIES STOP_WAITING_PENALTIES STATION_WAITING_PENALTIES BUS_BIAS_FACTORS BUS_BIAS_CONSTANTS RAIL_BIAS_FACTORS RAIL_BIAS_CONSTANTS MAX_WALK_DISTANCES MAX_BICYCLE_DISTANCES MAX_WAIT_TIMES MIN_WAIT_TIMES MAX_NUMBER_OF_TRANSFERS MAX_NUMBER_OF_PATHS MAX_PARK_RIDE_PERCENTAGE MAX_KISS_RIDE_PERCENTAGE KISS_RIDE_TIME_FACTOR KISS_RIDE_STOP_TYPES MAX_KISS_RIDE_DROPOFF_WALK MAX_LEGS_PER_PATH FARE_CLASS_DISTRIBUTION DEFAULT_PARKING_DURATION LOCAL_ACCESS_DISTANCE LOCAL_FACILITY_TYPE LOCAL_IMPEDANCE_FACTOR MAX_CIRCUITY_RATIO MIN_CIRCUITY_DISTANCE MAX_CIRCUITY_DISTANCE Router Base • Create and manage path building threads • Send results to an output thread Path Builder Router Service • Process path building control keys • Prepare path building data structures • Set path building parameters by type Data Service Flow-Time Service Chicago RTSTEP TRANSIMS Model
Flow-Time Service • Support service class for managing link-delay and performance file processing Data_Service *dat UPDATE_FLOW_RATES CLEAR_INPUT_FLOW_RATES UPDATE_TRAVEL_TIMES LINK_DELAY_UPDATE_RATE LINK_DELAY_FLOW_FACTOR EQUATION_PARAMETERS • Initialize link-delay data • Cumulate flow and travel time data • Apply volume-delay equations Flow-Time Service Chicago RTSTEP TRANSIMS Model
Router and PathSkim Linkages HOUSEHOLD_TYPE_SCRIPT UPDATE_PLAN_RECORDS PRINT_UPDATE_WARNINGS • Build paths and write plan files for select trips • Update and merge plan files • Update flow rates and travel times Router ROUTE_FROM_SPECIFIED_LOCATIONS ROUTE_TO_SPECIFIED_LOCATIONS ROUTE_AT_SPECIFIED_TIMES ROUTE_BY_TIME_INCREMENT ROUTE_WITH_TIME_CONSTRAINT ROUTE_WITH_SPECIFIED_MODE ROUTE_WITH_SPECIFIED_USE_TYPE ROUTE_FROM_SPECIFIED_ZONES ROUTE_TO_SPECIFIED_ZONES ORIGIN_LOCATIONS_PER_ZONE DESTINATION_LOCATIONS_PER_ZONE LOCATION_SELECTION_METHOD ORIGIN_ZONE_FILE DESTINATION_ZONE_FILE ORIGIN_LOCATION_FILE DESTINATION_LOCATION_FILE ZONE_LOCATION_MAP_FILE Router Base Select Service • Build paths and write plan files for specified trips • Write zone or location-based skim files • Update flow rates and travel times PathSkim Router Base Select Service Chicago RTSTEP TRANSIMS Model
Simulator Services SIMULATION_START_TIME SIMULATION_END_TIME TIME_STEPS_PER_SECOND SPEED_CALCULATION_METHOD CELL_SIZE PLAN_FOLLOWING_DISTANCE LOOK_AHEAD_DISTANCE LOOK_AHEAD_LANE_FACTOR LOOK_AHEAD_TIME_FACTOR MAXIMUM_SWAPPING_SPEED MAXIMUM_SPEED_DIFFERENCE ENFORCE_PARKING_LANES FIX_VEHICLE_LOCATIONS DRIVER_REACTION_TIME PERMISSION_PROBABILITY SLOW_DOWN_PROBABILITY SLOW_DOWN_PERCENTAGE MINIMUM_WAITING_TIME MAXIMUM_WAITING_TIME MAX_ARRIVAL_TIME_VARIANCE MAX_DEPARTURE_TIME_VARIANCE COUNT_PROBLEM_WARNINGS PRINT_PROBLEM_MESSAGES Simulator Output • Create and manage output threads Output Services Simulator Base • Create and manage simulator threads Simulator Simulator Service • Process simulator control keys • Prepare simulator data structures • Set simulator parameters by type Router Base Chicago RTSTEP TRANSIMS Model
Simulator OutputLink Delay and Performance NEW_LINK_DELAY_FILE NEW_LINK_DELAY_FORMAT NEW_LINK_DELAY_TIME_FORMAT NEW_LINK_DELAY_INCREMENT NEW_LINK_DELAY_TIME_RANGE NEW_LINK_DELAY_LINK_RANGE NEW_LINK_DELAY_COORDINATES NEW_LINK_DELAY_VEH_TYPES NEW_LINK_DELAY_TURN_FLAG NEW_LINK_DELAY_FLOW_TYPE Simulator_Base *exe • Initialize link-delay data • Cumulate flow and travel time data • Write link-delay file Link-Delay Output NEW_PERFORMANCE_FILE NEW_PERFORMANCE_FORMAT NEW_PERFORMANCE_TIME_FORMAT NEW_PERFORMANCE_INCREMENT NEW_PERFORMANCE_TIME_RANGE NEW_PERFORMANCE_LINK_RANGE NEW_PERFORMANCE_COORDINATES NEW_PERFORMANCE_VEH_TYPES NEW_PERFORMANCE_TURN_FLAG NEW_PERFORMANCE_FLOW_TYPE Simulator_Base *exe • Initialize performance data • Cumulate flow and travel time data • Write performance file Performance Output Chicago RTSTEP TRANSIMS Model
Simulator OutputSnapshot and Occupancy NEW_SNAPSHOT_FILE NEW_SNAPSHOT_FORMAT NEW_SNAPSHOT_TIME_FORMAT NEW_SNAPSHOT_INCREMENT NEW_SNAPSHOT_TIME_RANGE NEW_SNAPSHOT_LINK_RANGE NEW_SNAPSHOT_COORDINATES NEW_SNAPSHOT_MAX_SIZE NEW_SNAPSHOT_LOCATION_FLAG NEW_SNAPSHOT_CELL_FLAG Simulator_Base *exe • Initialize snapshot data • Process vehicle locations • Write snapshot file Snapshot Output Simulator_Base *exe NEW_OCCUPANCY_FILE NEW_OCCUPANCY_FORMAT NEW_OCCUPANCY_TIME_FORMAT NEW_OCCUPANCY_INCREMENT NEW_OCCUPANCY_TIME_RANGE NEW_OCCUPANCY_LINK_RANGE NEW_OCCUPANCY_COORDINATES NEW_OCCUPANCY_MAX_FLAG • Initialize occupancy data • Cumulate cell occupancy data • Write occupancy file Occupancy Output Chicago RTSTEP TRANSIMS Model
Simulator OutputRidership and Turn Volume Simulator_Base *exe NEW_RIDERSHIP_FILE NEW_RIDERSHIP_FORMAT NEW_RIDERSHIP_TIME_FORMAT NEW_RIDERSHIP_TIME_RANGE NEW_RIDERSHIP_ROUTE_RANGE NEW_RIDERSHIP_ALL_STOPS • Initialize ridership data • Cumulate ridership data • Write ridership file Ridership Output Simulator_Base *exe NEW_TURN_VOLUME_FILE NEW_TURN_VOLUME_FORMAT NEW_TURN_VOLUME_FILTER NEW_TURN_VOLUME_TIME_FORMAT NEW_TURN_VOLUME_INCREMENT NEW_TURN_VOLUME_TIME_RANGE NEW_TURN_VOLUME_NODE_RANGE • Initialize turn volume data • Cumulate turning movements • Write turn volume file Turn Volume Output Chicago RTSTEP TRANSIMS Model
Multiple Threads, DLL and MPI • Boost library used for multi-threads • All SysLib classes available for dynamic linking to other software packages (e.g., Path Builder) • MPI Microsimulator under development • Expand to other thread-ready applications (e.g., Router, PlanPrep) • Software compiled for multiple platforms • Stand-alone single thread – 32 bit and 64 bit (Bin and Bin64) • Stand-alone multi-thread – 32 bit and 64 bin (BinBoost, Bin64Boost) • DLL single thread – 32 bit and 64 bit (BinDLL and Bin64DLL) • DLL multi-thread – 32 bit and 64 bit (BinBoostDLL and Bin64BoostDLL) • MPI multi-thread – 32 bit and 64 bit (BinMPI and Bin64MPI) Chicago RTSTEP TRANSIMS Model