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

📄 dqbyhsj.cpp

📁 这是本人两年前兼职为某个公司做的石油钻进设计软件
💻 CPP
📖 第 1 页 / 共 5 页
字号:
				   f5.ReadString(gs1,300);
			   }
			   catch (CFileException exception5)
			   {
				   AfxMessageBox("Error reading file");
				   return;
			   }
			   AXYZ=gs1;
			   k=1;
			   do
			   {
				   txcsgs = txcsgs + 1;
				   try
				   {
					   f5.ReadString(gs1,300);
				   }
				   catch (CFileException exception5)
				   {
					   AfxMessageBox("Error reading file");
					   return;
				   }
				   CCO=gs1;
				   if( CCO == "[END]\n")
				   {
					   break;
				   }
				   AA=gs1;
				   baizhi=0;
				   title="";
				   for(J=0;J<=AA.GetLength();J++)
				   {  
					   
					   if( AA.Mid(J,1)==","||AA.Mid(J,1)=="\n")
					   {
						   baizhi=baizhi+1;
						   if(baizhi==1)
						   {
							   ddq[txcsgs] = atof(title);
							   title="";
						   }
						   if(baizhi==2)
						   {
							   ddh[txcsgs]=atof(title);
							   title="";
						   }
						   if(baizhi==3)
						   {
							   ddhp[txcsgs]=atof(title);
							   title="";
						   }
						   if(baizhi==4)
						   {
							   dde[txcsgs]=atof(title);
						   }
					   }
					   else
					   {
						   title=title+AA.Mid(J,1);			
					   }
				   }
			   }
			   while(k>0);
		   }
		   else
		   {
			   MessageBox(NULL, "无电潜泵特性参数,请更正!","参数错误",MB_ICONWARNING);
			   return;
		   }          
		   txcsgs = txcsgs - 1;
	  }
	  f5.Close();
	  
	  g_iProgress = 25;	// 计算进度
	  pzuida = Prs;
	  for(i=1;i<=5;i++)
	  {
		  if( pzuida < canshu[2][i])
		  {
			  pzuida = canshu[2][i];
		  }
	  }
	  
	  GIP = GIP / 100;
	  Fw = 1;
      OG = 0.8;
	  DIT = DIT / 1000;
	  DOT = DOT / 1000;
	  DIC = DIC / 1000;
	  CO2 = CO2 / 100;
	  H2S = H2S / 100;
	  N2 = N2 / 100;
      for(i=1;i<=5;i++)
	  {
		  for(J=1;J<=4;J++)
		  {
			  if(canshu[i][J] == 0)
			  {
				  for(K=J+1;K<=5;K++)
				  {
					  if( canshu[i][K] >= 0)
					  {
						  canshu[i][J] = canshu[i][K];
						  canshu[i][K] = 0;
						  break;
					  }
				  }
			  }
		  }
	  }
	  for(i=1;i<=5;i++)
	  {
		  fxcsgs[i] = 0;
		  for(J=1;J<=5;J++)
		  {
			  if(canshu[i][J] > 0)
			  {
				  fxcsgs[i] = fxcsgs[i] + 1;
			  }
		  }
	  }
	  
	  //	  计算总数 = 0;
	  //	  if( fjkyl == 1)
	  //	  {
	  //		  计算总数 = 计算总数 + fxcsgs[1];
	  //	  }
	  //	  if( fdcyl == 1)
	  //	  {
	  //		  计算总数 = 计算总数 + fxcsgs[2];
	  //	  }
	  //	  if( fcyzs == 1)
	  //	  {
	  //		  计算总数 = 计算总数 + fxcsgs[3];
	  //	  }
	  //	  if( fqyb == 1)
	  //	  {
	  //		  计算总数 = 计算总数 + fxcsgs[4];
	  //	  }
	  //	  if( fbgsd == 1)
	  //	  {
	  //		  计算总数 = 计算总数 + fxcsgs[5];
	  //	  }
	  //确定多相流计算方法
	  if( MMPF == 1)
	  {
		  jsff = "Hagedorn和Brown多相流方法";
	  }
	  else if( MMPF == 2)
	  {
		  jsff = "Duns和Ros多相流方法";
	  }
	  else if( MMPF == 3)
	  {
		  jsff = "Orkiszewski多相流方法";
	  }
	  else if( MMPF == 4)
	  {
		  jsff = "Beggs和Brill多相流方法";
	  }
	  else if( MMPF == 5)
	  {
		  jsff = "Mukherjee和Brill多相流方法";
	  }
	  else if( MMPF == 6)
	  {
		  jsff = "SWPI和SPA多相流方法";
	  }  
	  tjingkou = tjingkou + 273.15;
	  tdiceng = tdiceng + 273.15;
	  TG = (tdiceng - tjingkou) / DVW;
	  csjs.trqnjcs(GG, H2S, CO2, 1);//天然气的临界参数
	  PC=csjs.Pc;//对比压力
	  TC=csjs.Tc;//对比温度
	  
	  Pb = Prs;
	  
	  //入井动态关系IPR(PLI, QB, Qomax, Qtmax, Qtest, Ptest, Prs, Pb, Fw);
      zpjjs.rjIPR(PLI,Qtest,Ptest, Prs, Pb, Fw);
	  QB=zpjjs.QB;
	  Qomax=zpjjs.Qomax;
	  Qtmax=zpjjs.Qtmax;
	  PLI=zpjjs.PLIZZZ;
	  dcyl[0] = int(0.05 * Qtmax);
	  if( dcyl[0] > 5)
	  {
		  dcyl[0] = 5;
	  }
	  for(J=1;J<=500;J++)
	  {
		  if( dcyl[J - 1] < 50)
		  {
			  DLTQ = 2.5;
		  }
		  else if( dcyl[J - 1] < 200)
		  {
			  DLTQ = 5;
		  }  
		  else if( dcyl[J - 1] < 1000)
		  {
			  DLTQ = 10;
		  }
		  else if( dcyl[J - 1] < 5000)
		  {
			  DLTQ = 20;
		  }
		  else
		  {
			  DLTQ = 50;
		  }
		  dcyl[J] = dcyl[J - 1] + DLTQ;
		  njsds = J;
		  if( dcyl[J] > 1.25 * Qtmax || dcyl[J] >= 2000)
		  {
			  break;	
		  }
	  }
	  
	  g_iProgress = 30;	// 计算进度
	  
	  //打开文件,写入设计结果
	  CStdioFile f3;
	  CFileException exception3;
	  BOOL status1;	 
	  /*	   fileDialogFilter2 ="Data files (*.RNB)|*.RNB|All files (*.*)|*.*||";
	  fileDialogExt2 = "RNB";
	  CFileDialog fileDialog2( FALSE, 
	  fileDialogExt2, NULL,
	  0, fileDialogFilter2 );
	  fileDialog2.m_ofn.lpstrTitle="保存计算结果";
	  if( fileDialog2.DoModal() == IDCANCEL )
	  {
	  return;
	   }*/
  	   templs1 = ((CCVenusApp*)AfxGetApp())->GetMyAppPath();
	   templs1  += "\\tempfile.txt";	
	   status1 = f3.Open(templs1,CFile::modeCreate|CFile::modeWrite);
	   if (!status1)
	   {
		   char s[100];
		   sprintf(s, "Error opening file for reading. Code:%d",
			   exception3.m_cause);
		   AfxMessageBox(s);
		   return;
	   }
	   try
	   {
		   f3.WriteString("\n");
		   //			title=
		   templs1="\t\t$$电潜泵排水采气节点分析结果$0\n";
		   f3.WriteString(templs1);
		   f3.WriteString("\n");
	   }
	   catch (CFileException exception3)
	   {
		   AfxMessageBox("Error reading file");
		   return;
	   }
	   templs1="";
	   try
	   {
		   f3.WriteString("\n");
		   templs1=templs1+"\t"+bengxing+"$0"+"\n";
		   f3.WriteString(templs1);
	   }
	   catch (CFileException exception3)
	   {
		   AfxMessageBox("Error reading file");
		   return;
	   }
	   dybt = 0;
       CStdioFile f4;
	   CFileException exception4;
	   /*       templs1=fileDialog2.GetPathName();
       templs2=templs1.Left(templs1.GetLength()-3);
	   templs1=templs2+"GNB";*/
	   templs1.Empty();
	   templs1 = ((CCVenusApp*)AfxGetApp())->GetMyAppPath();
	   templs1  += "\\tempfile.gra";	
	   status1 = f4.Open(templs1,CFile::modeCreate|CFile::modeWrite);	
	   if (!status1)
	   {
		   char s[100];
		   sprintf(s, "Error opening file for reading. Code:%d",
			   exception4.m_cause);
		   AfxMessageBox(s);
		   return;
	   }    
	   for(pfxcs=1;pfxcs<=5;pfxcs++, 	g_iProgress += 13)
	   {
		   switch(pfxcs)
		   {
		   case 1:
			   if( fjkyl == 0)
			   {
				   goto nonecomp;
			   }
			   templs1="$$";
			   templs1=templs1+"电潜泵排水采气井口压力分析["+jsff+"]"+"\n";
			   try
			   {
				   f4.WriteString(templs1);    
			   }
			   catch (CFileException exception4)
			   {
				   AfxMessageBox("Error reading file");
				   return;
			   }
			   fxcs = "井口压力";
			   fxcsdw = "  MPa";
			   break;
		   case 2:
			   if( fdcyl == 0)
			   {
				   goto nonecomp;
			   }
			   templs1="$$";
			   templs1=templs1+"电潜泵排水采气地层压力分析["+jsff+"]"+"\n";
			   try
			   {
				   f4.WriteString(templs1);    
			   }
			   catch (CFileException exception4)
			   {
				   AfxMessageBox("Error reading file");
				   return;
			   }
			   fxcs = "地层压力";
			   fxcsdw = "  MPa";
			   break;
		   case 3:
			   if( fcyzs == 0)
			   {
				   goto nonecomp;
			   }
			   templs1="$$";
			   templs1=templs1+"电潜泵排水采气产液指数分析["+jsff+"]"+"\n";
			   try
			   {
				   f4.WriteString(templs1);    
			   }
			   catch (CFileException exception4)
			   {
				   AfxMessageBox("Error reading file");
				   return;
			   }
			   fxcs = "产液指数";
			   fxcsdw = "m^3/d.MPa";
			   break;
		   case 4:
			   if( fqyb == 0)
			   {
				   goto nonecomp;
			   }
			   templs1="$$";
			   templs1=templs1+"电潜泵排水采气气液比分析["+jsff+"]"+"\n";
			   try
			   {
				   f4.WriteString(templs1);    
			   }
			   catch (CFileException exception4)
			   {
				   AfxMessageBox("Error reading file");
				   return;
			   }
			   fxcs = " 气液比 ";
			   fxcsdw = "m^3/m^3";
			   break;
		   case 5:
			   if( fbgsd == 0)
			   {
				   goto nonecomp;
			   }
			   templs1="$$";
			   templs1=templs1+"电潜泵排水采气泵挂深度分析["+jsff+"]"+"\n";
			   try
			   {
				   f4.WriteString(templs1);    
			   }
			   catch (CFileException exception4)
			   {
				   AfxMessageBox("Error reading file");
				   return;
			   }
			   fxcs = "泵挂深度";
			   fxcsdw = "   m";
			   break;
		   }
		   try
		   {
			   f4.WriteString("节点压力最小值,MPa:\n");
			   f4.WriteString("节点压力最大值,MPa:\n");
			   f4.WriteString("产油量最小值,m^3/d:\n");
			   f4.WriteString("产油量最大值,m^3/d:\n");
			   f4.WriteString("Pn\n");
			   f4.WriteString("Qo\n");
			   f4.WriteString("Pn__MPa\n");
			   f4.WriteString("Qo__m^3/d\n");
			   f4.WriteString(" 1\n");
		   }
		   catch (CFileException exception4)
		   {
			   AfxMessageBox("Error reading file");
			   return;
		   }
		   
		   for(K=1;K<=fxcsgs[pfxcs];K++)
		   {
			   //入井动态关系IPR(PLI, QB, 3, Qtmax, Qtest, Ptest, Prs, Pb, Fw)
			   zpjjs.rjIPR(PLI, Qtest, Ptest, Prs, Pb, Fw);
			   QB=zpjjs.QB;
			   Qomax=zpjjs.Qomax;
			   Qtmax=zpjjs.Qtmax;
			   PLI=zpjjs.PLIZZZ;
			   jslr = "是";
			   jslc = "是";
			   jkyl = Pwh;
			   DCYL = Prs;
			   qyb = GW

⌨️ 快捷键说明

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