Компьютерное моделирование беспроводных AD-HOC сетей для целей расчета времени связи мобильных абонентов
Дипломная работа - Компьютеры, программирование
Другие дипломы по предмету Компьютеры, программирование
gressBar1.Visible:=True;.ADOTable1.Last;.ADOTable1.Insert;.ADOTable1.FieldByName(Дата).AsString:=Data;.ADOTable1.FieldByName(Начало).AsString:=TimeStart;.ADOTable1.FieldByName(Окончание).AsString:=TimeEnd;.ADOTable1.FieldByName(Узлов).AsInteger:=k;.ADOTable1.FieldByName(Совпадений).AsInteger:=j;.ADOTable1.FieldByName(Среднее время жизни).AsString:=TimeToStr(SrTime);.ADOTable1.Post;.ADOTable1.Refresh;.ADOTable1.Last;.ProgressBar1.Position:=1;
else
begin
MessageDlg(Не было ни одного полного цикла жизни сети.+#13+Данные об испытание не будут сохранены в Базу Данных!,mtInformation,[mbOK],0);
Exit;
end;
//запись в таблицу Начальные параметры
for i:=0 to Form1.StringGrid3.RowCount-1 do.ADOTable2.Last;.ADOTable2.Insert;.ADOTable2.FieldByName(Испытание).AsInteger:=Form2.ADOTable1.FieldByName(Id).AsInteger;.ADOTable2.FieldByName(Узел).AsInteger:=i+1;
:=RoundTo(StrToInt(Form1.StringGrid3.Cells[1,i])*sqrt(Pix),-2);:=RoundTo(StrToInt(Form1.StringGrid3.Cells[2,i])*sqrt(Pix),-2);.ADOTable2.FieldByName(Положение).AsString:=FloatToStr(q)+;+FloatToStr(w);:=RoundTo(StrToInt(Form1.StringGrid3.Cells[3,i])*sqrt(Pix),-2);:=RoundTo(StrToInt(Form1.StringGrid3.Cells[4,i])*sqrt(Pix),-2);.ADOTable2.FieldByName(Направление).AsString:=FloatToStr(q)+;+FloatToStr(w);
// q:=RoundTo(StrToInt(Form1.StringGrid3.Cells[5,i])*Pix,-2);.ADOTable2.FieldByName(Скорость).AsString:=Form1.StringGrid3.Cells[5,i];
// q:=RoundTo(StrToInt(Form1.StringGrid3.Cells[6,i])*Pix,-2);.ADOTable2.FieldByName(Радиус).AsString:=Form1.StringGrid3.Cells[6,i];//FloatToStr(q);.ADOTable2.Post;.ADOTable2.Refresh;.ProgressBar1.Position:=Form1.ProgressBar1.Position+1;;
// Запись в таблицу Параметры поля
Form2.ADOTable4.Last;.ADOTable4.Insert;.ADOTable4.FieldByName(Испытание).AsInteger:=Form2.ADOTable1.FieldByName(Id).AsInteger;.ADOTable4.FieldByName(Ширина).AsInteger:=StrToInt(Form1.LabeledEdit3.Text);.ADOTable4.FieldByName(Высота).AsInteger:=StrToInt(Form1.LabeledEdit4.Text);.ADOTable4.FieldByName(Условия радиуса).AsString:=Form1.Edit1.Text+м<=R<=+Form1.Edit2.Text+м;.ADOTable4.FieldByName(Условия скорости).AsString:=Form1.Edit3.Text+м/с<=V<=+Form1.Edit4.Text+м/с;.ADOTable4.Post;.ADOTable4.Refresh;.ProgressBar1.Position:=Form1.ProgressBar1.Position+1;
// Запись в таблицу Соединенияi:=1 to Form1.StringGrid2.RowCount-1 doForm1.StringGrid2.Cells[2,i]= then;.ADOTable3.Last;.ADOTable3.Insert;.ADOTable3.FieldByName(Испытание).AsInteger:=Form2.ADOTable1.FieldByName(Id).AsInteger;.ADOTable3.FieldByName(Путь).AsString:=Form1.StringGrid2.Cells[0,i];.ADOTable3.FieldByName(Соединение).AsString:=Form1.StringGrid2.Cells[1,i];.ADOTable3.FieldByName(Разрыв).AsString:=Form1.StringGrid2.Cells[2,i];.ADOTable3.FieldByName(Жизнь).AsString:=Form1.StringGrid2.Cells[3,i];.ADOTable3.Post;.ADOTable3.Refresh;.ProgressBar1.Position:=Form1.ProgressBar1.Position+1;.ProgressBar1.Visible:=False;;;LifePath(j:integer);l,x0,y0,r1,x2,y2:integer;:byte; str:string;l:=j+1 to k do
//считывание параметров:=StrToInt(Form1.StringGrid1.Cells[6,j]);:=StrToInt(Form1.StringGrid1.Cells[1,j]);:=StrToInt(Form1.StringGrid1.Cells[2,j]);
//изменение параметров для вычислений в соответствие с радиусом
StrToInt(Form1.StringGrid1.Cells[6,l])then:=StrToInt(Form1.StringGrid1.Cells[6,l]);:=StrToInt(Form1.StringGrid1.Cells[1,l]);:=StrToInt(Form1.StringGrid1.Cells[2,l]);:=x2;:=y2;:=StrToInt(Form1.StringGrid1.Cells[1,l]);:=StrToInt(Form1.StringGrid1.Cells[2,l]);;">if r1>StrToInt(Form1.StringGrid1.Cells[6,l]) then:=StrToInt(Form1.StringGrid1.Cells[6,l]);:=StrToInt(Form1.StringGrid1.Cells[1,l]);:=StrToInt(Form1.StringGrid1.Cells[2,l]);:=x2;:=y2;:=StrToInt(Form1.StringGrid1.Cells[1,l]);:=StrToInt(Form1.StringGrid1.Cells[2,l]);;
//проверка соединения(sqr(x2-x0)+sqr(y2-y0))<=sqr(r1/sqrt(Pix)) then[j-1,l-1]:=1;[l-1,j-1]:=1;
// Form1.StringGrid2.Cells[j,l]:=1;
// Form1.StringGrid2.Cells[l,j]:=1;
//прорисовка соединения.Image1.Canvas.Brush.Style:=bsSolid;.Image1.Canvas.Pen.Color:=RGB(0,0,255);.Image1.Canvas.Pen.Width:=2;.Image1.Canvas.MoveTo(x0,y0);.Image1.Canvas.LineTo(x2,y2);.Image1.Canvas.Pen.Width:=1;[j-1,l-1]:=0;[l-1,j-1]:=0;
// Form1.StringGrid2.Cells[j,l]:=0;
// Form1.StringGrid2.Cells[l,j]:=0;;;
//проверка сетиflag then//проверка на разрыв сетиl:=0 to Length(Net)-2 doConnect[Net[l],Net[l+1]]=0 then:=false;.StringGrid2.Cells[2,p]:=TimeToStr(Time);.StringGrid2.Cells[3,p]:=TimeToStr((StrToTime(Form1.StringGrid2.Cells[1,p])-Time)*20);
// if Form1.StringGrid2.Cells[4,p]= then
// Form1.StringGrid2.Cells[4,p]:=00:00:00;p=ks then.Button1.Enabled:=False;.Button4.Enabled:=False;.Button2.Enabled:=True;.LabeledEdit1.Enabled:=True;.LabeledEdit2.Enabled:=True;.Timer1.Enabled:=false;:=TimeToStr(Time);.CheckBox1.Enabled:=True;
//GropuBox.LabeledEdit3.Enabled:=True;.LabeledEdit4.Enabled:=True;.Edit1.Enabled:=True;.Edit2.Enabled:=True;.Edit3.Enabled:=True;.Edit4.Enabled:=True;.Button5.Enabled:=True;
//ЗАПИСЬ В БДForm1.N7.Enabled then;(Ошибка при добавление данных в БД,mtError,[mbCancel],0);;;;//проверка на появление сетиl:=0 to k-1 do:=0;j:=0 to k-1 do:=s+Connect[l,j];:=s-2;s=1 then:=nil;
;:=str+IntToStr(Net[Length(Net)-1]+1);x0:=1toForm1.StringGrid2.RowCount-1doForm1.StringGrid2.Cells[0,x0]=then:=x0;.Label8.Caption:=:+IntToStr(p);.StringGrid2.Cells[0,p]:=str;.StringGrid2.Cells[1,p]:=TimeToStr(Time);:=;;;;;;//=D;;;TForm1.Timer1Timer(Sender:TObject);i,rPix,vPix:integer;.Canvas.Brush.Style:=bsSolid;.Canvas.Pen.Color:=RGB(255,255,255);">{Form1.Timer1.Enabled:=false;(Begin +IntToStr(l+1));.Timer1.Enabled:=true;}(l); //йцукенLength(Net)=k then:=true;y0:=0 to Length(net)-2 do:=str+IntToStr(Net[y0]+1)+;:=str+IntToStr(Net[Length(Net)-1]+1);x0:=1 to Form1.StringGrid2.RowCount-1 doForm1.StringGrid2.Cells[0,x0]= then:=x0;.Label8.Caption:=Количество образовавшихся сетей: +IntToStr(p);.StringGrid2.Cells[0,p]:=str;.StringGrid2.Cells[1,p]:=TimeToStr(Time);:=;;;;;; //концы =D;;;TForm1.Timer1Timer(Sender: TObject);i,rPix,vPix:integer;.Canvas.Brush.Style:=bsSolid;.Canvas.Pen.Color:=RGB(255,255,255);
// Image1.Canvas.Brush.Color:=RGB(255,255,255);.Canvas.Rectangle(0,0,Image1.Width,Image1.Height);i:=1 to k do
//считывание информации из таблицы
x:=StrToInt(StringGrid1.Cells[1,i]);
y:=StrToInt(StringGrid1.Cells[2,i]);:=StrToInt(StringGrid1.Cells[3,i]);:=StrToInt(StringGrid1.Cells[4,i]);:=StrToFloat(StringGrid1.Cells[5,i]);:=StrToInt(StringGrid1.Cells[6,i]);
x1-vPix))thenxy1-vPix)and(y<y1+vPix) then
x:=x1;
y:=y1;
//смена направления движения
Randomize;:=random(Image1.Width);:=random(Image1.Height);
//смена скорости:=RoundTo(random*(Par[5]-Par[4])+Par[4]-0.1,-1)+0.1;.Cells[3,i]:=IntToStr(x1);.Cells[4,i]:=IntToStr(y1);.Cells[5,i]:=FloatToStr(v);;
//прорисовка узла i
// Image1.Canvas.Pen.Width:=1;.Canvas.Brush.Style:=bsSolid;.Canvas.Brush.Color:=RGB(255,0,0);.Canvas.Pen.Color:=RGB(255,0,0);.Canvas.Ellipse(x-2,y-2,x+2,y+2);.Canvas.Brush.Style:=bsClear;.Canvas.TextOut(x,y-10,IntToStr(i));.Canvas.Pen.Color:=RGB(0,255,0);
// rPix:=Round(sqr(r)/Pix);:=Round(r/sqrt(Pix));.Canvas.Ellipse(x-rPix,y-rPix,x+rPix,y+rPix);;i:=1 to k-1 do(i);(p=ks) and (Timer1.Enabled=false) then.Label1.Caption:=Form1.Label1.Caption+#13+Конец: + TimeEnd;;TForm1.Button1Click(Sender: TObject);j,i:Integer;:=;:=;:=;i:=1 to StringGrid1.RowCount-1 doj:=0 to StringGrid1.ColCount-1 donot(j=5) then(StringGrid1.Cells[j,i]);
MessageDlg(Данные в таблице введены неверно!,mtError,[mbOk],0);
Exit;;
// CheckBox1.Enabled:=False;.Caption:=Стоп;.Caption:=Стоп;.Caption:=Стоп;Button1.Caption=Начать then:=TimeToStr