CQM  -  C++ Queuing Model
by Raczynski Consulting
Useful inks:

Vehicle Dynamics simulation

Queuing model simulator / animator (no programming)

New book
 on simulation by S.Raczynski



Fluid dynamics simulation

Molecular simulation and solidification

Molecular simulation and solidification

SimBall : System Dynamics

Simulation Encyclopedia



You are visitor no.(since April 2002)  
free hit counter




Any trouble with your discrete event simulation in C?  Are you asked to develop your own application as a part of a project on mass service and/or queuing systems? Need examples for your simulation course? C++ CQM helps you in creating C++ models of systems with waiting lines and servers. As the result, you get C++ code. You can run it, or do with it what you want. Note that CQM has the copyright, but the resulting C source code does not.

We recommend that you also visit the Queuing Model Simulator page. QMS is another way to simulate queuing systems. CQM provides the source code that can be used in your programs and edited, while QMS is a complete simulation package. QMS is more versatile and can generate animations, no programming needed. Compare the two options, according to your needs.

C Queuing Model (CQM) is a C++ source code generator for queuing models.
The resulting code is a complete C++ project, compatible with the Borland's C++Builder 6 or later. It should be noted that CQM has been developed as a didactic tool, rather than a professional simulator. So, it works well for "typical" queuing mass-service models, but may be insufficient for manufacturing simulation or for models with complicated restriction or additional conditions imposed on model components. On the other hand, quite big models can be simulated, up to 1000 blocks per model.

  *  The main CQM blocks are: input flow (entity generator), queue, server, entity flow split and terminating block.

*  Graphical result presentation. While running the generated code, the queues appear on the screen as moving bars, the state of the servers and other blocks is shown during the simulation. Then a plot is generated for each queue. Finally, the code generates a typical "GPSS-like" statistics.

 *  Implementation: CQM runs on an IBM PC and compatibles. The requirements are the same as for C++Bulder.

    Some of the most popular applications of computer simulation are queuing models.  No shop, bank, post office or  complex production system can  be analyzed without considering lines of buyers, clients, workers or parts of machinery formed into lines or waiting in stacks to be served, repaired or revised. Similar methods are used to simulate factories  and, in particular the Flexible Manufacturing Systems (FMS). 

CQM is very similar to the PASION QMGW module. Both programs accept up to 1000 blocks per model (queues, servers, etc.). However, QMGW, being apart of a bigger simulation package is more flexible and versatile. This is due to the fact that QMGW generates PASION source code that is automatically translated to Delphi Pascal, compiled and executed. So, the user can include his own Pascal procedures, for example his own random number generators, or some more complicated output selection rules for the split points. CQM does not support such features, but it is still a quite useful and easy to use tool. The random number generators of CQM can only be selected from a list of several more useful distributions. But many of the other features of QMGW are supported by CQM. The CQM model is defined graphically, using the following blocks. As stated in the summary, CQM is a didactic tool. The result of CQM run is a C++ code, while QMGW generates Pascal code and runs it automatically.

The main concepts of the model generated by CQM are processes and events. A process is a description of the "life" of a model active entity that passes through the model fixed resources. Each process includes a series of event specifications. The execution of an event is carried out by the Clock function. The clock manages the global model time variable named mtime and retrieves the event messages from the event queue. Each time Clock gets a message, the corresponding event is being executed and the model time is updated. The model processes must be instantiated, creating one or more entities of the process type. From inside the body of any event, any entity can schedule any other event (of itself or of any other entity), or re-schedule the same event for further, may be repetitive, execution. Event scheduling consists in putting the event message on the event queue. Clock mechanism retrieves the event with the lowest executing time, executes it and looks for the next event, until no more events remain in the event queue. Obviously this means that the managing of the event queue requires a good sorting algorithm. Those who are familiar with discrete event simulation know that a simulation language or package is so good as good is its event queue handling algorithm.

The following figure shows an example of CQM model. It is a small mass service system. Blocks 1, 16 and 46 are client entry points (generators). Blocks 2, 12, 17 and 47 are split points, which direct the clients to other model blocks. Red FIFO blocks are waiting lines, and blue rectangles are servers. The blocks 13, 14, 20, 31, 32, 18, 42, 43, 19, 15, 57, 58 and 53 are exits. This model structure can be created wit CQM within less than 10 minutes of user work. Then, the user is prompted to give the block parameters (service and inter-arrival times, split rules etc.). After completing the task, the user can generate the C++ code, ready to be run with C++Builder, to work on it or to port it to other platforms.

 The detailed explanation of the generated code as well as the user manual comes in the help file included in the package.

Examples of CQM screens produced by the generated C code.


To order press the button below. The price of CQM package is US$29.


Contact:    Stanislaw Raczynski