📄 zpjdtfx.cpp
字号:
// Zpjdtfx.cpp: implementation of the CZpjdtfx class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "cvenus.h"
#include "Zpjdtfx.h"
#include "yqsxz.h"
#include "LZXJD.h"
#include "math.h"
#include "dxlyltd.h"
#include "direct.h"//用于得到系统路径
#include "Common.h"
#include "zpjjdfx.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern char cGraphColor[][16];
extern int iGraphColorNum;
extern int g_iProgress ; // 计算进度
extern bool bFinishThread;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CZpjdtfx::CZpjdtfx()
{
m_strJSFF = _T("");
g_iProgress = 0;
}
CZpjdtfx::~CZpjdtfx()
{
}
void CZpjdtfx::Dtfx()
{
double dblCSZ[4][10];
int iJSS[5];
double dblRLR[10][10][501];
double dblRLC[501];
double dblQYL[501];
double dblDVW,dblPDC,dblPJK,dblTDC,dblTJK,dblPLIYS,dblQCS,dblPCS,dblGWR;
double dblDIC, dblDIT1, dblDVT1, dblDIT2, dblDVT2, dblRR;
double dblDvc, dblDoc, dblPsep, dblGG, dblCO2, dblH2S, dblN2, dblGW, dblNaCl;
int iDXLMethod;
double dblPLI = 0;
int iTemp,iTemp01,iTemp02,iTemp03;
for(iTemp01 = 0; iTemp01 < 4; iTemp01++)
{
for(iTemp02 = 0; iTemp02 < 10; iTemp02++)
{
dblCSZ[iTemp01][iTemp02] = 0;
}
}
for(iTemp = 0; iTemp < 5; iTemp++)
{
iJSS[iTemp] = 0;
}
for(iTemp01 = 0; iTemp01 < 10; iTemp01++)
{
for(iTemp02 = 0; iTemp02 < 10; iTemp02++)
for(iTemp03 = 0; iTemp03 < 500; iTemp03++)
{
dblRLR[iTemp01][iTemp02][iTemp03] = 0;
}
}
for(iTemp = 0; iTemp <= 500; iTemp++)
{
dblRLC[iTemp] = 0;
}
for(iTemp = 0; iTemp <= 500; iTemp++)
{
dblQYL[iTemp] = 0;
}
dblDVW = dblPDC = dblPJK = dblTDC = dblTJK = dblPLIYS = dblQCS = dblPCS = dblGWR = 0;
dblDIC = dblDIT1 = dblDVT1 = dblDIT2 = dblDVT2 = dblRR = 0;
dblDvc = dblDoc = dblPsep = dblGG = dblCO2 = dblH2S = dblN2 = dblGW = dblNaCl = 0;
g_iProgress = 5;
CString strTemp;
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(1, 5);
dblDVW=atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(2, 5);
dblPDC = atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(3, 5);
dblPJK = atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(4, 5);
dblTDC = atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(5, 5);
dblTJK = atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(6, 5);
dblPLIYS = atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(7, 5);
dblQCS = atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(8, 5);
dblPCS = atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(9, 5);
dblGWR = atof(strTemp);
// DIC, DIT1, DVT1, DIT2, DVT2, RR
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(10, 5);
dblDIC = atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(11, 5);
dblDIT1 = atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(12, 5);
dblDVT1 = atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(13, 5);
dblDIT2 = atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(14, 5);
dblDVT2 = atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(15, 5);
dblRR = atof(strTemp);
// Dvc, Doc, Psep, GG, CO2, H2S, N2, GW, NaCl
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(16, 5);
dblDvc = atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(17, 5);
dblDoc = atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(18, 5);
dblPsep = atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(19, 5);
dblGG = atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(20, 5);
dblCO2 = atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(21, 5);
dblH2S = atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(22, 5);
dblN2 = atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(23, 5);
dblGW = atof(strTemp);
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(24, 5);
dblNaCl = atof(strTemp);
iTemp = 24;
iTemp03 = 24;
for(iTemp01 = 0; iTemp01 < 4; iTemp01 += 3)
{
if(iTemp > 24)
iTemp += 20;
for(iTemp02 = 0; iTemp02 < 5; iTemp02++)
{
iTemp++;
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(iTemp, 5);
dblCSZ [iTemp01][iTemp02] = atof(strTemp);
}
}
iTemp = iTemp03 + 5;
for(iTemp01 = 1; iTemp01 < 3; iTemp01++)
{
for(iTemp02 = 0; iTemp02 < 10; iTemp02++)
{
iTemp++;
strTemp = ((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_grid.GetTextRC(iTemp, 5);
dblCSZ [iTemp01][iTemp02] = atof(strTemp);
}
}
iDXLMethod = ((CComboBox*)((CCVenusApp*)AfxGetApp())->m_pMainDlg->m_Page19.GetDlgItem(IDCBX_ZPD_DXL))->GetCurSel();
iDXLMethod++;
g_iProgress = 10;
for(iTemp01 = 0; iTemp01 < 4; iTemp01++)
{
for(iTemp02 = 0; iTemp02 < 9; iTemp02++)
{
if(dblCSZ[iTemp01][iTemp02] == 0)
{
for(iTemp03 = iTemp02 + 1; iTemp03 < 10; iTemp03++)
{
if(dblCSZ[iTemp01][iTemp03] >= 0)
{
dblCSZ[iTemp01][iTemp02] = dblCSZ[iTemp01][iTemp03];
dblCSZ[iTemp01][iTemp03] = 0;
break;
}
}
}
}
}
double dblTemp;
for(iTemp01 = 0; iTemp01 < 4; iTemp01++)
{
if(iTemp01 == 0 || iTemp01 == 3)
iTemp = 5;
else
iTemp = 10;
for(iTemp02 = 0; iTemp02 < iTemp - 1; iTemp02++)
{
for(iTemp03 = iTemp02 + 1; iTemp03 < iTemp; iTemp03++)
{
if(dblCSZ[iTemp01][iTemp02] < dblCSZ[iTemp01][iTemp03])
{
dblTemp = dblCSZ[iTemp01][iTemp03];
dblCSZ[iTemp01][iTemp03] = dblCSZ[iTemp01][iTemp02];
dblCSZ[iTemp01][iTemp02] = dblTemp;
}
}
}
}
if(dblCSZ[0][0] == 0)
dblCSZ[0][0] = dblPJK;
if(dblCSZ[1][0] == 0)
dblCSZ[1][0] = dblPDC;
if(dblCSZ[2][0] == 0)
dblCSZ[2][0] = dblPLIYS;
if(dblCSZ[3][0] == 0)
dblCSZ[3][0] = dblGWR;
g_iProgress = 20;
for(iTemp01 = 0; iTemp01 < 4; iTemp01++)
{
for(iTemp02 = 0; iTemp02 < 10; iTemp02++)
{
if(dblCSZ[iTemp01][iTemp02] > 0)
iJSS[iTemp01]++;
}
}
/*
For i = 1 To 4
For J = 1 To 10
If 参数(i, J) > 0 Then 计算数(i) = 计算数(i) + 1
Next J
Next i
ReDim Q水量(计算数(1), 计算数(2), 计算数(3), 计算数(4))
*/
double dblQSL[11][11][11][11]; // Q水量
CCommon comm;
m_strJSFF = comm.DXLMethod(iDXLMethod);
double dblFW,dblPB;
dblFW = 1;
dblPB = dblPDC;
dblPLI = dblCSZ[2][0];
double dblQB,dblQoMax,dblQtMax;
zpjjdfx jdfx;
//入井动态关系IPR(产液指数, QB, Qomax, Qtmax, Qtest, Ptest, Prs, Pb, Fw);
//Call 入井动态关系IPR(PLI, QB, Qomax, Qtmax, q测试, p测试, P地层, Pb, Fw)
jdfx.rjIPR(dblPLI, dblQCS, dblPCS, dblPDC, dblPB, dblFW);
dblQB = jdfx.QB;
dblQoMax = jdfx.Qomax;
dblQtMax = jdfx.Qtmax;
dblPLI = jdfx.PLIZZZ;
CStdioFile stdfRes,stdfGraph;
CFileException fe;
BOOL bStatus;
CString strPath;
// strPath = ((CCVenusApp*)AfxGetApp())->GetMyAppPath();
if(((CCVenusApp*)AfxGetApp())->m_cBaseFileLeft.IsEmpty())
{
strTemp = ((CCVenusApp*)AfxGetApp())->GetOpenFileName(1);
if(strTemp.IsEmpty()) return;
}
else
{
strTemp = ((CCVenusApp*)AfxGetApp())->m_cBaseFileLeft + _T(".RSW");
}
// strTemp = strPath + _T(".RSW");
bStatus = stdfRes.Open(strTemp,CFile::modeCreate|CFile::modeWrite);
if(!bStatus)
{
TCHAR szMsg[100];
sprintf(szMsg, "Error opening file for reading. Code:%d",
fe.m_cause);
AfxMessageBox(szMsg);
return;
}
if(((CCVenusApp*)AfxGetApp())->m_cBaseFileLeft.IsEmpty())
{
strTemp = ((CCVenusApp*)AfxGetApp())->GetOpenFileName(2);
if(strTemp.IsEmpty()) return;
}
else
{
strTemp = ((CCVenusApp*)AfxGetApp())->m_cBaseFileLeft + _T(".GSW");
}
// strTemp = strPath + _T(".GSW");
// AfxMessageBox(strTemp);
bStatus = stdfGraph.Open(strTemp,CFile::modeCreate|CFile::modeWrite);
if(!bStatus)
{
TCHAR szMsg[100];
sprintf(szMsg, "Error opening file for reading. Code:%d",
fe.m_cause);
AfxMessageBox(szMsg);
return;
}
// AfxMessageBox("HELLO");
try
{
stdfRes.WriteString(_T("\n"));
strTemp = _T("\t\t$$井自喷动态分析计算结果$0\n");
stdfRes.WriteString(strTemp);
stdfRes.WriteString(_T("\n"));
stdfRes.WriteString(_T("井口压力$7\t产水指数$7\t气液比$7"));
for(iTemp01 = 0; iTemp01 < 10; iTemp01++)
{
if(dblCSZ[1][iTemp01] > 0)
stdfRes.WriteString(_T("\t地层压力$7"));
}
stdfRes.WriteString(_T("\nMPa$11\t m^3/d·MPa$11\t m^3/m^3$11"));
for(iTemp01 = 0; iTemp01 < 10; iTemp01++)
{
if(dblCSZ[1][iTemp01] > 0)
{
strTemp.Format(_T("\t%.2f"),dblCSZ[1][iTemp01]);
strTemp += _T("$11");
stdfRes.WriteString(strTemp);
}
}
stdfRes.WriteString(_T("\n"));
// 参数变换及计算有关参数
dblQYL[0] = int(0.05 * dblQtMax);
if(dblQYL[0] > 0.5)
dblQYL[0] = 0.5;
double dblDLTQ = 0;
int iCount = 0;
for(iTemp01 = 1; iTemp01 <= 500; iTemp01++)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -