Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
20
Добавлен:
27.05.2015
Размер:
3.29 Кб
Скачать
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, TeeProcs, TeEngine, Chart, XPMan, ComCtrls,
Grids, Series, Buttons;
type
TForm2 = class(TForm)
SG1: TStringGrid;
XPManifest1: TXPManifest;
C1: TChart;
C2: TChart;
RadioGroup1: TRadioGroup;
BitBtn1: TBitBtn;
Series1: TLineSeries;
Series2: TLineSeries;
BitBtn2: TBitBtn;
Label1: TLabel;
Edit1: TEdit;
procedure BitBtn1Click(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure Edit1Exit(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
t,y,v,tpr,k,dt,a,b,c:real;
l,kol,la,tau:integer;
implementation
uses unit1;
{$R *.dfm}
procedure TForm2.BitBtn1Click(Sender: TObject);
begin
form2.Visible:=false;
form1.Visible:=true;
end;
procedure TForm2.RadioGroup1Click(Sender: TObject);
begin
sg1.Cells[0,0]:='t';
sg1.Cells[1,0]:='l';
sg1.Cells[2,0]:='y(l)';
sg1.Cells[3,0]:='V(l)';
dt:=strtofloat(form1.Edit9.text);
tpr:=strtofloat(form1.Edit7.text)/6;
k:=strtofloat(form1.Edit10.text);
tau:=strtoint(form1.Edit8.text);
la:=round(tau/dt);
a:=2*tpr*tpr/(tpr*tpr+dt*dt);
b:=tpr*tpr/(tpr*tpr+dt*dt);
c:=k*dt*dt/(tpr*tpr+dt*dt);
kol:=strtoint(edit1.Text);
for l:=0 to 300-1 do
begin
sg1.Cells[0,l+1]:='';
sg1.cells[1,l+1]:='';
sg1.Cells[2,l+1]:='';
sg1.Cells[3,l+1]:='';
end;
end;
procedure TForm2.BitBtn2Click(Sender: TObject);
begin
c1.Series[0].Clear;
c2.Series[0].Clear;
kol:=strtoint(edit1.Text);
if form2.RadioGroup1.ItemIndex=0 then
begin
for l:=0 to kol-1 do
begin
sg1.Cells[0,l+1]:=floattostr(dt*l);
sg1.cells[1,l+1]:=inttostr(l);
sg1.Cells[3,l+1]:='100';
end;
for l:=1 to la do
sg1.Cells[2,l]:='5,65';
for l:=la to kol-1 do
begin
sg1.Cells[2,l+1]:=floattostr(a*strtofloat(sg1.Cells[2,l])-b*strtofloat(sg1.Cells[2,l-1])+c*strtofloat(sg1.Cells[3,l-1]));
end;
for l:=1 to kol do
begin
c1.series[0].AddXY(strtofloat(sg1.Cells[1,l]),strtofloat(sg1.Cells[3,l]),'',clred);
c2.Series[0].AddXY(strtofloat(sg1.Cells[1,l]),strtofloat(sg1.Cells[2,l]),'',clred);
end;
end;
if form2.RadioGroup1.ItemIndex=1 then
begin
for l:=0 to kol-1 do
begin
sg1.Cells[0,l+1]:=floattostr(dt*l);
sg1.cells[1,l+1]:=inttostr(l);
end;
for l:=1 to la do
sg1.Cells[2,l]:='5,65';
for l:=1 to round(tpr*6) do
sg1.Cells[3,l]:='100';
for l:=round(tpr*6+1) to round(tpr*12) do
sg1.Cells[3,l]:=floattostr(strtofloat(form1.edit1.Text)+100);
for l:=round(tpr*12) to kol do
sg1.Cells[3,l]:='100';
for l:=la to kol-1 do
begin
sg1.Cells[2,l+1]:=floattostr(a*strtofloat(sg1.Cells[2,l])-b*strtofloat(sg1.Cells[2,l-1])+c*strtofloat(sg1.Cells[3,l-1]));
end;
for l:=1 to kol do
begin
c1.series[0].AddXY(strtofloat(sg1.Cells[1,l])-tpr*6,strtofloat(sg1.Cells[3,l]),'',clred);
c2.Series[0].AddXY(strtofloat(sg1.Cells[1,l])-tpr*6,strtofloat(sg1.Cells[2,l]),'',clred);
end;
end;
end;
procedure TForm2.Edit1Exit(Sender: TObject);
begin
close;
end;
end.
Соседние файлы в папке МТУ курсовик
  • #
    27.05.20156.55 Кб18Unit1.~dfm
  • #
    27.05.20151.71 Кб18Unit1.~pas
  • #
    27.05.20159.17 Кб18Unit2.dcu
  • #
    27.05.201551 б18Unit2.ddp
  • #
    27.05.20154.53 Кб18Unit2.dfm
  • #
    27.05.20153.29 Кб20Unit2.pas
  • #
    27.05.201551 б19Unit2.~ddp
  • #
    27.05.20154.53 Кб18Unit2.~dfm
  • #
    27.05.20153.32 Кб19Unit2.~pas
  • #
    27.05.201518 Кб19untitled1.ewb
  • #
    27.05.20159.18 Mб25Бе.doc