The problem starts with the input tmedpred = tmed
What else did you expect?

tmed is tpred and tpred is tmedpred + something. So
tmedpred = tpred
is a recursive definition as the error messages states.
"tmedpred" shall return to the structure of the first NDSolve (enf1)
Where is this implemented?