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

📄 zpjjdfx.cpp

📁 这是本人两年前兼职为某个公司做的石油钻进设计软件
💻 CPP
📖 第 1 页 / 共 5 页
字号:
					   if( K == 1 || (K > 1 && L > 0))
					   {
						   PN=dxl(MMPF,P1, T0, TG, QG, QW, 0, GG, GW, OG, L, DOL, 0, RR, H2S, CO2, N2, NaCl, 0, 1, 1);
						   P1 = PN;
					   }
				   }
				   if( P1 > Pdcyl + 5)
				   {
					   break;
				   }
				   if( Rjsjg[0][J] > 500 || Rjsjg[0][J] > 0.25 * Qtmax)
				   {
					   if( P1 < 0.5 * jsjg[1 + 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(csz[1][i],30,Temp);
				   templs1=Temp;
				   templs1.TrimLeft();
				   templs1.TrimRight();
				   templs1="Ptf="+templs1+"(MPa)]"+"\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;
		   }			  
	g_iProgress = 26;	// 计算进度
	ENDCOMPUTE;
		   
		   //写入计算的数据结果
		   try
		   {
			   title="\t\t";
			   //			title=title+"    [井口压$0"+"\t"+"力分析]$0\n";
			   title=title+"[井口压力分析]$0\n";
			   f3.WriteString(title);
			   //			f3.WriteString("  产液量$7\t流入压力$7\t         在下$13\t列井口压$12\t力下的节$12\t点压力,$12\t  MPa$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[1][i],30,Temp);
			   templs1=Temp;
			   templs1.TrimLeft();
			   templs1.TrimRight();
			   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;
			   gcvt(Q,30,Temp1);
			   templs2=Temp1;
			   A1 = A1 + "\t" + templs1;
			   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 = 30;	// 计算进度
	ENDCOMPUTE;

	  //油管尺寸分析
	  // -------------------------------------
	  
	  if(Pygccfx==1)
	  {
		  try
		  {
			  templs1="$$";
			  templs1=templs1+"油管尺寸分析[节点在井底]["+jsff+"]"+"\n";
			  f4.WriteString(templs1);
			  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];
			  }
		  }
		  try
		  {
			  f4.WriteString("-1 -1\n");
			  //			f4.WriteString(" 0             1\n");
			  f4.WriteString(cGraphColor[iColorIndex++]);
			  iColorIndex %= iGraphColorNum;
			  
			  gcvt(Pdcyl,30,Temp);
			  templs1=Temp;
			  templs1.TrimLeft();
			  templs1.TrimRight();
			  templs1="IPR[Prs="+templs1+ "(MPa)]"+"\n";
			  f4.WriteString(templs1);
		  }
		  catch(CFileException exception4)
		  {
			  AfxMessageBox("Error reading file");
			  return;
		  }
	g_iProgress = 37;	// 计算进度
	ENDCOMPUTE;
		  
		  //流出关系计算
		  if( Nyglctx == 0)
		  {
			  Nyglctx = 1;
			  if( Pygccfx == 1)
			  {
				  ni = fxcsgs[2];
			  }
			  else
			  {
				  ni = 0;
			  }
			  for(i=0;i<=ni;i++)
			  {
				  for(J=0;J<=Pfxjsds;J++)
				  {
					  QW = Rjsjg[0][J];
					  QG = QW * GWR;
					  P1 = Pjkyl;
					  if( i == 0)
					  {
						  for(K=1;K<=3;K++)
						  {
							  if( K == 1)
							  {
								  L = DVT1;
								  DOL = DIT1;
								  T0 = Tjkwd;
							  }
							  else if( K == 2)
							  {
								  L = DVT2;
								  DOL = DIT2;
								  T0 = Tjkwd + TG * DVT1;
							  }
							  else if( K == 3)
							  {
								  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, 0, 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(i=1;i<=fxcsgs[2];i++)
		  {
			  if( i > 0 && csz[2][i] <= 0)
			  {
				  break;
			  }
			  for(J=2;J<=Pfxjsds;J++)
			  {
				  if( J > 2 && Tjsjg[1 + i][J] <= 0)
				  {
					  break;
				  }
				  if( Rjsjg[0][J] > 500 || Rjsjg[0][J] > 0.25 * Qtmax)
				  {
					  if( Tjsjg[1 + i][J] < 0.5 * Tjsjg[1 + i][J - 1])
					  {
						  break;
					  }
				  }
				  gcvt(Rjsjg[0][J],30,Temp);
				  templs1=Temp;
				  gcvt(Tjsjg[1 + i][J],30,Temp1);
				  templs2=Temp1;
				  templs1=" "+templs1+" "+templs2+"\n";
				  try
				  {
					  f4.WriteString(templs1);
				  }
				  catch (CFileException exception4)
				  {
					  AfxMessageBox("Error reading file");
					  return;
				  }			    
				  jsjg[1 + i][J] = Tjsjg[1 + i][J];
				  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;
			  }
			  catch (CFileException exception4)
			  {
				  AfxMessageBox("Error reading file");
				  return;
			  }			    
			  if( i > 0)
			  {
				  gcvt(csz[2][i],30,Temp);
				  templs1=Temp;
				  templs1="Dit=" + templs1 + "(mm)"+"\n";
				  try
				  {
					  f4.WriteString(templs1);
				  }
				  catch (CFileException exception4)
				  {
					  AfxMessageBox("Error reading file");
					  return;
				  }			    
			  }
			  else
			  {
				  try
				  {
					  f4.WriteString("Dit=实际油管\n");
				  }
				  catch (CFileException exception4)
				  {
					  AfxMessageBox("Error reading file");
					  return;
				  }		
			  }
		  }
		  try
		  {
			  f4.WriteString("-10 -10\n");
		  }
		  catch (CFileException exception4)
		  {
			  AfxMessageBox("Error reading file");
			  return;
		  }
			g_iProgress = 44;	// 计算进度
	ENDCOMPUTE;
  
		  //写入计算的数据结果
		  try
		  {
			  title="\t\t";
			  //			title=title+"[油管尺$0"+"\t"+"寸 (节点$0"+"\t"+"在井底$0)"+"\t"+"分析]$0"+"\n";
			  title=title+"[油管尺寸分析(节点在井底)]$0"+"\n";
			  f3.WriteString(title);
			  //			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[2][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";

⌨️ 快捷键说明

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