⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tjjieguo.pas

📁 过负荷记录仪器分为单片机数据采集器和微机数据分析记录数据库软件两部分。 仪器具有监视变压器负荷电流(通过改变传感器也可记录最低电压)并自动记录过负荷电流出现的开始时间
💻 PAS
📖 第 1 页 / 共 2 页
字号:
unit tjjieguo;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, MXGRID, ComCtrls, TabNotBk, ExtCtrls, StdCtrls, DB,
  DBTables, TeEngine, Series, TeeProcs, Chart;

type
  Ttjjieguofrm = class(TForm)
    Panel1: TPanel;
    notebook: TTabbedNotebook;
    aci: TLabel;
    ashi: TLabel;
    azui: TLabel;
    bci: TLabel;
    bshi: TLabel;
    bzui: TLabel;
    Query1: TQuery;
    DataSource1: TDataSource;
    Chart1: TChart;
    Series1: TBarSeries;
    Chart2: TChart;
    Series2: TBarSeries;
    Chart3: TChart;
    Series3: TLineSeries;
    Chart4: TChart;
    Series4: TLineSeries;
    Chart5: TChart;
    Series5: TLineSeries;
    Chart6: TChart;
    Series6: TLineSeries;
    procedure FormShow(Sender: TObject);
    procedure notebookClick(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  tjjieguofrm: Ttjjieguofrm;

implementation

uses tongji;

{$R *.dfm}

procedure Ttjjieguofrm.FormShow(Sender: TObject);
var
  counttime,temp:single;
  max,maxold,i:integer;
  startime,endtime:tdatetime;
begin
counttime:=0;
max:=0;
Query1.Close ;
query1.DatabaseName :='ax';
Query1.RequestLive :=true;
Query1.SQL.Text :='select * from axiang '+tongjifrm.cxsql;
Query1.Open ;
aci.Caption :='A相过负荷累计次数:' +inttostr(query1.RecordCount)+' 次         ';
query1.First ;
for i:=1 to query1.RecordCount do
  begin
    endtime:= query1.FieldValues ['结束时间'];
    startime:=query1.FieldValues ['开始时间'];
    if endtime<startime then temp:=0
    else temp:=endtime - startime;
    counttime:=counttime+temp;
    maxold:=query1.FieldValues ['最大值'];
    if max<maxold then max:=maxold;
    query1.Next ;
  end;

ashi.Caption :='A相过负荷累计时间: ' + FormatDateTime ('hh:nn:ss',
    counttime);

azui.Caption :='最大值:   ' +inttostr(max)+'  A      ';

Query1.Close ;
query1.DatabaseName :='bx';
Query1.RequestLive :=true;
Query1.SQL.Text :='select * from bxiang '+tongjifrm.cxsql;
Query1.Open ;
bci.Caption :='B相过负荷累计次数:' +inttostr(query1.RecordCount)+' 次         ';
query1.First ;
counttime:=0;
max:=0;
for i:=1 to query1.RecordCount do
  begin
    endtime:=query1.FieldValues ['结束时间'];
    startime:=query1.FieldValues ['开始时间'];
    if endtime<startime then temp:=0
    else temp:=endtime - startime;
    counttime:=counttime+temp;
    maxold:=query1.FieldValues ['最大值'];
    if max<maxold then max:=maxold;
    query1.Next ;
  end;

bshi.Caption :='B相过负荷累计时间: ' +  FormatDateTime ('hh:nn:ss',
    counttime);
bzui.Caption :='最大值:   ' +inttostr(max)+'  A      ';
end;
//////////////////////////////////////////////////////////////////////////////

procedure Ttjjieguofrm.notebookClick(Sender: TObject);
var
startime,endtime,temp,starday,endday:tdatetime;
cishu:array [0..1000] of integer;
i,k,days:integer;
ksnian,ksyue,ksri,jsnian,jsyue,jsri,hour,min,sec,msec,oldstartime:word;
begin

if notebook.PageIndex =1 then
  begin
    k:=0;
    for i:=0 to 23 do cishu[i]:=0;
    chart1.Series [0].Clear ;
    Query1.Close ;
    query1.DatabaseName :='ax';
    Query1.RequestLive :=true;
    Query1.SQL.Text :='select * from axiang '+tongjifrm.cxsql;
    Query1.Open ;
    query1.First ;
    starday:=query1.FieldValues ['开始时间'];
    decodedate(starday,ksnian,ksyue,ksri);
    query1.last;
    endday:=query1.FieldValues ['开始时间'];
    decodedate(endday,jsnian,jsyue,jsri);
    days:=trunc(endday)-trunc(starday);
    chart1.Title.Text.Delete(0);
    if days>1 then
    chart1.Title.Text.Add('A相'+inttostr(ksnian)+'年'+inttostr(ksyue)+'月'
                    +inttostr(ksri)+'日-------'+inttostr(jsnian)+'年'
                    +inttostr(jsyue)+'月'+inttostr(jsri)+'日过负荷次数分布')
    else
    chart1.Title.Text.Add('A相'+inttostr(ksnian)+'年'+inttostr(ksyue)+'月'
                    +inttostr(ksri)+'日过负荷次数分布');
    query1.First ;
   if days>1 then
    begin
    oldstartime:=0;
    while not query1.Eof do
     begin
      startime:=query1.FieldValues ['开始时间'];
      if oldstartime<trunc(startime) then
         begin
         if k>0 then chart1.Series[0].AddXY(k,
                cishu[ksri],inttostr(ksyue)+'/'+inttostr(ksri),clyellow);
          inc(k);
          oldstartime:=trunc(startime);
         end;
      decodedate(startime,ksnian,ksyue,ksri);
      cishu[ksri]:=cishu[ksri]+1;
      query1.Next ;
     end;
     chart1.Series[0].AddXY(k,
                cishu[ksri],inttostr(ksyue)+'/'+inttostr(ksri),clyellow);
    end
    else begin
    while not query1.Eof do
     begin
      startime:=query1.FieldValues ['开始时间'];
      decodetime(startime,hour,min,sec,msec);
      cishu[hour]:=cishu[hour]+1;
      query1.Next ;
     end;
    for i:=0 to 23 do
     begin
      if cishu[i]<>0 then
       begin
        inc(k);
        chart1.Series[0].AddXY(k,cishu[i],inttostr(i),clyellow);
       end;
     end;
   end;
  end;
if notebook.PageIndex =2 then
 begin
    k:=0;
    for i:=0 to 23 do cishu[i]:=0;
    chart2.Series [0].Clear ;
    Query1.Close ;
    query1.DatabaseName :='bx';
    Query1.RequestLive :=true;
    Query1.SQL.Text :='select * from bxiang '+tongjifrm.cxsql;
    Query1.Open ;
    query1.First ;
    starday:=query1.FieldValues ['开始时间'];
    decodedate(starday,ksnian,ksyue,ksri);
    query1.last;
    endday:=query1.FieldValues ['开始时间'];
    decodedate(endday,jsnian,jsyue,jsri);
    days:=trunc(endday)-trunc(starday);
    chart2.Title.Text.Delete(0);
    if days>1 then
    chart2.Title.Text.Add('B相'+inttostr(ksnian)+'年'+inttostr(ksyue)+'月'
                    +inttostr(ksri)+'日-------'+inttostr(jsnian)+'年'
                    +inttostr(jsyue)+'月'+inttostr(jsri)+'日过负荷次数分布')
    else
    chart2.Title.Text.Add('B相'+inttostr(ksnian)+'年'+inttostr(ksyue)+'月'
                    +inttostr(ksri)+'日过负荷次数分布');
    query1.First ;
    if days>1 then
    begin
    oldstartime:=0;
    while not query1.Eof do
     begin
      startime:=query1.FieldValues ['开始时间'];
      if oldstartime<trunc(startime) then
         begin
         if k>0 then chart2.Series[0].AddXY(k,
                cishu[ksri],inttostr(ksyue)+'/'+inttostr(ksri),clgreen);
          inc(k);
          oldstartime:=trunc(startime);
         end;
      decodedate(startime,ksnian,ksyue,ksri);
      cishu[ksri]:=cishu[ksri]+1;
      query1.Next ;
     end;
     chart2.Series[0].AddXY(k,
                cishu[ksri],inttostr(ksyue)+'/'+inttostr(ksri),clgreen);
    end
    else begin
    while not query1.Eof do
     begin
      startime:=query1.FieldValues ['开始时间'];
      decodetime(startime,hour,min,sec,msec);
      cishu[hour]:=cishu[hour]+1;
      query1.Next ;
     end;
    for i:=0 to 23 do
     begin
      if cishu[i]<>0 then
       begin
        inc(k);
        chart2.Series[0].AddXY(k,cishu[i],inttostr(i),clgreen);
       end;
     end;
    end;
  end;
if notebook.PageIndex =3 then
  begin
  for i:=0 to 23 do cishu[i]:=0;
    chart3.Series [0].Clear ;
    Query1.Close ;
    query1.DatabaseName :='ax';

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -