next up previous contents index
Next: Performance Evaluation Up: Monorail System Previous: Station   Contents   Index

Monorail System

To construct the monorail system, we will make four instances from Station. Stations ST1 and ST3 each have one vehicle initially, the other two have none, while the loading time of ST1 is 30 time-units, the other three each have a loading time of 10.

Each station will collect its own performance data. All couplings are connected as shown in Figure 3.3.

Coupled* MakeMonorail(const char* name) {
    Coupled* monorail = new Coupled(name);
    //-- Add Station 0 to 3 ----
    Station* ST0 = new Station("ST0", false, 10);
    ST0->CollectStatistics();

    Station* ST1 = new Station("ST1", true, 30);
    ST1->CollectStatistics();

    Station* ST2 = new Station("ST2", false, 10);
    ST2->CollectStatistics();

    Station* ST3 = new Station("ST3", true, 10);
    ST3->CollectStatistics();

    monorail->AddModel(ST0);
    monorail->AddModel(ST1);
    monorail->AddModel(ST2);
    monorail->AddModel(ST3);
    //---------------------------------------------
    //-------- Add internal couplings ------------
    monorail->AddCP(ST0->ovehicle, ST1->ivehicle);
    monorail->AddCP(ST1->ovehicle, ST0->ipull);

    monorail->AddCP(ST1->ovehicle, ST2->ivehicle);
    monorail->AddCP(ST2->ovehicle, ST1->ipull);

    monorail->AddCP(ST2->ovehicle, ST3->ivehicle);
    monorail->AddCP(ST3->ovehicle, ST2->ipull);

    monorail->AddCP(ST3->ovehicle, ST0->ivehicle);
    monorail->AddCP(ST0->ovehicle, ST3->ipull);
    //---------------------------------------------
    return monorail;
}
If you try the command run, DEVS# will simulate system performance until it reaches the simulation ending time of 1000 time units. The default simulation speed of DEVS# is the real time so it will take 1000 seconds in reality. However, the user don't have to wait until the simulation ending time. Don't forget to use the command pause to stop a simulation run any time you want.

We can change the simulation speed as maximum by scale 0 . If you don't care of animation output, you can set animode none. In addition, if you don't want to see the status of discrete state transitions, you can set dtmode none too.

The following screen is the results of the command print p.

CPU Run Time: 12.375000 sec.
mr.ST0
phase=E,nso=false: 0
phase=E,nso=true: 0.59
phase=L,nso=false: 0.01
phase=L,nso=true: 0.19
phase=S,nso=true: 0.2
phase=W,nso=true: 0.01

mr.ST1
phase=E,nso=true: 0.21
phase=L,nso=false: 0.4
phase=L,nso=true: 0.19
phase=S,nso=true: 0.2

mr.ST2
phase=E,nso=false: 0.2
phase=E,nso=true: 0.4
phase=L,nso=false: 0.2
phase=L,nso=true: 0
phase=S,nso=true: 0.2

mr.ST3
phase=E,nso=false: 0.19
phase=E,nso=true: 0.41
phase=L,nso=false: 0.2
phase=S,nso=true: 0.2
The performance index for each station is the ratio of the total time the station stays in each state divided by the simulation run time of 1000. In the example above, for mr.ST3, phase=L,nso=false: 0.2 indicates that the total time ST3 spent in the LOADING state was about 20% of the length of simulation run time of 1000. That means that station 3 spent about 200 time-units in the LOADING phase.

It is not hard to find that since ST1::loading_t=30 is three times longer than other stations' loading_t, ST1 stays at LOADING about 59% of the simulation time. This causes ST0 to transition into WAIT because ST1 stays so long at LOADING.

Exercise 4.3   Let's comment out the line of ``#define REMEMBERING'' in Station.h of Ex_Monorial example. Build it again and try run. When the run stops, try print q and print p. Is there a station which gets into COLLIDED?


next up previous contents index
Next: Performance Evaluation Up: Monorail System Previous: Station   Contents   Index
MHHwang 2007-05-07