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

📄 canshuluru.cpp

📁 主要用于商用车车辆燃油经济性的计算和一些参数影响的分析
💻 CPP
字号:
// CanShuLuRu.cpp : implementation file
//

#include "stdafx.h"
#include "FuelEconomy.h"

#include "CanShuLuRu.h"






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

/////////////////////////////////////////////////////////////////////////////
// CCanShuLuRu dialog

int IG_IS_NOT=0;
	extern double m,A,Cd,i0,ig[10],If,Iw,R,be0,nT;
	extern int Uamax,Memax,Nmax,Nmin;
	extern int GongKuang,CheXing,N;
	extern double M,rou;
	extern CString JiXing;
    extern float Kr;
	extern int ZHIJIE;

CCanShuLuRu::CCanShuLuRu(CWnd* pParent /*=NULL*/)
	: CDialog(CCanShuLuRu::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCanShuLuRu)
	m_a = 5;
	m_be0 = 1.2;
	m_Cd = 0.6;
	m_i0 = 5.286;
	m_If = 0.518;
	m_Iw = 6.396;
	m_m = 10800;
	m_Memax =1050;
	m_nm =1600;
	m_nT = 0.85;
	m_R = 0.505;
	m_Show = _T("");
	m_CheXing = 0;
	m_ChengYuan = 45;
	m_Uamax = 187;
	m_JiXingZHI = _T("柴油机");
	m_nmax = 2800;
	m_nmin = 600;
	m_DANWEISHU = _T("6");
	m_Ig1 = 5.73;
	m_Ig2 = 3.2;
	m_Ig3 = 1.77;
	m_Ig4 = 1;
	m_Ig5 = 0.78;
	m_Ig6 = 0.0;
	m_Kr = 1.08f;
	//}}AFX_DATA_INIT
}


void CCanShuLuRu::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCanShuLuRu)
	DDX_Control(pDX, IDC_E_IG5, m_Ig5Contrl);
	DDX_Control(pDX, IDC_E_IG6, m_Ig6Contrl);
	DDX_Control(pDX, IDC_COM_DANWEISHU, m_DANGWeiSHu);
	DDX_Control(pDX, IDC_C_JIXING, m_JiXing);
	DDX_Control(pDX, IDC_C_CHEXING, m_ComboCtrl);
	DDX_Text(pDX, IDC_E_A, m_a);
	DDX_Text(pDX, IDC_E_BE0, m_be0);
	DDX_Text(pDX, IDC_E_CD, m_Cd);
	DDX_Text(pDX, IDC_E_I0, m_i0);
	DDX_Text(pDX, IDC_E_IF, m_If);
	DDX_Text(pDX, IDC_E_IW, m_Iw);
	DDX_Text(pDX, IDC_E_M, m_m);
	DDX_Text(pDX, IDC_E_MEMAX, m_Memax);
	DDX_Text(pDX, IDC_E_NM, m_nm);
	DDX_Text(pDX, IDC_E_NT, m_nT);
	DDX_Text(pDX, IDC_E_R, m_R);
	DDX_Text(pDX, IDC_E_SHOWING, m_Show);
	DDX_CBIndex(pDX, IDC_C_CHEXING, m_CheXing);
	DDX_Text(pDX, IDC_E_CHENGYUAN, m_ChengYuan);
	DDV_MinMaxInt(pDX, m_ChengYuan, 0, 100);
	DDX_Text(pDX, IDC_E_Uamax, m_Uamax);
	DDV_MinMaxInt(pDX, m_Uamax, 80, 200);
	DDX_CBString(pDX, IDC_C_JIXING, m_JiXingZHI);
	DDX_Text(pDX, IDC_E_NMAX, m_nmax);
	DDX_Text(pDX, IDC_E_NMIN, m_nmin);
	DDX_CBString(pDX, IDC_COM_DANWEISHU, m_DANWEISHU);
	DDX_Text(pDX, IDC_E_IG1, m_Ig1);
	DDX_Text(pDX, IDC_E_IG2, m_Ig2);
	DDX_Text(pDX, IDC_E_IG3, m_Ig3);
	DDX_Text(pDX, IDC_E_IG4, m_Ig4);
	DDX_Text(pDX, IDC_E_IG5, m_Ig5);
	DDX_Text(pDX, IDC_E_IG6, m_Ig6);
	DDX_Text(pDX, IDC_E_KR, m_Kr);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCanShuLuRu, CDialog)
	//{{AFX_MSG_MAP(CCanShuLuRu)
	ON_BN_CLICKED(IDC_B_LURUIG, OnBLuruig)
	ON_CBN_CLOSEUP(IDC_C_CHEXING, OnCloseupCChexing)
	ON_EN_UPDATE(IDC_E_CHENGYUAN, OnUpdateEChengyuan)
	ON_CBN_CLOSEUP(IDC_COM_DANWEISHU, OnCloseupComDanweishu)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCanShuLuRu message handlers


void CCanShuLuRu::OnBLuruig() 
{
	// TODO: Add your control notification handler code here

	UpdateData(true);
	N=m_ChengYuan;
	m=m_m;
    Uamax=m_Uamax;
	

	Memax=m_Memax;
	A=m_a;
	Cd=m_Cd;
	i0=m_i0;
	If=m_If;
	Iw=m_Iw;
	R=m_R;
	be0=m_be0;
	nT=m_nT;
	Nmax=m_nmax;
	Nmin=m_nmin;
	CheXing=m_CheXing;
	Kr=m_Kr;
	ig[1]=m_Ig1;
	ig[2]=m_Ig2;
	ig[3]=m_Ig3;
	ig[4]=m_Ig4;
	ig[5]=m_Ig5;
	ig[6]=m_Ig6;
	for(int i=1;i<=6;i++){if(ig[i]==1){ZHIJIE=i;}else{}}
   
	if(CheXing==0){M=m+N*(60+13);}//GB12534-1990规定长途客车乘客60kg,行李每人13kg
	else if(CheXing==1){M=m+N*60*(65/100);}
	else if(CheXing==-1){MessageBox("请选择车型");}
	
	
	
	

	
    JiXing=m_JiXingZHI;
	if(JiXing=="柴油机"){rou=8.0;}
	else if(JiXing=="汽油机"){rou=7.0;}
	else {MessageBox("请选择发动机类型");}


	UpdateData(TRUE);

	m_Show.Empty();
    CString strl[30],strr;
	strl[0].Format("空气阻力系数Cd:%5.2f\r\n    ",m_Cd);
	strl[1].Format("客车迎风面积A  :%5.2f\r\n",m_a);
	strl[2].Format("机械传动效率nT:%5.2f\r\n   ",m_nT);
	strl[3].Format("车 轮 半 径 R    :%5.2f\r\n",m_R);
	strl[4].Format("飞轮转动惯量If  :%5.2f\r\n   ",m_If);
	strl[5].Format("车轮转动惯量Iw:%5.2f\r\n",m_Iw);
	strl[6].Format("汽车总质量   m :%5.2d\r\n  ",m_m);
	strl[7].Format("修正总质量   M :%5.2f\r\n",M);
	strl[8].Format("怠 速 油 耗Qi    :%5.2f\r\n  ",m_be0);
	strl[9].Format("主 传 动 比 i0      :%5.2f\r\n",m_i0);
    for(i=0;i<10;i++){strr+=strl[i];}
    m_Show+=strr;
    
  

   
	UpdateData(FALSE);
		// TODO: Add your control notification handler code here

//	CIgDlg dlg;
//	if(dlg.DoModal()==IDOK){
	extern double ig[10],Delta[10],M,R,If,Iw,nT,i0;
	extern int DangWShu,IG_IS_NOT;
//    DangWShu=dlg.m_DangWei;
	IG_IS_NOT=1;

    if(m_DANGWeiSHu.GetCurSel()==0){DangWShu=4;}
	if(m_DANGWeiSHu.GetCurSel()==1){DangWShu=5;}
	if(m_DANGWeiSHu.GetCurSel()==2){DangWShu=6;}
	UpdateData(true);
	for( i=1;i<=DangWShu;i++){
	Delta[i]=1+Iw/(M*R*R)+(If*i0*i0*ig[i]*ig[i]*nT)/(M*R*R);
    }
	for( i=1;i<=DangWShu;i++)
	{CString strll;
	strll.Format("第%d挡传动比:%5.2f\r\n相应的质量转换系数:%5.2f\r\n",i,ig[i],Delta[i]);
	m_Show+=strll;
	}
	UpdateData(false);
	

}




void CCanShuLuRu::OnCloseupCChexing() 
{
	// TODO: Add your control notification handler code here
	extern int CheXing;
	m_CheXing=m_ComboCtrl.GetCurSel();

}

void CCanShuLuRu::OnUpdateEChengyuan() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function to send the EM_SETEVENTMASK message to the control
	// with the ENM_UPDATE flag ORed into the lParam mask.
	
	// TODO: Add your control notification handler code here
	extern int N;
	UpdateData(true);
	N=m_ChengYuan;
	UpdateData(false);

}





void CCanShuLuRu::OnOK() 
{
	// TODO: Add extra validation here
	extern int xm0;
	xm0=1;
	if(IG_IS_NOT==1){
		CDialog::OnOK();}
	else{MessageBox("请完整输入各个参数");}
}

void CCanShuLuRu::OnCloseupComDanweishu() 
{
	// TODO: Add your control notification handler code here
	int shu;
	shu=m_DANGWeiSHu.GetCurSel();
	if(shu==0){
		m_Ig5Contrl.SetReadOnly();
		m_Ig6Contrl.SetReadOnly(); }
	else if(shu==1){
		m_Ig5Contrl.SetReadOnly(false);
		m_Ig6Contrl.SetReadOnly();}
	else {
		m_Ig5Contrl.SetReadOnly(false);
		m_Ig6Contrl.SetReadOnly(false); }

}






BOOL CCanShuLuRu::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
		/////////////////////////
	  m_ChengYuan=N;
	m_m=m;
    m_Uamax=Uamax;
	m_Memax=Memax;
	m_a=A;
	m_Cd=Cd;
	m_i0=i0;
	m_If=If;
	m_Iw=Iw;
	m_R=R;
	m_be0=be0;
	m_nT=nT;
	m_nmax=Nmax;
	m_nmin=Nmin;
    m_CheXing=CheXing;
	m_Kr=Kr;
	m_Ig1=ig[1];
	m_Ig2=ig[2];
	m_Ig3=ig[3];
	m_Ig4=ig[4];
	m_Ig5=ig[5];
	m_Ig6=ig[6];
UpdateData(false);
	
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

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