From 203ddeba3d648dc21419d644151b8053aa97d8b5 Mon Sep 17 00:00:00 2001 From: Michel Juillard <michel.juillard@mjui.fr> Date: Mon, 24 Aug 2015 11:21:06 +0200 Subject: [PATCH] finalize svar_global_identification_check --- ComputingTasks.cc | 13 +++++++++++++ ComputingTasks.hh | 7 +++++++ DynareBison.yy | 7 ++++++- DynareFlex.ll | 1 + ParsingDriver.cc | 6 ++++++ ParsingDriver.hh | 2 ++ 6 files changed, 35 insertions(+), 1 deletion(-) diff --git a/ComputingTasks.cc b/ComputingTasks.cc index 28de2ee5..eaeebf2b 100644 --- a/ComputingTasks.cc +++ b/ComputingTasks.cc @@ -1627,6 +1627,8 @@ SvarIdentificationStatement::getMaxLag() const void SvarIdentificationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) { + // no equations OK with Svar Identification + mod_file_struct.bvar_present = true; if (!mod_file_struct.svar_identification_present) mod_file_struct.svar_identification_present = true; else @@ -1704,6 +1706,7 @@ SvarIdentificationStatement::writeOutput(ostream &output, const string &basename it->value->writeOutput(output); output << ";" << endl; } + output << "options_.ms.nlags = " << r << ";" << endl; } } @@ -2010,6 +2013,16 @@ SvarStatement::writeOutput(ostream &output, const string &basename, bool minimal output << "'ALL';" << endl; } +SvarGlobalIdentificationCheckStatement::SvarGlobalIdentificationCheckStatement(void) +{ +} + +void +SvarGlobalIdentificationCheckStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const +{ + output << "svar_global_identification_check(options_);" << std::endl; +} + SetTimeStatement::SetTimeStatement(const OptionsList &options_list_arg) : options_list(options_list_arg) { diff --git a/ComputingTasks.hh b/ComputingTasks.hh index 7e6d863b..111f565f 100644 --- a/ComputingTasks.hh +++ b/ComputingTasks.hh @@ -640,6 +640,13 @@ public: virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const; }; +class SvarGlobalIdentificationCheckStatement : public Statement +{ +public: + SvarGlobalIdentificationCheckStatement(); + virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const; +}; + class SetTimeStatement : public Statement { private: diff --git a/DynareBison.yy b/DynareBison.yy index 392d3d3e..73dfb181 100644 --- a/DynareBison.yy +++ b/DynareBison.yy @@ -157,7 +157,7 @@ class ParsingDriver; %token MS_ESTIMATION MS_SIMULATION MS_COMPUTE_MDD MS_COMPUTE_PROBABILITIES MS_FORECAST %token SVAR_IDENTIFICATION EQUATION EXCLUSION LAG UPPER_CHOLESKY LOWER_CHOLESKY MONTHLY QUARTERLY %token MARKOV_SWITCHING CHAIN DURATION NUMBER_OF_REGIMES NUMBER_OF_LAGS -%token SVAR COEFF COEFFICIENTS VARIANCES CONSTANTS EQUATIONS +%token SVAR SVAR_GLOBAL_IDENTIFICATION_CHECK COEFF COEFFICIENTS VARIANCES CONSTANTS EQUATIONS %token EXTERNAL_FUNCTION EXT_FUNC_NAME EXT_FUNC_NARGS FIRST_DERIV_PROVIDED SECOND_DERIV_PROVIDED %token SELECTED_VARIABLES_ONLY COVA_COMPUTE SIMULATION_FILE_TAG FILE_TAG %token NO_ERROR_BANDS ERROR_BAND_PERCENTILES SHOCKS_PER_PARAMETER NO_CREATE_INIT @@ -258,6 +258,7 @@ statement : parameters | conditional_forecast_paths | plot_conditional_forecast | svar_identification + | svar_global_identification_check | markov_switching | svar | external_function @@ -850,6 +851,10 @@ restriction_elem_expression : COEFF '(' symbol COMMA INT_NUMBER ')' { driver.add_positive_restriction_element($1,$5,$7);} ; +svar_global_identification_check: SVAR_GLOBAL_IDENTIFICATION_CHECK ';' + { driver.add_svar_global_identification_check(); } + ; + markov_switching : MARKOV_SWITCHING '(' ms_options_list ')' ';' { driver.markov_switching(); } ; diff --git a/DynareFlex.ll b/DynareFlex.ll index ce022df7..f380e502 100644 --- a/DynareFlex.ll +++ b/DynareFlex.ll @@ -163,6 +163,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2 <INITIAL>markov_switching {BEGIN DYNARE_STATEMENT; return token::MARKOV_SWITCHING;} <INITIAL>svar {BEGIN DYNARE_STATEMENT; return token::SVAR;} +<INITIAL>svar_global_identification_check {BEGIN DYNARE_STATEMENT; return token::SVAR_GLOBAL_IDENTIFICATION_CHECK;} <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; } diff --git a/ParsingDriver.cc b/ParsingDriver.cc index f2621fcf..26d0dc61 100644 --- a/ParsingDriver.cc +++ b/ParsingDriver.cc @@ -1013,6 +1013,12 @@ ParsingDriver::add_constants_exclusion() svar_constants_exclusion = true; } +void +ParsingDriver::add_svar_global_identification_check() +{ + mod_file->addStatement(new SvarGlobalIdentificationCheckStatement); +} + void ParsingDriver::do_sigma_e() { diff --git a/ParsingDriver.hh b/ParsingDriver.hh index 7ad6aaf4..cd1a782d 100644 --- a/ParsingDriver.hh +++ b/ParsingDriver.hh @@ -485,6 +485,8 @@ public: void add_upper_cholesky(); //! Svar_Identification Statement: restriction of form lower cholesky void add_lower_cholesky(); + //! Svar_Global_Identification_Check Statement + void add_svar_global_identification_check(); //! Forecast Statement void forecast(); void set_trends(); -- GitLab