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

📄 paraadd.pas

📁 合成实验的上位机程序
💻 PAS
📖 第 1 页 / 共 5 页
字号:
  {//打开试验
  if MessageBox(ParaAddFrm.Handle,'您确信要另外选择一个试验吗?','提示',
    MB_YESNO+MB_ICONQUESTION+MB_DEFBUTTON2+MB_APPLMODAL)=IDNO then
  begin
    Exit;
  end;}
  case ComboBox1.ItemIndex of
    0: OpenDialog1.InitialDir:=Main.ShuJuDir+'单分';
    1: OpenDialog1.InitialDir:=Main.ShuJuDir+'合分';
    2: OpenDialog1.InitialDir:=Main.ShuJuDir+'重合闸';
    3: OpenDialog1.InitialDir:=Main.ShuJuDir+'动热稳定';
    4: OpenDialog1.InitialDir:=Main.ShuJuDir+'自定义';
  else
    OpenDialog1.InitialDir:=Main.ShuJuDir;
  end;
  if OpenDialog1.Execute=True then
  begin
    golFileName:=pChar(OpenDialog1.FileName);
    for I:=0 to 2 do
      for J:=1 to 12 do
        StringGrid1.Cells[I,J]:='';
    for I:=0 to 1 do
      for J:=1 to 23 do
        StringGrid2.Cells[I,J]:='';
    ADOConnection1.Close;
    ADODataSet1.Close;
    ADODataSet2.Close;
    ADoConnection1.ConnectionString:=
      'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+OpenDialog1.FileName+
      ';Persist Security Info=False;Jet OLEDB:System database="";'+
      'Jet OLEDB:Registry Path="";Jet OLEDB:Engine Type=5;'+
      'Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;'+
      'Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:Create System Database=False;';
    ADOConnection1.Connected:=True;
    ADODataSet1.CommandText:='outChannel';
    DataSource1.DataSet:=ADODataSet1;
    ADODataSet1.Connection:=ADOConnection1;
    ADODataSet1.Open;
    ADODataSet2.CommandText:='Information';
    DataSource2.DataSet:=ADODataSet2;
    ADODataSet2.Connection:=ADOConnection1;
    ADODataSet2.Open;
    for I:=0 to 4 do
      if ComboBox1.Items.Strings[I]=ADODataSet2.FieldByName('TestType').AsString then
      begin
        ComboBox1.ItemIndex:=I;
        break;
      end;
    Edit1.Text:=ADODataSet2.FieldByName('Client').AsString;
    Edit2.Text:=ADODataSet2.FieldByName('Product').AsString;
    if ComboBox1.Text<>'自定义试验' then
    if ComboBox1.Text<>'重合闸试验' then
    begin
      for I:=1 to ADODataSet1.RecordCount do
      begin
        StringGrid1.Cells[0,I]:=ADODataSet1.FieldByName('通道序号').AsString;
        StringGrid1.Cells[1,I]:=ADODataSet1.FieldByName('第一段高电平持续时间').AsString;
        StringGrid1.Cells[2,I]:=ADODataSet1.FieldByName('通道功能').AsString;
        if I<>ADODataSet1.RecordCount then
          ADODataSet1.Next;
      end;
    end
    else
    begin
      for I:=1 to 12 do
        case I of
          1,6..12: begin
                     StringGrid1.Cells[0,I]:=ADODataSet1.FieldByName('通道序号').AsString;
                     StringGrid1.Cells[1,I]:=ADODataSet1.FieldByName('第一段高电平持续时间').AsString;
                     StringGrid1.Cells[2,I]:=ADODataSet1.FieldByName('通道功能').AsString;
                     if I<>12 then
                       ADODataSet1.Next;
                   end;
              2,4: begin
                     StringGrid1.Cells[0,I]:=ADODataSet1.FieldByName('通道序号').AsString;
                     StringGrid1.Cells[1,I]:=ADODataSet1.FieldByName('第一段高电平持续时间').AsString;
                     StringGrid1.Cells[2,I]:=ADODataSet1.FieldByName('通道功能').AsString;
                   end;
              3,5: begin
                     StringGrid1.Cells[0,I]:=ADODataSet1.FieldByName('通道序号').AsString;
                     StringGrid1.Cells[1,I]:=ADODataSet1.FieldByName('第二段高电平持续时间').AsString;
                     StringGrid1.Cells[2,I]:=ADODataSet1.FieldByName('通道功能').AsString;
                     ADODataSet1.Next;
                   end;  
        end;
      tmp1:=StringGrid1.Cells[1,4];
      tmp2:=StringGrid1.Cells[1,5];
      if (StrToInt(tmp1)<>0) and (StrToInt(tmp2)=0) then
      begin
        StringGrid1.Cells[1,5]:=StringGrid1.Cells[1,4];
        StringGrid1.Cells[1,4]:='0';
      end;
    end;
    With StringGrid2 do
    begin
      if ADODataSet2.FieldByName('TestType').AsString='单分试验' then
      begin
        Cells[1,1]:=ADODataSet2.FieldByName('t1').AsString;
        Cells[1,2]:=ADODataSet2.FieldByName('t2').AsString;
        Cells[1,3]:=ADODataSet2.FieldByName('t3').AsString;
        Cells[1,4]:=ADODataSet2.FieldByName('t4').AsString;
        Cells[1,5]:=ADODataSet2.FieldByName('t5').AsString;
        Cells[1,6]:=ADODataSet2.FieldByName('t6').AsString;
        Cells[1,7]:=ADODataSet2.FieldByName('t7').AsString;
        Cells[1,8]:=ADODataSet2.FieldByName('t8').AsString;
        Cells[1,9]:=ADODataSet2.FieldByName('t9').AsString;
        Cells[1,10]:=ADODataSet2.FieldByName('t10').AsString;
        Cells[1,11]:=ADODataSet2.FieldByName('t11').AsString;
        Cells[1,12]:=ADODataSet2.FieldByName('t12').AsString;
        Cells[0,1]:='N1(短路半波数)';
        Cells[0,2]:='合闸开关合闸时间(ms)';
        Cells[0,3]:='试品分闸时间(ms)';
        Cells[0,4]:='试品燃弧时间(ms)';
        Cells[0,5]:='辅助开关分闸时间(ms)';
        Cells[0,6]:='辅助开关燃弧时间(ms)';
        Cells[0,7]:='燃弧开关分闸时间(ms)';
        Cells[0,8]:='t(燃弧开关在短路电流过零前t毫秒分闸)';
        Cells[0,9]:='N2(短路电流过零后保护开关分闸错后半波数)';
        Cells[0,10]:='保护开关分闸时间(ms)';
        Cells[0,11]:='高压开锁时间';
        Cells[0,12]:='延弧开锁时间';
      end;
      if ADODataSet2.FieldByName('TestType').AsString='合分试验' then
      begin
        Cells[1,1]:=ADODataSet2.FieldByName('t1').AsString;
        Cells[1,2]:=ADODataSet2.FieldByName('t2').AsString;
        Cells[1,3]:=ADODataSet2.FieldByName('t3').AsString;
        Cells[1,4]:=ADODataSet2.FieldByName('t4').AsString;
        Cells[1,5]:=ADODataSet2.FieldByName('t5').AsString;
        Cells[1,6]:=ADODataSet2.FieldByName('t6').AsString;
        Cells[1,7]:=ADODataSet2.FieldByName('t7').AsString;
        Cells[1,8]:=ADODataSet2.FieldByName('t8').AsString;
        Cells[1,9]:=ADODataSet2.FieldByName('t9').AsString;
        Cells[1,10]:=ADODataSet2.FieldByName('t10').AsString;
        Cells[1,11]:=ADODataSet2.FieldByName('t11').AsString;
        Cells[1,12]:=ADODataSet2.FieldByName('t12').AsString;
        Cells[1,13]:=ADODataSet2.FieldByName('t13').AsString;
        Cells[0,1]:='N1(短路半波数)';
        Cells[0,2]:='合闸开关合闸时间(ms)';
        Cells[0,3]:='试品合闸时间(ms)';
        Cells[0,4]:='试品分闸时间(ms)';
        Cells[0,5]:='试品燃弧时间(ms)';
        Cells[0,6]:='辅助开关分闸时间(ms)';
        Cells[0,7]:='辅助开关燃弧时间(ms)';
        Cells[0,8]:='燃弧开关分闸时间(ms)';
        Cells[0,9]:='t(燃弧开关在短路电流过零前t毫秒分闸)';
        Cells[0,10]:='N2(短路电流过零后保护开关分闸错后半波数)';
        Cells[0,11]:='保护开关分闸时间(ms)';   
        Cells[0,12]:='高压开锁时间';
        Cells[0,13]:='延弧开锁时间';
      end;
      if ADODataSet2.FieldByName('TestType').AsString='重合闸试验' then
      begin
        Cells[1,1]:=ADODataSet2.FieldByName('t1').AsString;
        Cells[1,2]:=ADODataSet2.FieldByName('t2').AsString;
        Cells[1,3]:=ADODataSet2.FieldByName('t3').AsString;
        Cells[1,4]:=ADODataSet2.FieldByName('t4').AsString;
        Cells[1,5]:=ADODataSet2.FieldByName('t5').AsString;
        Cells[1,6]:=ADODataSet2.FieldByName('t6').AsString;
        Cells[1,7]:=ADODataSet2.FieldByName('t7').AsString;
        Cells[1,8]:=ADODataSet2.FieldByName('t8').AsString;
        Cells[1,9]:=ADODataSet2.FieldByName('t9').AsString;
        Cells[1,10]:=ADODataSet2.FieldByName('t10').AsString;
        Cells[1,11]:=ADODataSet2.FieldByName('t11').AsString;
        Cells[1,12]:=ADODataSet2.FieldByName('t12').AsString;
        Cells[1,13]:=ADODataSet2.FieldByName('t13').AsString;
        Cells[1,14]:=ADODataSet2.FieldByName('t14').AsString;
        Cells[1,15]:=ADODataSet2.FieldByName('t15').AsString;
        Cells[1,16]:=ADODataSet2.FieldByName('t16').AsString;
        Cells[1,17]:=ADODataSet2.FieldByName('t17').AsString;
        Cells[1,18]:=ADODataSet2.FieldByName('t18').AsString;
        Cells[1,19]:=ADODataSet2.FieldByName('t19').AsString;
        Cells[1,20]:=ADODataSet2.FieldByName('t20').AsString;
        Cells[1,21]:=ADODataSet2.FieldByName('t21').AsString;
        Cells[1,22]:=ADODataSet2.FieldByName('t22').AsString;   
        Cells[1,23]:=ADODataSet2.FieldByName('t23').AsString;
        Cells[0,1]:='N2(试品分闸2短路半波数)';
        Cells[0,2]:='无电流时间(ms)';
        Cells[0,3]:='N1(试品分闸1短路半波数)';
        Cells[0,4]:='合闸开关合闸时间(ms)';
        Cells[0,5]:='试品分闸1时间(ms)';
        Cells[0,6]:='试品分闸1燃弧时间(ms)';
        Cells[0,7]:='辅助开关分闸1时间(ms)';
        Cells[0,8]:='辅助开关分闸1燃弧时间(ms)';
        Cells[0,9]:='N3(短路电流一次过零后辅助开关分闸1燃弧时间)';
        Cells[0,10]:='辅助开关合闸时间(ms)';
        Cells[0,11]:='N(辅助开关提前试品合闸半波数)';
        Cells[0,12]:='试品合闸时间(ms)';
        Cells[0,13]:='试品分闸2时间(ms)';
        Cells[0,14]:='试品分闸2燃弧时间(ms)';
        Cells[0,15]:='辅助开关分闸2时间(ms)';
        Cells[0,16]:='辅助开关分闸2燃弧时间(ms)';
        Cells[0,17]:='燃弧开关分闸时间(ms)';
        Cells[0,18]:='t(燃弧开关在短路电流二次过零前t毫秒分闸)';
        Cells[0,19]:='N4(短路电流二次过零后保护开关分闸错后半波数)';
        Cells[0,20]:='保护开关分闸时间(ms)';
        Cells[0,21]:='保护开关时间(ms)';
        Cells[0,22]:='高压开锁时间';
        Cells[0,23]:='延弧开锁时间';
      end;
      if ADODataSet2.FieldByName('TestType').AsString='动热稳定试验' then
      begin
        Cells[1,1]:=ADODataSet2.FieldByName('t1').AsString;
        Cells[1,2]:=ADODataSet2.FieldByName('t2').AsString;
        Cells[1,3]:=ADODataSet2.FieldByName('t3').AsString;
        Cells[0,1]:='保护开关合闸时间(ms)';
        Cells[0,2]:='高压开锁时间';
        Cells[0,3]:='延弧开锁时间';
      end;
      ADOConnection1.Close;
      ADODataSet1.Close;
      ADODataSet2.Close;
      if ComboBox1.Text<>'自定义试验' then
      begin
        dxButton1.Enabled:=True;
        oneSave:=0;
        MainFrm.ParaData.Enabled:=False;
        MainFrm.ParaDataBtn.Enabled:=False;
        MainFrm.Reset.Enabled:=False;
        MainFrm.ResetBtn.Enabled:=False;
        MainFrm.TestRun.Enabled:=False;
        MainFrm.TestRunBtn.Enabled:=False;
        MainFrm.TestVer.Enabled:=False;
        MainFrm.TestVerBtn.Enabled:=False;
        MainFrm.WaveView.Enabled:=False;
        MainFrm.WaveViewBtn.Enabled:=False;
      end
      else
      begin
        dxButton1.Enabled:=False;
        oneSave:=0;
        MainFrm.ParaData.Enabled:=True;
        MainFrm.ParaDataBtn.Enabled:=True;
        MainFrm.Reset.Enabled:=True;
        MainFrm.ResetBtn.Enabled:=True;
        MainFrm.TestRun.Enabled:=True;
        MainFrm.TestRunBtn.Enabled:=True;
        MainFrm.TestVer.Enabled:=True;
        MainFrm.TestVerBtn.Enabled:=True;
        MainFrm.WaveView.Enabled:=True;
        MainFrm.WaveViewBtn.Enabled:=True;
      end;
      for I:=1 to 32 do
      begin
        cnnConImg[I].Tag:=0;
        cnnConImg[I].Picture.LoadFromFile(Main.PictureDir+'Gray.bmp');
        cnnVerImg[I].Picture.LoadFromFile(Main.PictureDir+'Gray.bmp');
      end;
      for I:=1 to 4 do
      begin
        cnnHighImg[I].Picture.LoadFromFile(Main.PictureDir+'Gray.bmp');
        cnnArcImg[I].Picture.LoadFromFile(Main.PictureDir+'Gray.bmp');
      end;
      //MainFrm.XPMenu1.XPControls:=MainFrm.XPMenu1.XPControls+[xcToolBar];
    end;
  end;
  //隐藏显示通道选择菜单
  WaveViewFrm.T1.Visible:=False;
  WaveViewFrm.T2.Visible:=False;
  WaveViewFrm.T3.Visible:=False;
  WaveViewFrm.T4.Visible:=False;
  WaveViewFrm.T5.Visible:=False;
  WaveViewFrm.T6.Visible:=False;
  WaveViewFrm.T7.Visible:=False;
  WaveViewFrm.T8.Visible:=False;
  WaveViewFrm.T9.Visible:=False;
  WaveViewFrm.T10.Visible:=False;
  WaveViewFrm.T11.Visible:=False;
  WaveViewFrm.T12.Visible:=False;
  WaveViewFrm.T13.Visible:=False;
  WaveViewFrm.T14.Visible:=False;
  WaveViewFrm.T15.Visible:=False;
  WaveViewFrm.T16.Visible:=False;
  WaveViewFrm.T17.Visible:=False;
  WaveViewFrm.T18.Visible:=False;
  WaveViewFrm.T19.Visible:=False;
  WaveViewFrm.T20.Visible:=False;
  WaveViewFrm.T21.Visible:=False;
  WaveViewFrm.T22.Visible:=False;
  WaveViewFrm.T23.Visible:=False;
  WaveViewFrm.T24.Visible:=False;
  WaveViewFrm.T25.Visible:=False;
  WaveViewFrm.T26.Visible:=False;
  WaveViewFrm.T27.Visible:=False;
  WaveViewFrm.T28.Visible:=False;
  WaveViewFrm.T29.Visible:=False;
  WaveViewFrm.T30.Visible:=False;
  WaveViewFrm.T31.Visible:=False;
  WaveViewFrm.T32.Visible:=False;
  MainFrm.CaptionLbl.Caption:='合成试验('+ComboBox1.Text+')';
