What about for the second condition (slightly more complex but not massively so):
elseif energyTrend >= 99 and (energyStoredRatio >= 0.99 or (energyStoredRatio >= 0.91 and energyTrend >= 2000)) then
i.e. by having it at 99 even if dealing with a T2 mass fab you should be getting a very tiny energy shortfall as it turns off and on (helping to highlight to the player there might be an issue with their power)
By having it kick in at 91% when you have significant net energy (that's more than a T3 fab) it means your power should recover quickly from an overcharge, while allowing significantly longer to turn on mass fabs to avoid significantly overflowing energy.