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

📄 uclass.pas

📁 测井储层敏感指数计算-对某一测井数据进行相应井段储层敏感性指数计算
💻 PAS
📖 第 1 页 / 共 3 页
字号:
unit UClass;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, OleCtrls,  ComCtrls,
  DB, ADODB, AxCtrls, VCF1,Math ,IniFiles, TeeProcs, TeEngine, Chart,
  Series, Buttons;

type
    TForm1 = class(TForm)
    ADOConnection1: TADOConnection;
    ADOQuery1: TADOQuery;
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label16: TLabel;
    Label15: TLabel;
    Label14: TLabel;
    Label13: TLabel;
    Label12: TLabel;
    Label11: TLabel;
    Label10: TLabel;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    Edit7: TEdit;
    Edit8: TEdit;
    Edit9: TEdit;
    Edit10: TEdit;
    Edit11: TEdit;
    Edit12: TEdit;
    Edit13: TEdit;
    Edit14: TEdit;
    Edit15: TEdit;
    GroupBox4: TGroupBox;
    Button3: TButton;
    Button5: TButton;
    GroupBox2: TGroupBox;
    Label17: TLabel;
    Edit16: TEdit;
    Label18: TLabel;
    Edit17: TEdit;
    ScrollBar1: TScrollBar;
    GroupBox3: TGroupBox;
    Label19: TLabel;
    Label20: TLabel;
    Label21: TLabel;
    GroupBox6: TGroupBox;
    Label22: TLabel;
    Label23: TLabel;
    Label24: TLabel;
    GroupBox7: TGroupBox;
    Label25: TLabel;
    Label26: TLabel;
    Label27: TLabel;
    GroupBox8: TGroupBox;
    Label28: TLabel;
    Label29: TLabel;
    Label30: TLabel;
    BitBtn6: TBitBtn;
    BitBtn3: TBitBtn;
    BitBtn4: TBitBtn;
    Label31: TLabel;
    ComboBox1: TComboBox;
    GroupBox5: TGroupBox;
    ProgressBar1: TProgressBar;
    Chart1: TChart;
    Chart2: TChart;
    Chart3: TChart;
    Series1: THorizLineSeries;
    Series2: THorizLineSeries;
    Series3: THorizLineSeries;
    Series5: THorizBarSeries;
    Series6: THorizBarSeries;
    Series7: THorizBarSeries;
    Chart4: TChart;
    HorizLineSeries1: THorizLineSeries;
    HorizBarSeries1: THorizBarSeries;
    Button1: TButton;
    procedure Button5Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure RadioButton1Click(Sender: TObject);
    procedure RadioButton2Click(Sender: TObject);
    procedure ScrollBar1Change(Sender: TObject);
    procedure BitBtn6Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure BitBtn4Click(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure Button1Click(Sender: TObject);

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

var
  Form1: TForm1;

  //变量声明
  DFA:double;//视流体密度
  DFA1:double;//
  DG:single;//岩石骨架密度值
  SDG:single;
  NCL:double;//中子测井值
  DFA2:double;//
  DSH:double;//岩石密度
  NSH:double;//泥岩的中子孔隙度
  SHF1:integer;//
  GMXI:double;//测井曲线极大值
  GMNI:double;//测井曲线极小值
  VCL:double;//粘土含量
  DCL:double;//粘土密度值
  DFMN:double;//视流体密度最小值
  FDC:double;//流体密度调整因子
  CLMX:double;//粘土含量上限
  FDMN:double;//流体密度最小值
  SNCL:double;//
  SDCL:double;//
  RNCL:double;//
  DCLN:double;//
  ENCL:double;//
  DCLM:double;//粘土点密度的最大值
  SL2:double;//
  NCLM:double;//混合粘土点中子测井孔隙度最大值
  NCLN:double;//混合粘土点中子测井孔隙度最小值
  BWMX:double;//束缚水含量最大值
  BWMN:double;//束缚水含量最小值
  BW:double;//粘土束缚水
  DGCL:double;//干粘土密度
  DWB:double;//束缚水密度
  PMAX:double;//纯砂岩最大孔隙度
  PE:double;//有效孔隙度
  PT:double;
  RWE:double;//地层水等效电阻率
  RW:double;//地层水电阻率
  RWCL:double;//粘土水电阻率
  RTEMP:double;//
  BHT:double;//井底温度
  GRAD:double;//地温梯度
  ENDEP:double;//该点深度
  RDEP:double;//地层水RW读值处的深度
  RF75:double;//75F下电阻率
  C:double;//粘土水化水含量
  CEC:double;//粘土阳离子交换能力
  HIMX:double;//
  HIMN:double;//
  CECMX:double;//
  CECMN:double;//
  FAI:double;//

  WellTop:double; // 井段上部
  WellBottom:double; //井段下部
  P:double;//通过粘土分析化验资料得出的高岭石占高岭石、绿泥石总量百分含量
  DEPTH:array of double;//井深
  GR:array of double;//自然伽马
  SP:array of double;//自然电位
  DEN:array of double;//密度
  CNL:array of double;//中子含量

  VSH:array of double;//泥岩的相对体积
  TMI:double;
  TMON:array of double;//蒙脱石百分含量
  TCHK:double;//
  TGL:array of double;//高岭石百分含量
  TLN:array of double;//绿泥石百分含量
  TILL:array of double;//伊利石百分含量
  SVCL:array of double;//计算出的粘土含量

  mTGL:array of double;//高岭石敏感指数
  mTLN:array of double;//绿泥石敏感指数
  mTILL:array of double;//伊利石敏感指数
  mTMON:array of double;//蒙脱石敏感指数
  mSVCL:array of double;//粘土敏感指数

  WellID:string;
  acount:integer;
implementation

uses zhishu;

{$R *.dfm}

procedure TForm1.Button5Click(Sender: TObject);
begin
  form1.Close;
end;

procedure TForm1.FormShow(Sender: TObject);
var
    path,D,DBPWS,usernm,ServerIP,coninfo,str:string;
    TF_iniFile: TIniFile;
    i:integer;
begin
    GroupBox5.Visible:=false;

    try
    //读取数据库链接字符串
    Path:=ExtractFilePath(Application.ExeName);
    if fileexists(Path + 'psdp.ini') then
    begin
      D := 'DB';
      TF_iniFile := Tinifile.Create(Path + 'psdp.ini');

      DBPWS :=TF_iniFile.ReadString(D, 'DBPWS', '');
      usernm :=TF_iniFile.ReadString(D, 'usernm', 'sa');
      ServerIP :=TF_iniFile.ReadString(D, 'DBIP', '127.0.0.1');

      //创建数据库的连接字符串
      coninfo := 'Provider=SQLOLEDB.1;Password=' + trim(DBPWS) + ';Persist Security Info=false;';
      coninfo := coninfo + 'User ID=' + trim(usernm) + ';Initial Catalog=PSDP;';
      coninfo := coninfo + 'Data Source=' + ServerIP;

      //自己生成的ConnectionString
      //Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=PSDP;Data Source=SHAOXIAODONG
      //修改ADOConnection1连接字符串
      ADOConnection1.ConnectionString:=coninfo;
      //TF_iniFile.Destroy;
      TF_iniFile.Free;
    end;

    SHF1:=1;

    {
    //打开文本文件读取测井编号
    path:=ExtractFilePath(Application.ExeName)+'Sen.txt';
    AssignFile(F,path);
    Reset(F);
    Reset(F);
    try
      Readln(F,str);
    finally
      CloseFile(F);
    end;   }

    WellID:='1';

    //取得某一口井已经计算井段并显示
    ADOQuery1.Close;
    ADOQuery1.SQL.Clear;
    str:='select * from TbParameterTable where WellID='+ WellID +'order by DepthTop ASC';
    ADOQuery1.SQL.Add(str);
    ADOQuery1.ExecSQL;
    ADOQuery1.Open;
    acount:=ADOQuery1.RecordCount;
    if acount=0 then exit;
    ADOQuery1.Recordset.MoveFirst;
    for i:=0 to acount-1 do
    begin
      str:= floattostr(ADOQuery1.Recordset.Fields['WellID'].Value)+'-'+
            floattostr(ADOQuery1.Recordset.Fields['DepthTop'].Value)+'-'+
            floattostr(ADOQuery1.Recordset.Fields['DepthBottom'].Value);
      ComboBox1.AddItem(str,nil);
      ADOQuery1.Recordset.MoveNext ;
    end;

    except
    Application.HandleException(Self);
    end;
    ScrollBar1.Enabled:=false;
end;

procedure TForm1.Button3Click(Sender: TObject);
var
    F:TextFile; Path,S: string;
    Tbccmgzs_top,Tbccmgzs_bottom:string;
    i:integer;
    SqlString:string;
    temp1,temp2,temp3,temp4,temp5,temp6,temp7:string;

begin
 try
    //检测输入参数合法性
    if (Edit9.Text='') or (StrToFloat(Edit9.Text)<0) or (StrToFloat(Edit9.Text)>100) then
    begin
      application.MessageBox('输入参数空或非法!', '系统提示', 0);
      exit;
    end
    else  P:=StrToFloat(Edit9.Text);
    if (Edit1.Text='') or (StrToFloat(Edit1.Text)<0) or (StrToFloat(Edit1.Text)>1) then
    begin
      application.MessageBox('输入参数空或非法!', '系统提示', 0);
      exit;
    end
    else  FDC:=StrToFloat(Edit1.Text);
    if (Edit12.Text='') or (StrToFloat(Edit12.Text)<0.34) or (StrToFloat(Edit12.Text)>0.36) then
    begin
      application.MessageBox('输入参数空或非法!', '系统提示', 0);
      exit;
    end
    else  HIMX:=StrToFloat(Edit12.Text);
    if (Edit13.Text='') or (StrToFloat(Edit13.Text)<0) or (StrToFloat(Edit13.Text)>0.13) then
    begin
      application.MessageBox('输入参数空或非法!', '系统提示', 0);
      exit;
    end
    else  HIMN:=StrToFloat(Edit13.Text);
    if (Edit14.Text='') or (StrToFloat(Edit14.Text)<8) or (StrToFloat(Edit14.Text)>40) then
    begin
      application.MessageBox('输入参数空或非法!', '系统提示', 0);
      exit;
    end
    else  CECMN:=StrToFloat(Edit14.Text);
    if (Edit15.Text='') or (StrToFloat(Edit15.Text)<80) or (StrToFloat(Edit15.Text)>150) then
    begin
      application.MessageBox('输入参数空或非法!', '系统提示', 0);
      exit;
    end
    else  CECMX:=StrToFloat(Edit15.Text);
    if (Edit16.Text='') or (Edit17.Text='') or (StrToFloat(Edit16.Text)>=StrToFloat(Edit17.Text)) then
    begin
      application.MessageBox('输入参数空或非法!', '系统提示', 0);
      exit;
    end
    else
    begin
      WellTop:=StrToFloat(Edit16.Text);
      WellBottom:=StrToFloat(Edit17.Text);
    end  ;
    //给其他变量赋值
    DCLM:=StrToFloat(Edit3.Text);
    DCLN:=StrToFloat(Edit2.Text);
    NCLM:=StrToFloat(Edit5.Text)/100;
    NCLN:=StrToFloat(Edit4.Text)/100;
    DGCL:=StrToFloat(Edit6.Text);
    PMAX:=StrToFloat(Edit7.Text)/100;
    RW:=StrToFloat(Edit8.Text);
    BHT:=StrToFloat(Edit9.Text);
    GRAD:=StrToFloat(Edit10.Text);
    RDEP:=StrToFloat(Edit11.Text);
    //采用默认值参数
    DG:=2.65;
    DSH:=2.45;
    NSH:=0.35;
    NCL:=0.40;
    DCL:=2.65;
    CLMX:=0.55;
    FDMN:=0.1;
    BWMX:=0.20;
    BWMN:=0.01;
    RWCL:=0.05;
    DWB:=1;

    //取得要删除敏感指数段最大DepthBottom
    ADOQuery1.Close;
    ADOQuery1.SQL.Clear;
    SqlString:='Select * from TbParameterTable where WellID='+WellID+ ' and DepthTop>='+floattostr(WellTop)+' and DepthTop<='+floattostr(WellBottom)+' order by DepthBottom DESC';
    ADOQuery1.SQL.Add(SqlString);
    ADOQuery1.ExecSQL;
    ADOQuery1.Open;
    if ADOQuery1.RecordCount <>0 then
    begin
      ADOQuery1.Recordset.MoveFirst;
      Tbccmgzs_bottom:=ADOQuery1.Recordset.Fields['DepthBottom'].Value;
    end
    else  Tbccmgzs_bottom:=floattostr(WellBottom);

    //取得要删除敏感指数段最小DepthTop
    ADOQuery1.Close;
    ADOQuery1.SQL.Clear;
    SqlString:='Select * from TbParameterTable where WellID='+WellID+ ' and DepthBottom>='+floattostr(WellTop)+' and DepthBottom<='+floattostr(WellBottom)+' order by DepthTop ASC';
    ADOQuery1.SQL.Add(SqlString);
    ADOQuery1.ExecSQL;
    ADOQuery1.Open;
    if ADOQuery1.RecordCount <>0 then
    begin
      ADOQuery1.Recordset.MoveFirst;
      Tbccmgzs_top:=ADOQuery1.Recordset.Fields['Depthtop'].Value;
    end
    else  Tbccmgzs_top:=floattostr(WellTop);
    
    //删除上次表中的临时计算结果  储层敏感指数计算结果表-Tbccmgzs
    ADOQuery1.Close;
    ADOQuery1.SQL.Clear;
    SqlString:='Delete from Tbccmgzs where WellID='+WellID+ ' and Depth>='+Tbccmgzs_top+' and Depth<='+Tbccmgzs_bottom;
    ADOQuery1.SQL.Add(SqlString);
    ADOQuery1.ExecSQL;

    //删除上次表中结果结果对应参数 TbParameterTable
    ADOQuery1.Close;
    ADOQuery1.SQL.Clear;
    SqlString:='Delete from TbParameterTable where (WellID='+WellID+ ') and (DepthTop>='+floattostr(WellTop)+' and DepthTop<='+floattostr(WellBottom)+') or ((DepthBottom>='+floattostr(WellTop)+' and DepthBottom<='+floattostr(WellBottom)+'))';
    ADOQuery1.SQL.Add(SqlString);
    ADOQuery1.ExecSQL;

    //连接数据库,获取记录条数
    ADOQuery1.Close;
    ADOQuery1.SQL.Clear;
    SqlString:='select * from TbParameterCyqx where WellID='+WellID+ ' and Depth>='+floattostr(WellTop)+' and Depth<='+floattostr(WellBottom);
    ADOQuery1.SQL.Add(SqlString);
    ADOQuery1.ExecSQL;
    ADOQuery1.Open;
    acount:=ADOQuery1.RecordCount;
    if acount=0 then
    begin
      application.MessageBox('不存在相应记录条数!', '系统提示', 0);
      exit;
    end;

    SetLength(DEPTH,acount);
    SetLength(SP,acount);
    SetLength(GR,acount);

⌨️ 快捷键说明

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