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

📄 uclass.pas

📁 测井储层敏感指数计算-对某一测井数据进行相应井段储层敏感性指数计算
💻 PAS
📖 第 1 页 / 共 3 页
字号:
    SetLength(DEN,acount);
    SetLength(CNL,acount);

    SetLength(TMON,acount);
    SetLength(TGL,acount);
    SetLength(TLN,acount);
    SetLength(TILL,acount);

    SetLength(mTMON,acount);
    SetLength(mTGL,acount);
    SetLength(mTLN,acount);
    SetLength(mTILL,acount);

    SetLength(VSH,acount);
    SetLength(SVCL,acount);
    SetLength(mSVCL,acount);

    //变量赋值
    ADOQuery1.Recordset.MoveFirst;
    for i:=0 to acount-1 do
    begin
      DEPTH[i]:= ADOQuery1.Recordset.Fields['Depth'].Value;
      GR[i]:= ADOQuery1.Recordset.Fields['GR'].Value;
      SP[i]:= ADOQuery1.Recordset.Fields['SP'].Value;
      DEN[i]:= ADOQuery1.Recordset.Fields['DEN'].Value;
      CNL[i]:= ADOQuery1.Recordset.Fields['CNL'].Value/100;
      ADOQuery1.Recordset.MoveNext ;
    end;

    Edit16.Hint:=floattostr(DEPTH[0])+'-'+ floattostr(DEPTH[acount-1]);
    Edit17.Hint:=floattostr(DEPTH[0])+'-'+ floattostr(DEPTH[acount-1]);

    //计算泥质相对体积
    if SHF1=1 then
    begin
    //保证第一个值为非法数据
    For i:= 0 To acount - 1   do
    begin
      if GR[i]=-9999 then continue
      else
      begin
       GMXI := GR[i];
       GMNI := GR[i];
       break;
      end;
    end;

    //计算最大值、最小值并排除非法数据
    For i:= 0 To acount - 1   do
    begin
      if GR[i]=-9999 then continue;
      If GR[i] > GMXI Then GMXI := GR[i];
      If GR[i] < GMNI Then GMNI := GR[i];
    end;

    end;
    if SHF1=2 then
    begin
    //保证第一个值为非法数据
    For i:= 0 To acount - 1   do
    begin
      if GR[i]=-9999 then continue
      else
      begin
       GMXI := SP[i];
       GMNI := SP[i];
       break;
      end;
    end;

    //计算最大值、最小值并排除非法数据
    For i:= 0 To acount - 1   do
    begin
      if GR[i]=-9999 then continue;
      If SP[i] > GMXI Then GMXI := SP[i];
      If SP[i] < GMNI Then GMNI := SP[i];
    end;
    end;

    //清空表格
    Chart1.Series[0].Clear ;
    Chart1.Series[1].Clear ;
    Chart2.Series[0].Clear ;
    Chart2.Series[1].Clear ;
    Chart3.Series[0].Clear ;
    Chart3.Series[1].Clear ;
    Chart4.Series[0].Clear ;
    Chart4.Series[1].Clear ;

    Chart1.Series[0].Active:=false;
    Chart1.Series[1].Active:=false;
    Chart2.Series[0].Active:=false;
    Chart2.Series[1].Active:=false;
    Chart3.Series[0].Active:=false;
    Chart3.Series[1].Active:=false;
    Chart4.Series[0].Active:=false;
    Chart4.Series[1].Active:=false;

    GroupBox5.Visible:=true;
    for i:=0 to acount-1 do
    begin
      //对曲线表中存在的非法数据-9999项予以剔除
      if  (DEPTH[i] =-9999) or
          (GR[i]=-9999) or
          (SP[i]=-9999) or
          (DEN[i]=-9999) or
          (CNL[i]=-9999)  then continue;

      if SHF1=1 then
        VSH[i]:=(GR[i]-GMNI)/(GMXI-GMNI);
      if SHF1=2 then
        VSH[i]:=(SP[i]-GMNI)/(GMXI-GMNI);
      //敏感度指数计算
      //第一步:计算视流体密度
      DFA1:=DG*CNL[i]/(CNL[i]+DG-DEN[i]);    //1。DFA1
      DFA2:=DG*(CNL[i]-VSH[i]*NSH)/(CNL[i]-VSH[i]*NSH+DG-(DEN[i]+VSH[i]*(DG-DSH)));  //2。DFA2
      VCL:=((DG-1)*CNL[i]+DEN[i]-DG)/((DG-1)*NCL-DCL+DG); //3。粘土含量VCL初值
      DFMN:=DFA1-FDC*(DFA1-DFA2)*(VCL+0.1)/(VSH[i]+0.1); //4。经验性估算视流体密度最小值
      //5。由用户提供的粘土含量上限调整DFMN
      if VCL>CLMX then DFMN:=1;
      if (VCL>=0.01) and (VCL<=CLMX) then DFMN:=DFMN+(VCL-0.01)*(1-DFMN)/(CLMX-0.01);
      //6。由用户提供的流体密度最小值进一步调整DFMN
      if (DFMN<FDMN) then DFMN:=FDMN;
      if (DFA2<DFMN) then DFA2:=DFMN;

      //计算视流体密度
      DFA:=DFA2;

      //第二步:计算粘土点参数
      RNCL:=(CNL[i]-DFA*(DG-DEN[i]-VCL*(DG-DCLN))/(DG-DFA))/VCL;
      ENCL:=(CNL[i]-DFA*(DG-DEN[i]-VCL*(DG-DCLM))/(DG-DFA))/VCL;
      FAI:=(DG-DEN[i])/(DG-DFA)-VCL*(DG-DCLN)/(DG-DFA);
      SL2:=(DCLN-DCLM)/(RNCL-ENCL);//直线ER斜率
      SDCL:=SL2*(RNCL-ENCL)+DCLM;//计算出的粘土点参数
      BW:=VCL*(DGCL-SDCL)/(DGCL-DWB);
      SNCL:=NCLM+(BW-BWMN)*(NCLN-NCLM)/(BWMX-BWMN);

      //第三步:计算粘土含量
      SVCL[i]:=(DG*CNL[i]+(DEN[i]-2.65-CNL[i])*DFA)/((DG-DFA)*SNCL-(DG-DCL)*DFA);

      //第四步:计算粘土阳离子交换能力CEC
      //1. 计算粘土水化水含盐量
      PT:=(BW*VSH[i]+(1-VSH[i])*PMAX);
      PE:=PT-BW;
      RWE:=PT*RW*RWCL/(RWCL*PE+RW*BW);
      RTEMP:=BHT-GRAD*(DEPTH[i]-RDEP)/100;
      RF75:=RWE*(RTEMP+7)/82;
      C:=power(10,((3.526-Log10(RF75-0.012))/0.955))/(58.453*1000);
      //2. 计算粘土水化水质量
      SDG:=DGCL*SVCL[i]+(1-SVCL[i])*DG;
      BW:=BW*DWB/(SDG*(1-PT));
      CEC:=BW*1000/(0.084*power(C,-0.5)+0.22);

      //第五步:计算不同粘土矿物的相对含量  存储于粘土矿物分析数据表中
      //1、伊-蒙百分含量
      TMI:=(HIMX-FAI)/(HIMX-HIMN);
      //2、蒙脱石百分含量
      TMON[i]:=TMI*(CEC-CECMN)/(CECMX-CECMN);
      //3、伊利石百分含量
      TILL[i]:=TMI-TMON[i];
      //4、高岭石、绿泥石百分含量
      TCHK:=1-TMI;
      //5、高岭石百分含量
      TGL[i]:=P*TCHK/100;
      //6、绿泥石百分含量
      TLN[i]:=(1-P/100)*TCHK;

       //对于计算得到的非法数据跳过    折线中间断线
       if (TMON[i]<0) or (TMON[i]>1) then
       begin
         Chart1.Series[0].AddNullXY(trunc(TMON[i]*100),DEPTH[i],'');
         continue;
       end;
       if (TILL[i]<0) or (TILL[i]>1) then
       begin
         Chart2.Series[0].AddNullXY(trunc(TILL[i]*100),DEPTH[i],'');
         continue;
       end;
       if (TGL[i]<0)  or (TGL[i]>1) or (TLN[i]<0)  or (TLN[i]>1) then
       begin
         Chart3.Series[0].AddNullXY(trunc((TLN[i]+TGL[i])*100),DEPTH[i],'');
         continue;
       end;
       if (SVCL[i]<0) or (SVCL[i]>1) then
       begin
         Chart4.Series[0].AddNullXY(trunc(SVCL[i]*100),DEPTH[i],'');
         continue;
       end;
       
              
       if  (DEPTH[i] <= WellBottom) and (DEPTH[i] >= WellTop)  then
       begin
        Chart1.Series[0].AddXY(trunc(TMON[i]*100),DEPTH[i]);
        Chart2.Series[0].AddXY(trunc(TILL[i]*100),DEPTH[i]);
        Chart3.Series[0].AddXY(trunc((TLN[i]+TGL[i])*100),DEPTH[i]);
        Chart4.Series[0].AddXY(trunc(SVCL[i]*100),DEPTH[i]);
       end ;

      //计算碱敏指数
      mSVCL[i] := power(SVCL[i],0.1353)*exp(-0.0821);
      mTMON[i] := power(TMON[i],0.668)*exp(-0.1033);
      mTILL[i] := power(TILL[i],0.0448)*exp(-0.1717);
      mTGL[i] := power(TGL[i],0.3173)*exp(0.3682);
      mTLN[i] := power(TLN[i],0.0416)*exp(-0.2323);
      temp2:= floattostr((0.67408*mSVCL[i]+0.7024*mTMON[i]+0.3681*mTILL[i]+0.6167*mTGL[i]+0.2323*mTLN[i])/(0.67408+0.7024+0.3681+0.6167+0.2323));

      //计算水敏指数
      mSVCL[i] := power(SVCL[i],0.4623)*exp(0.1705);
      mTMON[i] := power(TMON[i],0.201)*exp(0.1045);
      mTILL[i] := power(TILL[i],0.2603)*exp(0.062);
      mTGL[i] := power(TGL[i],0.3316)*exp(0.2548);
      mTLN[i] := power(TLN[i],-0.0843)*exp(-0.4827);
      temp3 := floattostr((0.66517*mSVCL[i]+0.7267*mTMON[i]+0.4579*mTILL[i]+0.326*mTGL[i]+0.0666*mTLN[i])/(0.66517+0.7267+0.4579+0.326+0.0666));

      //计算速敏指数
      mSVCL[i] := power(SVCL[i],0.5738)*exp(-0.0699);
      mTMON[i] := power(TMON[i],0.3271)*exp(-0.0714);
      mTILL[i] := power(TILL[i],0.0509)*exp(-0.5886);
      mTGL[i] := power(TGL[i],0.9673)*exp(0.9766);
      mTLN[i] := power(TLN[i],0.2936)*exp(-0.0695);
      temp4 := floattostr((0.48787*mSVCL[i]+0.7641*mTMON[i]+0.0807*mTILL[i]+0.3641*mTGL[i]+0.5006*mTLN[i])/(0.48787+0.7641+0.0807+0.3641+0.5006));

      //计算酸敏指数
      mSVCL[i] := power(SVCL[i],0.2577)*exp(-0.1139);
      mTMON[i] := power(TMON[i],0.0852)*exp(-0.2363);
      mTILL[i] := power(TILL[i],0.184)*exp(-0.1115);
      mTGL[i] := power(TGL[i],0.2327)*exp(-0.0044);
      mTLN[i] := power(TLN[i],-0.0625)*exp(0.1529);
      temp5 := floattostr((0.73615*mSVCL[i]+0.4478*mTMON[i]+0.6325*mTILL[i]+0.7817*mTGL[i]+0.028*mTLN[i])/(0.73615+0.4478+0.6325+0.7817+0.028));

      //计算盐敏指数
      mSVCL[i] := power(SVCL[i],0.3157)*exp(0.0811);
      mTMON[i] := power(TMON[i],0.1853)*exp(0.1562);
      mTILL[i] := power(TILL[i],0.3252)*exp(0.28);
      mTGL[i] := power(TGL[i],0.4104)*exp(0.3876);
      mTLN[i] := power(TLN[i],0.6028)*exp(0.477);
      temp6 := floattostr((0.40802*mSVCL[i]+0.6548*mTMON[i]+0.4298*mTILL[i]+0.5415*mTGL[i]+0.389*mTLN[i])/(0.40802+0.6548+0.4298+0.5415+0.389));

      //计算等级指数
      temp7:= floattostr((power(strtofloat(temp2),2)+power(strtofloat(temp3),2)+power(strtofloat(temp4),2)+power(strtofloat(temp5),2)+power(strtofloat(temp6),2))/(strtofloat(temp2)+strtofloat(temp3)+strtofloat(temp4)+strtofloat(temp5)+strtofloat(temp6)));

      //将储层敏感指数计算结果保存到Tbccmgzs中去
      ADOQuery1.Close;
      ADOQuery1.SQL.Clear;
      SqlString:='insert into Tbccmgzs(WellID,Depth,SMZS,VMZS,YMZS,JMZS,AMZS,ZHZS) values('+WellID+','+FloatToStr(DEPTH[i])+','+temp3+','+temp4+','+temp6+','+temp2+','+temp5+','+temp7+')';
      ADOQuery1.SQL.Add(SqlString);
      ADOQuery1.ExecSQL;


      //进度条显示
      ProgressBar1.Position := i;

    end;

    GroupBox5.Visible:=false;

      ADOQuery1.Close;
      ADOQuery1.SQL.Clear;
      SqlString:='select * from TbDataNtkw where WellID='+WellID+ ' and Depth>='+floattostr(WellTop)+' and Depth<='+floattostr(WellBottom)+ ' order by Depth';
      ADOQuery1.SQL.Add(SqlString);
      ADOQuery1.ExecSQL;
      ADOQuery1.Open;

      //画实验分析数据
      if ADOQuery1.RecordCount<>0 then
      begin
      ADOQuery1.Recordset.MoveFirst;
      for i:=0 to  ADOQuery1.RecordCount-1 do
      begin
        Chart1.Series[1].AddXY(trunc(strtofloat(ADOQuery1.Recordset.Fields['mtshl'].Value)),ADOQuery1.Recordset.Fields['Depth'].Value);
        Chart2.Series[1].AddXY(trunc(ADOQuery1.Recordset.Fields['ylshl'].Value),ADOQuery1.Recordset.Fields['Depth'].Value);
        Chart3.Series[1].AddXY(trunc((ADOQuery1.Recordset.Fields['glshl'].Value+ADOQuery1.Recordset.Fields['lnshl'].Value)),ADOQuery1.Recordset.Fields['Depth'].Value);
        Chart4.Series[1].AddXY(trunc(ADOQuery1.Recordset.Fields['ntzhl'].Value),ADOQuery1.Recordset.Fields['Depth'].Value);

        ADOQuery1.Recordset.MoveNext ;
      end;
      end;
      //激活显示
      Chart1.Series[0].Active:=true;
      Chart1.Series[1].Active:=true;
      Chart2.Series[0].Active:=true;
      Chart2.Series[1].Active:=true;
      Chart3.Series[0].Active:=true;
      Chart3.Series[1].Active:=true;
      Chart4.Series[0].Active:=true;
      Chart4.Series[1].Active:=true;

      //保存本次计算参数到TbParameterTable中去
      ADOQuery1.Close;
      ADOQuery1.SQL.Clear;
      SqlString:='insert into TbParameterTable(WellID,DepthTop,DepthBottom,DG,DSH,NSH,NCL,DCL,FDC,CLMX,FDMN,DCLN,DCLM,NCLM,NCLN,BWMX,BWMN,DGCL,DWB,PMAX,RW,RWCL,BHT,GRAD,RDEP,HIMX,HIMN,CECMX,CECMN,P,GRSP) values('
        +WellID+','+floattostr(WellTop)+','+floattostr(WellBottom)+','+floattostr(DG)+','+floattostr(DSH)+','+floattostr(NSH)+','+floattostr(NCL)+','+floattostr(DCL)+','+floattostr(FDC)+','+floattostr(CLMX)+','
        +floattostr(FDMN)+','+floattostr(DCLN)+','+floattostr(DCLM)+','+floattostr(NCLM)+','+floattostr(NCLN)+','+floattostr(BWMX)+','+floattostr(BWMN)+','+floattostr(DGCL)+','+floattostr(DWB)+','+floattostr(PMAX)+
        ','+floattostr(RW)+','+floattostr(RWCL)+','+floattostr(BHT)+','+floattostr(GRAD)+','+floattostr(RDEP)+','+floattostr(HIMX)+','+floattostr(HIMN)+','+floattostr(CECMX)+','+floattostr(CECMN)+','+floattostr(P)+','+floattostr(SHF1)+')';

      ADOQuery1.SQL.Add(SqlString);
      ADOQuery1.ExecSQL;

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

      except
         Application.HandleException(Self);
      end;
    //确认调整参数
    Application.MessageBox('若对当前的参数不满意,请再次调整!', '系统提示', MB_OK);

