Commit badeec61 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Add interface and documentation to model_diagnostics

Closes: #205
parent 87d2dbca
......@@ -2689,6 +2689,16 @@ Contains the eigenvalues of the model, as computed by the @code{check}
command.
@end defvr
@deffn Command model_diagnostics ;
This command performs various sanity checks on the model, and prints a
message if a problem is detected (missing variables at current period,
invalid steady state, singular Jacobian of static model).
@end deffn
@deffn Command model_info ;
@deffnx Command model_info (@var{OPTIONS}@dots{});
......
......@@ -2410,3 +2410,13 @@ ExtendedPathStatement::writeOutput(ostream &output, const string &basename) cons
<< ") ];" << endl
<< "oo_.exo_simul = oo_.ep.shocks;" << endl;
}
ModelDiagnosticsStatement::ModelDiagnosticsStatement()
{
}
void
ModelDiagnosticsStatement::writeOutput(ostream &output, const string &basename) const
{
output << "model_diagnostics(M_,options_,oo_);" << endl;
}
......@@ -805,4 +805,11 @@ public:
virtual void writeOutput(ostream &output, const string &basename) const;
};
class ModelDiagnosticsStatement : public Statement
{
public:
ModelDiagnosticsStatement();
virtual void writeOutput(ostream &output, const string &basename) const;
};
#endif
......@@ -113,7 +113,7 @@ class ParsingDriver;
%token LYAPUNOV_FIXED_POINT_TOL LYAPUNOV_DOUBLING_TOL LYAPUNOV_SQUARE_ROOT_SOLVER_TOL MARKOWITZ MARGINAL_DENSITY MAX MAXIT
%token MFS MH_DROP MH_INIT_SCALE MH_JSCALE MH_MODE MH_NBLOCKS MH_REPLIC MH_RECOVER MIN MINIMAL_SOLVING_PERIODS SOLVE_MAXIT
%token MODE_CHECK MODE_COMPUTE MODE_FILE MODEL MODEL_COMPARISON MODEL_INFO MSHOCKS ABS SIGN
%token MODIFIEDHARMONICMEAN MOMENTS_VARENDO DIFFUSE_FILTER SUB_DRAWS
%token MODEL_DIAGNOSTICS MODIFIEDHARMONICMEAN MOMENTS_VARENDO DIFFUSE_FILTER SUB_DRAWS
%token <string_val> NAME
%token NAN_CONSTANT NO_STATIC NOBS NOCONSTANT NODISPLAY NOCORR NODIAGNOSTIC NOFUNCTIONS
%token NOGRAPH NOMOMENTS NOPRINT NORMAL_PDF
......@@ -270,6 +270,7 @@ statement : parameters
| ms_variance_decomposition
| calib_smoother
| extended_path
| model_diagnostics
;
dsample : DSAMPLE INT_NUMBER ';'
......@@ -2177,6 +2178,10 @@ extended_path_option : o_periods
| o_solver_periods
;
model_diagnostics : MODEL_DIAGNOSTICS ';'
{ driver.model_diagnostics(); }
;
o_dr_algo : DR_ALGO EQUAL INT_NUMBER {
if (*$3 == string("0"))
driver.warning("dr_algo option is now deprecated, and may be removed in a future version of Dynare");
......
......@@ -157,6 +157,7 @@ string eofbuff;
<INITIAL>external_function {BEGIN DYNARE_STATEMENT; return token::EXTERNAL_FUNCTION;}
/* End of a Dynare statement */
<INITIAL>calib_smoother { BEGIN DYNARE_STATEMENT; return token::CALIB_SMOOTHER; }
<INITIAL>model_diagnostics {BEGIN DYNARE_STATEMENT; return token::MODEL_DIAGNOSTICS;}
<DYNARE_STATEMENT>; {
if (!sigma_e)
......
......@@ -2493,3 +2493,8 @@ ParsingDriver::process_graph_format_option()
graph_formats.clear();
}
void
ParsingDriver::model_diagnostics()
{
mod_file->addStatement(new ModelDiagnosticsStatement());
}
......@@ -634,6 +634,8 @@ public:
void add_graph_format(const string &name);
//! Add the graph_format option to the OptionsList structure
void process_graph_format_option();
//! Model diagnostics
void model_diagnostics();
};
#endif // ! PARSING_DRIVER_HH
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment