simetro welcome!. simetro a language for simulating metro systems

18
SIMetro Welcome!

Upload: simon-lamb

Post on 17-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems

SIMetro

Welcome!

Page 2: SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems

SIMetro

SIMetroA Language for Simulating Metro Systems

Page 3: SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems

SIMetro

Our Team

Stefanie W

eisman

Project M

anager

Dan Iter

Language Guru

Qianbo W

angS

ystem A

rchitect

Alan V

ergaS

ystem Integrator

Xiao Tan

Tester/Validator

Page 4: SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems

SIMetro

SIMetro can help!

Tired of mobbed stations?

Page 5: SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems

SIMetro

Features of SIMetro1

Easy to learn and use

2

Real-world applications, Practical results

3

Textual and Graphical Output

4

Helps you go from this…

TO THIS.

Page 6: SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems

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

Page 7: SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems

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

Page 8: SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems

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…

Page 9: SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems

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 linesavgWait = avgWait +

getAvgWaitTime(Red_line, sometime);avgWait = avgWait +

getAvgWaitTime(Blue_line, sometime);//divide wait time by number of linesavgWait = avgWait /num_lines;return avgWait;}

Page 10: SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems

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

JavacodeJavacode 1 2 3

stat1

stat2

stat3 1 2 3

stat1

stat2

stat3

1 2 3

stat1

stat2

stat3

1 2 3

stat1

stat2

stat3

Page 11: SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems

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

Page 12: SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems

SIMetro

Intermediate Codepublic class main {

static ArrayList<Station> stationList=new ArrayList<Station>();

static ArrayList<Line> lineList=new ArrayList<Line>();

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);

Page 13: SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems

SIMetro

Output GUI

Page 14: SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems

SIMetro

Integrate the front end and the back end and test how it works.

Use Black Box testing to test:GrammarThe Front EndThe Back End

Test the compiler with different SIMetro programs.

Testing Methods

Unit Testing

IntegrationTesting

SystemTesting

Page 15: SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems

SIMetro

Designing Tools

Antlr

Java API Net

Beans

Google CodeSVN

Eclipse

Designing Tools

SIMetro

Page 16: SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems

SIMetro

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

Page 17: SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems

SIMetroCompany Logo

ALL ABOARD!

SIMetro!SIMetro!

FlexibleFlexible

SIMpleSIMple

IntuitiveIntuitive

Page 18: SIMetro Welcome!. SIMetro A Language for Simulating Metro Systems

SIMetro

SIMetro: A Language for Simulating Metro Systems