local O=_Tune.E_Horsepower/100 local X=_Tune.E_Torque/100 local w=_Tune.E_Trans1/1000 local G=_Tune.E_Trans2/1000 local m=_Tune.E_Redline/1000 function elecHP(X)X=X/1000 local v=1e-09 if X<=w then v=((X/w)^_Tune.EH_FrontMult/(1/O))*(X/w)+((X/w)^(1/_Tune.EH_FrontMult)/(1/O))*(1-X/w)elseif w<X and X<G then v=O elseif G<=X then v=O-((X-G)/(m-G))^_Tune.EH_EndMult/(1/(O*(_Tune.EH_EndPercent/100)))else error("\n\t \091\065\067\054\067\093\058 \068\114\105\118\101 \105\110\105\116\105\097\108\105\122\097\116\105\111\110 \102\097\105\108\101\100\033"..("\n\t    \065\110 \117\110\107\110\111\119\110 \101\114\114\111\114 \111\099\099\117\114\101\100 \119\104\101\110 \105\110\105\116\105\097\108\105\122\105\110\103 \101\108\101\099\116\114\105\099 \104\111\114\115\101\112\111\119\101\114\046"..("\n\t    \080\108\101\097\115\101 \115\101\110\100 \097 \115\099\114\101\101\110\115\104\111\116 \111\102 \116\104\105\115 \109\101\115\115\097\103\101 \116\111 \065\118\120\110\116\117\114\097\100\111\114\046"..("\n\t    \082\058 "..(X..("\044 \084\049\058 "..(w("\044 \084\050\058 ")..(G("\044 \076\058 ")..m("\046")))))))))end return v end function elecTQ(O)O=O/1000 local v=1e-09 if O<w then v=X elseif w<=O then v=X-((O-w)/(m-w))^_Tune.ET_EndMult/(1/(X*(_Tune.ET_EndPercent/100)))else error("\n\t \091\065\067\054\067\093\058 \068\114\105\118\101 \105\110\105\116\105\097\108\105\122\097\116\105\111\110 \102\097\105\108\101\100\033"..("\n\t    \065\110 \117\110\107\110\111\119\110 \101\114\114\111\114 \111\099\099\117\114\101\100 \119\104\101\110 \105\110\105\116\105\097\108\105\122\105\110\103 \101\108\101\099\116\114\105\099 \116\111\114\113\117\101\046"..("\n\t    \080\108\101\097\115\101 \115\101\110\100 \097 \115\099\114\101\101\110\115\104\111\116 \111\102 \116\104\105\115 \109\101\115\115\097\103\101 \116\111 \065\118\120\110\116\117\114\097\100\111\114\046"..("\n\t    \082\058 "..(O..("\044 \084\049\058 "..(w("\044 \084\050\058 ")..(G("\044 \076\058 ")..m("\046")))))))))end return v end
--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