end;

procedure TParaAddFrm.dxButton2Click(Sender: TObject);
var
  I:Integer;
begin
  for I:=1 to StringGrid1.RowCount do
    if ComboBox3.Text=StringGrid1.Cells[0,I] then
      if MessageBox(ParaAddFrm.Handle,'示波器通道和其它通道冲突,请重新设置!','错误',
        MB_OK+MB_ICONERROR+MB_DEFBUTTON1+MB_APPLMODAL)=IDOK then
       Exit;                                          
  //退出命令
  ParaAddFrm.CloseSpdBtnClick(Sender);
end;

procedure TParaAddFrm.FormShow(Sender: TObject);
begin
  //自定义一个基准时间   
  BaseTime:=805;
end;

procedure TParaAddFrm.ComboBox5Change(Sender: TObject);
begin
  ComboBox4.ItemIndex:=ComboBox5.ItemIndex;
end;

procedure TParaAddFrm.FormCloseQuery(Sender: TObject;
  var CanClose: Boolean);
begin
  if dxButton1.Enabled=True then
    if MessageBox(ParaAddFrm.Handle,'您确信不保存试验参数就退出吗?','提示',
      MB_YESNO+MB_ICONQUESTION+MB_DEFBUTTON2+MB_APPLMODAL)=IDNO then
      CanClose:=False
    else
      CanClose:=True;
end;

end.

⌨️ 快捷键说明

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