Система массового обслуживания

Автор работы: Пользователь скрыл имя, 18 Декабря 2014 в 08:50, курсовая работа

Описание работы

Процессы функционирования различных систем и сетей связи могут быть представлены той или иной совокупностью систем массового обслуживания (СМО) - стохастических, динамических, дискретно-непрерывных математических моделей. Исследование характеристик таких моделей может проводиться либо аналитическими методами, либо путем имитационного моделирования.

Файлы: 1 файл

ПЗ.docx

— 190.17 Кб (Скачать файл)

                {

                    EVM1.Release();

                    if (queueEVM1.QueueSize>0)

                    {

                        queueEVM1.Depart();

 

 

                        EVM1.Seize();

 

 

 

                        EventsArray[1].Time = Sim_Time + t2EVM123;

                    }

                }

                 else

                    if ((next_event_type == 2) && (EVM2.Free == false))

                    {

                        EVM2.Release();

                        if (queueEVM2.QueueSize > 0)

                        {

                            queueEVM2.Depart();

                            EVM2.Seize();

 

                            EventsArray[2].Time = Sim_Time + t2EVM123;

                        }

                    }

                      else

                        if ((next_event_type == 3) && (EVM1.Free == false))

                        {

                            EVM3.Release();

                            if (queueEVM3.QueueSize > 0)

                            {

                                queueEVM3.Depart();

                                EVM3.Seize();

 

                                EventsArray[3].Time = Sim_Time + t2EVM123;

                            }

                        }

            }

           

            public void Tabl1(out int queueSizeK1, out int queueSizeEVM1, out int queueSizeEVM2, out int queueSizeEVM3,

                out bool FreeK1, out bool FreeEVM1, out bool FreeEVM2, out bool FreeEVM3,

                out int kolOtkazov, out int timeObrVK1, out float timeReleaseK1, out float timeReleaseEVM1,

                out float timeReleaseEVM2, out float timeReleaseEVM3, out int t2EVM123, out float timePostZ)

            {

                queueSizeK1 = queueK1.QueueSize;

                queueSizeEVM1 = queueEVM1.QueueSize;

                queueSizeEVM2 = queueEVM2.QueueSize;

                queueSizeEVM3 = queueEVM3.QueueSize;

                FreeK1 = K1.Free;

                FreeEVM1 = EVM1.Free;

                FreeEVM2 = EVM2.Free;

                FreeEVM3 = EVM3.Free;

                kolOtkazov = kol_Otkasov;

                timeObrVK1 = TimeObrVK1;

                timeReleaseK1 = this.timeReleaseK1;

                timeReleaseEVM1 = EventsArray[1].Time;

                timeReleaseEVM2 = EventsArray[2].Time;

                timeReleaseEVM3 = EventsArray[3].Time;

                t2EVM123 = this.t2EVM123;

                timePostZ = EventsArray[0].Time;

            }

        }

 

        private void Start_Click(object sender, EventArgs e)

        {

            try

            {

 

 

 

                int queueSizeK1 = 0, queueSizeEVM1 = 0, queueSizeEVM2 = 0, queueSizeEVM3 = 0;

                bool FreeK1 = true, FreeEVM1 = true, FreeEVM2 = true, FreeEVM3 = true;

                int timeObrVK1, t2EVM123;

                float timeReleaseK1, timeReleaseEVM1, timeReleaseEVM2, timeReleaseEVM3;

                int kol_Otkazov = 0;

 

 

 

                float timePostZ;

                int j = 0;

 

                //считывание данных с формы

                IM_System system = new IM_System();

 

                dataGridView1.ColumnCount = 18;  //количество столбцов в dataGridView1

                dataGridView1.RowCount = 2000;//добавление 2000 строк

 

                DataGridViewCellStyle columnHeaderStyle = new DataGridViewCellStyle();

                columnHeaderStyle.Font = new Font("Verdana", 4, FontStyle.Bold);

                dataGridView1.ColumnHeadersDefaultCellStyle = columnHeaderStyle;

 

                //Установка ширины столбцов в dataGridView1

                dataGridView1.Columns[0].Width = 50;

                dataGridView1.Columns[1].Width = 100;

                dataGridView1.Columns[2].Width = 50;

                dataGridView1.Columns[3].Width = 50;

                dataGridView1.Columns[4].Width = 50;

                dataGridView1.Columns[5].Width = 50;

                dataGridView1.Columns[6].Width = 50;

                dataGridView1.Columns[7].Width = 50;

                dataGridView1.Columns[8].Width = 50;

                dataGridView1.Columns[9].Width = 50;

                dataGridView1.Columns[10].Width = 50;

                dataGridView1.Columns[11].Width = 50;

                dataGridView1.Columns[12].Width = 50;

                dataGridView1.Columns[13].Width = 50;

                dataGridView1.Columns[14].Width = 50;

                dataGridView1.Columns[15].Width = 50;

                dataGridView1.Columns[16].Width = 50;

                dataGridView1.Columns[17].Width = 50;

 

                dataGridView1.Columns[0].Name = "Мод время";

                dataGridView1.Columns[1].Name = "T пост";

                dataGridView1.Columns[2].Name = "ОчерK1";

                dataGridView1.Columns[3].Name = "КаналK1";

                dataGridView1.Columns[4].Name = "T обрK1";

                dataGridView1.Columns[5].Name = "T освK1";

                dataGridView1.Columns[6].Name = "ОчерEVM1";

                dataGridView1.Columns[7].Name = "КаналEVM1";

                dataGridView1.Columns[8].Name = "T освEVM1";

                dataGridView1.Columns[9].Name = "ОчерEVM2";

                dataGridView1.Columns[10].Name = "КаналEVM2";

                dataGridView1.Columns[11].Name = "T освEVM2";

                dataGridView1.Columns[12].Name = "ОчерEVM3";

                dataGridView1.Columns[13].Name = "КаналEVM3";

                dataGridView1.Columns[14].Name = "T освEVM3";

                dataGridView1.Columns[15].Name = "T обр";

                dataGridView1.Columns[16].Name = "N";

                dataGridView1.Columns[17].Name = "Кол отказов";

 

                //время поступления заявок  tgen1+-tgen2

                system.tgen1 = 10;//Convert.ToInt32(textBox1.Text);

 

 

                system.tgen2 = 5;//Convert.ToInt32(textBox2.Text);

                //время обработки заявки t1evm1+-t2evm1

                system.t1K1 = 10;//Convert.ToInt32(textBox3.Text);

                system.t2K1 = 3; // Convert.ToInt32(textBox4.Text);

                system.t2EVM123 = 33;

                //количество поступивших заявок

                system.tend = 500;// Convert.ToInt32(textBox5.Text);

 

 

 

 

                system.Init();//инициализация системы

                system.Synhronise();//синхронизация события

                //открываем цикл до тех пор, пока не наступит заданное  время моделирования

                while (system.Tranzakt_Value < system.tend)//до тех пор, пока количество поступивших заявок не превысит 1000

                {

                    //выбираем тип события

                    switch (system.next_event_type)

                    {

                        case 0:

                            system.GoIn();//поступление заявки

                            break;

                        case 1:

                            system.GoOut();//удаление заявки

                            break;

                        case 2:

                            system.GoOut();//удаление заявки

                            break;

                        case 3:

                            system.GoOut();//удаление заявки

                            break;

                    }

                    //system.Tabl1() необходима для вывода  данных в таблицу 

                    system.Tabl1(out queueSizeK1, out queueSizeEVM1, out queueSizeEVM2, out queueSizeEVM3,

                   out FreeK1, out FreeEVM1, out FreeEVM2, out FreeEVM3, out kol_Otkazov, out timeObrVK1, out timeReleaseK1,

                   out timeReleaseEVM1, out timeReleaseEVM2, out timeReleaseEVM3, out t2EVM123, out timePostZ);

 

                    dataGridView1[0, j].Value = system.Sim_Time;

                    dataGridView1[1, j].Value = timePostZ;

                    dataGridView1[2, j].Value = queueSizeK1;

                    dataGridView1[3, j].Value = FreeK1;

                    dataGridView1[4, j].Value = timeObrVK1;

                    dataGridView1[5, j].Value = timeReleaseK1;

                    dataGridView1[6, j].Value = queueSizeEVM1;

                    dataGridView1[7, j].Value = FreeEVM1;

                    dataGridView1[8, j].Value = timeReleaseEVM1;

                    dataGridView1[9, j].Value = queueSizeEVM2;

                    dataGridView1[10, j].Value = FreeEVM2;

                    dataGridView1[11, j].Value = timeReleaseEVM2;

                    dataGridView1[12, j].Value = queueSizeEVM3;

                    dataGridView1[13, j].Value = FreeEVM3;

                    dataGridView1[14, j].Value = timeReleaseEVM3;

                    dataGridView1[15, j].Value = t2EVM123;

                    dataGridView1[16, j].Value = system.Tranzakt_Process;

                    dataGridView1[17, j].Value = kol_Otkazov;

 

                    j++;

 

                    system.Synhronise();//синхронизируем события

                }

                //Вывод данных на форму

                textBox6.Text = Convert.ToString(system.Tranzakt_Value);  //количество поступивших заявок

 

 

                textBox7.Text = Convert.ToString(kol_Otkazov);   //количество отказов

                textBox8.Text = Convert.ToString(system.Tranzakt_Process);//количество обработанных заявок

                textBox13.Text = Convert.ToString(system.Sim_Time);       //модельное время

                textBox9.Text = Convert.ToString(queueSizeK1);            //очередь в канале

                textBox11.Text = Convert.ToString(queueSizeEVM1);         //очередь в ЭВМ1

                textBox12.Text = Convert.ToString(queueSizeEVM2);         //очередь в ЭВМ2

                textBox14.Text = Convert.ToString(queueSizeEVM3);         //очередь в ЭВМ3

                textBox15.Text = Convert.ToString(FreeK1);                //занятость канала

                textBox16.Text = Convert.ToString(FreeEVM1);              //занятость ЭВМ1

                textBox17.Text = Convert.ToString(FreeEVM2);              //занятость ЭВМ2

                textBox18.Text = Convert.ToString(FreeEVM3);              //занятость ЭВМ3

 

 

 

                this.BackColor = System.Drawing.Color.MediumSeaGreen;

                MessageBox.Show("Система смоделирована! ");

            }

            //если не введены параметры  или введены неправильно

            catch (FormatException ex)

            {

                MessageBox.Show("Неправильно введены параметры модели! Введите данные заново! " + ex);

            }

        }

 

        private void Close_Click(object sender, EventArgs e)//выход из программы

        {

            Application.Exit();

        }

    }

}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3 Симуляция

 

            

 

              GPSS World Simulation Report - Модель 1 (Курс проект по модел).42.1

 

 

                   Thursday, June 19, 2014 05:04:08 

 

           START TIME           END TIME  BLOCKS  FACILITIES  STORAGES

                0.000           5074.710    36        4          3

 

 

              NAME                       VALUE 

          AA                          10003.000

          BA                          10004.000

          CAA                         10005.000

          DAA                         10006.000

          EVM1                        10010.000

          EVM2                        10011.000

          EVM3                        10012.000

          K1                          10009.000

          MET2                           32.000

          METK1                          34.000

          MT1                            17.000

          MT2                            25.000

          MT3                             9.000

          OCHEVM1                     10000.000

          OCHEVM2                     10001.000

          OCHEVM3                     10002.000

          OCHK1                       10008.000

          OTK                         10013.000

          VREM                        10007.000

 

 

