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

📄 gasshotforecastview.cpp

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

#include "stdafx.h"
#include "CVenus.h"
#include "MainFrm.h"
#include "GasShotForecastView.h"
#include	"ChildFrm.h"
#include "resource.h"

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

/////////////////////////////////////////////////////////////////////////////
// CGasShotForecastView

IMPLEMENT_DYNCREATE(CGasShotForecastView, CFormView)

CGasShotForecastView::CGasShotForecastView()
	: CFormView(CGasShotForecastView::IDD)
{
	//{{AFX_DATA_INIT(CGasShotForecastView)
	m_cstrModel = _T("");
	m_fD = 0.0f;
	m_fD1 = 0.0f;
	m_fD1P = 0.0f;
	m_fFMIO = 0.0f;
	m_fPAVE = 0.0f;
	m_fPPC = 0.0f;
	m_fPPR = 0.0f;
	m_fPRT = 0.0f;
	m_fQ1 = 0.0f;
	m_fQGAS = 0.0f;
	m_fQPER = 0.0f;
	m_fQW = 0.0f;
	m_fSD = 0.0f;
	m_fSDP = 0.0f;
	m_fSDPS = 0.0f;
	m_fSDS = 0.0f;
	m_fSP = 0.0f;
	m_fSPS = 0.0f;
	m_fST = 0.0f;
	m_fSTS = 0.0f;
	m_fTAVE = 0.0f;
	m_fTPC = 0.0f;
	m_fTPR = 0.0f;
	m_fZ = 0.0f;
	//}}AFX_DATA_INIT
}

CGasShotForecastView::~CGasShotForecastView()
{
}

void CGasShotForecastView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CGasShotForecastView)
	DDX_Text(pDX, IDC_EDIT_GSF_MODEL, m_cstrModel);
	DDX_Text(pDX, IDC_EDIT_GSF_D, m_fD);
	DDX_Text(pDX, IDC_EDIT_GSF_D1, m_fD1);
	DDX_Text(pDX, IDC_EDIT_GSF_D1P, m_fD1P);
	DDX_Text(pDX, IDC_EDIT_GSF_FMIO, m_fFMIO);
	DDX_Text(pDX, IDC_EDIT_GSF_PAVE, m_fPAVE);
	DDX_Text(pDX, IDC_EDIT_GSF_PPC, m_fPPC);
	DDX_Text(pDX, IDC_EDIT_GSF_PPR, m_fPPR);
	DDX_Text(pDX, IDC_EDIT_GSF_PRT, m_fPRT);
	DDX_Text(pDX, IDC_EDIT_GSF_Q1, m_fQ1);
	DDX_Text(pDX, IDC_EDIT_GSF_QGAS, m_fQGAS);
	DDX_Text(pDX, IDC_EDIT_GSF_QPER, m_fQPER);
	DDX_Text(pDX, IDC_EDIT_GSF_QW, m_fQW);
	DDX_Text(pDX, IDC_EDIT_GSF_SD, m_fSD);
	DDX_Text(pDX, IDC_EDIT_GSF_SDP, m_fSDP);
	DDX_Text(pDX, IDC_EDIT_GSF_SDPS, m_fSDPS);
	DDX_Text(pDX, IDC_EDIT_GSF_SDS, m_fSDS);
	DDX_Text(pDX, IDC_EDIT_GSF_SP, m_fSP);
	DDX_Text(pDX, IDC_EDIT_GSF_SPS, m_fSPS);
	DDX_Text(pDX, IDC_EDIT_GSF_ST, m_fST);
	DDX_Text(pDX, IDC_EDIT_GSF_STS, m_fSTS);
	DDX_Text(pDX, IDC_EDIT_GSF_TAVE, m_fTAVE);
	DDX_Text(pDX, IDC_EDIT_GSF_TPC, m_fTPC);
	DDX_Text(pDX, IDC_EDIT_GSF_TPR, m_fTPR);
	DDX_Text(pDX, IDC_EDIT_GSF_Z, m_fZ);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CGasShotForecastView, CFormView)
	ON_WM_CONTEXTMENU()
	//{{AFX_MSG_MAP(CGasShotForecastView)
	ON_WM_CREATE()
	ON_COMMAND(ID_SPD_CACL, OnSpdCacl)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGasShotForecastView diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CGasShotForecastView message handlers

float CGasShotForecastView::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.519999E-2
		*(kj-13)/2.87+0.14*(wc-0.525)/0.195-0.0149*(wh-525)/133+
		0.112*(xw-90)/30+0.0467*(kzr-0.505)/0.203);
}

