Perfect foresight high value

I am trying to solve a NK model with investment in a perfect foresight context. The shock implemented is a 10 period ahead forward guidance. When I solve the model with a stochastic simulation everything goes well. But in the perfect foresight:
1-some of the equation residuals are different from 0,
2-the IRF display huge value.
3-the model display the same responses for all the variables (except for the interest rate) wether the shock is positive or negative

I also tried a version of forward guidance proposed by prof. @jpfeifer at the following link DSGE_mod/NK_linear_forward_guidance at master · JohannesPfeifer/DSGE_mod · GitHub but the there is no solution.
Any idea on what is going on here?

Thank you
FG13.mod (6.8 KB)

  1. Your model does not satisify the BK condition, so I wonder why the stochastic version works.
  2. Your initial and terminal values do not make sense. Why are you using nonlinear steady states for a linearized model?

I would have expected:

FG13.mod (6.9 KB)

Thank you very much for the correction Prof. @jpfeifer.
For the stochastic simulation I am running the program with the same SS I found analytically (but not used) and the Taylor rule. I checked again and the BK are satisfied (I attached the stochastic version. Can you please let me know there is any problem there?).
Since the main goal was to do a perfect foresight simulation I though it would ne useful to find the SS for the initval-endval block.
So I guess the problem comes from my SS in perfect foresight?

testfig51.mod (9.4 KB)

I see. The Taylor rule of course makes a difference. An interest peg does not work in a stochastic model. So the problem in the perfect foresight case indeed came from the wrong steady state (and having a wrong constant in the monetary policy rule)