end;

procedure TForm1.RadioButton1Click(Sender: TObject);
begin
    RadioButton2.Checked:=false;
    SHF1:=1;
end;

procedure TForm1.RadioButton2Click(Sender: TObject);
begin
    RadioButton1.Checked:=false;
    SHF1:=2;
end;

procedure TForm1.ScrollBar1Change(Sender: TObject);

procedure ScrollChart(MyChart:TChart);
Var DiferAxis, DiferChart, Offset :Double;
begin
  With MyChart do
    DiferChart:=MaxYValue(leftAxis)-MinYValue(leftAxis);
  With MyChart.LeftAxis do
  begin
    Automatic:=false;
    DiferAxis:=Maximum-Minimum;
    Offset:=Chart1.MinYValue(Chart1.LeftAxis)+ScrollBar1.Position*(DiferChart)/100.0;
    if Offset <= Maximum then
    begin
     Minimum:=Offset;
     Maximum:=Offset+DiferAxis;
    end else
    begin
     Maximum:=Offset+DiferAxis;
     Minimum:=Offset;
    end
  end;
end;

var i :longint;
var TmpChart :TComponent;
begin
   for i:=1 to 84 do
   begin
      TmpChart:= FindComponent('Chart'+IntToStr(i));
      if ( TmpChart <> nil ) then
      begin
          ScrollChart( TChart(TmpChart) );
      end
   end;
