📄 qjlxpyljll.cpp
字号:
char s[100];
sprintf(s, "Error opening file for reading. Code:%d",
exception4.m_cause);
AfxMessageBox(s);
return;
}
try
{
title="$$";
title=title+"连续排液临界流量图\n";
f4.WriteString(title);
f4.WriteString("油管内径最小值,mm:\n");
f4.WriteString("油管内径最大值,mm:\n");
f4.WriteString("产气量最小值,10^4m^3/d:\n");
f4.WriteString("产气量最大值,10^4m^3/d:\n");
f4.WriteString("Dit\n");
f4.WriteString("Qg\n");
f4.WriteString("Dit__mm\n");
f4.WriteString("Qg__10^4m^3/d\n");
f4.WriteString(" 1\n");
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
for(J=0;J<=njsds;J++)
{
Q = Qqlzz * J; //产气量
if( AF * BF > 0)
{
P = pow(Prs,2) - AF * Q - BF * pow(Q,2);
}
else if( Cldxs * Nzs > 0)
{
P = pow(Prs,2) - pow((Q / Cldxs),(1 / Nzs));
}
if( P <= 4)
{
break;
}
else
{
P = pow(P,0.5);
}
T = Tdcwd;
PR = P / PC;
TR = (T + 273.15) / TC;
//Call 天然气偏差系数(Z, PR, TR)
Z=csjs.trqpcxs(PR, TR);
WG = 3484.5 * GG * P / (T + 273.15) / Z;
if( yhs == 0)
{
//Call 水的表面张力(STL, P, T)
STL=csjs.sbmzl(P, T);//计算水的表面张力
}
else
{
//Call 油的表面张力(STL, GL, P, T)
STL=csjs.ybmzl(GL, P, T);//计算油的表面张力
}
WL = 1000 * GL;
Vg = 7.15 * pow((0.001*STL*(WL-WG)),0.25)/pow(WG,0.5);
DIT = pow((Q/0.019645/P/Vg*(273+T)*Z),0.5);
dJsjg[0][J] = int(100 * Q);
dJsjg[0][J]=dJsjg[0][J]/ 100.0;
dJsjg[1][J] = int(100 * P);
dJsjg[1][J]=dJsjg[1][J]/ 100.0;
dJsjg[2][J] = int(100 * DIT);
dJsjg[2][J]=dJsjg[2][J]/ 100.0;
try
{
gcvt(dJsjg[0][J],30,Temp);
templs1=Temp;
gcvt(dJsjg[2][J],30,Temp1);
templs2=Temp1;
templs1=" "+templs1+" "+templs2+"\n";
f4.WriteString(templs1);
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
//主窗口.SSPanel1.FloodPercent = Int(J / 4)
}
// BFB = 主窗口.SSPanel1.FloodPercent + 1
g_iProgress = 65; // 计算进度
ENDCOMPUTE;
try
{
f4.WriteString("-1 -1\n");
// f4.WriteString(" 0 1\n");
f4.WriteString(cGraphColor[iColorIndex++]);
iColorIndex %= iGraphColorNum;
f4.WriteString("井底条件\n");
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
for(J=0;J<=njsds;J++)
{
Q = Qqlzz * J; //产气量
if( AF * BF > 0)
{
P = pow(Prs,2) - AF * Q - BF * pow(Q,2);
}
else if( Cldxs * Nzs > 0)
{
P = pow(Prs,2) - pow((Q / Cldxs),(1 / Nzs));
}
if( P <= 1)
{
break;
}
else
{
P = pow(P,0.5);
}
T = Tjkwd;
TR = (T + 273.15) / TC;
DIT0 = 62;
do
{
DIT = DIT0;
RG = QG * 10000;
P0 = P;
T0 = Tdcwd;
dit00 = DIT / 1000;
//Call 气井压力(Pwh, P0, T0, TG, DVW, DIT0, 0, RR, RG, GG, LGR, GL, H2S, N2, CO2, 0, -1, 1)
Pwh=qjyljsz.qjyl(P0, T0, TG, DVW, DIT0, 0, RR, RG, GG, LGR, GL, H2S, N2, CO2, 0, 0, -1, 1);
PR = Pwh / PC;
//Call 天然气偏差系数(Z, PR, TR)
Z=csjs.trqpcxs(PR, TR);//天然气偏差因子
WG = 3484.5 * GG * P / (T + 273.15) / Z;
if( yhs == 0)
{
//Call 水的表面张力(STL, P, T);
STL=csjs.sbmzl(P, T);//计算水的表面张力
}
else
{
//Call 油的表面张力(STL, GL, P, T);
STL=csjs.ybmzl(GL, P, T);//计算油的表面张力
}
WL = 1000*GL;
Vg = 7.15*pow((0.001*STL*(WL-WG)),0.25)/pow(WG,0.5);
DIT0 = pow((Q/0.019645/P/Vg*(273+T)*Z),0.5);
}
while(fabs(DIT - DIT0) > 0.5);
dJsjg[0][J] = int(100 * Q);
dJsjg[0][J]=dJsjg[0][J]/ 100.0;
dJsjg[3][J] = int(100 * Pwh);
dJsjg[3][J]=dJsjg[3][J]/ 100.0;
dJsjg[4][J] = int(100 * DIT);
dJsjg[4][J]=dJsjg[4][J]/ 100.0;
try
{
gcvt(dJsjg[0][J],30,Temp);
templs1=Temp;
gcvt(dJsjg[4][J],30,Temp1);
templs2=Temp1;
templs1=" "+templs1+" "+templs2+"\n";
f4.WriteString(templs1);
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
//主窗口.SSPanel1.FloodPercent = BFB + Int(0.75 * J)
}
try
{
f4.WriteString("-1 -1\n");
// f4.WriteString(" 0 1\n");
f4.WriteString(cGraphColor[iColorIndex++]);
iColorIndex %= iGraphColorNum;
f4.WriteString("井口条件\n");
f4.WriteString("-10 -10\n");
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
g_iProgress = 85; // 计算进度
ENDCOMPUTE;
//写入计算的数据结果
CStdioFile f3;
CFileException exception3;
// templs1 = strAppPath + "\\tempfile.txt";
status1 = f3.Open(strAppPath1,CFile::modeCreate|CFile::modeWrite);
if (!status1)
{
char s[100];
sprintf(s, "Error opening file for reading. Code:%d",
exception3.m_cause);
AfxMessageBox(s);
return;
}
try
{
f3.WriteString("\n");
title="\t$$连续排液临界流量计算结果$0\n";
f3.WriteString(title);
f3.WriteString("\n");
title1=" 气 量$7";
title1=title1+ "\t" + " 井底流压$7" + "\t" + " 最大内径$7" + "\t" + " 井口流压$7" + "\t" + " 最大内径$7"+"\n";
f3.WriteString(title1);
title1=" $3";
title1=title1+ "\t" + " $3" + "\t" + " (井底)$3" + "\t" + " $3" + "\t" + " (井口)$3"+"\n";
f3.WriteString(title1);
title2=" 万方/天$11";
title2=title2+ "\t" + " MPa$11" + "\t" + " mm$11" + "\t" + " MPa$11" + "\t" + " mm$11";
for(i=27;i<=31;i++)
{
feng[i-27].TrimLeft();
feng[i-27].TrimRight();
}
title2 = title2+feng[0]+"\t\t"+feng[1]+"\t\t"+feng[2]+"\t\t"+feng[3]+"\t\t"+feng[4]+"\t\t"+"\n";
f3.WriteString(title2);
// title3="/天";
// title3=title3+"\t"+" MPa "+"\t"+" mm"+"\t"+" MPa" + "\t"+" mm"+"\n";
// f3.WriteString(title3);
}
catch (CFileException exception3)
{
AfxMessageBox("Error reading file");
return;
}
for(J=0;J<=njsds;J++)
{
if( J > 0 && dJsjg[1][J] == 0)
{
break;
}
for(i=0;i<=4;i++)
{
gcvt(dJsjg[i][J],30,Temp);
B=Temp;
if( i == 0)
{
A = B;
}
else
{
A = A +"\t"+ B;
}
}
A=A+"\n";
if( dJsjg[0][J] == int(dJsjg[0][J]))
{
try
{
f3.WriteString(A);
}
catch (CFileException exception3)
{
AfxMessageBox("Error reading file");
return;
}
}
}
g_iProgress = 100; // 计算进度
try
{
// f3.WriteString("10\n");
}
catch (CFileException exception3)
{
AfxMessageBox("Error reading file");
return;
}
f3.Close();
f4.Close();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -