--Electric Curve


local EHP=_Tune.E_Horsepower/100
local ETQ=_Tune.E_Torque/100
local ETrans1=_Tune.E_Trans1/1000
local ETrans2=_Tune.E_Trans2/1000
local ELimit=_Tune.E_Redline/1000 

function elecHP(RPM)
	RPM=RPM/1000
	local retVal=1e-9
	if RPM<=ETrans1 then
		retVal=((((RPM/ETrans1)^_Tune.EH_FrontMult)/(1/EHP))*(RPM/ETrans1))+((((RPM/ETrans1)^(1/_Tune.EH_FrontMult))/(1/EHP))*(1-(RPM/ETrans1)))
	elseif ETrans1<RPM and RPM<ETrans2 then
		retVal=EHP
	elseif ETrans2<=RPM then
		retVal=EHP-(((RPM-ETrans2)/(ELimit-ETrans2))^_Tune.EH_EndMult)/(1/(EHP*(_Tune.EH_EndPercent/100)))
	else
		error( "\n\t [AC6C]: Drive initialization failed!"
			.."\n\t    An unknown error occured when initializing electric horsepower."
			.."\n\t    Please send a screenshot of this message to Avxnturador."
			.."\n\t    R: "..RPM..", T1: "..ETrans1", T2: "..ETrans2", L: "..ELimit".")
	end
	return retVal
end

function elecTQ(RPM)
	RPM=RPM/1000
	local retVal=1e-9
	if RPM<ETrans1 then
		retVal=ETQ
	elseif ETrans1<=RPM then
		retVal=ETQ-(((RPM-ETrans1)/(ELimit-ETrans1))^_Tune.ET_EndMult)/(1/(ETQ*(_Tune.ET_EndPercent/100)))
	else
		error( "\n\t [AC6C]: Drive initialization failed!"
			.."\n\t    An unknown error occured when initializing electric torque."
			.."\n\t    Please send a screenshot of this message to Avxnturador."
			.."\n\t    R: "..RPM..", T1: "..ETrans1", T2: "..ETrans2", L: "..ELimit".")
	end
	return retVal
end
