📄 gassanddesign.cpp
字号:
// GasSandDesign.cpp : implementation file
//
#include "stdafx.h"
#include "CVenus.h"
#include "MainFrm.h"
#include "GasSandDesign.h"
#include "ChildFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CGasSandDesign
IMPLEMENT_DYNCREATE(CGasSandDesign, CFormView)
CGasSandDesign::CGasSandDesign()
: CFormView(CGasSandDesign::IDD)
{
//{{AFX_DATA_INIT(CGasSandDesign)
m_fU = 0.0f;
m_fZ = 0.0f;
//}}AFX_DATA_INIT
}
CGasSandDesign::~CGasSandDesign()
{
}
void CGasSandDesign::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CGasSandDesign)
DDX_Control(pDX, IDC_EDIT_Z, m_ctrlZ);
DDX_Control(pDX, IDC_EDIT_U, m_ctrlU);
DDX_Control(pDX, IDC_CHECK_Z, m_ctrlCheckZ);
DDX_Control(pDX, IDC_CHECK_u, m_ctrlCheckU);
DDX_Control(pDX, IDC_LIST_SHOTPARASELECT_SELECTED, m_ctrlSelected);
DDX_Control(pDX, IDC_LIST_SHOTPARASELECT_LIST, m_ctrlList);
DDX_Text(pDX, IDC_EDIT_U, m_fU);
DDX_Text(pDX, IDC_EDIT_Z, m_fZ);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CGasSandDesign, CFormView)
ON_WM_CONTEXTMENU()
//{{AFX_MSG_MAP(CGasSandDesign)
ON_BN_CLICKED(IDC_BUTTON_SHOTPARASELECT_LOAD, OnButtonShotparaselectLoad)
ON_NOTIFY(NM_CLICK, IDC_LIST_SHOTPARASELECT_LIST, OnClickListShotparaselectList)
ON_BN_CLICKED(IDC_CHECK_u, OnCHECKu)
ON_BN_CLICKED(IDC_CHECK_Z, OnCheckZ)
ON_COMMAND(ID_SPD_CACL, OnSpdCacl)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CGasSandDesign diagnostics
#ifdef _DEBUG
void CGasSandDesign::AssertValid() const
{
CFormView::AssertValid();
}
void CGasSandDesign::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CGasSandDesign message handlers
void CGasSandDesign::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
GetParentFrame()->SetWindowText(_T("气井防砂优化设计"));
CMainFrame* wnd = (CMainFrame*)AfxGetMainWnd();
UpdateData();
m_fQGas = wnd->m_structSandPressDesign.fQ;
UpdateData(FALSE);
m_ctrlList.InsertColumn (0,"序号",LVCFMT_LEFT ,40,0);
m_ctrlList.InsertColumn (1,"相对流体压降",LVCFMT_LEFT ,100,1);
m_ctrlList.InsertColumn (2,"型号",LVCFMT_LEFT ,200,2);
m_ctrlList.InsertColumn (3,"相位角度",LVCFMT_LEFT ,100,3);
m_ctrlList.InsertColumn (4,"孔密",LVCFMT_LEFT ,60,4);
m_ctrlList.InsertColumn (5,"穿深",LVCFMT_LEFT ,60,5);
m_ctrlList.InsertColumn (6,"孔径",LVCFMT_LEFT ,60,6);
m_ctrlList.InsertColumn (7,"套管强度降低系数(%)",LVCFMT_LEFT ,150,7);
m_ctrlSelected.InsertColumn (0,"序号",LVCFMT_LEFT ,40,0);
m_ctrlSelected.InsertColumn (1,"相对流体压降",LVCFMT_LEFT ,100,1);
m_ctrlSelected.InsertColumn (2,"型号",LVCFMT_LEFT ,200,2);
m_ctrlSelected.InsertColumn (3,"相位角度",LVCFMT_LEFT ,100,3);
m_ctrlSelected.InsertColumn (4,"孔密",LVCFMT_LEFT ,60,4);
m_ctrlSelected.InsertColumn (5,"穿深",LVCFMT_LEFT ,60,5);
m_ctrlSelected.InsertColumn (6,"孔径",LVCFMT_LEFT ,60,6);
m_ctrlSelected.InsertColumn (7,"套管强度降低系数(%)",LVCFMT_LEFT ,150,7);
}
float CGasSandDesign::Compute_u()
{
CMainFrame* wnd = (CMainFrame*)AfxGetMainWnd();
float v = wnd->m_structBDTTable.fFloorGasPorportion;
float t = (float)((wnd->m_structBDTTable.fWellBottomTemp-273)*5/9+32);
float kk = (float)((9.4+0.579*v)*pow(t+460,1.5)/(207+550.43*v+t+460));
float x = (float)(3.5+986/(t+460)+0.2897);
float r = (float)(2.4-0.2*x);
float u = (float)(0.0001*kk*exp(x*pow(v,r)));
return u;
}
float CGasSandDesign::Compute_z()
{
CMainFrame* wnd = (CMainFrame*)AfxGetMainWnd();
float v = wnd->m_structBDTTable.fFloorGasPorportion;
float ppc,ptc,ppr,ptr;
if(v>0.7)
{
ppc = (float)(708.75 - 57.5*v);
ptc = (float)(109 + 314*v);
}
else if(v<=0.7)
{
ppc = (float)(693 - 36*v);
ptc = (float)(166 + 318*v);
}
float t = (float)((wnd->m_structBDTTable.fWellBottomTemp-273)*5/9+32);
float p = (float)(wnd->m_structBDTTable.fStratumAverPress/0.00689);
ppr = (float)(p/ppc);
ptr = (float)(t/ptc);
float zza;
if(ptr >= 0.92)
zza = (float)(1.39*pow(ptr-0.92,0.5) - 0.36*ptr - 0.101);
else
zza = (float)(1.39*pow(0.92-ptr,0.5) - 0.36*ptr - 0.101);
float zzb = (float)((0.62-0.23*ptr)*ppr);
float zzc = (float)((0.066/(ptr-0.86)-0.037)*pow(ppr,2));
float zzd = (float)((0.32/pow(10,9*(ptr-1)))*ppr*6);
float zze = (float)(zzb+zzc+zzd);
float zzf = (float)(0.132-0.32*log(ptr));
float zg = (float)pow(10,0.3106-0.49*ptr+ptr+0.1824*pow(ppr,2));
float z = (float)(zza + (1-zza)*exp(-zze) + zzf* pow(ppr,zg));
return z;
}
void CGasSandDesign::OnButtonShotparaselectLoad()
{
CMainFrame* wnd = (CMainFrame*)AfxGetMainWnd();
if(wnd->m_structShotParaBase.bState == FALSE)
{
MessageBox("还未进行计算 !","工程信息");
return;
}
UpdateData(TRUE);
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(int i=0;i<wnd->m_structShotParaBase.iNum;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);
sprintf(strTemp,"%5.2f",wnd->m_structShotParaSelect[i].fPara );
m_ctrlList.SetItemText (i,7,strTemp);
}
UpdateData(FALSE);
}
void CGasSandDesign::OnClickListShotparaselectList(NMHDR* pNMHDR, LRESULT* pResult)
{
CMainFrame* wnd = (CMainFrame*)AfxGetMainWnd();
UpdateData();
m_ctrlSelected.DeleteAllItems ();
LVITEM pitem;
pitem.mask=LVIF_TEXT;
pitem.state=0;
pitem.stateMask=0;
pitem.iSubItem=0;
pitem.pszText="";
pitem.iItem=0;
m_ctrlSelected.InsertItem (&pitem);
int m_iSelected = m_ctrlList.GetSelectionMark();
char strTemp[20];
sprintf(strTemp,"%d",m_iSelected+1);
m_ctrlSelected.SetItemText (0,0,strTemp);
sprintf(strTemp,"%2.4f",wnd->m_structShotParaSelect[m_iSelected].fProPer );
m_ctrlSelected.SetItemText (0,1,strTemp);
m_ctrlSelected.SetItemText (0,2,wnd->m_structShotParaSelect[m_iSelected].strModel );
sprintf(strTemp,"%4.1f",wnd->m_structShotParaSelect[m_iSelected].fAngle );
m_ctrlSelected.SetItemText (0,3,strTemp);
sprintf(strTemp,"%4.0f",wnd->m_structShotParaSelect[m_iSelected].fShotDen );
m_ctrlSelected.SetItemText (0,4,strTemp);
sprintf(strTemp,"%5.2f",wnd->m_structShotParaSelect[m_iSelected].fShotDepth );
m_ctrlSelected.SetItemText (0,5,strTemp);
sprintf(strTemp,"%3.2f",wnd->m_structShotParaSelect[m_iSelected].fDiameter );
m_ctrlSelected.SetItemText (0,6,strTemp);
sprintf(strTemp,"%5.2f",wnd->m_structShotParaSelect[m_iSelected].fPara );
m_ctrlSelected.SetItemText (0,7,strTemp);
UpdateData(FALSE);
*pResult = 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -