enter image description here

After the added graphics had an error, the program was written on

delphi7 

The code itself:

 procedure TFDub2.BitBtn6Click(Sender: TObject); begin if gr=3 then begin Form2.Chart1.Series[0].Clear;//Бброс Form2.Chart1.Series[1].Clear;//Бброс Form2.Chart1.Series[2].Clear;//Бброс Form2.Chart1.Series[3].Clear;//Бброс Form2.Chart1.Series[4].Clear;//Бброс Form2.Chart1.Series[5].Clear;//Бброс Kiz:=StrToFloat(Edit7.Text); Niz:=0; While Niz<=1 do begin if Niz=0 then //ΠŸΠΎΡΡ‚Ρ€ΠΎΠ΅Π½ΠΈΠ΅ ΠΈΠ·ΠΎΠ»ΠΈΠ½ΠΈΠΈ ΠΏΡ€ΠΈ опасной скорости Π²Π΅Ρ‚Ρ€Π° begin X:=0; jX:=0; jXY:=1; Xiz:=0; kj:=0; While jX<=90 do begin Y:=0; jY:=0; While jY<=90 do//Π€ΠΎΡ€ΠΌΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ Ρ†ΠΈΠΊΠ»Π° ΠΏΠΎ ΠΏΠ΅Ρ€Π΅ΠΌΠ΅Π½Π½ΠΎΠΉ jy begin aY[jY]:=Y; //Π‘Π»ΠΎΠΊ расчёта коэф-Ρ‚Π° S2 IF aX[jX]=0 then aX[jX]:=0.000001; Y1:=Sqr(Y/(aX[jX]*1000)); if um>5 then tym:=5*Y1 else tym:=um*Y1; ty2m:=Sqr(tym); S2m:=1/Sqr(1+5*tym+12.8*ty2m+17*tym*ty2m+45.1*ty2m*ty2m); //ΠšΠΎΠ½Π΅Ρ† Π±Π»ΠΎΠΊΠ° расчёта коэф-Ρ‚Π° S2 yxKmp[jX,jY]:=S2m*aKmp[jX]; // yxKcc[jX,jY]:=S2m*aKcc[jX]; // yxKrz[jX,jY]:=S2m*aKrz[jX]; kkj:=0; while kkj<90 do begin if (Kiz<aKmp[kkj+1]) and (Kiz>=aKmp[kkj]) then begin XXiz:=(90*(aX[kkj]+(Kiz-aKmp[kkj])*(aX[kkj+1]-aX[kkj])/(aKmp[kkj+1]-aKmp[kkj])))/meridian+Nl; ik:=kkj; Form2.Chart1.Series[0].AddXY(XXiz,El); Form2.Chart1.Series[1].AddXY(XXiz,El); kkj:=90; end; kkj:=kkj+1; end; if (Kiz>=aKmp[jX+1]) and (Kiz<aKmp[jX]) then begin Xiz:=(90*(aX[jX]+(Kiz-aKmp[jX])*(aX[jX+1]-ax[jX])/(aKmp[jX+1]-aKmp[jX])))/meridian+Nl; iX:=jX; Form2.Chart1.Series[0].AddXY(Xiz,El); Form2.Chart1.Series[1].AddXY(Xiz,El); jX:=90; end; if (Kiz>=yxKmp[jX,jy]) and (Kiz<yxKmp[jX,jY-1]) then begin Yizmp[jX,jY]:=(aY[jY-1]+(Kiz-yxKmp[jX,jY-1])*(aY[jY]-aY[jY-1])/(yxKmp[jX,jY]-yxKmp[jX,jY-1]))/parallel+El; if aX[jX]=2 then aX[jX]:=XXiz/1000; Form2.Chart1.Series[0].AddXY(aX[jX]*1000,Yizmp[jX,jY]); Form2.Chart1.Series[1].AddXY(aX[jX]*1000,2*El-Yizmp[jX,jY]); Form2.Chart1.Series[4].AddXY(aX[1],Yizmp[jX,jY]*(1.5)); Form2.Chart1.Series[5].AddXY(aX[1],2*El-Yizmp[jX,jY]*(1.5)); end; //Π‘Π»ΠΎΠΊ Π²Ρ‹Π²ΠΎΠ΄Π° массива Ρ‚ΠΎΡ‡Π΅ΠΊ Π½Π° Π“Π˜Π‘ if Yizmp[jX,jY]>0 then begin aXiz[1,jX]:=Yizmp[jX,jY]; aXiz[0,jX]:=jX*zst; aXYiz[jX,1]:=Yizmp[jX,jY]; aXYiz[jX,0]:=jX*zst; end; aXYiz[iX,0]:=Xiz; aXYiz[ik,0]:=XXiz; //ΠšΠΎΠ½Π΅Ρ† Π±Π»ΠΎΠΊΠ° Y:=Y+5; jY:=jY+1; end; //ΠšΠΎΠ½Π΅Ρ† Ρ†ΠΈΠΊΠ»Π° ΠΏΠΎ ΠΏΠ΅Ρ€Π΅ΠΌΠ΅Π½Π½ΠΎΠΉ jy jX:=jX+1; end;//ΠšΠΎΠ½Π΅Ρ† Ρ†ΠΈΠΊΠ»Π° ΠΏΠΎ ΠΏΠ΅Ρ€Π΅ΠΌΠ΅Π½Π½ΠΎΠΉ jX end; //ΠšΠΎΠ½Π΅Ρ† Π±Π»ΠΎΠΊΠ° построСния ΠΈΠ·ΠΎΠ»ΠΈΠ½ΠΈΠΉ ΠΏΡ€ΠΈ опасной скорости Π²Π΅Ρ‚Ρ€Π° jj:=1; {-------------------------------------------------------------} if Niz=1 then //ΠŸΠΎΡΡ‚Ρ€ΠΎΠ΅Π½ΠΈΠ΅ ΠΈΠ·ΠΎΠ»ΠΈΠ½ΠΈΠΈ ΠΏΡ€ΠΈ Π·Π°Π΄Π°Π½Π½ΠΎΠΉ скорости Π²Π΅Ρ‚Ρ€Π° begin X:=0; jX:=0; jXY:=1; While jX<=90 do begin Y:=0; jY:=0; While jY<=90 do//Π€ΠΎΡ€ΠΌΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ Ρ†ΠΈΠΊΠ»Π° ΠΏΠΎ ΠΏΠ΅Ρ€Π΅ΠΌΠ΅Π½Π½ΠΎΠΉ jy begin aY[jY]:=Y; // aXY[jX,jy]:=Y; //Π‘Π»ΠΎΠΊ расчёта коэф-Ρ‚Π° S2 IF aX[jX]=0 then aX[jX]:=0.000001; Y1:=Sqr(Y/(aX[jX]*90)); if u>5 then ty:=5*Y1 else ty:=u*Y1; ty2:=Sqr(ty); S2:=1/Sqr(1+5*ty+12.8*ty2+17*ty*ty2+45.1*ty2*ty2); //ΠšΠΎΠ½Π΅Ρ† Π±Π»ΠΎΠΊΠ° расчёта коэф-Ρ‚Π° S2 yxKmpu[jX,jY]:=S2*aKmpu[jX]; // yxKccu[jX,jY]:=S2*aKccu[jX]; // yxKrzu[jX,jY]:=S2*aKrzu[jX]; kkj:=0; while kkj<90 do begin if (Kiz<aKmpu[kkj+1]) and (Kiz>=aKmpu[kkj]) then begin XXizu:=(90*(aX[kkj]+(Kiz-aKmpu[kkj])*(aX[kkj+1]-ax[kkj])/(aKmpu[kkj+1]-aKmpu[kkj])))/meridian+Nl; iku:=kkj; Form2.Chart1.Series[2].AddXY(XXizu,El); Form2.Chart1.Series[3].AddXY(XXizu,El); kkj:=90; end; kkj:=kkj+1; end; if (Kiz>=aKmpu[jX+1]) and (Kiz<aKmpu[jX]) then begin Xizu:=(90*(aX[jX]+(Kiz-aKmpu[jX])*(aX[jX+1]-ax[jX])/(aKmpu[jX+1]-aKmpu[jX])))/meridian+Nl; iXu:=jX; Form2.Chart1.Series[2].AddXY(Xizu,EL); Form2.Chart1.Series[3].AddXY(Xizu,El); jX:=90; end; if (Kiz>=yxKmpu[jX,jy]) and (Kiz<yxKmpu[jX,jY-1]) then begin Yizmpu[jX,jY]:=(aY[jY-1]+(Kiz-yxKmpu[jX,jY-1])*(aY[jY]-aY[jY-1])/(yxKmpu[jX,jY]-yxKmpu[jX,jY-1]))/parallel+El; Form2.Chart1.Series[2].AddXY(aX[jX]*90,Yizmpu[jX,jY]); Form2.Chart1.Series[3].AddXY(aX[jX]*90,2*El-Yizmpu[jX,jY]); Form2.Chart1.Series[4].AddXY(aX[1],Yizmpu[jX,jY]*(1.5)); Form2.Chart1.Series[5].AddXY(aX[1],2*El-Yizmpu[jX,jY]*(1.5)); end; //Π‘Π»ΠΎΠΊ Π²Ρ‹Π²ΠΎΠ΄Π° массива Ρ‚ΠΎΡ‡Π΅ΠΊ Π½Π° Π“Π˜Π‘ if Yizmpu[jX,jY]>0 then begin aXizu[1,jX]:=Yizmpu[jX,jY]; aXizu[0,jX]:=jX*zst; aXYizu[jX,1]:=Yizmpu[jX,jY]; aXYizu[jX,0]:=jX*zst; end; aXYizu[iXu,0]:=Xizu; aXYizu[iku,0]:=XXizu; //ΠšΠΎΠ½Π΅Ρ† Π±Π»ΠΎΠΊΠ° Y:=Y+5; jY:=jY+1; end; //ΠšΠΎΠ½Π΅Ρ† Ρ†ΠΈΠΊΠ»Π° ΠΏΠΎ ΠΏΠ΅Ρ€Π΅ΠΌΠ΅Π½Π½ΠΎΠΉ jy jX:=jX+1; end;//ΠšΠΎΠ½Π΅Ρ† Ρ†ΠΈΠΊΠ»Π° ΠΏΠΎ ΠΏΠ΅Ρ€Π΅ΠΌΠ΅Π½Π½ΠΎΠΉ jX end; //ΠšΠΎΠ½Π΅Ρ† Π±Π»ΠΎΠΊΠ° построСния ΠΈΠ·ΠΎΠ»ΠΈΠ½ΠΈΠΉ ΠΏΡ€ΠΈ опасной скорости Π²Π΅Ρ‚Ρ€Π° Niz:=Niz+1; end; //ΠšΠΎΠ½Π΅Ρ† Ρ†ΠΈΠΊΠ»Π° ΠΏΠΎ Niz jj:=1; Form2.Label1.Caption:=Edit7.Text; Form2.Label2.Caption:=ckm+' ΠΌ/с;'; Form2.Label3.Caption:=ck+' ΠΌ/с'; Form2.Show; end else FDub6.Show; end; //ΠšΠΎΠ½Π΅Ρ† ΠΏΡ€ΠΎΡ†Π΅Π΄ΡƒΡ€Ρ‹ построСния ΠΈΠ·ΠΎΠ»ΠΈΠ½ΠΈΠΉ 