LABEL              LOC  BLOCK TYPE     ENTRY COUNT CURRENT COUNT RETRY

                    1    GENERATE           511             0       0

                    2    QUEUE              511             0       0

                    3    QUEUE              511            12       0

                    4    SEIZE              499             0       0

 

 

                    5    DEPART             499             0       0

                    6    ADVANCE            499             1       0

                    7    RELEASE            498             0       0

                    8    TEST               498             0       0

MT3                 9    TEST               487             0       0

                   10    TEST               319             0       0

                   11    ENTER              163             9       0

                   12    SEIZE              154             1       0

                   13    LEAVE              153             0       0

                   14    ADVANCE            153             0       0

                   15    RELEASE            153             0       0

                   16    TRANSFER           153             0       0

MT1                17    TEST               324             0       0

                   18    TEST               288             0       0

                   19    ENTER              163            10       0

                   20    SEIZE              153             0       0

                   21    LEAVE              153             0       0

                   22    ADVANCE            153             1       0

                   23    RELEASE            152             0       0

                   24    TRANSFER           152             0       0

MT2                25    TEST               161             0       0

                   26    TEST               161             0       0

                   27    ENTER              161             9       0

                   28    SEIZE              152             0       0

                   29    LEAVE              152             0       0

 

 

 

                   30    ADVANCE            152             1       0

                   31    RELEASE            151             0       0

MET2               32    DEPART             456             0       0

                   33    TERMINATE          456             0       0

METK1              34    QUEUE               11             0       0

                   35    DEPART              11             0       0

                   36    TERMINATE           11             0       0

Информация о работе Система массового обслуживания