Presentation is loading. Please wait.

Presentation is loading. Please wait.

SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems.

Similar presentations


Presentation on theme: "SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems."— Presentation transcript:

1 SIMetro Welcome!

2 SIMetro A Language for Simulating Metro Systems

3 SIMetro Our Team Stefanie Weisman Project Manager Dan Iter Language Guru Qianbo Wang System Architect Alan Verga System Integrator Xiao Tan Tester/Validator

4 SIMetro SIMetro can help! Tired of mobbed stations?

5 SIMetro Features of SIMetro 1 Easy to learn and use 2 Real-world applications, Practical results 3 Textual and Graphical Output 4 Helps you go from this… TO THIS.

6 SIMetro Modular, Reusable Code //mymap.map file Station SA, SB; Population P1 {(SB, 10)} Population P2 {(SA, 5)} Station SA {“110ST”;Coordinates (1,5); Population P1; } Station SB {“116ST”;Coordinates (5,4); Population P2; } Line L {(A, B, A);Frequency 4; Capacity 12; Speed 3; } //end mymap.map file //mystat.stat load mymap.map; Stat pplTimesTwo(Time t){ num ppl = getNumPassengers(t) * 2; return ppl;} //end mystat.stat //mysim.sim file load mymap.map; load mystats.stat; Time lateNight = [0, 6]; Time morningRush = [6, 10]; Time day = [10, 15]; Simulate (24) { //changeRate (Time, sourceStation, DestinationStation, newRate); changeRate (latenight, SA, SB, 1); changeRate (day, SA, SB, *2); changeFrequency (day, L, +4); skipStation (day, L, A); } showGUI(5); num val = pplTimesTwo(day); print "This is the number of people in the system at time “ day.start "to time " day.end ": " val; //end mysim.sim file

7 SIMetro Language SIMtax  Object Orientation “SIMplified”  Stations  Populations People that live around a station Values can be scaled or real.  Lines  Times Instants or time intervals during cycle. Can represent anything from hours to ranges (rush hour) to seasons

8 SIMetro Managing a Simulation  Heavy lifting of creating a simulation is done for you.  No fuss with small details and book keeping.  Simple modifiers that go inside of the main loop statement.  ChangeRate, changeFrequency, changeSpeed, etc…

9 SIMetro User Defined Statistics  Use library functions to construct your own project specific statistics  Simulation stores values of your statistic at all times  Call statistics just like functions, using same syntax as library functions  Example Code: Stat WestSideAvgWaitTime(Time sometime) { num num_lines = 2; num avgWait = 0; //use library function for average wait time of red and blue lines avgWait = avgWait + getAvgWaitTime(Red_line, sometime); avgWait = avgWait + getAvgWaitTime(Blue_line, sometime); //divide wait time by number of lines avgWait = avgWait /num_lines; return avgWait; }

10 SIMetro Lexer Parser Semantic Analysis Source Program SIMetro.g SIMetro Simulator Timeline Swing Interface SIMetro Controller Front End Back End.class file.class file ANTLR simwalk.g Java code Java code 1 2 3 stat1 stat2 stat3 1 2 3 stat1 stat2 stat3 1 2 3 stat1 stat2 stat3 1 2 3 stat1 stat2 stat3

11 SIMetro Sample Program //mymap.map file Station SA, SB; Population P1 {(SB, 10)} Population P2 {(SA, 5)} Station SA {“110ST”;Coordinates (1,5); Population P1; } Station SB {“116ST”;Coordinates (5,4); Population P2; } Line L {(A, B, A);Frequency 4; Capacity 12; Speed 3; } //end mymap.map file //mystat.stat load mymap.map; Stat pplTimesTwo(Time t){ num ppl = getNumPassengers(t) * 2; return ppl;} //end mystat.stat //mysim.sim file load mymap.map; load mystats.stat; Time lateNight = [0, 6]; Time morningRush = [6, 10]; Time day = [10, 15]; Simulate (24) { //changeRate (Time, sourceStation, DestinationStation, newRate); changeRate (latenight, SA, SB, 1); changeRate (day, SA, SB, *2); changeFrequency (day, L, +4); skipStation (day, L, A); } showGUI(5); num val = pplTimesTwo(day); print "This is the number of people in the system at time “ day.start "to time " day.end ": " val; //end mysim.sim file

12 SIMetro Intermediate Code public class main { static ArrayList stationList=new ArrayList (); static ArrayList lineList=new ArrayList (); public static void main(String[] args) { Station SA=new Station("110ST", new Coordinate(0,0)); stationList.add(SA); Station SB=new Station("116ST", new Coordinate(0,6)); stationList.add(SB); Station arr[]=new Station[3]; arr[0]=SA; arr[1]=SB; Line LA= new Line("Line1", 0.2, 2.0, 100,arr ); lineList.add(LA); PopItem PIA=new PopItem (SA,5); PopItem PIArr[]=new PopItem[1]; PIArr[0]=PIA; Population PA=new Population(PIArr); SA.setPop(PA); Simulate sim=new Simulate(); sim.createRoutingTables(stationList,lineLi st); for(int time=0;time<60;time++){ sim.peopleArrive(); sim.trainArrive(); sim.trainMove(); }

13 SIMetro Output GUI

14 SIMetro Integrate the front end and the back end and test how it works. Use Black Box testing to test: Grammar The Front End The Back End Test the compiler with different SIMetro programs. Testing Methods Unit Testing Integration Testing System Testing

15 SIMetro Designing Tools Antlr Java API Net Beans Google Code SVN Eclipse Designing Tools SIMetro

16 Conclusion  Learned:  ANTLR Tool Suite  Communicate Communicate Communicate  Simplicity Trumps Ambition  What Worked:  Division of Labor  Global Updates  Done Differently: Focus on linguistic details earlier

17 SIMetro Company Logo ALL ABOARD! SIMetro! Flexible SIMple Intuitive

18 SIMetro SIMetro: A Language for Simulating Metro Systems


Download ppt "SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems."

Similar presentations


Ads by Google