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

📄 gasshotparaselectview.cpp

📁 这是本人两年前兼职为某个公司做的石油钻进设计软件
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// GasShotParaSelectView.cpp : implementation file
//

#include "stdafx.h"
#include "CVenus.h"
#include "MainFrm.h"
#include "GasShotParaSelectView.h"
#include	"ChildFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CGasShotParaSelectView

IMPLEMENT_DYNCREATE(CGasShotParaSelectView, CFormView)

CGasShotParaSelectView::CGasShotParaSelectView()
	: CFormView(CGasShotParaSelectView::IDD)
{
	//{{AFX_DATA_INIT(CGasShotParaSelectView)
	//}}AFX_DATA_INIT
	m_iSelected = 0;
}

CGasShotParaSelectView::~CGasShotParaSelectView()
{
}

void CGasShotParaSelectView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CGasShotParaSelectView)
	DDX_Control(pDX, IDC_LIST_GASSHOTPARASELECT_SELECTED, m_ctrlSelected);
	DDX_Control(pDX, IDC_LIST_GASSHOTPARASELECT_LIST, m_ctrlList);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CGasShotParaSelectView, CFormView)
	ON_WM_CONTEXTMENU()
	//{{AFX_MSG_MAP(CGasShotParaSelectView)
	ON_WM_CREATE()
	ON_NOTIFY(NM_CLICK, IDC_LIST_GASSHOTPARASELECT_LIST, OnClickListGasshotparaselectList)
	ON_COMMAND(ID_SPD_CACL, OnSpdCacl)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGasShotParaSelectView diagnostics

#ifdef _DEBUG
void CGasShotParaSelectView::AssertValid() const
{
	CFormView::AssertValid();
}

void CGasShotParaSelectView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CGasShotParaSelectView message handlers

float CGasShotParaSelectView::fnprw1(float ks, float km, float kj, float xw, float kzr, float yh, float yc, float wh, float wc)
{
	return (float)(0.7158+0.1231*(ks-200)/61.5-0.0126*(yh-13)/2.87+
		0.1244*(km-29)/8.609999+0.0599*(yc-0.525)/0.195+8.519999*
		pow(10,-2)*(kj-13)/2.87+0.14*(wc-0.525)/0.195-0.0149*
		(wh-525)/133+0.0112*(xw-90)/30+0.0467*(kzr-0.505)/0.203);
}

float CGasShotParaSelectView::fnprw2(float ks, float km, float jbj, float yc, float wc, float dp)
{
	return (float)(-0.0221*(dp-16)/5.74+0.0559*(jbj-114.3)/15.62+
		0.0095*((ks-200)/61.5)*((km-29)/8.609999)+0.0241*((km-29)/8.609999)*
		((wc-0.525)/0.195)+0.0106*((yc-0.525)/0.195)*((wc-0.525)/0.195));
}

float CGasShotParaSelectView::fnprw3(float ks, float km, float xw, float yh, float yc, float dp)
{
	return (float)(0.0106*((km-29)/8.609999)*((dp-16)/5.74)-0.0142*
		((xw-90)/30)*((dp-16)/5.74)-0.0126*pow((ks-200)/61.5,2)+
		0.0009*pow((yh-13)/2.87,2)-0.0144*pow((km-29)/8.609999,2)-
		0.012*pow((yc-0.525)/0.195,2));
}

float CGasShotParaSelectView::fnprw4(float kj, float xw, float jbj, float kzr, float wh, float pk, float dp)
{
	return (float)(0.0104*pow((wh-525)/133,2)-0.0092*pow((kzr-0.505)/0.203,2)
		+0.0101*pow((pk-100)/41,2)+0.0187*pow((dp-16)/5.74,2)+0.0116*
		pow((jbj-114.3)/15.62,2)-0.0027*pow((xw-90)/30,2)-0.0074*
		pow((kj-13)/2.87,2));
}

float CGasShotParaSelectView::fnprw5(float ks, float xw, float kzr, float wc, float dp)
{
	return (float)(0.0159*((xw-90)/30)*((kzr-0.505)/0.203)-0.0101*
		((ks-200)/61.5)*((dp-16)/5.74)-0.0219*pow((wc-0.525)/0.195,2));
}

float CGasShotParaSelectView::fnprc1(float ks, float km, float kj, float xw, float kzr, float yh, float yc, float wh, float wc)
{
	return (float)(1.2075+0.0435*(ks-425)/71.76-0.0223*(yh-13)/2.87+
		0.1973*(km-29)/8.609999+0.0281*(yc-0.525)/0.195+0.1873*
		(kj-13)/2.87+0.0544*(wc-0.525)/0.195-0.0193*(wh-200)/82+0.0255*
		(xw-90)/30+0.0515*(kzr-0.505)/0.203);
}

float CGasShotParaSelectView::fnprc2(float ks, float km, float xw, float jbj, float kzr, float wh, float wc)
{
	return (float)(0.0485*(jbj-114.3)/15.62+0.0111*((ks-425)/71.76)*
		((km-29)/8.609999)+0.0201*((wc-0.525)/0.195)*((wh-200)/82)+
		0.0211*((xw-90)/30)*((kzr-0.505)/0.203)-
		0.0069*pow((ks-425)/71.67,2));
}

