Приложение. Исходный код системы (по модулям).
ind,per,block1,block2,block3,coun,coun1,coun2,coun3,n1,n2,n3,k:double;
p1,p2,p3:array [1 50] of double;
GrPar, GrPercent, parm:array[1 200] of double;
MCon, Default,maxb:string;
sbl1,sbl2,sbl3:double;
kn, kp:array[1 3] of double;
srbl1,srbl2,srbl3,sdxq1,sdxq2,sdxq3:double;
dx1,dx2,dx3,sigm1,sigm2,sigm3,m:double;
begin
try
with Query1 do
begin
Active:=False;
SQL.Clear;
SQL.Add('Select * from "'+Form1.Table1.TableName+'"');
ExecSQL;
end;
Query1.Active:=True;
Chart1.Enabled:=True;
except
Application.MessageBox('Ошибка инициализации БД. Возможно не установлен BDE, или база не открыта.','Ошибка',mb_Ok+MB_ICONHAND);
Chart1.Enabled:=False;
Exit;
end;
if Query1.RecordCount=0 then
begin
Application.MessageBox('В БД нет ни одной записи.','Сообщение',mb_Ok+MB_ICONASTERISK);
Exit;
end;
Cf1:=TIniFile.Create(GetCurrentDir+'\Config.ini');
try
with Cf1 do
begin
MCon:=ReadString('MARK_CONFIG','MARKS_TYPE',Default);
if MCon='ONE_IN_ONE' then
begin
maxb:=ReadString('MARK_CONFIG','MARKS_VALUE',Default);
end;
MCon:=ReadString('BLOCK_CONFIG','NUM_BLOCKS',Default);
end;
NumI:=StrToInt(maxb);
Cf1.Free;
except
Application.MessageBox('Ошибка чтения из INI-файла. Проверьте конфигурацию.','Ошибка',mb_Ok+mb_IconHand);
Exit;
end;
for i:=0 to 200 do
begin
GrPar[i]:=0;
GrPercent[i]:=0;
parm[i]:=0;
end;
per:=0;
ind:=0;
Query1.First;
for j:=1 to Query1.RecordCount do
begin
parm[j]:=Query1.FieldValues['SUMMARK'];
Query1.Next;
end;
ind:=0;
for i:=1 to 6*NumI+1 do
begin
for j:=1 to Query1.RecordCount do
begin
if ind=parm[j] then per:=per+1;
end;
GrPar[i]:=ind;
GrPercent[i]:=per/Query1.RecordCount;
per:=0;
ind:=ind+1;
end;
Series1.Clear;
Chart1.BottomAxis.Title.Caption:='Суммарный балл';
Chart1.BottomAxis.Minimum:=0*NumMarks;
Chart1.BottomAxis.Maximum:=ind-1;
For i:=0 to 6*NumI+1 do
begin
Series1.AddXY(GrPar[i],GrPercent[i]);
end;
if MCon='2' then
begin
with Query1 do
begin
Series2.Clear;
Chart2.BottomAxis.Maximum:=RecordCount;
Chart2.BottomAxis.Minimum:=0;
n1:=0;
k:=1;
coun:=0;
First;
for i:=1 to RecordCount do
begin
block1:=FieldValues['MARK1']+FieldValues['MARK2']+FieldValues['MARK3'];
block2:=FieldValues['MARK4']+FieldValues['MARK5']+FieldValues['MARK6'];
Series2.AddXY(k,block1-block2);
if block1-block2>=0 then coun:=coun+1;
Next;
k:=k+1;
end;
end;
n1:=coun/Query1.RecordCount;
Label1.Caption:='Надежность реализации - '+FloatToStr(n1*100)+'%.';
end;
if MCon='3' then
begin
with Query1 do
begin
Series2.Clear;
Series4.Clear;
Series5.Clear;
Chart2.BottomAxis.Maximum:=RecordCount+10;
Chart2.BottomAxis.Minimum:=0;
n1:=0; n2:=0; n3:=0;
k:=1;
coun:=0; coun2:=0; coun3:=0;
First;
for i:=1 to RecordCount do
begin
block1:=FieldValues['MARK1']+FieldValues['MARK2'];
block2:=FieldValues['MARK3']+FieldValues['MARK4'];
block3:=FieldValues['MARK5']+FieldValues['MARK6'];
Series2.AddXY(k,block1-block2);
Series4.AddXY(k,block2-block3);
Series5.AddXY(k,block1-block3);
if block1-block2>=0 then coun1:=coun1+1;
if block2-block3>=0 then coun2:=coun2+1;
if block1-block3>=0 then coun3:=coun3+1;
Next;
k:=k+1;
end;
end;
n1:=coun1/Query1.RecordCount;
n2:=coun2/Query1.RecordCount;
n3:=coun3/Query1.RecordCount;
Label1.Caption:='Надежность реализации - '+FloatToStr(Okrugl(n1*100,2))+'%, '+FloatToStr(Okrugl(n2*100,2))+'%, '+FloatToStr(Okrugl(n3*100,2))+'%.';