SMPL - SMPL Simulation Language Ali Mohammad Zareh Bidoki...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: SMPL Simulation Language Ali Mohammad Zareh Bidoki From Simulating Computer Systems: Techniques and Tools, M.H. MacDougall , MIT Press Series in Computer Systems, 1987 ٢ Simulation System Components Shared Resources (Memory, bus,…) Tokens (Customer,Packet,Inst, process) Event Scheduler (clk) ٣ Simulation Language & Operating System ¡ Resource Management ¡ Event Scheduling ¡ Queuing ¡ Priority ¡ Preemption ٤ Simulating M/M/1 with SMPL //----- Include files --------------------------------------------------------- #include <stdio.h> // Needed for printf() #include "smpl.h" // Needed for SMPL //===== Main program ========================================================== void main(void) { real Ta = 200; // Mean interarrival time (seconds) real Ts = 100; // Mean service time real te = 1.0e6; // Total simulation time int customer = 1; // Customer id (always '1' for this simulation) int event; // Event (1 = arrival, 2 = request, 3 = completion) int server; // Handle for server facility // Initialize SMPL subsystem smpl(0, "M/M/1 Queue"); // Initialize server facility (single server) server=facility("server", 1); // Schedule arrival event at time 0 to kick-off simulation schedule(1, 0.0, customer); ٥ Simulating M/M/1 with SMPL // Loop while simulation time is less than te while (time() < te) { // "Cause" the next event on the event list cause(&event,&customer); // Process the event switch(event) { case 1: // *** Arrival schedule(2, 0.0, customer); schedule(1, expntl(Ta), customer); break; case 2: // *** Request Server if (request(server, customer, 0) == 0) schedule(3, expntl(Ts), customer); break; case 3: // *** Release server release(server, customer); break; } } // Output standard SMPL report report(); } ٦ SMPL ¡ SMPL is a set of C functions for building event- based, discrete-event simulation models. SMPL was written by M. H. MacDougall and is described in Simulating Computer Systems, Techniques and Tools , The MIT Press, 1987. ٧ SMPL Entities ¡ Facilities ¡ Tokens ¡ Events ٨ Facilities ¡ A facility typically represents some work-performing resource...
View Full Document

This note was uploaded on 11/13/2011 for the course IE 230 taught by Professor Akbari during the Spring '11 term at Amirkabir University of Technology.

Page1 / 12

SMPL - SMPL Simulation Language Ali Mohammad Zareh Bidoki...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online