Simulating a queue model

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • martial
    New Member
    • Jan 2007
    • 1

    Simulating a queue model

    HI EVERYONE:

    i'm trying to simulate the following program which is the implementation of a m/m/2/k queue system, and i've got some errors.Could someone help me to solve this problem?

    the program is :

    #include <stdio.h> // Needed for printf()
    #include "smpl.h" // Needed for SMPL
    #define K 10
    //===== 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/D/2/K Queue");

    // Initialize server facility (single server)
    server=facility ("server", 2);

    // Schedule arrival event at time 0 to kick-off simulation
    schedule(1, 0.0, customer);

    // Loop while simulation time is less than te
    while (time() < te)
    {
    // "Cause" the next event on the event list
    cause(&event,&c ustomer);

    // Process the event
    switch(event)
    {
    case 1: // *** Arrival
    if ((inq(server) + status(server)) < K)
    schedule(2, 0.0, customer);
    schedule(1, 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();
    }


    The errors are:
    md2k.obj : error LNK2001: unresolved external symbol "void __cdecl report(void)" (?report@@YAXXZ )
    md2k.obj : error LNK2001: unresolved external symbol "void __cdecl release(int,int )" (?release@@YAXH H@Z)
    md2k.obj : error LNK2001: unresolved external symbol "double __cdecl expntl(double)" (?expntl@@YANN@ Z)
    md2k.obj : error LNK2001: unresolved external symbol "int __cdecl request(int,int ,int)" (?request@@YAHH HH@Z)
    md2k.obj : error LNK2001: unresolved external symbol "int __cdecl status(int)" (?status@@YAHH@ Z)
    md2k.obj : error LNK2001: unresolved external symbol "int __cdecl inq(int)" (?inq@@YAHH@Z)
    md2k.obj : error LNK2001: unresolved external symbol "void __cdecl cause(int *,int *)" (?cause@@YAXPAH 0@Z)
    md2k.obj : error LNK2001: unresolved external symbol "double __cdecl time(void)" (?time@@YANXZ)
    md2k.obj : error LNK2001: unresolved external symbol "void __cdecl schedule(int,do uble,int)" (?schedule@@YAX HNH@Z)
    md2k.obj : error LNK2001: unresolved external symbol "int __cdecl facility(char *,int)" (?facility@@YAH PADH@Z)
    md2k.obj : error LNK2001: unresolved external symbol "void __cdecl smpl(int,char *)" (?smpl@@YAXHPAD @Z)
    Debug/md2k.exe : fatal error LNK1120: 11 unresolved externals
    Error executing link.exe.

    md2k.exe - 12 error(s), 0 warning(s)
  • Motoma
    Recognized Expert Specialist
    • Jan 2007
    • 3236

    #2
    Originally posted by martial
    The errors are:
    md2k.obj : error LNK2001: unresolved external symbol "void __cdecl report(void)" (?report@@YAXXZ )
    md2k.obj : error LNK2001: unresolved external symbol "void __cdecl release(int,int )" (?release@@YAXH H@Z)
    md2k.obj : error LNK2001: unresolved external symbol "double __cdecl expntl(double)" (?expntl@@YANN@ Z)
    md2k.obj : error LNK2001: unresolved external symbol "int __cdecl request(int,int ,int)" (?request@@YAHH HH@Z)
    md2k.obj : error LNK2001: unresolved external symbol "int __cdecl status(int)" (?status@@YAHH@ Z)
    md2k.obj : error LNK2001: unresolved external symbol "int __cdecl inq(int)" (?inq@@YAHH@Z)
    md2k.obj : error LNK2001: unresolved external symbol "void __cdecl cause(int *,int *)" (?cause@@YAXPAH 0@Z)
    md2k.obj : error LNK2001: unresolved external symbol "double __cdecl time(void)" (?time@@YANXZ)
    md2k.obj : error LNK2001: unresolved external symbol "void __cdecl schedule(int,do uble,int)" (?schedule@@YAX HNH@Z)
    md2k.obj : error LNK2001: unresolved external symbol "int __cdecl facility(char *,int)" (?facility@@YAH PADH@Z)
    md2k.obj : error LNK2001: unresolved external symbol "void __cdecl smpl(int,char *)" (?smpl@@YAXHPAD @Z)
    Debug/md2k.exe : fatal error LNK1120: 11 unresolved externals
    Error executing link.exe.
    It looks like the linker is having trouble finding the function calls you are making. Is there a .c or .cpp file that needs to be added to your project? Is there an external DLL which you need to link against?

    Comment

    • horace1
      Recognized Expert Top Contributor
      • Nov 2006
      • 1510

      #3
      you are including the SMPL header file smpl.h and calling the functions so you also need to compile and link the smpl library which is probably in a file smpl.c
      If you don't have it you can download it from the link in the Simulation Tools section of
      http://www.csee.usf.ed u/~christen/tools/toolpage.html

      Comment

      Working...