end;

procedure TForm1.BitBtn6Click(Sender: TObject);
Var DiferAxis,DiferChart,NewMin, NewMax:Double;
var i :longint;
var TmpChart :TComponent;
begin
  Chart1.LeftAxis.Automatic:=false;
  ScrollBar1.Enabled:=true;
  With Chart1 do
    DiferChart:=MaxYValue(leftAxis)-MinYValue(leftAxis);
  With Chart1.LeftAxis do
  Begin
    DiferAxis:=(Maximum-Minimum)/0.8;
    NewMin:=Chart1.MinYValue(Chart1.LeftAxis)+ScrollBar1.Position*(DiferChart-DiferAxis)/100.0;
    NewMax:=Minimum+DiferAxis;
  end;
  for i:=1 to 84 do
   begin
      TmpChart:= FindComponent('chart'+IntToStr(i));
      if ( TmpChart <> nil ) then
      begin
         TChart(TmpChart).LeftAxis.SetMinMax(NewMin,NewMax);
      end
  end;

  if DiferChart/DiferAxis <= 1.01 then
  begin
     BitBtn6.Enabled:=false;
     ScrollBar1.Position:=0;
     ScrollBar1.Enabled:=false;
  end
end;


procedure TForm1.BitBtn3Click(Sender: TObject);
Var DiferAxis,DiferChart,NewMin,NewMax :Double;
var i :longint;
var TmpChart :TComponent;
begin
  Chart1.LeftAxis.Automatic:=false;
  With Chart1 do
    DiferChart:=MaxYValue(leftAxis)-MinYValue(leftAxis);
  With Chart1.LeftAxis do

⌨️ 快捷键说明

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