
Список использованной литературы
1. Б.Д.Гнеденко, И.Н.Коваленко “Введение в теорию массового обслуживания”- М.:Наука, 1987 год.
2. Б.Я.Советов, С.А.Яковлев “Моделирование систем”, Москва “Высшая школа” 2001год.
3. Б.Я.Советов, С.А.Яковлев “Моделирование систем. Лабораторный практикум”, Москва “Высшая школа”1989 год.
4. Методические указания по оформлению курсовых и дипломных проектов для студентов специальностей 210300 “Роботы и робототехнические системы”, 220200 “Автоматизированные системы обработки информации и управления”, 210100 “Управление и информатика в технических системах”. Уфа 1997 год.
5. Н.П.Бусленко “Моделирование сложных систем”,- М.:Наука, 1987 год.
Приложение а (псевдокод)
Алгоритм моделирования работы заданной системы:
начало
скаляр Time,i,SumPac,TimePac,SumTimePac,Buf,TimeBuf,Poter: целая;
массив a[ 6 ]: целый;
ввод (Time:=10000);
для i = 1 до SumPac
повторять
ввод (TimePac:= a[random(7)]);
TimeBuf:=5;
пока SumTimePac< Time выполнять
начало
если TimePac < TimeBuf то
начало
Buf:= TimeBuf- TimePac все;
если Buf > 5 то
начало
Poter:= Poter+1; Buf:=0;
все;
все;
если Poter>(SumPac*0.3) то
начало
TimeBuf:=4;
timePoter:=timePoter+1;
иначе
TimeBuf:=5;
все;
SumPac:=SumPac+1;
SumTimePac:=SumTimePac+ TimePac;
вывод (timePoter, Poter, SumPac)
конец;
Приложение в (листинг программы)
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Buttons;
type
TForm1 = class(TForm)
Timer1: TTimer;
Timer2: TTimer;
Timer3: TTimer;
Edit1: TEdit;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Memo1: TMemo;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
GroupBox1: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
Label8: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure Timer3Timer(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
SumPac,Pac,TimePac,Buf,TimeBuf,TimeTrans,Poter,timePoter: integer;
Time,i:integer;
a1:PAnsiChar;
const a: array[0..6] of char = ('3', '4', '5', '6', '7', '8', '9');
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
timer1.Enabled:=true;
SumPac:=0;
SumTimePac:=0;
TimePac:=0;
Buf:=0;
TimeBuf:=0;
TimeTrans:=5;
Poter:=0;
timePoter:=0;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
randomize;
if radiobutton1.Checked=true then
TimePac:=strtoint(a[random(7)]) else
TimePac:=strtoint(a[0]);
timer1.Interval:=TimePac;
timer2.Interval:=TimePac;
if TimePac<timer3.Interval then
TimeBuf:=TimeBuf+(timer3.Interval-TimePac);
if SumTimePac<=(strtoint(edit1.Text)*1000) then begin
timer1.Enabled:=true;
timer2.Enabled:=true;
timer3.Enabled:=true;
label1.Caption:='Число потерянных пакетов='+floattostr(poter)+' шт';
label2.Caption:=Время:'+floattostr(SumTimePac)+'мс';
label3.Caption:=’Всего пакетов='+floattostr(SumPac)+'шт.';
label6.Caption:=Ресурс подключен:'+floattostr(timePoter)+' раз';
label7.Caption:='Частота подключения ресурса:'+floattostr(Round(timePoter/strtoint(edit1.Text)))+'раз/с';
label8.Caption:='Частота уничтожения пакетов:'+floattostr(Round(poter/strtoint(edit1.Text)))+ 'шт/с';
end else
if
SumTimePac>1000 then begin
timer1.Enabled:=false;
timer2.Enabled:=false;
timer3.Enabled:=false;
end;
if Poter>(SumPac*0.3) then begin
timer3.Interval:=4;
timePoter:=timePoter+1;
end else
timer3.Interval:=5;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
begin
Buf:=Buf+1;
SumPac:=SumPac+1;
SumTimePac:=SumTimePac+timer2.Interval;
memo1.SelText:=inttostr(SumPac)+'-пакетов-'+inttostr(TimePac)+'ìñ'#10;
end;
procedure TForm1.Timer3Timer(Sender: TObject);
begin
if Buf>0 then
Buf:=Buf-1 else
if Buf>=1 then begin
Buf:=Buf-1; Poter:=Poter+1;
end else
if Buf<=0 then
Buf:=0;
if TimeBuf>=5 then begin
Poter:=Poter+1;
TimeBuf:=0;
end;
end;
end.