Problems with zero profit condition

Hello,
I’m new here and quite inexperienced with Dynare. Me and a fellow student are programming an OLG model for our master’s thesis, inspired in part by Eggertsson and Mehrotra (2014).
So our model has three generations and the middle generation loans to the young. We also have capital in the model, so basically there are two different interest rates - one is rental rate on capital and one is the real rate on loans. The point is to shock an exogenous loaning restriction (for the young cohort) to push interest rates on loans down quite a bit.

Our model is quite “well behaved”, in the sense that it can handle relatively big shocks. But the regular condition y = wage plus interest on capital, doesn’t hold. There’s a vast residual. Instead, in our model, the relation seems to be y = w + k*q + s , that is output equals wage plus rental income on capital PLUS savings in the form of capital investment! Which seems really weird.

Has anyone any suggestions to what might be the problem here? We’re quite stuck here, so any help is deeply appreciated!
modell2.mod (2.27 KB)

Having tried a few other checks, I see now that the condition y - (q+cdelta)*k - w = 0 holds in our model. Is this sufficient? I am also a bit worried that y minus consumption and savings does not equal zero. Has anyone got any experience with something similar?

I don’t know your model, but the economy’s resource constraint does not involve savings. It says goods produced are equal to goods used. The use of resources typically involves consumption, investment, any deadweigh losses from adjustment costs and government spending. You only get savings in there by linking investment and savings.

seems to be the resource constraint. If that holds but not your other equation, it suggests that your concept of savings is wrong. It could have to do with weighting as there are three types of agents or net vs. gross investment/savings.