📄 scjjdfx.cpp
字号:
A1 = A1 + "\t" + ",MPa$14";
A2 = "井的产量$13";
A2 = A2 + "\t" + ",万m^3/d$14$14";
for(i=1;i<=5;i++)
{
P = 0;
Q = 0;
for(J=2;J<=njsds;J++)
{
Q1 = jieguo[0][J - 1];
Q2 = jieguo[0][J];
PI1 = jieguo[1][J - 1];
PI2 = jieguo[1][J];
PO1 = jieguo[i + 1][J - 1];
PO2 = jieguo[i + 1][J];
if( J > 2 && PI2 * PO2 == 0)
{
break;
}
if( PI1 >= PO1 && PI2 <= PO2 || (PI1 <= PO1 && PI2 >= PO2))
{
jslzjd.qlzxjd(Q1, Q2, PI1, PO1, PI2, PO2);
P=jslzjd.Y;
Q=jslzjd.X;
break;
}
}
if( P > 0)
{
P = int(100 * P);
P=P/ 100;
}
if( Q > 0)
{
Q = int(100 * Q);
Q=Q/ 100;
}
gcvt(P,30,temptp);
templs1=temptp;
templs1.TrimLeft();
templs1.TrimRight();
A1 = A1 + "\t" + templs1;
gcvt(Q,30,temptp1);
templs2=temptp1;
templs2.TrimLeft();
templs2.TrimRight();
A2 = A2 + "\t" + templs2;
}
A1=A1+"\n";
A2=A2+"\n";
try
{
f3.WriteString(A1);
f3.WriteString(A2);
f3.WriteString("\n");
}
catch (CFileException exception3)
{
AfxMessageBox("Error reading file");
return;
}
// bfblj = bfblj + 98 * fxcsgs[1] / jszs;
}
}
g_iProgress = 35; // 计算进度
ENDCOMPUTE;
//地层压力分析
if( cdcyl == 1)
{
//节点在井口
for(i=0;i<=10;i++)
{
for(J=0;J<=njsds;J++)
{
jieguo[i][J] = 0;
}
}
//流入关系计算
try
{
templs1="$$地层压力分析[井口流压~产气量]\n";
f4.WriteString(templs1);
f4.WriteString("节点压力最小值,MPa:\n");
f4.WriteString("节点压力最大值,MPa:\n");
f4.WriteString("产气量最小值,10^4m^3/d:\n");
f4.WriteString("产气量最大值,10^4m^3/d:\n");
f4.WriteString("Pn\n");
f4.WriteString("Qg\n");
f4.WriteString("Pn__MPa\n");
f4.WriteString("Qg__10^4m^3/d\n");
f4.WriteString(" 1\n");
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
Pmax = 0;
BAC = 98 * fxcsgs[2] / jszs / (fxcsgs[2] + 1) / njsds;
for(i=1;i<=5;i++)
{
pdiceng = canshu[2][i];
if( pdiceng == 0)
{
break;
}
for(J=0;J<=njsds;J++)
{
/* 百分比 = Int(bfblj + BAC * ((i - 1) * njsds + J + 1));
if( 主窗口.SSPanel1.FloodPercent < 百分比)
{
主窗口.SSPanel1.FloodPercent = 百分比;
}*/
QG = int(1000 * qqlzz * J);
QG=QG/ 1000;
if( AF * BF > 0)
{
PWF = pow(pdiceng,2) - AF * QG - BF * pow(QG,2);
}
else if( CF * NF > 0)
{
PWF = pow(pdiceng,2) - pow((QG / CF),(1 / NF));
}
if( PWF > 0)
{
PWF = pow(PWF,0.5);
}
else
{
break;
}
qqiliang = QG * 10000;
gylx=qjyljsz.qjyl(PWF, tdiceng, TG, LC, DIC, 0, RR, qqiliang, GG, LGR, GL, H2S, N2, CO2, 0, 0, -1, 1);
if( gylx < 0.5)
{
jieguo[0][J] = QG;
jieguo[i][J] = 0;
break;
}
Tun = tdiceng - LC * TG;
gyali=qjyljsz.qjyl(gylx, Tun, TG, DVT2, DIT2, 0, RR, qqiliang, GG, LGR, GL, H2S, N2, CO2, 0, 0, -1, 1);
if( gyali < 0.5)
{
jieguo[0][J] = QG;
jieguo[i][J] = 0;
break;
}
Tun = tdiceng - (LC + DVT2) * TG;
P2=qjyljsz.qjyl(gyali, Tun, TG, DVT1, DIT1, 0, RR, qqiliang, GG, LGR, GL, H2S, N2, CO2, 0, 0, -1, 1);
if( P2 < 0.5)
{
jieguo[0][J] = QG;
jieguo[i + 1][J] = 0;
break;
}
else
{
jieguo[0][J] = QG;
jieguo[i + 1][J] = P2;
}
gcvt(QG,30,temptp);
templs1=temptp;
gcvt(P2,30,temptp1);
templs2=temptp1;
templs1=" "+templs1+"\t"+templs2+"\n";
try
{
f4.WriteString(templs1);
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
if( J == 0 && Pmax < P2)
{
Pmax = P2;
}
}
gcvt(QG,30,temptp);
templs1=temptp;
gcvt(0,30,temptp1);
templs2=temptp1;
templs1=" "+templs1+"\t"+templs2+"\n";
try
{
f4.WriteString(templs1);
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
try
{
f4.WriteString("-1\t-1\n");
f4.WriteString(cGraphColor[iColorIndex++]);
iColorIndex %= iGraphColorNum;
gcvt(canshu[2][i],30,temptp);
templs1=temptp;
templs1.TrimLeft();
templs1.TrimRight();
templs1="Ptf="+templs1+"(MPa)"+"\n";
f4.WriteString(templs1);
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
}
g_iProgress = 40; // 计算进度
ENDCOMPUTE;
//流出关系计算
if( DCH > 0)
{
pxlyl = phuiya;
pslyl = pxlyl;
for(J=0;J<=njsds;J++)
{
// 百分比 = Int(bfblj + BAC * (fxcsgs(2) * njsds + J + 1))
// If 主窗口.SSPanel1.FloodPercent < 百分比 Then 主窗口.SSPanel1.FloodPercent = 百分比
QG = int(1000 * qqlzz * J);
QG=QG/ 1000;
if( QG == 0)
{
pslyl = pxlyl;
}
else
{
pylzj = 1.5;
DX = -1;
do
{
pslyl = pslyl + pylzj;
dylb = pxlyl / pslyl;
PR = pslyl / PC;
TR = tjingkou / TC;
Z=csjs.trqpcxs(PR, TR);//天然气偏差因子
if( dylb < 0.55)
{
qyzql = 0.19 * pow(DCH,2) * pslyl / pow((tjingkou * Z * GG),0.5);
}
else
{
dylb = pow(dylb,1.5748) - pow(dylb,1.7874);
if( dylb <= 0)
{
dylb = 0;
}
qyzql = 0.8835 * pow(DCH,2) * pslyl * pow((dylb / (tjingkou * Z * GG)),0.5);
}
if( DX == -1 && qyzql > QG)
{
pylzj = -0.618 * pylzj;
}
else if( DX == 1 && qyzql > QG)
{
pylzj = 0.618 * pylzj;
}
else if( DX == 1 && qyzql < QG)
{
pylzj = -0.618 * pylzj;
}
if( qyzql > QG)
{
DX = 1;
}
else
{
DX = -1;
}
} while(fabs(qyzql - QG) > 0.05);
}
jieguo[1][J] = int(1000 * pslyl);
jieguo[1][J]=jieguo[1][J]/ 1000;
gcvt(QG,30,temptp);
templs1=temptp;
gcvt(jieguo[1][J],30,temptp1);
templs2=temptp1;
templs1=" "+templs1+"\t"+templs2+"\n";
try
{
f4.WriteString(templs1);
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
if( pslyl > Pmax + 1)
{
break;
}
}
try
{
f4.WriteString("-1\t-1\n");
f4.WriteString(cGraphColor[iColorIndex++]);
iColorIndex %= iGraphColorNum;
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
gcvt(DCH,30,temptp);
templs1=temptp;
templs1.TrimLeft();
templs1.TrimRight();
templs1="Doc="+templs1+"(mm)"+"\n";
try
{
f4.WriteString(templs1);
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
}
try
{
f4.WriteString("-10\t-10\n");
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
templs1="\t\t";
templs1=templs1+ "[地层压力分析 (节点在井口)]$0\n";
templs2=" 气 量$7";
templs2=templs2+ "\t" + "油嘴压力$7" + "\t" + " 在下列地层压力下的节点压力,MPa$13" + "\t" + "$12" + "\t" + "$12" + "\t" + "$12" + "\t" + "$14"+"\n";
try
{
f3.WriteString(templs1);
f3.WriteString(templs2);
}
catch (CFileException exception3)
{
AfxMessageBox("Error reading file");
return;
}
A= "万方/天$11";
A = A + "\t" + " MPa$11";
for(i=1;i<=5;i++)
{
gcvt(canshu[2][i],30,temptp);
templs1=temptp;
A = A + "\t" + templs1;
}
A=A+"\n";
try
{
f3.WriteString(A);
}
catch (CFileException exception3)
{
AfxMessageBox("Error reading file");
return;
}
for(J=0;J<=njsds;J++)
{
if((jieguo[0][J] + jieguo[2][J] + jieguo[3][J] + jieguo[4][J] + jieguo[5][J] + jieguo[6][J] )== 0)
{
break;
}
for(i=0;i<=6;i++)
{
gcvt(jieguo[i][J],30,temptp);
B = temptp;
if( i == 0)
{
A = B;
}
else
{
A = A + "\t" + B;
}
}
A=A+"\n";
try
{
f3.WriteString(A);
}
catch (CFileException exception3)
{
AfxMessageBox("Error reading file");
return;
}
}
try
{
f3.WriteString("\n");
}
catch (CFileException exception3)
{
AfxMessageBox("Error reading file");
return;
}
// bfblj = bfblj + 98 * fxcsgs[2] / jszs;
//节点在井底
for(i=0;i<=10;i++)
{
for(J=0;J<=njsds;J++)
{
jieguo[i][J] = 0;
}
}
g_iProgress = 45; // 计算进度
ENDCOMPUTE;
//流入关系计算
try
{
templs1="$$地层压力分析[井底流压~产气量]\n";
f4.WriteString(templs1);
f4.WriteString("节点压力最小值,MPa:\n");
f4.WriteString("节点压力最大值,MPa:\n");
f4.WriteString("产气量最小值,10^4m^3/d:\n");
f4.WriteString("产气量最大值,10^4m^3/d:\n");
f4.WriteString("Pn\n");
f4.WriteString("Qg\n");
f4.WriteString("Pn__MPa\n");
f4.WriteString("Qg__10^4m^3/d\n");
f4.WriteString(" 1\n");
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
Pmax = 0;
BAC = 98 * fxcsgs[2] / jszs / (fxcsgs[2] + 2) / njsds;
for(i=1;i<=5;i++)
{
pdiceng = canshu[2][i];
if( pdiceng == 0)
{
break;
}
for(J=0;J<=njsds;J++)
{
// 百分比 = Int(bfblj + BAC * ((i - 1) / (fxcsgs(2) - 1) * njsds + J + 1))
// If 主窗口.SSPanel1.FloodPercent < 百分比 Then 主窗口.SSPanel1.FloodPercent = 百分比
QG = int(1000 * qqlzz * J);
QG=QG/ 1000;
if( AF * BF > 0)
{
PWF = pow(pdiceng,2) - AF * QG - BF * pow(QG,2);
}
else if( CF * NF > 0)
{
PWF = pow(pdiceng,2) - pow((QG / CF),(1 / NF));
}
if( PWF > 0)
{
PWF = pow(PWF,0.5);
}
else
{
gcvt(QG,30,temptp);
templs1=temptp;
gcvt(0,30,temptp1);
templs2=temptp1;
templs1=templs1+"\t"+templs2+"\n";
try
{
f4.WriteString(" "+templs1);
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
jieguo[0][J] = QG;
jieguo[i][J] = 0;
break;
}
gcvt(QG,30,temptp);
templs1=temptp;
gcvt(PWF,30,temptp1);
templs2=temptp1;
templs1=" "+templs1+"\t"+templs2+"\n";
try
{
f4.WriteString(templs1);
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
jieguo[0][J] = QG;
jieguo[i][J] = PWF;
if( J == 0 && Pmax < PWF)
{
Pmax = PWF;
}
}
try
{
f4.WriteString("-1\t-1\n");
f4.WriteString(cGraphColor[iColorIndex++]);
iColorIndex %= iGraphColorNum;
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
gcvt(canshu[2][i],30,temptp);
templs1=temptp;
templs1.TrimLeft();
templs1.TrimRight();
templs1="Prs="+templs1+"(MPa)"+"\n";
try
{
f4.WriteString(templs1);
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
}
//流出关系计算
for(i=0;i<=5;i++)
{
if( i > 0)
{
DIT10 = canshu[3][i] / 1000;
DVT10 = DVT1 + DVT2 + LC;
DVT20 = 0;
DVT30 = 0;
if( DIT10 == 0)
{
break;
}
}
else
{
DIT10 = DIT1;
DVT10 = DVT1;
DIT20 = DIT2;
DVT20 = DVT2;
DVT30 = LC;
}
for(J=0;J<=njsds;J++)
{
// 百分比 = Int(bfblj + BAC * ((i + 1) * njsds + J + 1))
// If 主窗口.SSPanel1.FloodPercent < 百分比 Then 主窗口.SSPanel1.FloodPercent = 百分比
QG = int(1000 * qqlzz * J);
QG=QG/ 1000;
qqiliang = QG * 10000;
gylx=qjyljsz.qjyl(pjingkou, tjingkou, TG, DVT10, DIT10, 0, RR, qqiliang, GG, LGR, GL, H2S, N2, CO2, 0, 0, 1, 1);
Tun = tjingkou + TG * DVT10;
gyali=qjyljsz.qjyl(gylx, Tun, TG, DVT20, DIT20, 0, RR, qqiliang, GG, LGR, GL, H2S, N2, CO2, 0, 0, 1, 1);
Tun = tjingkou + TG * (DVT10 + DVT20);
P2=qjyljsz.qjyl(gyali, Tun, TG, DVT30, DIT20, 0, RR, qqiliang, GG, LGR, GL, H2S, N2, CO2, 0, 0, 1, 1);
jieguo[i + 6][J] = P2;
gcvt(QG,30,temptp);
templs1=temptp;
gcvt(jieguo[i + 6][J],30,temptp1);
templs2=temptp1;
templs1=" "+templs1+"\t"+templs2+"\n";
try
{
f4.WriteString(templs1);
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
if( P2 > Pmax + 1)
{
break;
}
}
try
{
f4.WriteString("-1\t-1\n");
f4.WriteString(cGraphColor[iColorIndex++]);
iColorIndex %= iGraphColorNum;
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
if( i == 0)
{
try
{
f4.WriteString("Dit=实际油管\n");
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
}
else
{
gcvt(canshu[3][i],30,temptp);
templs1=temptp;
templs1.TrimLeft();
templs1.TrimRight();
templs1="Dit="+templs1+"(mm)"+"\n";
try
{
f4.WriteString(templs1);
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
}
}
try
{
f4.WriteString("-10\t-10\n");
}
catch (CFileException exception4)
{
AfxMessageBox("Error reading file");
return;
}
g_iProgress = 50; // 计算进度
ENDCOMPUTE;
templs1="\t\t";
templs1=templs1+ "[地层压力分析 (节点在井底)]$0"+"\n";
templs2=" 气 量$7";
templs2=templs2+ "\t" + "油管压力$7" + "\t" + " 在下列地层压力下的节点压力,MPa$13" + "\t" + "$12" + "\t" + "$12" + "\t" + "$12" + "\t" + "$14"+"\n";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -