📄 gassanddesign.cpp
字号:
void CGasSandDesign::OnCHECKu()
{
BOOL state = m_ctrlCheckU.GetCheck();
m_ctrlU.EnableWindow(state);
}
void CGasSandDesign::OnCheckZ()
{
BOOL state = m_ctrlCheckZ.GetCheck();
m_ctrlZ.EnableWindow(state);
}
void CGasSandDesign::OnSpdCacl()
{
// TODO: Add your command handler code here
CMainFrame* wnd = (CMainFrame*)AfxGetMainWnd();
UpdateData();
float u;
if(m_ctrlCheckU.GetCheck())
u = m_fU;
else if(wnd->m_structGasShotForecast.bState == FALSE)
{
MessageBox("请先进行气井表皮系数预测的计算或输入气体粘度和气体偏差系数 !","工程信息");
return ;
}
else
u = wnd->m_structGasShotForecast.fFMIO;
if(u == 0)
{
MessageBox("天然气粘度不能为0!","工程信息");
}
float d0 = wnd->m_structBDTTable.fOilResCannulaDiameter * 1000;
float delta = wnd->m_structBDTTable.fOilResCannulaCliffDeep * 1000;
float k = (float)(wnd->m_structBDTTable.fStratumFilterPercent/0.9869);
float v = (float)(wnd->m_structBDTTable.fFloorGasPorportion);
m_fQGas = wnd->m_structGasShotForecast.fQGAS*10000/20;
float z;
if(m_ctrlCheckZ.GetCheck())
z = m_fZ;
else if(wnd->m_structGasShotForecast.bState == FALSE)
{
MessageBox("请先进行气井表皮系数预测的计算或输入气体粘度和气体偏差系数 !","工程信息");
return ;
}
else
z = wnd->m_structGasShotForecast.fZ;
float b = (float)(pow(10,6.5-0.95*log(k)));
float t = (float)(wnd->m_structBDTTable.fWellBottomTemp);
float pi = (float)(wnd->m_structBDTTable.fStratumAverPress/0.00689);
///////////////
int i,j,nTemp1,nTemp2;
STRUCTSHOTPARAPRESELECT structTemp;
float l,q,d,fTemp,ks,kj,km,xw,xwt,yh,yc,f1,r;
long lCount=0;
for(i=0;i<wnd->m_structBDTTable.lCount;i++)
{
// l = (float)(wnd->m_structTTPShotPara[i].fShotDepth*wnd->m_structTTPResult.fPP[i] / 25.4);
l = (float)(wnd->m_structTTPResult.fPDepth[i] / 25.4);
// d = (float)(wnd->m_structTTPShotPara[i].fDiameter*wnd->m_structTTPResult.fPP[i] / 25.4);
d = (float)(wnd->m_structTTPResult.fPDiameter[i] / 25.4);
for(j=0;j<wnd->m_structBDTTable.iShotDenNum;j++)
{
q = (float)(m_fQGas / (0.1589873*wnd->m_structBDTTable.fShotDen[j]*
wnd->m_structBDTTable.fShotLayerPly));
for(nTemp1=0;nTemp1<wnd->m_structBDTTable.iShotPhasicNum;nTemp1++)
{
fTemp = (float)(pow(pi/14.7,2)-
((2.57*pow(10,-12)*q*v*b/(pow(d,2)*u)+1/k)*0.033*
z*t*u*l*q*v/pow(d,2))+(v*28.964)); //*1e-3
if(fTemp<0) continue;
/* if(fTemp < 0)
{
MessageBox("估计气井产量输入值太大 !","工程信息");
return;
}
*/ fTemp = (float)(pow(fTemp,0.5)*14.7);
fTemp = (float)((pi-fTemp)*0.00689);
if(fTemp<0) fTemp = 0;
if(lCount>=384)
{
structTemp.fAngle = wnd->m_structBDTTable.fShotPhasic[nTemp1];
structTemp.fDiameter = wnd->m_structTTPShotPara[i].fDiameter;
structTemp.fShotDen = wnd->m_structBDTTable.fShotDen[j];
structTemp.fShotDepth = wnd->m_structTTPShotPara[i].fShotDepth;
sprintf(structTemp.strModel,"%s",wnd->m_structTTPShotPara[i].strModel);
if(structTemp.fProPer == 120)
structTemp.fProPer = fTemp;
else if(structTemp.fProPer == 90)
structTemp.fProPer = (float)(fTemp/0.95);
else if(structTemp.fProPer == 60)
structTemp.fProPer = (float)(fTemp/0.93);
else if(structTemp.fProPer == 180)
structTemp.fProPer = (float)(fTemp/0.75);
else if(structTemp.fProPer == 0)
structTemp.fProPer = (float)(fTemp/0.62);
else
structTemp.fProPer = (float)(fTemp/0.91);
ks = wnd->m_structShotParaSelect[lCount].fShotDepth;
kj = wnd->m_structShotParaSelect[lCount].fDiameter;
km = wnd->m_structShotParaSelect[lCount].fShotDen;
xw = wnd->m_structShotParaSelect[lCount].fAngle;
yh = wnd->m_structSDT[j].fPressDeep ;
yc = wnd->m_structSDT[j].fPressLong ;
xwt = xw;
if(xw==0) xwt = (float)360;
f1 = (float)(360*1000/(xwt*km));
r = (float)((d0-2*delta)/2);
fTemp = (float)(1+(kj*1.48/(f1-kj*1.48))*(90/(3.141593*xwt))
*(2*kj/r+sin(2*kj/r)));
structTemp.fPara = (float)(1/fTemp);
for(nTemp2=0;nTemp2<lCount;nTemp2++)
{
if(structTemp.fProPer<wnd->m_structShotParaSelect[nTemp2].fProPer)
swap(structTemp,wnd->m_structShotParaSelect[nTemp2]);
}
continue;
}
wnd->m_structShotParaSelect[lCount].fAngle = wnd->m_structBDTTable.fShotPhasic[nTemp1];
wnd->m_structShotParaSelect[lCount].fDiameter = wnd->m_structTTPShotPara[i].fDiameter;
wnd->m_structShotParaSelect[lCount].fShotDen = wnd->m_structBDTTable.fShotDen[j];
wnd->m_structShotParaSelect[lCount].fShotDepth = wnd->m_structTTPShotPara[i].fShotDepth;
sprintf(wnd->m_structShotParaSelect[lCount].strModel,"%s",wnd->m_structTTPShotPara[i].strModel);
if(wnd->m_structShotParaSelect[lCount].fAngle == 120)
wnd->m_structShotParaSelect[lCount].fProPer = fTemp;
else if(wnd->m_structShotParaSelect[lCount].fAngle == 90)
wnd->m_structShotParaSelect[lCount].fProPer = (float)(fTemp/0.95);
else if(wnd->m_structShotParaSelect[lCount].fAngle == 60)
wnd->m_structShotParaSelect[lCount].fProPer = (float)(fTemp/0.93);
else if(wnd->m_structShotParaSelect[lCount].fAngle == 180)
wnd->m_structShotParaSelect[lCount].fProPer = (float)(fTemp/0.75);
else if(wnd->m_structShotParaSelect[lCount].fAngle == 0)
wnd->m_structShotParaSelect[lCount].fProPer = (float)(fTemp/0.62);
else
wnd->m_structShotParaSelect[lCount].fProPer = (float)(fTemp/0.91);
ks = wnd->m_structShotParaSelect[lCount].fShotDepth;
kj = wnd->m_structShotParaSelect[lCount].fDiameter;
km = wnd->m_structShotParaSelect[lCount].fShotDen;
xw = wnd->m_structShotParaSelect[lCount].fAngle;
yh = wnd->m_structSDT[j].fPressDeep ;
yc = wnd->m_structSDT[j].fPressLong ;
xwt = xw;
if(xw==0) xwt = (float)360;
f1 = (float)(360*1000/(xwt*km));
r = (float)((d0-2*delta)/2);
fTemp = (float)(1+(kj*1.48/(f1-kj*1.48))*(90/(3.141593*xwt))
*(2*kj/r+sin(2*kj/r)));
wnd->m_structShotParaSelect[lCount].fPara = (float)(1/fTemp);
for(nTemp2=0;nTemp2<lCount;nTemp2++)
{
if(wnd->m_structShotParaSelect[lCount].fProPer<wnd->m_structShotParaSelect[nTemp2].fProPer)
{
swap(wnd->m_structShotParaSelect[lCount],wnd->m_structShotParaSelect[nTemp2]);
}
}
lCount++;
}
}
}
///////////////
wnd->m_structSandPressDesign.fQ = m_fQGas;
m_ctrlList.DeleteAllItems ();
m_ctrlSelected.DeleteAllItems ();
LVITEM pitem;
pitem.mask=LVIF_TEXT;
pitem.state=0;
pitem.stateMask=0;
pitem.iSubItem=0;
pitem.pszText="";
char strTemp[20];
for(i=0;i<lCount;i++)
{
pitem.iItem=i;
m_ctrlList.InsertItem (&pitem);
sprintf(strTemp,"%d",i+1);
m_ctrlList.SetItemText (i,0,strTemp);
sprintf(strTemp,"%2.4f",wnd->m_structShotParaSelect[i].fProPer);
m_ctrlList.SetItemText (i,1,strTemp);
m_ctrlList.SetItemText (i,2,wnd->m_structShotParaSelect[i].strModel);
sprintf(strTemp,"%4.1f",wnd->m_structShotParaSelect[i].fAngle);
m_ctrlList.SetItemText (i,3,strTemp);
sprintf(strTemp,"%4.0f",wnd->m_structShotParaSelect[i].fShotDen);
m_ctrlList.SetItemText (i,4,strTemp);
sprintf(strTemp,"%5.2f",wnd->m_structShotParaSelect[i].fShotDepth);
m_ctrlList.SetItemText (i,5,strTemp);
sprintf(strTemp,"%3.2f",wnd->m_structShotParaSelect[i].fDiameter);
m_ctrlList.SetItemText (i,6,strTemp);
fTemp = (float)((1-wnd->m_structShotParaSelect[i].fPara)*100);
sprintf(strTemp,"%5.2f",fTemp);
m_ctrlList.SetItemText (i,7,strTemp);
}
UpdateData(FALSE);
wnd->m_bSelected = TRUE;
wnd->m_structSelectedPara = wnd->m_structShotParaSelect[0];
wnd->m_structShotParaBase.bState = TRUE;
wnd->m_structShotParaBase.iNum = lCount;
}
#include "resource.h"
void CGasSandDesign::OnContextMenu(CWnd*, CPoint point)
{
// CG: This block was added by the Pop-up Menu component { if (point.x == -1 && point.y == -1){ //keystroke invocation CRect rect; GetClientRect(rect); ClientToScreen(rect); point = rect.TopLeft(); point.Offset(5, 5); } CMenu menu; VERIFY(menu.LoadMenu(IDR_POPUP_SPD)); CMenu* pPopup = menu.GetSubMenu(4); ASSERT(pPopup != NULL); CWnd* pWndPopupOwner = this;// while (pWndPopupOwner->GetStyle() & WS_CHILD)// pWndPopupOwner = pWndPopupOwner->GetParent(); pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, pWndPopupOwner); }
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -