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

📄 testdlg.cpp

📁 换热器校核程序,用于板翅式的校核。。。。
💻 CPP
字号:
// testDlg.cpp : implementation file
//

#include "stdafx.h"
#include "test.h"
#include "testDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTestDlg dialog
float a[20][20]={{4.7,0.3,2.0,3.74e-3,6.1,2.45,0.722,2.498},{6.5,0.2,1.4,5.4e-3,10.714,2.02,0.722,2.93},
			   {6.5,0.3,2.0,5.27e-3,7.9,2.67,0.785,3.24},{9.5,0.6,2.0,8.37e-3,11.1,3.02,0.785,3.03},
			  {9.5,0.6,4.2,7.63e-3,5.952,5.13,0.785,4.88},{4.7,0.3,2.0,3.74e-3,6.1,2.45,0.722,2.5},
			   {6.5,0.2,1.4,5.4e-3,10.714,2.02,0.833,2.93},{9.5,0.2,1.4,7.97e-3,15.0,2.13,0.885,4.1},
			  {9.5,0.2,1.7,8.21e-3,12.706,2.58,0.861,3.47},{4.7,0.3,2.0,3.47e-3,6.1,2.45,0.65,2.5},
			  {6.5,0.2,1.4,5.4e-3,10.714,2.02,0.833,2.93},{6.5,0.2,1.7,5.56e-3,9.176,2.42,0.8,2.51},
			  {6.5,0.3,0.2,5.27e-3,7.9,2.67,0.766,3.24}};

float t11,t12,t21,t22,q1,q2,eff,c,deltm,tm2,tm1,mu1,mu2,lamda1,lamda2,cp1,cp2,pr1,pr2,
	  n1,n2,l1,l2,l3,bs,lamdaf1,lamdaf2,ac1,ac2,gm1,gm2,re1,re2,nu1,nu2,alpha1,alpha2,mh1,mh2,
	  yitaf1,yitaf2,af1,af2,a1,a2,ap1,ap2,aeff1,aeff2,ap,rw,ka,k1,k2,w1,w2,cxing,ntu,yitai,
	  yita,fai,t12n,t22n,deltayita,deltap,deltas;

CTestDlg::CTestDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CTestDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CTestDlg)
	m_input1 = _T("250.0");
	m_input2 = _T("90.0");
	m_input3 = _T("0.115");
	m_input4 = _T("1");
	m_input5 = _T("0.93");
	m_output = _T("");
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CTestDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTestDlg)
	DDX_Text(pDX, IDC_EDIT1, m_input1);
	DDX_Text(pDX, IDC_EDIT2, m_input2);
	DDX_Text(pDX, IDC_EDIT3, m_input3);
	DDX_Text(pDX, IDC_EDIT4, m_input4);
	DDX_Text(pDX, IDC_EDIT6, m_input5);
	DDX_Text(pDX, IDC_EDIT5, m_output);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CTestDlg, CDialog)
	//{{AFX_MSG_MAP(CTestDlg)
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTestDlg message handlers

BOOL CTestDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CTestDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CTestDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CTestDlg::OnOK() 
{
	// TODO: Add extra validation here
	
	//CDialog::OnOK();
	int i;
	deltap=0.5;deltas=2;
	CString temp1;
	UpdateData(TRUE);
	t11= atof(m_input1);
	t21= atof(m_input2);
	q1= atof(m_input3);
	q2 = atof(m_input4);
	eff = atof(m_input5);
	
	eff=eff+0.01;
	
	t12=t11-eff*(t11-t21);
	
	t22=t21+q1/q2*(t11-t12);
	c=q1/q2;
	deltm=((t11-t22)-(t12-t21))/(log((t11-t22)/(t12-t21)));
	if (c<0.5)
	{tm2=(t21+t22)/2;tm1=tm2+deltm;}
	else  {tm1=(t11+t12)/2;tm2=(t21+t22)/2;}
	
	mu1=mupara(tm1);
	mu2=mupara(tm2);
	lamda1=lamdapara(tm1);
	lamda2=lamdapara(tm2);
	cp1=cppara(tm1);
	cp2=cppara(tm2);
	pr1=prpara(tm1);
	pr2=prpara(tm2);
//	printf("%f,%f,%f,%f,%f,%f,%f,%f\n",mu1,mu2,lamda1,lamda2,cp1,cp2,pr1,pr2);
     //str.format("%f",fff);
//	m_output = m_output +
		temp1.Format("%f",mu1);
	m_output = m_output + temp1 + " ";
		temp1.Format("%f",mu2);
	m_output = m_output + temp1 + " ";
		temp1.Format("%f",lamda1);
	m_output = m_output + temp1 + " ";
		temp1.Format("%f",lamda2);
	m_output = m_output + temp1 + " ";
		temp1.Format("%f",cp1);
	m_output = m_output + temp1 + " ";
		temp1.Format("%f",cp2);
	m_output = m_output + temp1 + " ";
		temp1.Format("%f",pr1);
	m_output = m_output + temp1 + " ";
		temp1.Format("%f",pr2);
	m_output = m_output + temp1;
	m_output = m_output + "\r\n";

	
	
	for (i=0;i<=8;i++)
	{
		
		n1=7;n2=8;l1=220;l2=60;bs=6;
		l3=n1*(a[i][0]+2*deltap)+n2*a[i][0]+2*deltas;
		lamdaf1=lamdaf2=175;
		ac1=n1*(l2-1.5*bs)*1e-3*(a[i][0]-a[i][0]*a[i][1]/a[i][2])*1e-3;
		ac2=n2*(l1-2*bs)*1e-3*(a[i][0]-a[i][0]*a[i][1]/a[i][2])*1e-3;
		
		gm1=q1/ac1;gm2=q2/ac2;
		re1=gm1*a[i][5]*1e-3/mu1;re2=gm2*a[i][5]*1e-3/mu2;
		nu1=0.06*pow(re1,(2.0/3.0));nu2=0.06*pow(re2,(2.0/3.0));
		alpha1=nu1*lamda1/a[i][5]/1e-3;alpha2=nu2*lamda2/a[i][5]/1e-3;
		mh1=sqrt(2*alpha1/lamdaf1/a[i][1]/1e-3)*a[i][0]/2*1e-3;
		mh2=sqrt(2*alpha2/lamdaf2/a[i][1]/1e-3)*a[i][0]/2*1e-3;
		yitaf1=tanh(mh1)/mh1;yitaf2=tanh(mh2)/mh2;
		af1=n1*(l2-1.5*bs)*1e-3/a[i][2]*a[i][0]*l1*2*1e-3;
		af2=n2*(l1-2*bs)*1e-3/a[i][2]*a[i][0]*l2*2*1e-3;
		a1=af1/a[i][6];a2=af2/a[i][6];
		a1=af1/a[i][6];a2=af2/a[i][6];
		ap1=a1-af1;
		ap2=a2-af2;
		aeff1=ap1+yitaf1*af1;aeff2=ap2+yitaf2*af2;
		ap=2*n1*(l1-2*bs)*(l2-1.5*bs)*1e-6;
		rw=0.5e-3/175/ap;
		ka=1/(1/aeff1/alpha1+rw+1/aeff2/alpha2);
		k1=ka/a1;
		w1=q1*cp1*1e3;w2=q2*cp2*1e3;
		cxing=min1(w1,w2)/max1(w1,w2);
		ntu=ka/min1(w1,w2);
		yitai=1-exp(pow(ntu,0.22)/cxing*(exp(-cxing*pow(ntu,0.78))-1));
		yita=(pow((1-cxing*yitai)/(1-yitai),2)-1)/(pow((1-cxing*yitai)/(1-yitai),2)-cxing);
		fai=yita*min1(w1,w2)*(t11-t21);
		t12n=t11-fai/w1;t22n=t21+fai/w2;
		
		deltayita=((yita-eff)/eff)<0?((eff-yita)/eff):((yita-eff)/eff);
		
		if (deltayita<0.01&&calcmass(i,l1,l2,l3)<=4) a[i][8]=1;
		
//		printf("%d,%f,%f,%f,%f\n",i,yita,deltayita,calcmass(i,l1,l2,l3),a[i][8]);
		float temp_f = calcmass(i,l1,l2,l3);
		temp1.Format("%d",i);
		m_output = m_output + temp1 + " ";
		 temp1.Format("%f",yita);
		 m_output = m_output + temp1 + " ";
		temp1.Format("%f",deltayita);
		m_output = m_output + temp1 + " ";
		temp1.Format("%f",temp_f);
		m_output = m_output + temp1 + " ";
	temp1.Format("%f",a[i][8]);	
	m_output = m_output + temp1;
	m_output = m_output + "\r\n";
		
		
	}
	UpdateData(FALSE);
	
	//scanf("%d",&i);
}


float CTestDlg::mupara(float t)
{
	float a[100]={0,14.6,15.2,15.7,16.2,16.7,17.2,17.6,18.1,18.6,19.1,19.6,20.1,20.6,21.1,21.5,21.9,22.8,23.7,
		24.5,25.3,26.0,27.4,29.7,31.4,33.0,36.2,39.1,41.8,44.3,46.7,49.0,51.2,53.5};
	float z;
	t=0.1*t+6;
	z=a[(int)floor(t)]+(t-(int)floor(t))*(a[(int)floor(t)+1]-a[(int)floor(t)]);z=z*1e-6;
	return(z);
}


float CTestDlg::lamdapara(float t)
{
	float a[100]={0,2.04,2.12,2.20,2.28,2.36,2.44,2.51,2.59,2.67,2.76,2.83,2.90,2.96,3.05,3.13,3.21,3.34,3.49,3.64,3.78,3.93,4.27,4.60,4.91,5.21,5.74,6.22,6.71,7.18,7.63,8.07,8.50,9.15};
	float z;
	t=0.1*t+6;
	z=a[(int)floor(t)]+(t-(int)floor(t))*(a[(int)floor(t)+1]-a[(int)floor(t)]);z=z*1e-2;
	return(z);
}

float CTestDlg::cppara(float t)
{
	float a[100]={0,1.103,1.013,1.013,1.009,1.009,1.005,1.005,1.005,1.005,1.005,1.005,1.005,
		1.009,1.009,1.009,1.009,1.009,1.013,1.017,1.022,1.026,1.038,1.047,1.059,1.068,1.093,1.114,1.135,1.156,1.172,1.185,1.197,1.210};
	float z;
	t=0.1*t+6;
	z=a[(int)floor(t)]+(t-(int)floor(t))*(a[(int)floor(t)+1]-a[(int)floor(t)]);
	return(z);
}

float CTestDlg::prpara(float t)
{
	float a[100]={0,0.728,0.728,0.723,0.716,0.712,0.707,0.705,0.703,0.701,0.699,0.698,0.696,0.694,0.692,
		0.690,0.688,0.686,0.684,0.682,0.681,0.680,0.677,0.674,0.678,0.687,0.699,0.706,0.713,0.717,
		0.719,0.722,0.724};
	float z;
	t=0.1*t+6;
	z=a[(int)floor(t)]+(t-(int)floor(t))*(a[(int)floor(t)+1]-a[(int)floor(t)]);
	return(z);
}

float CTestDlg::max1(float x,float y)
{float z;z=x>y?x:y;return(z);}
float CTestDlg::min1(float x,float y)
{float z;z=x<y?x:y;return(z);}

float CTestDlg::calcmass(int i,float l1,float l2,float l3)
{
	float rou1,rou2,h,mfl,mcov,mb,m,mflt,l11,l21,delta,n11,mf1,mf2,mf,mps,ms1,ms2,ms,mcore;
	rou1=2.7307e3;rou2=2.639e3;n11=16;
	l11=248;l21=134;delta=3;h=35;
	mf1=n1*(2*l2-3*bs)/a[i][2]*sqrt(a[i][0]*a[i][0]+a[i][2]*a[i][2])*l1*a[i][1]*rou1*1e-9;
	mf2=n2*(l1-2*bs)/a[i][2]*sqrt(a[i][0]*a[i][0]+a[i][2]*a[i][2])*2*l2*a[i][1]*rou1*1e-9;
	mf=mf1+mf2;
	mps=(2*n1*deltap+2*deltas)*l1*2*l2*rou1*1e-9;
	ms1=3*n1*l1*bs*a[i][0]*rou1*1e-9;
	ms2=2*n2*2*l2*bs*a[i][0]*rou1*1e-9;
	ms=ms1+ms2;
	mcore=mf+mps+ms;
	mfl=4*(l11+l21-2*n11)*n11*delta*rou2*1e-9;
	mflt=mfl+4*(l1+l21-2*n11)*10*2*rou1*1e-9;
	mcov=(2*l3*2*l2+(4*2*l2+5*l3)*h)*delta*rou2*1e-9;
	mb=2*((62*62-42*42)*10+(46*46-42*42)*20)*3.141/4.0*rou2*1e-9;
	m=mcore+mflt+mcov+mb;
	return(m);
}

⌨️ 快捷键说明

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