標題: 關于發(fā)動機檔位加減檔算法設計及仿真圖 [打印本頁]

作者: 000123@    時間: 2024-5-14 17:40
標題: 關于發(fā)動機檔位加減檔算法設計及仿真圖
求助大神看看我的程序的錯誤或給一份發(fā)動機檔位加減檔算法設計及仿真圖及程序
主要程序代碼如下:
//預處理數(shù)據(jù)
#define CAR_MAX 130
#define TORQUE_MAX 1.25
#define ROTATE_MAX 2550
#define Economy_rpm_MIN 1000
#define Economy_rpm_MAX 1300
struct InputData Preproccess(struct InputData sinputData)//將接收的數(shù)據(jù)限制在一定范圍內(nèi)
{
        sinputData.car_speed = (CAR_MAX < sinputData.scar_speed) ? CAR_MAX : sinputData.car_speed;
        sinputData.rotate_speed = (ROTATE_MAX < sinputData.rotate_speed) ? ROTATE_MAX : sinputData.rotate_speed;
        sinputData.torquePercent = (TORQUE_MAX < sinputData.torquePercent) ? TORQUE_MAX : sinputData.torquePercent;
        return sinputData;
}
//計算當前檔位
int ShiftNow(float scar_speed, float srotate_speed, unsigned int Key)//計算當前檔位,從6檔以上考慮
{
        //15.53        12.08        9.39        7.33        5.73        4.46        3.48        2.71        2.1        1.64        1.28        1
        gearRadio = 480.255 * srotate_speed / Key / car_speed;//計算齒輪比
        int shift_now = 0;
      
                if ((gearRadio>4.31) && (gearRadio<4.61))
                {
                        shift_now = 6;
                }
                else if ((gearRadio > 3.33) && (gearRadio < 3.63))
                {
                        shift_now = 7;
                }
                else if ((gearRadio>2.56) && (gearRadio < 2.86))
                {
                        shift_now = 8;
                }
                else if ((gearRadio>1.95) && (gearRadio < 2.25))
                {
                        shift_now = 9;
                }
                else if ((gearRadio>1.49) && (gearRadio < 1.79))
                {
                        shift_now = 10;
                }
                else if ((gearRadio>1.13) && (gearRadio < 1.43))
                {
                        shift_now = 11;
                }
                else if ((gearRadio>0.85) && (gearRadio < 1.15))
                {
                        shift_now = 12;
                }
                else
                        shift_now = 0;//當前檔位值初始化為0,將丟棄該點的所有值
               
        return shift_now;
}
//計算換擋狀態(tài)值,3表示不換擋,4表示升檔,5表示降檔
int  ComputeShiftState(float srotate_speed)//計算換擋狀態(tài)
{
      
        if((srotate_speed>=Economy_rpm_MIN)&&(srotate_speed<= Economy_rpm_MAX))
        {
                shiftState =3;//不換檔
        }
        else if (srotate_speed > Economy_rpm_MAX)
        {
                shiftState = 4;//升檔               
        }
        else if (srotate_speed < Economy_rpm_MIN)
        {
                shiftState = 5;//降檔
        }
        else
        {
                shiftState = 3;
        }
        return  shiftState ;
}





歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1