Events Step by StepModel Implementation (1)
The doInitalSchedules() Method |
||
The third and last of the inherited methods from desmoj.core.simulator.Model is called doInitalSchedules(). Its purpose is to place all events or process activations, respectively, on the event list which are needed to get the simulation started. In our case, we have to schedule the first truck generator event. This will create the first truck and let it arrive in our system and then schedule itself again to generate the next truck. /** * Activates dynamic model components (events). * * This method is used to place all events or processes on the * internal event list of the simulator which are necessary to start * the simulation. * * In this case, the truck generator event will have to be * created and scheduled for the start time of the simulation. */ public void doInitialSchedules() { // create the TruckGeneratorEvent TruckGeneratorEvent truckGenerator = new TruckGeneratorEvent(this, "Truck Generator", true); // schedule for start of simulation truckGenerator.schedule(new TimeSpan(0), TimeUnit.MINUTES); } |
||
http://desmoj.sourceforge.net/tutorial/events/impl3.html |