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

📄 scjjdfx.cpp

📁 这是本人两年前兼职为某个公司做的石油钻进设计软件
💻 CPP
📖 第 1 页 / 共 4 页
字号:
		    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;
			}
		    try
			{
				f3.WriteString(A+"\n");
			}
			catch (CFileException exception3)
			{
				AfxMessageBox("Error reading file");
				return;
			}									
    
			for(J=0;J<=njsds;J++)
			{
				 if( jieguo[0][J] == 0 && jieguo[6][J] == 0)
				 {
					 break;
				 }
				 for(i=0;i<=5;i++)
				 {
					gcvt(jieguo[i][J],30,temptp);
					templs1=temptp;
		 			B = templs1;
					if( i == 0)
					{
						gcvt(jieguo[0][J],30,temptp);
	   					templs1=temptp;
						gcvt(jieguo[6][J],30,temptp1);
	   					templs2=temptp;					
						A = templs1 + "\t" + templs2;
					}
					else
					{
						A = A + "\t" + B;
					}
				 }
			     A=A+"\n";
				 try
				 {
					f3.WriteString(A);
				 }
				 catch (CFileException exception3)
				 {
					AfxMessageBox("Error reading file");
					return;
				 }									
			}
			A1="   地$5";
			A1=A1+ "\t" + "层$4" + "\t" + "油管尺寸$7";
            A2="   压$9";
			A2 = A2 + "\t" + "力$8" + "\t" + "实际油管$11";
			for(i=1;i<=5;i++)
			{
				  if( canshu[3][i] <= 0)
				  {
					  break;
				  }
				  A1 = A1 + "\t" + "油管尺寸";
				  gcvt(canshu[3][i],30,temptp);
	   			  templs1=temptp;
				  A2 = A2 + "\t" + templs1;
			}
			A1=A1+"\n";
			A2=A2+"\n";
			try
			{
			    f3.WriteString(A1);
			    f3.WriteString(A2);
			}
			catch (CFileException exception3)
			{
				AfxMessageBox("Error reading file");
				return;
			}									
			for(i=1;i<=5;i++)
			{
			  if( canshu[2][i] == 0)
			  {
				  break;
			  }
              gcvt(canshu[2][i],30,temptp);
			  templs1=temptp;
			  A6=templs1;
			  A6 = A6 +"$7" + "\t" + "节点压力";
			  A7 = "   MPa$11";
			  A7 = A7 + "\t" + "产气量$14";
			  for(J=0;J<=5;J++)
			  {
		  		if( J > 0)
				{
					if( canshu[3][J] == 0)
					{
						break;
					}
				}
				P = 0;
				Q = 0;
				for(JK=2;JK<=njsds;JK++)
				{
				  Q1 = jieguo[0][JK - 1];
				  Q2 = jieguo[0][JK];
				  PI1 = jieguo[i][JK - 1];
				  PI2 = jieguo[i][JK];
				  PO1 = jieguo[J + 6][JK - 1];
				  PO2 = jieguo[J + 6][JK];
				  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.0;
				}
                gcvt(P,30,temptp);
				templs1=temptp;
				A6 = A6 + "\t" + templs1;
                gcvt(Q,30,temptp1);
				templs2=temptp1;
				A7 = A7 + "\t" + templs2;
			  }
			  A6=A6+"\n";
              A7=A7+"\n";
			  try
			  {
					 f3.WriteString(A6);
					 f3.WriteString(A7);
			  }
			  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;
	  }
		
	g_iProgress = 60;	// 计算进度
	ENDCOMPUTE;
	  //油管尺寸分析(节点在井口)  
	  if( cygcc == 1)
	  {
		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;
		} 
		for(i=0;i<=10;i++)
		{
			for(J=0;J<=njsds;J++)
			{
		       jieguo[i][J] = 0;
			}
		}
		BAC = 98 * fxcsgs[3] / jszs / (fxcsgs[3] + 2) / njsds;
		//流入关系计算
		Pmax = 0;
		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;
			DIT20 = DIT2;
			DIC0 = DIC;
			DVT10 = DVT1;
			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;
			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 = int(1000 * pow(PWF,0.5));
				PWF=PWF/ 1000;
			}
			else
			{
				break;
			}
			qqiliang = QG * 10000;
			gylx=qjyljsz.qjyl(PWF, tdiceng, TG, DVT30, DIC0, 0, RR, qqiliang, GG, LGR, GL, H2S, N2, CO2, 0,0, -1, 1);
			if( gylx < 0.5)
			{
				jieguo[0][J] = QG;
				jieguo[i + 1][J] = 0;
				break;
			}
			Tun = tdiceng - TG * DVT30;
			gyali=qjyljsz.qjyl(gylx, Tun, TG, DVT20, DIT20, 0, RR, qqiliang, GG, LGR, GL, H2S, N2, CO2, 0,0, -1, 1);
			if( gyali < 0.5)
			{
				jieguo[0][J] = QG;
				jieguo[i + 1][J] = 0;
				break;
			}
			Tun = tdiceng - TG * (DVT30 + DVT20);
			P2=qjyljsz.qjyl(gyali, Tun, TG, DVT10, DIT10, 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] = int(1000 * P2);
			  jieguo[i + 1][J]=jieguo[i + 1][J]/ 1000;
			}
			try
			{
				gcvt(QG,100,temptp);
				templs1=temptp;
				gcvt(P2,100,temptp1);
				templs2=temptp1;
				templs1=" "+templs1+"\t"+templs1+"\n";
				f4.WriteString(templs1);
			}
			catch (CFileException exception4)
			{
				AfxMessageBox("Error reading file");
				return;
			}			
			if( Pmax < P2 && J == 0)
			{
				Pmax = P2;
			}
		  }
          try
		  {
			gcvt(QG,100,temptp);
			templs1=temptp;
			templs1=" "+templs1+"\t"+"0"+"\n";
			f4.WriteString(templs1);
            f4.WriteString("-1\t-1\n");
			f4.WriteString(cGraphColor[iColorIndex++]);
			iColorIndex %= iGraphColorNum;
		  }
		  catch (CFileException exception4)
		  {
			AfxMessageBox("Error reading file");
			return;
		  }
		  if( i > 0)
		  {
			  gcvt(canshu[3][i],100,temptp);
			  templs1=temptp;
			  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;
			  } 
		  }
		}
	g_iProgress = 65;	// 计算进度
	ENDCOMPUTE;
		//流出关系计算
		if( DCH > 0)
		{
		  pxlyl = phuiya;
		  pslyl = pxlyl;
		  for(J=0;J<=njsds;J++)
		  {
//		 	百分比 = Int(bfblj + BAC * ((fxcsgs(3) + 1) * 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;
            try
			{
			   gcvt(QG,100,temptp);
			   templs1=temptp;
			   gcvt(jieguo[1][J],100,temptp1);
			   templs2=temptp1;
			   templs1=" "+templs1+"\t"+templs2+"\n";
			   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;
             gcvt(DCH,100,temptp);
			 templs1=temptp;
			 templs1.TrimLeft();
             templs1.TrimRight();
             templs1="Doc="+templs1+"(mm)\n";
             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[3][i],100,temptp);
			templs1=temptp;
			A = A + "\t" + templs1;
		}
        try
		{
			 A=A+"\n";
             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],100,temptp);
			B = temptp;
			if( i == 0)
			{
				A = B;
			}
			else
			{
				A = A + "\t" + B;
			}
		  }
          try
		  {
			 A=A+"\n";
			 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[3] / jszs;
	g_iProgress = 75;	// 计算进度
	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;
		}
		for(i=0;i<=10;i++)
		{
			for(J=0;J<=njsds;J++)
			{
		      jieguo[i][J] = 0;
			}
		}
		//流入关系计算
		for(J=0;J<=njsds;J++)
		{
//		  百分比 = Int(bfblj + BAC * (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);
			jieguo[0][J] = QG;
			jieguo[1][J] = PWF;
			try
			{
				gcvt(QG,100,temptp);
				templs1=temptp;
				gcvt(PWF,100,temptp1);
				templs2=temptp1;
				templs1=" "+templs1+"\t"+templs2+"\n";
				f4.WriteString(templs1);
			}
			catch (CFileException exception4)
			{
				AfxMessageBox("Error reading file");
				return;
			}   
		  }
		  else
		  {
			jieguo[0][J] = QG;
			jieguo[1][J] = 0;
            try
			{
				gcvt(QG,100,temptp);
				templs1=temptp;
				templs1=" "+templs1+"\t"+"0"+"\n";
				f4.WriteString(templs1);
			}
			catch (CFileException exception4)
			{
				AfxMessageBox("Error reading file");
				return;
			}
			break;
		  }
		}
        try
		{
			f4.WriteString("-1\t-1\n");
			f4.WriteString(cGraphColor[iColorIndex++]);
			iColorIndex %= iGraphColorNum;
            f4.WriteString("IPR\n");
		}
		catch (CFileException exception4)
		{
			AfxMessageBox("Error reading file");
			return;
		}
		//流出关系计算
		for(i=1;i<=5;i++)
		{
		  if( i > 0)
		  {
			DIT10 = canshu[3][i] / 1000;
			DVT10 = DVT1 + DVT2 + LC;
			DVT20 = 0;
			DVT30 = 0;
			if( DIT10 == 0)
			{
				break;
			}
		  }
		  else
		  {

⌨️ 快捷键说明

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