Perfect foresight simulation doesn't work

Dear Dynare staff,

I’m working on an extended version of the model of Gertler & Karadi (2011) with long term debt and sovereign risk. When I run the model, the stochastic simulations work perfectly, however, the deterministic one doesn’t. I need this simulation in order to get the min and max functions at work.
I found in another topic in the forum that it could be a problem of the timing because (correct me if I’m wrong) each current endogenous variable must have a corresponding equation that defines it. I found that I do have this problem in my model since I have two equations defining a unique current variable R (equations 4 and 25). When I fix the problem, I do not have the same IRFs in the stochastic simulation. How can I do to fix the problem without disturbing my model’s dynamics?

Thank you in advance for your help.
the model : model8.mod (7.9 KB)
the model with problem fixed : simul.mod (8.0 KB)

If the stochastic simulations work, the mod-file should be correct. Have you tried if it works with only a small shock?

Thanks for your reply. Problem solved. The stochastic IRFs are the same at the 1st order, however, they change in the modified version at the 3rd order. It must be related to the variable change that I did.