Exemplo n.º 1
0
float Pull2DRamHook(float* table, float xLookup)
{
	//Check if r4 is ram or not??
	if(table > (float*)&(pRamVariables->MasterInitFlag))
	{
		return *table;
	}
	else
	{
		 return Pull2DHooked((TwoDTable*)table, xLookup);
	}
}
Exemplo n.º 2
0
float ComputeMassAirFlow(TwoDTable* MafScalingTable, float MafVoltage)
{
    pRamVariables->MafFromSensor = Pull2DHooked(MafScalingTable,MafVoltage);

#if VE_RAMTUNING
    if(pRamVariables->VERamFlag == 0x01)
    {
        pRamVariables->VolumetricEfficiency = Pull3DHooked(&VolumetricEfficiencyRamTable, *pManifoldAbsolutePressure, *pEngineSpeed);
    }
    else
    {
#endif

#if SWITCH_HACKS
        pRamVariables->VolumetricEfficiency = BlendAndSwitch(VETableGroup, *pManifoldAbsolutePressure, *pEngineSpeed);
#else
        pRamVariables->VolumetricEfficiency = Pull3DHooked(&VolumetricEfficiencyTable1, *pManifoldAbsolutePressure, *pEngineSpeed);
#endif

#if VE_RAMTUNING
    }
#endif

    float intakeAirTempInKelvin = (*pIntakeAirTemp) + CelsiusToKelvin;

    pRamVariables->AtmosphericCompensation = Pull3DHooked(&AtmosphericCompensationTable, *pManifoldAbsolutePressure, *pAtmoPress);
#if SD_DMAP
    pRamVariables->DeltaMapCompensation = Pull3DHooked(&SDDeltaMapTable, *pDeltaMap, *pEngineSpeed);
#endif

    pRamVariables->MafFromSpeedDensity =
        Displacement *
        (*pEngineSpeed) *
        (*pManifoldAbsolutePressure) *
        pRamVariables->VolumetricEfficiency *
        pRamVariables->AtmosphericCompensation *
#if SD_DMAP
        pRamVariables->DeltaMapCompensation *
#endif
        SpeedDensityConstant / intakeAirTempInKelvin;

#if VE_RAMTUNING
    if (pRamVariables->MafMode == MafModeSpeedDensity || pRamVariables->VERamFlag == 0x01)
#else
    if (pRamVariables->MafMode == MafModeSpeedDensity)
#endif
    {
        return pRamVariables->MafFromSpeedDensity;
    }
    else if (pRamVariables->MafMode == MafModeBlending)
    {
        pRamVariables->SDMafBlendRatio = Pull3DHooked(&SDBlendingTable, *pManifoldAbsolutePressure, *pEngineSpeed);

        pRamVariables->SDMafFromBlend =
            ((pRamVariables->MafFromSpeedDensity * pRamVariables->SDMafBlendRatio) +
             (pRamVariables->MafFromSensor *
              (1 - pRamVariables->SDMafBlendRatio)));

        return pRamVariables->SDMafFromBlend;
    }
    else
    {
        return pRamVariables->MafFromSensor;
    }
}
Exemplo n.º 3
0
void InputUpdate()//TODO: put on SD branch
{
	float grad = 0.0000762939453125;
	float offs = 0.0f;
	pRamVariables->TGVLeftVolts = ShortToFloatHooked(*pTGVLeftVoltage,grad,offs);
	pRamVariables->TGVRightVolts = ShortToFloatHooked(*pTGVRightVoltage,grad,offs);
	pRamVariables->TGVLeftScaled = Smooth(LeftTGVInputSmoothingFactor,Pull2DHooked(&TGVLeftScaling,pRamVariables->TGVLeftVolts), pRamVariables->TGVLeftScaled) * LeftTGVInputMultiplier + LeftTGVInputOffset;
	pRamVariables->TGVRightScaled = Smooth(RightTGVInputSmoothingFactor,Pull2DHooked(&TGVRightScaling,pRamVariables->TGVRightVolts), pRamVariables->TGVRightScaled) * RightTGVInputMultiplier + LeftTGVInputOffset;
	
	switch(pRamVariables->MapBlendingInputMode)
	{
		case MapBlendingInputModeUndefined:
		break;
		
		case MapBlendingInputModeTGVLeft:
			pRamVariables->MapBlendRatio = pRamVariables->TGVLeftScaled;
			break;
		
		case MapBlendingInputModeTGVRight:
			pRamVariables->MapBlendRatio = pRamVariables->TGVRightScaled;
			break;
		
		default:
			pRamVariables->MapBlendRatio = DefaultMapBlendRatio;
			break;
	}
	
	switch(pRamVariables->MapSwitchingInputMode)
	{
		case MapSwitchingInputModeUndefined:
		break;
		
		#ifdef pSiDrive
		case MapSwitchingInputModeSiDrive:
		{
			switch(*pSiDrive)
		
			case SiDriveSS:
			pRamVariables->MapSwitch = MapSwitch3;
			break;
			
			case SiDriveSSAlt:
			pRamVariables->MapSwitch = MapSwitch3;
			break;
			
			case SiDriveS:
			pRamVariables->MapSwitch = MapSwitch2;
			break;
		
			default:
			pRamVariables->MapSwitch = MapSwitch1;
			break;
			}
		}
		#endif
		
		case MapSwitchingInputModeTGVLeft:
			MapSwitchThresholdCheck(pRamVariables->TGVLeftVolts);
			break;
		
		case MapSwitchingInputModeTGVRight:
			MapSwitchThresholdCheck(pRamVariables->TGVRightVolts);
			break;
		
		default:
		pRamVariables->MapSwitch = DefaultMapSwitch;
		break;
	}
