model2.cc


//////////////////////////////////////////////////////////////////////////// // Model model2.cc SIMLIB/C++ // // Simple test model of queuing system // #include "simlib.h" // global objects: Facility Box("Box"); Histogram Table("Table",0,25,20); class Customer : public Process { double Prichod; // atribute of each customer void Behavior() { // --- behavoir specification --- Prichod = Time; // incoming time Seize(Box); // start of service Wait(10); // time of service Release(Box); // end of service Table(Time-Prichod); // waiting and service time } }; class Generator : public Event { // model of system's input void Behavior() { // --- behavior specification --- (new Customer)->Activate(); // new customer Activate(Time+Exponential(1e3/150)); // } }; int main() { // experiment description Print(" model2 - SIMLIB/C++ example\n"); SetOutput("model2.out"); Init(0,1000); // experiment initialization for time 0..1000 (new Generator)->Activate(); // customer generator Run(); // simulation Box.Output(); // print of results Table.Output(); return 0; }

model2.out


+----------------------------------------------------------+ | FACILITY Box | +----------------------------------------------------------+ | Status = BUSY | | Time interval = 0 - 1000 | | Number of requests = 100 | | Average utilization = 0.993702 | +----------------------------------------------------------+ Input queue 'Box.Q1' +----------------------------------------------------------+ | QUEUE Q1 | +----------------------------------------------------------+ | Time interval = 0 - 1000 | | Incoming 153 | | Outcoming 98 | | Maximal length = 55 | | Average length = 33.4586 | | Minimal time = 4.15499 | | Maximal time = 396.788 | | Average time = 231.744 | +----------------------------------------------------------+ +----------------------------------------------------------+ | HISTOGRAM Table | +----------------------------------------------------------+ +----------------------------------------------------------+ | STATISTIC Table | +----------------------------------------------------------+ | Min = 10 Max = 401.78 | | Number of records = 99 | | Average value = 235.396 | +----------------------------------------------------------+ +------------+------------+----------+----------+----------+ | from | to | n | rel | sum | +------------+------------+----------+----------+----------+ | 0.000 | 25.000 | 7 | 0.070707 | 0.070707 | | 25.000 | 50.000 | 6 | 0.060606 | 0.131313 | | 50.000 | 75.000 | 5 | 0.050505 | 0.181818 | | 75.000 | 100.000 | 3 | 0.030303 | 0.212121 | | 100.000 | 125.000 | 6 | 0.060606 | 0.272727 | | 125.000 | 150.000 | 4 | 0.040404 | 0.313131 | | 150.000 | 175.000 | 4 | 0.040404 | 0.353535 | | 175.000 | 200.000 | 5 | 0.050505 | 0.404040 | | 200.000 | 225.000 | 3 | 0.030303 | 0.434343 | | 225.000 | 250.000 | 3 | 0.030303 | 0.464646 | | 250.000 | 275.000 | 6 | 0.060606 | 0.525253 | | 275.000 | 300.000 | 5 | 0.050505 | 0.575758 | | 300.000 | 325.000 | 3 | 0.030303 | 0.606061 | | 325.000 | 350.000 | 8 | 0.080808 | 0.686869 | | 350.000 | 375.000 | 20 | 0.202020 | 0.888889 | | 375.000 | 400.000 | 10 | 0.101010 | 0.989899 | | 400.000 | 425.000 | 1 | 0.010101 | 1.000000 | | 425.000 | 450.000 | 0 | 0.000000 | 1.000000 | | 450.000 | 475.000 | 0 | 0.000000 | 1.000000 | | 475.000 | 500.000 | 0 | 0.000000 | 1.000000 | +------------+------------+----------+----------+----------+
Last modification: 21. March 2002

If you have some suggestions to improve this page, please mail to peringer AT fit.vutbr.cz