Form code with graphs:

 unit Unit2; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, VclTee.TeeGDIPlus, VCLTee.TeEngine, Vcl.ExtCtrls, VCLTee.TeeProcs, VCLTee.Chart, Vcl.StdCtrls, VCLTee.Series; type TForm2 = class(TForm) Chart1: TChart; Series1: TLineSeries; Series2: TLineSeries; Series3: TLineSeries; Series4: TLineSeries; StaticText1: TStaticText; Label1: TLabel; Label2: TLabel; Label3: TLabel; procedure BitBtn6Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form2: TForm2; implementation {$R *.dfm} //label1:=Dub3.Edit7.Text procedure TForm2.BitBtn6Click(Sender: TObject); begin Chart1.Series[0].Clear;//Бброс Chart1.Series[1].Clear;//Бброс Chart1.Series[2].Clear;//Бброс Chart1.Series[3].Clear;//Бброс if CloseQuery then Close; end; end. 

Please tell me what could be the cause of the error, which way to dig?

  • 2
    First of all, you need to build the application in the Debug configuration, run it inside the IDE (F9) and look in the Call Stack window on which line of code the error occurs. After that, you can already analyze - why it arises there. AV is most often an appeal to a non-existent object. Which was not created or deleted - kami
  • you have only 4 episodes there, and at the beginning you clear 6. - teran
  • Thank. There in the button was the case most likely. Now I just got it. I wrote the code, but I did not create it. Now displays the graph) - Ivan Triumphov

0