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

📄 zpjjdfx.cpp

📁 这是本人两年前兼职为某个公司做的石油钻进设计软件
💻 CPP
📖 第 1 页 / 共 5 页
字号:
							  {
								  L = DVW - DVT1 - DVT2;
								  DOL = DIC;
								  T0 = Tjkwd + TG * (DVT1 + DVT2);
							  }
							  if( K == 1 || (K > 1 && L > 0))
							  {
								  PN=dxl(MMPF,P1, T0, TG, QG, QW, QO, GG, GW, OG, L, DOL, 0, RR, H2S, CO2, N2, NaCl, 0, 1, 1);	
								  P1 = PN;
							  }
						  }
					  }
					  else
					  {
						  DOL = csz[2][i] / 1000;
						  PN=dxl(MMPF,P1, Tjkwd, TG, QG, QW, QO, GG, GW, OG, DVW, DOL, 0, RR, H2S, CO2, N2, NaCl, 0, 1, 1);	
						  P1 = PN;
					  }
					  Tjsjg[1 + i][J] = int(1000 * P1);
					  Tjsjg[1 + i][J]=Tjsjg[1 + i][J]/ 1000;
					  if( Tjsjg[1 + i][J] > Pzdz)
					  {
						  break;
					  }
					  if( Rjsjg[0][J] > 500 || Rjsjg[0][J] > 0.25 * Qtmax)
					  {
						  if( Tjsjg[1 + i][J] < 0.5 * Tjsjg[1 + i][J - 1])
						  {
							  Tjsjg[1 + i][J] = 0;
							  break;
						  }
					  }
				  }
			  }
			  
		  }
		  for(J=2;J<=Pfxjsds;J++)
		  {
			  if( J > 2 && Tjsjg[1][J] <= 0)
			  {
				  break;
			  }
			  if( Tjsjg[1][J] > Pzdz)
			  {
				  break;
			  }
			  if( Rjsjg[0][J] > 500 || Rjsjg[0][J] > 0.5 * Qtmax)
			  {
				  if( Tjsjg[1][J] < Tjsjg[1][J - 1])
				  {
					  break;
				  }
			  }
			  gcvt(Rjsjg[0][J],30,Temp);
              templs1=Temp;
			  gcvt(Tjsjg[1][J],30,Temp1);
              templs2=Temp1;
              templs1=" "+templs1+ " "+templs2+"\n";
			  try
			  {
				  f4.WriteString(templs1);
				  
			  }
			  catch (CFileException exception4)
			  {
				  AfxMessageBox("Error reading file");
				  return;
			  }			  			
			  jsjg[1][J] = Tjsjg[1][J];
			  if( Qzdz <= Rjsjg[0][J] || Pzdz + 1 <= jsjg[1][J])
			  {
				  break;
			  }
		  }
		  try
		  {
			  f4.WriteString("-1 -1\n");
			  //				f4.WriteString(" 0             1\n");
			  f4.WriteString(cGraphColor[iColorIndex++]);
			  iColorIndex %= iGraphColorNum;
			  f4.WriteString("Dit=实际油管\n");
			  f4.WriteString("-10 -10\n");
		  }
		  catch (CFileException exception4)
		  {
			  AfxMessageBox("Error reading file");
			  return;
		  }			  			
	g_iProgress = 70;	// 计算进度
	ENDCOMPUTE;
		  //写入计算的数据结果
		  try
		  {
			  //				f3.WriteString("\t\t [地层压$0\t力分析]$0\n");
			  f3.WriteString("\t\t [地层压力分析]$0\n");
			  //				f3.WriteString(" 产液量$7\t油管压力$7\t   在下$13\t列地层压$12\t力下的节$12\t点压力,$12\tMPa$14\n");
			  f3.WriteString("产液量$7\t油管压力$7\t 在下列地层压力下的节点压力(MPa)$13\t$12\t$12\t$12\t$14\n");
		  }
		  catch (CFileException exception3)
		  {
			  AfxMessageBox("Error reading file");
			  return;
		  }			
		  A = "(m^3/d)$11\t(MPa)$11";
		  for(i=1;i<=5;i++)
		  {
			  gcvt(csz[3][i] ,30,Temp);
			  templs1=Temp;
			  A = A + "\t" + templs1;
		  }
		  A=A+"\n";
		  try
		  {
			  f3.WriteString(A);
		  }
		  catch (CFileException exception3)
		  {
			  AfxMessageBox("Error reading file");
			  return;
		  }    
		  for(J=0;J<=Pfxjsds;J++)
		  {
			  if( jsjg[0][J] == 0 || (jsjg[1][J] + jsjg[2][J] + jsjg[3][J] + jsjg[4][J] + jsjg[5][J] + jsjg[6][J]) == 0)
			  {
				  break;
			  }
			  for(i=0;i<=6;i++)
			  {
				  gcvt(jsjg[i][J],30,Temp); 	
				  B = Temp;
				  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;
			  }     
		  }
		  A1 = "节点压力(MPa)$13\t$14";
		  A2 = "井的产量(m^3/d)$13\t$14";
		  for(i=1;i<=5;i++)
		  {
			  P = 0;
			  Q = 0;
			  for(J=2;J<=Pfxjsds;J++)
			  {
				  Q1 = jsjg[0][J - 1];
				  Q2 = jsjg[0][J];
				  PI1 = jsjg[1][J - 1];
				  PI2 = jsjg[1][J];
				  PO1 = jsjg[i + 1][J - 1];
				  PO2 = jsjg[i + 1][J];
				  if( J > 2 && PI2 * PO2 == 0)
				  {
					  break;
				  }
				  if( PI1 >= PO1 && PI2 <= PO2 || (PI1 <= PO1 && PI2 >= PO2))
				  {
					  if( P > 0 && Q > 0)
					  {
						  qjd.qlzxjd(Q1, Q2, PI1, PO1, PI2, PO2);
						  P=qjd.Y;
						  Q=qjd.X;
						  break;
					  }
					  qjd.qlzxjd(Q1, Q2, PI1, PO1, PI2, PO2);
					  P=qjd.Y;
					  Q=qjd.X;
				  }
			  }
			  if( P > 0)
			  {
				  P = int(100 * P);
				  P=P/ 100;
			  }
			  if( Q > 0)
			  {
				  Q = int(100 * Q);
				  Q=Q/ 100;
			  }
			  gcvt(P,30,Temp);
			  templs1=Temp;
			  A1 = A1 + "\t" + templs1;
			  gcvt(Q,30,Temp1);
			  templs2=Temp1;
			  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;
		  }    
	  }
	g_iProgress = 72;	// 计算进度
	ENDCOMPUTE;
	  
  		  //气水比分析
		  if( Pqybfx == 1)
		  {
			  try
			  {
				  Title="$$";
				  Title=Title+"气液比分析图["+jsff+"]"+"\n";
				  f4.WriteString(Title);
				  f4.WriteString("节点压力最小值,MPa:\n");
				  f4.WriteString("节点压力最大值,MPa:\n");
				  f4.WriteString("产水量最小值,m^3/d:\n");
				  f4.WriteString("产水量最大值,m^3/d:\n");
				  f4.WriteString("Pwf\n");
				  f4.WriteString("Ql\n");
				  f4.WriteString("Pwf__MPa\n");
				  f4.WriteString("Ql__m^3/d\n");
				  f4.WriteString(" 1\n");
				  
			  }
			  catch (CFileException exception4)
			  {
				  AfxMessageBox("Error reading file");
				  return;
			  }			  			
			  for(i=0;i<=10;i++)
			  {
				  for(J=0;J<=Pfxjsds;J++)
				  {
					  jsjg[i][J] = 0;
				  }
			  }
			  //流入关系计算
			  if( Ndclrtx == 0)
			  {
				  //				goto Gdclr;
				  Ndclrtx = 1;
				  if( Pdcylfx == 1)
				  {
					  ni = 5;
				  }
				  else
				  {
					  ni = 0;
				  }
				  for(i=0;i<=ni;i++)
				  {
					  if( i == 0)
					  {
						  Prswl = Pdcyl;
					  }
					  else
					  {
						  Prswl = csz[3][i]; //分析的地层压力值
					  }
					  if( Prswl <= 0)
					  {
						  break;
					  }
					  wlipr(Prswl, PLI, QB, Qomax, Qtmax, Pdcyl, Pb, Fw);
					  pliwl=PLIwl;
					  qbwl=QBwl;
					  qomaxwl=Qomaxwl;
					  qtmaxwl=Qtmaxwl;
					  pbwl=Pbwl;
					  for(J=0;J<=Pfxjsds;J++)
					  {		  
						  PWF=YQPWF(Rjsjg[0][J], pbwl, qbwl, qomaxwl, qtmaxwl, Prswl, Pbwl, Fw);
						  if( PWF <= 0)
						  {
							  PWF = 0;
							  Rjsjg[i + 1][J] = 0.1;
							  break;
						  }
						  else
						  {
							  Rjsjg[i + 1][J] = PWF;
						  }
					  }
				  }
			  }
			  Qzdz = 0;
			  Pzdz = 0;
			  for(J=0;J<=Pfxjsds;J++)
			  {
				  if( J > 2 && Rjsjg[1][J] <= 0)
				  {
					  break;
				  }
				  gcvt(Rjsjg[0][J],30,Temp);
				  templs1=Temp;
				  gcvt(Rjsjg[1][J],30,Temp1);
				  templs2=Temp1;
				  templs1=" "+templs1+ " "+templs2+"\n";
				  try
				  {
					  f4.WriteString(templs1);
					  
				  }
				  catch (CFileException exception4)
				  {
					  AfxMessageBox("Error reading file");
					  return;
				  }			  			
				  jsjg[0][J] = Rjsjg[0][J];
				  jsjg[1][J] = Rjsjg[1][J];
				  if( Qzdz <= Rjsjg[0][J])
				  {
					  Qzdz = Rjsjg[0][J];
				  }
				  if( Pzdz <= Rjsjg[1][J])
				  {
					  Pzdz = Rjsjg[1][J];
				  }
			  }
			  gcvt(Pdcyl,30,Temp);
			  templs1=Temp;
			  templs1="IPR[Prs=" + templs1+"(MPa)]"+"\n";
			  try
			  {
				  f4.WriteString("-1 -1\n");
				  //					f4.WriteString(" 0             1\n");
				  f4.WriteString(cGraphColor[iColorIndex++]);
				  iColorIndex %= iGraphColorNum;
				  f4.WriteString(templs1);
			  }
			  catch (CFileException exception4)
			  {
				  AfxMessageBox("Error reading file");
				  return;
			  }			  			
			  rjIPR(PLI, qcs, pcs, Pdcyl, Pb, Fw);  
			  
			  for(i=1;i<=fxcsgs[4];i++)
			  {
				  if( i == 0)
				  {
					  GWR1 = GWR;
				  }
				  else
				  {
					  GWR1 = csz[4][i]; //分析的气液比值
				  }
				  if( i > 0 && GWR1 <= 0)
				  {
					  break;
				  }
	g_iProgress = 75;	// 计算进度
	ENDCOMPUTE;
				  //流出关系计算
				  for(J=2;J<=Pfxjsds;J++)
				  {
					  QO = Rjsjg[0][J] * (1 - Fw);
					  QW = Rjsjg[0][J] * Fw;
					  QG = Rjsjg[0][J] * GWR1;
					  P1 = Pjkyl;
					  for(K=1;K<=3;K++)
					  {
						  if( K == 1)
						  {
							  L = DVT1;
							  DIT = DIT1;
							  T0 = Tjkwd;
						  }
						  else if( K == 2)
						  {
							  L = DVT2;
							  DIT = DIT2;
							  T0 = Tjkwd + TG * DVT1;
						  }
						  else if( K == 3)
						  {
							  L = (DVW - DVT1 - DVT2);
							  DIT = DIC;
							  T0 = Tjkwd + TG * (DVT1 + DVT2);
						  }
						  if( K == 1 || (K > 1 && L > 0))
						  {
							  PN=dxl(MMPF,P1, T0, TG, QG, QW, QO, GG, GW, OG, L, DIT, 0, RR, H2S, CO2, N2, NaCl, 0, 1, 1);	
							  P1 = PN;
						  }
					  }
					  if( J > 2 && P1 <= 0)
					  {
						  break;
					  }
					  if( P1 > Pdcyl + 5)
					  {
						  break;
					  }
					  if( Rjsjg[0][J] > 500 || Rjsjg[0][J] > 0.25 * Qtmax)
					  {
						  if( P1 < 0.5 * jsjg[2 + i][J - 1])
						  {
							  break;
						  }
					  }
					  if( P1 > 0)
					  {
						  gcvt(Rjsjg[0][J],30,Temp);
						  templs1=Temp;
						  gcvt(P1,30,Temp1);
						  templs2=Temp1;
						  templs1=" "+templs1+ " "+templs2+"\n";
						  try
						  {
							  f4.WriteString(templs1);
							  
						  }
						  catch (CFileException exception4)
						  {
							  AfxMessageBox("Error reading file");
							  return;
						  }			  			
						  jsjg[1 + i][J] = P1;
					  }
					  else
					  {
						  jsjg[1 + i][J] = jsjg[1 + i][J - 1];
					  }
					  if( Qzdz <= Rjsjg[0][J] || Pzdz + 1 <= jsjg[1 + i][J])
					  {
						  break;
					  }
				  }
				  try
				  {
					  f4.WriteString("-1 -1\n");
					  //	  			   f4.WriteString(" 0             1\n");
					  f4.WriteString(cGraphColor[iColorIndex++]);
					  iColorIndex %= iGraphColorNum;
					  gcvt(GWR1,30,Temp);
					  templs1=Temp;
					  templs1="流出,GWR="+templs1+ "(m^3/m^3)"+"\n";
					  f4.WriteString(templs1);
				  }
				  catch (CFileException exception4)
				  {
					  AfxMessageBox("Error reading file");
					  return;
				  }			  			
				  //			  百分比 = 百分比 + Int(1 + 100 / jszs)
				  //			  主窗口.SSPanel1.FloodPercent = 百分比
			}
			try
			{
				f4.WriteString("-10 -10\n");
			}
			catch (CFileException exception4)
			{
				AfxMessageBox("Error reading file");
				return;
			}			  			
			//写入计算的数据计算结果
            title="\t\t";
			//			title=title+" [气水比$0" + "\t" + "分析]$0"+"\n";
			title=title+" [气水比分析]$0"+"\n";
			Title="";
			//			Title=Title+" 产水量$7" + "\t" + "流入压力$7" + "\t" + "    在下$13" + "\t" + "列气水比$12" + "\t" + "下的节点$12" + "\t" + "压力,$12" + "\t" + "MPa$14"+"\n";
			Title=Title+" 产水量$7" + "\t" + "流入压力$7" + "\t" + "  在下列气水比下的节点压力(MPa)$13" + "\t" + "$12" + "\t" + "$12" + "\t" + "$12" + "\t" + "$14"+"\n";
			try
			{
				f3.WriteString(title);
				f3.WriteString(Title);
			}
			catch (CFileException exception3)
			{
				AfxMessageBox("Error reading file");
				return;
			}    
			A = "(m^3/d)$11\t(MPa)$11";
			for(i=1;i<=5;i++)
			{
				gcvt(csz[4][i],30,Temp);
				templs1=Temp;
				A = A + "\t" + templs1;
			}
			A=A+"\n";
			try
			{
				f3.WriteString(A);
			}
			catch (CFileException exception3)
			{
				AfxMessageBox("Error reading file");
				return;
			}    
			for(J=0;J<=Pfxjsds;J++)
			{
				if( jsjg[0][J] == 0 || (jsjg[1][J] + jsjg[2][J] + jsjg[3][J] + jsjg[4][J] + jsjg[5][J] + jsjg[6][J]) == 0)
				{
					break;
				}
				for(i=0;i<=6;i++)
				{
					gcvt(jsjg[i][J],30,Temp);
					B = Temp;
					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;
				}    
			}
			A1 = "节点压力(MPa)$13\t$14";
			A2 = "井的产量(m^3/d)$13\t$14";
			for(i=1;i<=5;i++)
			{
				P = 0;
				Q = 0;
				for(J=2;J<=Pfxjsds;J++)
				{
					Q1 = jsjg[0][J - 1];
					Q2 = jsjg[0][J];
					PI1 = jsjg[1][J - 1];
					PI2 = jsjg[1][J];
					PO1 = jsjg[i + 1][J - 1];
					PO2 = jsjg[i + 1][J];
					if( J > 2 && PI2 * PO2 == 0)
					{
						break;
					}
					if( PI1 >= PO1 && PI2 <= PO2 || (PI1 <= PO1 && PI2 >= PO2))
					{
						if( P > 0 && Q > 0)
						{
							qjd.qlzxjd(Q1, Q2, PI1, PO1, PI2, PO2);
							P=qjd.Y;
							Q=qjd.X;
							break;
						}
						qjd.qlzxjd(Q1, Q2, PI1, PO1, PI2, PO2);
						P=qjd.Y;
						Q=qjd.X;
					}
				}

⌨️ 快捷键说明

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