I have a working model, in which I try to introduce level of variables with identity. For example writing log trend of real exchange rate as sum of last period log of real exchange rate plus it’s growth rate in this period. Equation takes this form - z_trend = z_trend(-1) + g_z_trend (line 133 in model codes).

where g_z_trend is defined as autoregressive process converging to steady state (line 146 in model). But model fails and error “The steady state contains NaN or Inf” occurs, and before the error the warning - Warning:
Matrix is singular to working precision.

In evaluate_steady_state (line 263)
In steady_ (line 55)
In steady (line 81)
In model (line 503)
In dynare (line 235)

If trend is introduced as just exogenous process converging to steady state (line 140 in model codes) model runs perfectly, but stating this equation like this is not viable since level of trend is not stationary process and writing it such as means that model has steady state not in growth rates but in levels.

I cant understand what causes the problem, is there another way to state level of variables in semi-structural (gap) models?

Check the residuals displayed in the command window. There are various equations with non-zero residuals. The main problem is that your equation defining the z_trend contains a constant. The model is nonstationary due to the drift. The only way to find a steady state is to set the variables to infinity, which is what happens.

But because your model is linear, the derivatives will not depend on the variable’s steady states. Thus, you can use the nocheck-option to suppress computation of the steady state. But before doing that, you need to make sure your model is correct.

Thank you very much proffesor Pfeifer. Just a little follow up question. If I understood it correctly I should give model steady states not initial values and then suppress steady state calculations. If it is so, what values do I assign for this nonstationary drift variables?

No, what I am saying is: First, there exists no steady state because of trend growth (unless you detrend the model). Second, that does not matter in your linear model, because the model solution will be same, regardless of the values chosen for the variables around which to approximate the model. Thus, you can simply pick an initial value to approximate around.