Exemplo n.º 4
0
void InputUpdate()//TODO: put on SD branch
{
	float grad = 0.0000762939453125;
	float offs = 0.0f;
	pRamVariables->TGVLeftVolts = ShortToFloatHooked(*pTGVLeftVoltage,grad,offs);
	pRamVariables->TGVRightVolts = ShortToFloatHooked(*pTGVRightVoltage,grad,offs);
	pRamVariables->TGVLeftScaled = Pull2DHooked(&TGVLeftScaling,pRamVariables->TGVLeftVolts);
	pRamVariables->TGVRightScaled = Pull2DHooked(&TGVRightScaling,pRamVariables->TGVRightVolts);
	
	switch(BlendRatioInput)
	{
		case InputModeUndefined:
		break;
		
		case InputModeTGVLeft:
			pRamVariables->MapBlendRatio = pRamVariables->TGVLeftScaled;
			break;
		
		case InputModeTGVRight:
			pRamVariables->MapBlendRatio = pRamVariables->TGVRightScaled;
			break;
		
		default:
			pRamVariables->MapBlendRatio = DefaultMapBlendRatio;
			break;
	}
	
	switch(MapSwitchInput)
	{
		case InputModeUndefined:
		break;
		
		#ifdef pSiDrive
		case InputModeSiDrive:
		{
			switch(*pSiDrive)
		
			case SiDriveSS:
			pRamVariables->MapSwitch = MapSwitch3;
			break;
			
			case SiDriveSSAlt:
			pRamVariables->MapSwitch = MapSwitch3;
			break;
			
			case SiDriveS:
			pRamVariables->MapSwitch = MapSwitch2;
			break;
		
			default:
			pRamVariables->MapSwitch = MapSwitch1;
			break;
			}
		}
		#endif
		
		case InputModeTGVLeft:
			MapSwitchThresholdCheck(pRamVariables->TGVLeftVolts);
			break;
		
		case InputModeTGVRight:
			MapSwitchThresholdCheck(pRamVariables->TGVRightVolts);
			break;
		
		default:
		pRamVariables->MapSwitch = DefaultMapSwitch;
		break;
	}