1 / 24

Virtual Machine and Traffic Simulation

Virtual Machine and Traffic Simulation. Presenter: Bin Yu. Virtual Machine Technology. Virtual Machine VS Physical Machine Layer of software sitting on top of physical machine Provide comfortable computation environment for specialized requirement Examples:

fordon
Download Presentation

Virtual Machine and Traffic Simulation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Virtual Machine and Traffic Simulation Presenter: Bin Yu

  2. Virtual Machine Technology • Virtual Machine VS Physical Machine • Layer of software sitting on top of physical machine • Provide comfortable computation environment for specialized requirement • Examples: • Languages: JAVA, C Sharp, Perl, Python, R • Applications: Windows, Linux, Unix, Mac OS, MATLAB, Mathematics, MS Office, MapInfo • Advantages: easy usage (smooth learning curve, less code burden & requirement), rapid prototyping, etc • Disadvantages: memory hog, inferior computation performance

  3. Status of Traffic Simulation • Plenty of simulation platforms • Macroscopic Platforms: emme, TransCAD • Mesoscopic Platforms: Aimsun, TransModeler, TRANSIMS • Microscopic Platforms: VISSIM, PARAMICS, SUMO, MATSim, MITSIMLab • Differentiated in programming language, simulation mode, concrete traffic models utilized • Share a common methodology to approach traffic simulation • Select a set of concrete traffic models as the core to drive traffic simulation and hard wire logic of the models into the platform itself

  4. Current Simulation Methodology • Car following model • VISSIM – Wiedemann 74 & 99 car following model • PARAMICS: adopted Hans-Thomas Fritzsche’s model • MITSIMLab: General Motor model and/or Kazi’s model • INTEGRATION: single-regime Michael Van Aerde and Rakha model

  5. Current Simulation Methodology • Advantages: • Relative easy implementation for system developers • Fast computation speed • Better system performance • Disadvantages: • Inflexibility in terms of transportation research • Difficulty in simulation of other models due to close coupling with concrete models • Abstract Program Interface (API), Common Object Model (COM) • Reading the fxxk source code • Not a suitable research tool in fields as model prototyping, comparison, and validation

  6. New Simulation Approach • Transportation research anticipate a platform satisfying: • Loosely coupling with concrete traffic models • Smooth learning curve in coding traffic models • Successful Examples from other disciplines • MATLAB, as a successful engineering software • Highly hiding computer related details like memory management • A M-language of fruitful functions and mechanisms supporting common engineering computation well • A runtime virtual machine interpreting and executing scripting files written in M-language

  7. New Simulation Approach • A specialized computer language • Offering mechanisms for better supporting traffic simulation • Easy learning and user friendly • Dynamic data type computer scripting language with automatic memory management • A runtime virtual machine executing traffic simulation expressed in the specialized computer language • AE – Advanced Emulator

  8. AE System Development History • Developed from the scratch • GNU C compiler, Assembly like language (DynASM) • Dynamic Data Type Computer Scripting Language • Ideas and prototypes borrowed from LUA • Trace-based Just-In-Time compiler module • Consult LUAJIT related technologies • OPENGL (Silicon Graphics Incorporate) for 2D and 3D animation • Libraries, i.e. EXPAT, NEDMALLOC, and SQLITE, for daily household work

  9. Work Flow Chart • Step 1. write source scripts using the AE language • Step 2. use the language compiler to convert source scripts into an array of byte codes • Step 3. load the virtual machine with compiled byte codes and execute them

  10. Use the AE Language to write scripts defining various aspects of information, including logic of concrete traffic models to be simulated Input Source scripts The AE Language compiler The AE runtime virtual machine To be executed by the AE virtual machine Input Output Set of bytecodes recognizable to the AE runtime virtual machine

  11. Use the AE Language to write scripts defining various aspects of information, including logic of concrete traffic models to be simulated Input Source scripts The AE Language compiler The AE runtime virtual machine Done no To be executed by the AE virtual machine Is emul called? Input Output yes while (sim ticks < sim period) Set of bytecodes recognizable to the AE runtime virtual machine Step 1: according to predefined traffic volumes, release a number of new vehicles into the system List of Byte Codes Step 2: for each active vehicle, determine the set of suitable traffic models, according to the vehicle’s current position, i.e. traveling on a link or passing a node, and execute these models ++ sim ticks Execution of Scripts Sample Byte Codes Output Step 3: for each active vehicle, physically move it to the position designated in Step 2

  12. The AE Language • Specially designed and implemented for traffic simulation • Aspect I – provide fruitful system level functions • Aspect II – offer a language mechanism for coding logic of concrete traffic models, also named rule

  13. System Functions • Components of Microscopic Traffic Simulation • Component 1 - Transportation Network • Component 2 - Traffic Volume • Component 3 - Vehicle Characteristics, including geometry size, mechanical properties • Component 4 - Logic of Traffic Models • Traditional simulation platforms • Require component 1, 2, and 3 • Component 4 not required as logic of traffic models are hardwired

  14. System Functions • Total 253 system function • 142 simulated related functions and divide into six categories • Network related (54 functions) • Vehicle Manipulated related (9 functions) • Traffic Model, or Rule, Execution related (18 functions) • Traffic Model, or Rule, Manipulation related (9 functions) • Vehicle Category Manipulation related (33 functions) • Vehicle Distribution related (18 functions) • 111 non-simulated related functions, including 45 mathematical functions, and so on List of System Functions

  15. Logic of Traffic Models • AE Vs Traditional simulation platforms • Traditional platforms – hardwire concrete traffic models, or model dependent • AE – model independent • Advantage – flexible in terms of traffic model simulation • Disadvantage – user responsibility to program logic of traffic models to be simulated • Introduce the concept of “rule” in the language level to support programming traffic models’ logic

  16. Rule Vs Subroutine • Two forms of functions • Subroutine – used to define sub-functionalities • Rule – used to define logic of traffic models to be simulated; distinguished from subroutine in aspects of: • Prefixed with keyword rule, not sub • Not callable in source scripts • Parameter list indicates traffic related information associated with model subname (param1, param2, param3) { … Logic of Subroutine … } rulename (CONVEY = {var1, var2}, LINK = {var3}, LANE = {var4, var5}, NODE = {var6, var7, var8}, MODEL = {var10}) { … Logic of Traffic Model … }

  17. Execution of Script • Writing source scripts defining transportation network, traffic network, vehicle characteristics through system functions and implementing logic of corresponding traffic models, or rules, to be simulated • Loaded into the language compiler and the virtual machine to fulfill the simulation • Source scripts are executed in the interpreting mode • Byte code interpretation is costly, resulting in inferior computation performance Work Flow Chart

  18. Just-In-Time Compilation • LuaJIT Technology • Trace based Just-In-Time compilation • Trace runtime execution of byte codes • Dynamically translate hot byte codes into equivalent machine codes • Execution of machine codes is much faster than execution of byte codes

  19. Just-In-Time Compilation • AE Just-In-Time Compilation • Based on LuaJIT technology • Improvements • Sparse matrix based memory efficient snapshot storage algorithm • Improved register spill-slot shuffling algorithm • Improved hot byte code tracing methodology through inserting marking purpose byte code • Performance optimization through reducing redundant calling of simulation related system functions • Support tracing of hot traffic model, or rule

  20. NO YES Is exit hotexit? run multiple traces before returning to Interpreter Change to JIT mode; Run machine instructions YES Start a trace Run machine instructions? NO NO NO Interpreter YES Tracer Source script Set of bytecodes Is bytecode hotspot? Is trace started? YES Translate bytecode to IR List of IR Codes Assemble the trace; Patch relevant bytecode Assembler YES Trace succeed? END NO JIT Dumps Fail the trace; Post clean; Restart the process

  21. Just-In-Time Compilation • Can bring more than 10 times performance improvements

  22. Two Lane Circular Road Demo

More Related