Display informative message when the model cannot be solved at the prior mode.

time-shift
Stéphane Adjemian (Charybdis) 2016-10-07 12:30:10 +02:00
parent acd8a4e73a
commit 83bc67f0c0
2 changed files with 66 additions and 0 deletions

View File

@ -128,6 +128,12 @@ if ismember('moments', varargin) % Prior simulations (2nd order moments).
oo__.dr = set_state_space(oo__.dr, Model, options_);
% Solve model
[dr, info, Model , options__ , oo__] = resol(0, Model , options_ ,oo__);
if info
skipline()
disp(sprintf('Cannot solve the model on the prior mode (info = %s, %s)', num2str(info(1)), interpret_resol_info(info)));
skipline()
return
end
% Compute and display second order moments
oo__ = disp_th_moments(oo__.dr, [], Model, options__, oo__);
skipline(2)

View File

@ -0,0 +1,60 @@
function message = interpret_resol_info(info)
% Returns a message describing problem encountered during the resolution of
% a model.
%
% INPUTS
% - info [struct] Second output argument return by the resol routine
%
% OUTPUTS
% - message [string] Description of the issue preventing model's resolution.
% Copyright (C) 2001-2016 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
switch info(1)
case 0
message = '';
case 1
message = 'The model doesn''t determine the current variable uniquely.';
case 2
message = 'MJDGGES (Generalized Schur decomposition) returned an error code.';
case 3
message = 'Blanchard & Kahn conditions are not satisfied: no stable equilibrium.';
case 4
message = 'Blanchard & Kahn conditions are not satisfied: indeterminacy.';
case 5
message = 'Blanchard & Kahn conditions are not satisfied: indeterminacy due to rank failure.';
case 6
message = 'The jacobian evaluated at the deterministic steady state is complex.';
case 19
message = 'The steadystate routine thrown an exception (inconsistent deep parameters).';
case 20
message = sprintf('Cannot find the steady state (the sum of square residuals of the static equations is %s)', num2str(info(2)));
case 21
message = sprintf('The steady state is complex (the sum of square residuals of imaginary parts of the steady state is %s)', num2str(info(2)));
case 22
message = 'The steady state has NaNs.';
case 23
message = 'Parameters have been updated in the steadystate routine and some have complex values.';
case 24
message = 'Parameters have been updated in the steadystate routine and some are NaNs.';
case 30
message = 'Ergodic variance can''t be computed.';
otherwise
message = 'Unknown issue!';
end