Контрольная работа по "Моделирование систем"

Автор работы: Пользователь скрыл имя, 21 Января 2013 в 06:02, контрольная работа

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

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

Файлы: 1 файл

Моделирование Систем.doc

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

                cout<<"Vvedite vremya raboti sistemi: ";

                cin>>time;

                do

                {

                        if(S==0)

                        {

                                for(int j=1; j<=2; j++)

                                {

                                lyambda=(1)*log(random(1000)/1000.0+0.001)/Ivh*j;

                                lyambda+=lyambda;

                                }

 

                                S=1;

                                t+=lyambda;

                                Cz++;

                                Cobsl++;

                        }

                       if(S==1)

                        {

                                for(int j=1; j<=2; j++)

                                {

                                lyambda=(-1)*log(random(1000)/1000.0+0.001)/Ivh*j;

                                lyambda+=lyambda;

                                }

 

                                mu=(-1)*log(random(1000)/1000.0+0.001)/Iobsl;

                                if(lyambda<mu)

                                {

                                        S=2;

                                        t+=lyambda;

                                        Cz++;

                                        Cobsl++;

                                        Tobsl+=lyambda;

                                }

                                else

                                {

                                        S=0;

                                        t+=mu;

                                        Tobsl+=mu;

                                }

                        }

 

                        if(S==2)

                        {

                                for(int j=1; j<=2; j++)

                                {

                                lyambda=(-1)*log(random(1000)/1000.0+0.001)/Ivh*j;

                                lyambda+=lyambda;

                                }

 

                                mu=(-1)*log(random(1000)/1000.0+0.001)/Iobsl;

                                if(lyambda<mu)

                                {

                                        S=3;

                                        t+=lyambda;

                                        Cz++;

                                        Cobsl++;

                                        Tobsl+=lyambda;

                                }

                                else

                                {

                                        S=1;

                                        t+=mu;

                                        Tobsl+=mu;

                                }

                        }

 

 

 

 

                        if(S==3)

                        {

                                for(int j=1; j<=2; j++)

                                {

                                lyambda=(-1)*log(random(1000)/1000.0+0.001)/Ivh*j;

                                lyambda+=lyambda;

                                }

 

                                mu=(-1)*log(random(1000)/1000.0+0.001)/Iobsl;

                                if(lyambda<mu)

                                {

                                        S=4;

                                        t+=lyambda;

                                        Cz++;

                                        Cobsl++;

                                        Tobsl+=lyambda;

                                }

                                else

                                {

                                        S=2;

                                        t+=mu;

                                        Tobsl+=mu;

                                }

                        }

 

 

                        if(S==4)

                        {

                                for(int j=1; j<=2; j++)

                                {

                                lyambda=(-1)*log(random(1000)/1000.0+0.001)/Ivh*j;

                                lyambda+=lyambda;

                                }

 

                                mu=(-1)*log(random(1000)/1000.0+0.001)/Iobsl;

                                if(lyambda<mu)

                                {

                                        S=5;

                                        t+=lyambda;

                                        Cz++;

                                        Cobsl++;

                                         Lo++;

                                        Tobsl+=lyambda;

                                }

                                else

                                {

                                        S=3;

                                        t+=mu;

                                        Tobsl+=mu;

                                }

                        }

 

                        if(S==5)

                        {

                                for(int j=1; j<=2; j++)

                                {

                                lyambda=(-1)*log(random(1000)/1000.0+0.001)/Ivh*j;

                                lyambda+=lyambda;

                                }

 

                                mu=(-1)*log(random(1000)/1000.0+0.001)/Iobsl;

                                if(lyambda<mu)

                                {

                                        S=6;

                                        t+=lyambda;

                                        Cz++;

                                         Lo++;

                                         Cobsl++;

                                        Tobsl+=lyambda;

                                }

                                else

                                {

                                        S=4;

                                        t+=mu;

                                        Tobsl+=mu;

 

                                }

                        }

 

 

                        if(S==6)

                        {

                                for(int j=1; j<=2; j++)

                                {

                                lyambda=(-1)*log(random(1000)/1000.0+0.001)/Ivh*j;

                                lyambda+=lyambda;

                                }

 

                                mu=(-1)*log(random(1000)/1000.0+0.001)/Iobsl;

                                if(lyambda<mu)

                                {

                                        S=7;

                                        t+=lyambda;

                                        Cz++;

                                         Lo++;

                                         Cobsl++;

                                        Tobsl+=lyambda;

                                }

                                else

                                {

                                        S=5;

                                        t+=mu;

                                        Tobsl+=mu;

 

                                }

                        }

 

 

                        if(S==7)

                        {

                                for(int j=1; j<=2; j++)

                                {

                                lyambda=(-1)*log(random(1000)/1000.0+0.001)/Ivh*j;

                                lyambda+=lyambda;

                                }

                                mu=(-1)*log(random(1000)/1000.0+0.001)/Iobsl;

                                if(lyambda<mu)

                                {

                                        S=7;

                                        t+=lyambda;

                                        Cz++;

                                        Co+=Lo-4;

                                        Tobsl+=lyambda;

                                }

                                else

                                {

                                        S=6;

                                        t+=mu;

                                        Tobsl+=mu;

 

                                }

                        }

 

                }

 

                while(t<time);

                Po=(time -Tobsl)/2/time;

                Potk=(double)Co/(double)Cz;

                Q=(double)Cobsl/(double)Cz;

                A=(double)Cobsl/time;

                KolKan=(time-Tobsl)/time;

                cout<<"Kolichestvo zayavok: "<<Cz<<"\n";

                cout<<"Kolichestvo obsluzhennih zayavok: "<<Cobsl<<"\n";

                cout<<"Otkazano "<<Co<<" zayavke(am)\n";

                cout<<"Veroyatnost prostoya: "<<Po<<"\n";

                cout<<"Veroyatnost otkaza: "<<Potk<<"\n";

                cout<<"Dolya obsluzhennih zayavok: "<<Q<<"\n";

                cout<<"Absolyutnaya propusknaya sposobnost: "<<A<<"\n";

                cout<<"Srednee chislo zanyatih kanalov: "<<KolKan<<"\n\n";

                cout<<"Otkaz: "<<Lo<<"\n\n";

        }

        getch();

}




Информация о работе Контрольная работа по "Моделирование систем"