diff --git a/ComputingTasks.cc b/ComputingTasks.cc index 28de2ee551da140691e3d1d4a307dae0a75a0cf0..eaeebf2bc27bde15f83b0a3b6af732edc0dd86ce 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 7e6d863bebaccccf242a53a42392efab2d1ffcc9..111f565fd6087cb1eb2af39766e97b84717e567c 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 392d3d3efe60a54ccc2b9b23a191f6a3df0c1343..73dfb18169aea04215122585abe46c472f879876 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 ce022df74363857411b69d4ed0d970c9ff54df84..f380e502101919fba499551d68eb126a792802eb 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 f2621fcf94a5a12abc9d1f111443bc9869962e83..26d0dc6162de649f6fcc7a7d8c615a34814bc5f4 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 7ad6aaf48fa7b64ad07ae7e43d937bc0e206e932..cd1a782d47a37e2a23926eeb8d06395e7f8f498b 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();