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

📄 zpjjdfx.cpp

📁 这是本人两年前兼职为某个公司做的石油钻进设计软件
💻 CPP
📖 第 1 页 / 共 5 页
字号:
			  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;
		  }
		  
		  //油管尺寸分析(节点在井口)
		  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;
					  }
				  }
			  }
		  }
		  for(i=1;i<=fxcsgs[2];i++)
		  {
			  if( i > 0 && csz[2][i] == 0)
			  {
				  break;
			  }
			  for(J=1;J<=Pfxjsds;J++)
			  {
				  QW = Rjsjg[0][J];
				  QG = QW * GWR;
				  P1 = Rjsjg[1][J];
				  if( i == 0)
				  {
					  for(K=3;K=1;K=K-1)
					  {
						  if( K == 1)
						  {
							  L = DVT1;
							  DIT = DIT1;
							  T0 = Tjkwd + TG * DVT1;
						  }
						  else if( K == 2)
						  {
							  L = DVT2;
							  DIT = DIT2;
							  T0 = Tjkwd + TG * (DVT1 + DVT2);
						  }
						  else if( K == 3)
						  {
							  L = (DVW - DVT1 - DVT2);
							  DIT = DIC;
							  T0 = Tdcwd;
						  }
						  if( K == 1 || (K > 1 && L > 0))
						  {
							  
							  PN=dxl(MMPF,P1, T0, TG, QG, QW, 0, GG, GW, OG, L, DIT, 0, RR, H2S, CO2, N2, NaCl, 0, -1, 1);				  
							  P1 = PN;
						  }
					  }
				  }
				  else
				  {
					  DIT = csz[2][i] / 1000;
					  PN=dxl(MMPF,P1, Tdcwd, TG, QG, QW, 0, GG, GW, OG, DVW, DIT, 0, RR, H2S, CO2, N2, NaCl, 0, -1, 1);	
					  P1 = PN;
				  }
				  if( J > 2 && P1 <= 2)
				  {
					  break;
				  }
				  jsjg[0][J] = Rjsjg[0][J];
				  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];
				  }
			  }
			  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.TrimLeft();
				  templs1.TrimRight();
				  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;
				  }			  			 
			  }
			  //		  百分比 = 百分比 + Int(1 + 100 / jszs)
			  //		  主窗口.SSPanel1.FloodPercent = 百分比
		}
	g_iProgress = 52;	// 计算进度
	ENDCOMPUTE;
		//流出关系计算	
		title="\t\t";
		//		title=title+"[油管尺$0"+"\t"+"寸 (节点$0"+"\t"+"在井口$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[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=1;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;
			}    
		}
		try
		{
			f3.WriteString("\n");
		}
		catch (CFileException exception3)
		{
			AfxMessageBox("Error reading file");
			return;
		}   
		try
		{
			f4.WriteString("-10 -10\n");
		}
		catch (CFileException exception4)
		{
			AfxMessageBox("Error reading file");
			return;
		}			
	  }
	  
	g_iProgress = 60;	// 计算进度
	ENDCOMPUTE;
	  //地层压力分析
	  //----------------------------------------------------------------------
	  if( Pdcylfx == 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(i=1;i<=fxcsgs[3];i++)
		  {
			  if( i > 0 && csz[3][i] <= 0)
			  {
				  break;
			  }
			  for(J=0;J<=Pfxjsds;J++)
			  {
				  if( J > 2 && Rjsjg[1 + i][J] <= 0)
				  {
					  break;
				  }
				  gcvt(Rjsjg[0][J],30,Temp);
				  templs1=Temp;
				  gcvt(Rjsjg[1 + i][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 + i][J] = Rjsjg[1 + i][J];
				  if( Qzdz <= Rjsjg[0][J])
				  {
					  Qzdz = Rjsjg[0][J];
				  }
				  if( Pzdz <= Rjsjg[1 + i][J])
				  {
					  Pzdz = Rjsjg[1 + i][J];
				  }
			  }
			  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[3][i],30,Temp);
                  templs1=Temp;
                  templs1="Prs="+templs1+ "(MPa)"+"\n";
				  try
				  {
					  f4.WriteString(templs1);
					  
				  }
				  catch (CFileException exception4)
				  {
					  AfxMessageBox("Error reading file");
					  return;
				  }			  			
			  }
			  else
			  {
				  gcvt(Pdcyl,30,Temp);
                  templs1=Temp;
                  templs1="Prs="+templs1+ "(MPa)"+"\n";				  
				  try
				  {
					  f4.WriteString(templs1);
					  
				  }
				  catch (CFileException exception4)
				  {
					  AfxMessageBox("Error reading file");
					  return;
				  }	
			  }
		  }
	g_iProgress = 67;	// 计算进度
	ENDCOMPUTE;
		  
		  //流出关系计算
		  if( Nyglctx == 0)
		  {
			  //				goto Gyglc;
			  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] * Fw;
					  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)

⌨️ 快捷键说明

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