Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
24
Добавлен:
27.05.2015
Размер:
4.69 Кб
Скачать
unit Unit1;

interface

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

type
TForm1 = class(TForm)
Panel1: TPanel;
BitBtn1: TBitBtn;
StringGrid1: TStringGrid;
Chart1: TChart;
Series1: TLineSeries;
Series2: TLineSeries;
Chart2: TChart;
Series3: TLineSeries;
Chart3: TChart;
Series4: TLineSeries;
Series5: TLineSeries;
Panel2: TPanel;
Label1: TLabel;
Edit1: TEdit;
LabeledEdit1: TLabeledEdit;
LabeledEdit2: TLabeledEdit;
LabeledEdit3: TLabeledEdit;
RadioGroup1: TRadioGroup;
Chart4: TChart;
Series6: TLineSeries;
Shape1: TShape;
Shape2: TShape;
Shape3: TShape;
procedure Colculate;
procedure NewValue;
procedure Grafics;
procedure Output;
procedure BitBtn1Click(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
const n=100;
var
Form1: TForm1;
Y: array[1..n] of Double;
dY: array[1..n] of Double;
U: array[1..n] of Double;
Uu: array[1..n] of Double;
Ud: array[1..n] of Double;
Up: array[1..n] of Double;
v: array[1..n] of Double;
Vogr: array[1..n] of Double;
Yogr: array[1..n] of Double;
t: array [1..n] of double;
Tu, Td, kp, Yz, w, Tef, Tpr: real;

implementation

{$R *.dfm}

{ TForm1 }

procedure TForm1.Colculate;
var l: integer;
begin
t[1]:=0;
Y[1]:=7530; dY[1]:=Yz-Y[1];
Uu[1]:=0; Ud[1]:=0; Up[1]:=0;
U[1]:=Uu[1]+Ud[1]+Up[1];
v[1]:=100; Yogr[1]:=0; Vogr[1]:=0;
for l:=2 to n do
begin
if l<7 then Y[l]:=7530 else
begin
t[l]:=t[l-1]+0.2;
Y[l]:=0.9*Y[l-1]-18.86*(v[l-5]-v[l-6]); end;
dY[l]:=(Yz-Y[l]);
Up[l]:=kp*dY[l]; // оперативная составляющая
Uu[l]:=Uu[l-1]+(0.2/Tu)*dY[l]; // априорная составляющая
Ud[l]:=(Td/0.2)*(dY[l]-dY[l-1]); // прогнозная составляющая
U[l]:=Uu[l]+Ud[l]+Up[l];
v[l]:=U[l]+w;

if v[l]<50 then Vogr[l]:=50
else
if v[l]>150 then Vogr[l]:=150
else Vogr[l]:=v[l];

if Y[l]<4518 then Yogr[l]:=4518
else
if Y[l]>12430 then Yogr[l]:=12430
else Yogr[l]:=Y[l];
end;
end;

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
NewValue;
Colculate;
Output;
Grafics;
end;

procedure TForm1.NewValue;
var Tf, Tp, tau, Tis,Tproc: double;
begin
if StrToFloat(LabeledEdit1.Text)=0 then Tf:=41.5
else Tf:=abs(StrToFloat(LabeledEdit1.Text));
if StrToFloat(LabeledEdit2.Text)=0 then Tp:=2
else Tp:=abs(StrToFloat(LabeledEdit1.Text));
if StrToFloat(LabeledEdit3.Text)=0 then tau:=1
else tau:=abs(StrToFloat(LabeledEdit1.Text));
if StrToFloat(Edit1.Text)>4500 then
Yz:=StrToFloat(Edit1.Text)
else
begin Yz:=8000; ShowMessage('Зарплата должна быть больше!'); end;
kp:=1.2/(Tf*(tau/Tp));
Tis:=2*Tp;
Tproc:=0.4*tau;
Tu:=Tis/kp; Td:=kp*Tproc;
end;

procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
if RadioGroup1.ItemIndex=0 then
w:=0
else
w:=30;
NewValue; Colculate; Output; Grafics;
end;

procedure TForm1.Grafics;
var i: integer;
begin
Series2.Clear;
for i:=1 to n do begin
Series1.AddXY(t[i], Yogr[i], '', clblack);
Series2.AddXY(t[i], Yz, '', clblack);
Series3.AddXY(t[i], Vogr[i], '', clblack);
Series4.AddXY(t[i], Y[i], '', clblack);
Series5.AddXY(t[i], Yz, '', clblack);
Series6.AddXY(t[i], v[i], '', clblack);
end;
end;

procedure TForm1.Output;
var i: integer;
begin
for i:=1 to n do
begin
StringGrid1.Cells[0,i]:=' '+IntToStr(i);
StringGrid1.Cells[1,i]:=' '+FloatToStr(Yz);
StringGrid1.Cells[2,i]:=FloatToStrF(Y[i],fffixed,7,3);
StringGrid1.Cells[3,i]:=FloatToStrF(dY[i],fffixed,7,3);
StringGrid1.Cells[4,i]:=FloatToStrF(u[i],fffixed,7,3);
StringGrid1.Cells[5,i]:=FloatToStrF(v[i],fffixed,7,3);
StringGrid1.Cells[6,i]:=' '+FloatToStr(Vogr[i]);
StringGrid1.Cells[7,i]:=FloatToStr(Yogr[i]);
StringGrid1.RowCount:=StringGrid1.RowCount+1;
end;

end;

procedure TForm1.FormCreate(Sender: TObject);
begin
StringGrid1.Cells[0,0]:=' l';
StringGrid1.Cells[1,0]:=' y*(l)';
StringGrid1.Cells[2,0]:=' y(l)';
StringGrid1.Cells[3,0]:=' dy(l)';
StringGrid1.Cells[4,0]:=' u(l)';
StringGrid1.Cells[5,0]:=' v(l)';
StringGrid1.Cells[6,0]:=' Vогр(l)';
StringGrid1.Cells[7,0]:=' Yогр(l)';
end;

end.
Соседние файлы в папке Программа
  • #
    27.05.2015184 б24PrOg.dpr
  • #
    27.05.2015876 б24PrOg.res
  • #
    27.05.20159.96 Кб24Unit1.dcu
  • #
    27.05.201551 б24Unit1.ddp
  • #
    27.05.201511.39 Кб24Unit1.dfm
  • #
    27.05.20154.69 Кб24Unit1.pas
  • #
    27.05.201551 б24Unit1.~ddp
  • #
    27.05.201511.39 Кб24Unit1.~dfm
  • #
    27.05.20154.69 Кб24Unit1.~pas