Скачиваний:
15
Добавлен:
02.05.2014
Размер:
5.14 Кб
Скачать
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Buttons, IWControl, IWCompDynamicChart,
TeeProcs, TeEngine, Chart, Series;

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;
Chart1: TChart;
Series1: TLineSeries;
Label9: TLabel;
Label10: TLabel;
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,SumTimePac,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

uses Unit2;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
timer1.Enabled:=true;
Chart1.SeriesList[0].Clear;
memo1.Text:='';
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;
label3.Caption:='Число потерянных пакетов='+floattostr(poter)+' шт.';
label9.Caption:='Число прошедших пакетов='+floattostr(SumPac+1-poter)+' шт.';
label2.Caption:='Время:'+floattostr(SumTimePac)+' мc';
label1.Caption:='Всего пакетов='+floattostr(SumPac+1)+'шт.';
label6.Caption:='Ресурс подключен:'+floattostr(timePoter)+' раз';
label7.Caption:='Частота подключения ресурса:'+floattostr(Round(timePoter/strtoint(edit1.Text)))+' раз/с';
label8.Caption:='Частота уничтожения пакетов:'+floattostr(Round(poter/strtoint(edit1.Text)))+' шт/с';
label10.Caption:='Вероятность уничтожения пакета:'+floattostrF(((1/(SumPac+1))*poter),fffixed,2,4);

if SumPac<=100 then begin
Chart1.SeriesList[0].AddXY(SumPac,TimePac,floattostr(SumPac),clRed) ;
end;
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;

procedure TForm1.BitBtn1Click(Sender: TObject);
var
a:PAnsiChar;
begin
{a1:='В системе передачи цифровой информации передается речь в цифровом виде. '+#10#13
+'Речевые пакеты передаются через два транзитных канала, буферируясь в '+#10#13
+'накопителях перед каждым каналом. Время передачи по каналу составляет 5 мс. '+#10#13
+'Пакеты поступают через 6+-3 мс. Пакеты, передававшиеся более 10 мс, на '+#10#13
+'выходе системы уничтожаются, так как их появление в декодере значительно '+#10#13
+'снизит качество передаваемой речи. Уничтожение более 30% пакетов недопустимо. '+#10#13
+'При достижении такого уровня система за счет ресурсов ускоряет передачу до '+#10#13
+'4 мс па канал. При снижении уровня до приемлемого происходит отключение ресурсов. '+#10#13
+'Смоделировать 10 с работы системы. Определить частоту уничтожения пакетов и '+#10#13
+'частоту подключения ресурса. ';
Application.MessageBox(a1 , 'ЗАДАНИЕ №15',MB_OK); }
form2.ShowModal;
end;

procedure TForm1.BitBtn2Click(Sender: TObject);
begin
a1:='В настоящей курсовой работе рассматривается проблема моделиро-'+#10#13
+'вания процессов в Q-схемах - одном из важнейших, с точки зрения '+#10#13
+'применения на практике, классов математических схем, разрабо-'+#10#13
+'танных для формализации процессов функционирования систем мас-'+#10#13
+'сового обслуживания (СМО) в теории массового обслуживания.';
Application.MessageBox(a1 , 'О прогпамме Выполнил: Сафиуллин И.М. ИСТ301в',MB_OK);


end;

end.
Соседние файлы в папке программа
  • #
    02.05.2014876 б14Project1.res
  • #
    02.05.2014188 б14Project1.~dpr
  • #
    02.05.20149.65 Кб14Unit1.dcu
  • #
    02.05.201451 б14Unit1.ddp
  • #
    02.05.20144.93 Кб14Unit1.dfm
  • #
    02.05.20145.14 Кб15Unit1.pas
  • #
    02.05.201451 б14Unit1.~ddp
  • #
    02.05.20144.93 Кб14Unit1.~dfm
  • #
    02.05.20145.15 Кб14Unit1.~pas
  • #
    02.05.20143.65 Кб14Unit2.dcu
  • #
    02.05.201451 б14Unit2.ddp