float CGasShotForecastView::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 CGasShotForecastView::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 CGasShotForecastView::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 CGasShotForecastView::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 CGasShotForecastView::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 CGasShotForecastView::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 CGasShotForecastView::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.100001E-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 CGasShotForecastView::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 CGasShotForecastView::DataOK()
{
	CMainFrame*	wnd = (CMainFrame*)AfxGetMainWnd();
	if(wnd->m_structBDTTable.bState == FALSE)
	{
		MessageBox("请输入源数据 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structTTPResult.bState == FALSE)
	{
		MessageBox("请先进行射孔参数校正 !","工程信息");
		return FALSE;
	}
	UpdateData();

	UpdateData(FALSE);
	if(wnd->m_structBDTTable.fShotLayerPly == 0)
	{
		MessageBox("请输入射孔段厚度 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structBDTTable.fWellRadius == 0)
	{
		MessageBox("请输入井筒半径 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structBDTTable.fStratumAverPress == 0)
	{
		MessageBox("请输入地层压力 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structBDTTable.fStratumFilterPercent == 0)
	{
		MessageBox("请输入地层渗透率 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structBDTTable.fProducePressDiff == 0)
	{
		MessageBox("请输入估计生产压差 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structBDTTable.fDrillPolluteDepth == 0)
	{
		MessageBox("请输入污染深度 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structBDTTable.fRevealOilRadius == 0)
	{
		MessageBox("请输入泄油半径 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structBDTTable.fStratumTemp == 0)
	{
		MessageBox("请输入地层温度 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structBDTTable.fStratumHolePercent == 0)
	{
		MessageBox("请输入地层孔隙度 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structBDTTable.fStratumHeterosphere == 0)
	{
		MessageBox("请输入地层非均质性 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structBDTTable.fFloorGasPorportion == 0)
	{
		MessageBox("请输入地面气体比重 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structBDTTable.fDrillPollutePercent == 0)
	{
		MessageBox("请输入污染程度 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structBDTTable.fStratumCentralDepth == 0)
	{
		MessageBox("请输入储层中部深度 !","工程信息");
		return FALSE;
	}
	if(wnd->m_structBDTTable.fStratumPly == 0)
	{
		MessageBox("请输入地层总厚度 !","工程信息");
		return FALSE;
	}

	return TRUE;
}


void CGasShotForecastView::GasshotforecastLoad() 
{
	// TODO: Add your control notification handler code here
	CMainFrame*	wnd = (CMainFrame*)AfxGetMainWnd();
	
	if(wnd->m_structGasShotForecast.bState == FALSE)
		return;
	UpdateData();

	m_fD = wnd->m_structGasShotForecast.fD;
	m_fD1 = wnd->m_structGasShotForecast.fD1;
	m_fD1P = wnd->m_structGasShotForecast.fD1P;
	m_fFMIO = wnd->m_structGasShotForecast.fFMIO;
	m_fPAVE = wnd->m_structGasShotForecast.fPAVE;
	m_fPPC = wnd->m_structGasShotForecast.fPPC;
	m_fPPR = wnd->m_structGasShotForecast.fPPR;
	m_fPRT = wnd->m_structGasShotForecast.fPRT;
	m_fQ1 = wnd->m_structGasShotForecast.fQ1;
	m_fQGAS = wnd->m_structGasShotForecast.fQGAS;
	m_fQPER = wnd->m_structGasShotForecast.fQPER;
	m_fQW = wnd->m_structGasShotForecast.fQW;
	m_fSD = wnd->m_structGasShotForecast.fSD;
	m_fSDP = wnd->m_structGasShotForecast.fSDP;
	m_fSDPS = wnd->m_structGasShotForecast.fSDPS;
	m_fSP = wnd->m_structGasShotForecast.fSP;
	m_fSPS = wnd->m_structGasShotForecast.fSPS;
	m_fST = wnd->m_structGasShotForecast.fST;
	m_fSTS = wnd->m_structGasShotForecast.fSTS;
	m_fTAVE = wnd->m_structGasShotForecast.fTAVE;
	m_fTPC = wnd->m_structGasShotForecast.fTPC;
	m_fTPR = wnd->m_structGasShotForecast.fTPR;
	m_fZ = wnd->m_structGasShotForecast.fZ;
	m_fShotDen = wnd->m_structSelectedPara.fShotDen  ;
	m_fAngle = wnd->m_structSelectedPara.fAngle ;
	m_cstrModel = wnd->m_structSelectedPara.strModel;

	UpdateData(FALSE);	
}

int CGasShotForecastView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CFormView::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here
	CMainFrame*	wnd = (CMainFrame*)AfxGetMainWnd();
	if(wnd->m_bSelected == FALSE)
	{
		MessageBox("请先在参数优选中选择一种射孔弹 !","工程信息");
		return -1;
	}
	
/*	CString cstrProjectName;
	CSpdDoc* pDoc = (CSpdDoc*)GetDocument();
	cstrProjectName = pDoc->m_cstrTitle +" - [气井产能比表皮系数预测]";
	pDoc->SetTitle (cstrProjectName);
*/
	GetParentFrame()->SetWindowText(_T("气井产能比表皮系数预测"));

	return 0;
}

void CGasShotForecastView::OnInitialUpdate() 
{
	CFormView::OnInitialUpdate();
	
	// TODO: Add your specialized code here and/or call the base class
	GasshotforecastLoad();
	
}


void CGasShotForecastView::OnSpdCacl() 
{
	// TODO: Add your command handler code here
	CWaitCursor		wait;
	if(DataOK() == FALSE) return;
	CMainFrame*	wnd = (CMainFrame*)AfxGetMainWnd();

	UpdateData();
	int iShotBullet;
	for(iShotBullet=0;iShotBullet<wnd->m_structBDTTable.lCount;iShotBullet++)
	{
		if(m_cstrModel.Compare(wnd->m_structSDT[iShotBullet].strModel)==0)
			break;
	}
	UpdateData(FALSE);
	if(iShotBullet>=wnd->m_structBDTTable.lCount)
	{
		MessageBox("射孔弹型号错误 !","工程信息");
		return;
	}

//	float ks1 = wnd->m_structSDT[iShotBullet].fShotDepth*wnd->m_structTTPResult.fPP[iShotBullet];

⌨️ 快捷键说明

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