float CGasShotParaSelectView::fnprc3(float km, float kj, float xw, float kzr, float yc, float wh, float wc)
{
	return (float)(-0.0255*pow((km-29)/8.609999,2)-0.0057*
		pow((yc-0.525)/0.195,2)-9.100001*pow(10,-3)*
		pow((kj-13)/2.87,2)-0.0102*pow((wc-0.525)/0.195,2)+
		0.0024*pow((wh-200)/82,2)-0.0177*pow((xw-90)/30,2)-
		0.0102*pow((kzr-0.505)/0.203,2));
}

float CGasShotParaSelectView::fnprc4(float yh, float jbj, float pk, float dp)
{
	return (float)(0.0028*pow((jbj-114.3)/15.62,2)+0.01*
		pow((dp-16)/5.74,2)+0.0338*pow((pk-100)/41,2)+
		0.0028*pow((yh-13)/2.87,2)-0.0243*(pk-100)/41-
		0.0373*(dp-16)/5.74);
}

BOOL CGasShotParaSelectView::DataOK()
{
	CMainFrame*	wnd = (CMainFrame*)AfxGetMainWnd();

	if(wnd->m_structBDTTable.bState == FALSE)
	{
		MessageBox("请输入原始数据 !","工程信息");
		return FALSE;
	}
	CString cstrTemp;
	cstrTemp = wnd->m_structBDTTable.strOilResCannulaModel;
	if(cstrTemp.IsEmpty())
	{
		MessageBox("请输入油层套管型号 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structBDTTable.fCannulaPressResistance == 0)
	{
		MessageBox("请输入套管抗挤压力 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structBDTTable.fOilResCannulaDiameter == 0)
	{
		MessageBox("请输入油层套管外径 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structBDTTable.fOilResCannulaCliffDeep == 0)
	{
		MessageBox("请输入油层套管壁厚 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structBDTTable.fStratumHolePercent == 0)
	{
		MessageBox("请输入孔隙度 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structBDTTable.fStratumHeterosphere == 0)
	{
		MessageBox("请输入地层非均质性 !","工程信息");//Kz/Kr
		return FALSE;
	}
	if(wnd->m_structBDTTable.fWellRadius == 0)
	{
		MessageBox("请输入井筒半径 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structBDTTable.fDrillPolluteDepth == 0)
	{
		MessageBox("请输入污染深度 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structBDTTable.fDrillPollutePercent == 0)
	{
		MessageBox("请输入污染程度 !","工程信息");
		return FALSE;
	}
	return TRUE;
}


void CGasShotParaSelectView::GasshotparaselectLoad() 
{
	// TODO: Add your control notification handler code here
	CMainFrame*	wnd = (CMainFrame*)AfxGetMainWnd();

	if(wnd->m_structShotParaBase.bState == FALSE)
	{
		MessageBox("还未进行计算 !","工程信息");
		return;
	}

	UpdateData(TRUE);
	for(int i=0;i<8;i++)
	{
		m_ctrlList.DeleteColumn (0);
		m_ctrlSelected.DeleteColumn (0);
	}
	m_ctrlList.InsertColumn (0,"序号",LVCFMT_LEFT ,40,0);
	m_ctrlList.InsertColumn (1,"产率比",LVCFMT_LEFT ,60,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 ,100,7);
	m_ctrlSelected.InsertColumn (0,"序号",LVCFMT_LEFT ,40,0);
	m_ctrlSelected.InsertColumn (1,"产率比",LVCFMT_LEFT ,60,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 ,100,7);

	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<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);	
}

int CGasShotParaSelectView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CFormView::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here
	CMainFrame*	wnd = (CMainFrame*)AfxGetMainWnd();
/*	CString cstrProjectName;
	CSpdDoc* pDoc = (CSpdDoc*)GetDocument();
	cstrProjectName = pDoc->m_cstrTitle +" - [气井射孔参数优化设计]";
	pDoc->SetTitle (cstrProjectName);
*/
	GetParentFrame()->SetWindowText(_T("气井射孔参数优化设计"));
	
	if(wnd->m_structShotParaBase.iNum<=0)
		wnd->m_structShotParaBase.iNum = 383;
	int iTemp;
	for(iTemp=0;iTemp<wnd->m_structShotParaBase.iNum;iTemp++)
	{
		xw2[iTemp+1] = wnd->m_structShotParaSelect[iTemp].fAngle;
		kj2[iTemp+1] = wnd->m_structShotParaSelect[iTemp].fDiameter;
		fk[iTemp+1] = (float)((1-wnd->m_structShotParaSelect[iTemp].fPara)/100);
		pr1[iTemp+1] = wnd->m_structShotParaSelect[iTemp].fProPer;
		km2[iTemp+1] = wnd->m_structShotParaSelect[iTemp].fShotDen;
		ks2[iTemp+1] = wnd->m_structShotParaSelect[iTemp].fShotDepth;
		dx2[iTemp+1] = wnd->m_structShotParaSelect[iTemp].strModel;
	}
	
	return 0;
}

void CGasShotParaSelectView::OnClickListGasshotparaselectList(NMHDR* pNMHDR, LRESULT* pResult) 

⌨️ 快捷键说明

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