The deterministic case fails but the stochastic case is OK

Dear Prof Pfeifer,

I’m trying to simulate a simple model under deterministic case. The model is small. The steady state is easy to solve. BK condition is satisfied. And the stochastic simulation works fine.

However, the perfect foresight simulation always fails. It seem that there is a singular Jacobian problem…
I have read the link https://forum.dynare.org/t/perfect-foresight-simulation-always-failed/17651/2. But there is no similar problem in my mod file.
Any clue how I can solve it? Thank you in advance!

I provide my mod and m files in the attachment
attachfile.zip (105.5 KB)
The zip file includes both deterministic case and stochastic case. And run “Main_RunMe.m”, you can see the results

Using

perfect_foresight_setup(periods=100); 
perfect_foresight_solver(stack_solve_algo=0,robust_lin_solve);

found a solution.