Station
as shown in Program_Monorail.cs
file. Station
s 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. The ending time of simulation is 1000, and there is no callback function used here.
static Coupled MakeMonorail(string name) { Coupled monorail = new Coupled(name); Station ST0 = new Station("ST0", false, 10); ST0.CollectStatistics(true); monorail.AddModel(ST0); Station ST1 = new Station("ST1", true, 30); ST1.CollectStatistics(true); monorail.AddModel(ST1); Station ST2 = new Station("ST2", false, 10); ST2.CollectStatistics(true); monorail.AddModel(ST2); Station ST3 = new Station("ST3", true, 10); ST3.CollectStatistics(true); 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; } static void Main(string[] args) { Coupled ms = MakeMonorail("mr"); SRTEngine Engine = new SRTEngine(ms, 1000, null); Engine.RunConsoleMenu(); }
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.
When the simulation stops, DEVS# makes the beep sounds every 1
second. To stop the beep sounds, input RETURN key (two times it is
kind of bugs but I could not fix it yet). The following screen is
the results of the command print
p
.
mr.ST0 phase= Empty, nso= True: 0.590 phase= Empty, nso= False: 0.000 phase= Loading, nso= False: 0.010 phase= Sending, nso= True: 0.200 phase= Loading, nso= True: 0.190 phase= Waiting, nso= True: 0.010 mr.ST1 phase= Sending, nso= False: 0.010 phase= Empty, nso= False: 0.020 phase= Loading, nso= False: 0.400 phase= Sending, nso= True: 0.190 phase= Empty, nso= True: 0.190 phase= Loading, nso= True: 0.190 mr.ST2 phase= Empty, nso= True: 0.400 phase= Loading, nso= True: 0.000 phase= Loading, nso= False: 0.200 phase= Sending, nso= True: 0.200 phase= Empty, nso= False: 0.200 mr.ST3 phase= Sending, nso= False: 0.010 phase= Empty, nso= False: 0.210 phase= Loading, nso= False: 0.200 phase= Sending, nso= True: 0.190 phase= Empty, nso= True: 0.390The 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= Loading, nso= False: 0.200
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% (phase=
Loading, nso= False: 0.400
and phase= Loading,
nso= True: 0.190
). This causes ST0
to transition
into Wait
because ST1
stays so long at
Loading
.
#define REMEMBERING
'' in
Station.cs
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
?