Nonlinear small open economy with captial

Hi, I would like to add endogenous capital accumulation into Mr. Pfeifer’s Gali Chapter 3 Nonlinear model in small open economy.
Although the model could run, but I think my equilibrium condition is wrong, because I‘m confused about how to define C*,Y*, and the relationship between C* and Y*.

There must be some problem in the code/ equilibrium equations, but I wasted days without spotting any. Can someone help me spotting the problem? [SOE_derivation.pdf|attachment]
Thank you so much in advance!

What exactly is your problem? The starred variables are the foreign ones and are not endogenously determined. If consumption and output deviations from steady state are not assumed to coincide, you would need to specify investment as well.

Thanks for your reply, Mr. Pfeifer.
As we can see,

So Mr.Peifer, I need to specify investment in code. But in the model, I don’t find another function could specify investment. I hope you could give me some advice.

But are you actually modeling the foreign economy?

Thanks for your reply, Mr. Pfeifer.
I model the invest in the new mod file, But as we can see the figure is wrong. I try my best but I don’t know which cause the wrong.
And MODEL_DIAGNOSTICS: No obvious problems with this mod-file were detected.
Small open economy + Incomplete financial market + Invest

Usually, oscillating IRFs are caused by timing errors that give rise to complex eigenvalues.