1 / 8

Overview on SMPL

Overview on SMPL. Slides are adapted from http://www.cs.sunysb.edu/~cse605/. SMPL. SMPL is a discrete event based simulator written in C It provides a set of C functions to build event based simulation models

gwen
Download Presentation

Overview on SMPL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Overview on SMPL Slides are adapted from http://www.cs.sunysb.edu/~cse605/

  2. SMPL • SMPL is a discrete event based simulator written in C • It provides a set of C functions to build event based simulation models • SMPL was written by M. H. MacDougall and is described in Simulating Computer Systems, Techniques and Tools, The MIT Press, 1987

  3. SMPL main C libraries -to model events and elements • Modeling elements • facility(server plus queue) • token(integer serving as customer id) • event • Managing the queue(s) • schedule • cause(same as dequeue) • request • release • Various random number generators

  4. request and release functions • request (facility, token, priority) • Requests the server. • If free, makes it busy. • If busy, enqueues the request in the facility queue. (Actually enqueues the current event). • returns status (busy/free). • release (facility, token) • Makes server free. • If the facility queue is non-empty, dequeuesthe head entry from the queue and schedules that event at the current time.

  5. M/M/1 simulation using SMPL Performing simulation until the simulation time is over Pair of schedule and cause keep track of events. Pair of request and release manage the server queue Initializing the system and scheduling the first request while (time()<te) { cause(&event,&customer); //dequeue the event whose time is triggered switch(event) { case 1: /* arrival */ schedule(2,0.0,customer); // a request is ready to receive service schedule(1,expntl(Ta),customer); //schedule the arrival of next request break; case 2: /* request server */ if (request(server,customer,0)==0) then //queue the request in the server schedule(3,expntl(Ts),customer); //schedule the service time break; case 3: /* release server */ release(server,customer); //release the request break; } } int customer=1,event,server; smpl(0,"M/M/1 Queue"); server=facility("server",1); schedule(1,0.0,customer);

  6. M/M/1 simulation using SMPLThree types of events • Arrival • Schedules next arrival after inter-arrival time. • Schedules Request at current time. • Request • Schedules Release after service time, if facility free. • Implicitly queues the event (i.e., the request) at facility queue, if server busy. • Always makes server busy. • Release • Schedules the event at the head of facility queue, if any, • at current time. (This event will be the request event of • the following customer.) • Always makes facility free.

  7. Event scheduling graph Current time, ∆Ta=0 Facility is free Schedule for service time, ∆Ts Arrival Release Request Facility is nonempty, and ∆Ts=0 ∆Ta=inter-arrival time case 1: //arrival schedule(2,0.0,customer); schedule(1,expntl(Ta),customer); case 3: /* release server */ release(server,customer); case 2: /* request server */ if (request(server,customer,0)==0) then schedule(3,expntl(Ts),customer);

  8. SMPL installation • SMPL source code is attached to the handout • SMPL installation: • You can either make a static library or compile your programs along with SMPL C functions. • Run make in the source directory to build the libsimpl.a, copy it tothe lib directory. • Useful links

More Related