From a3fc7a775262598b1106caefd9dea77e1d66bb31 Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan@dynare.org> Date: Mon, 4 Mar 2019 11:06:19 +0100 Subject: [PATCH] pac_model: fix input tests --- src/ParsingDriver.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/ParsingDriver.cc b/src/ParsingDriver.cc index a2b4beb9..f1dbb76e 100644 --- a/src/ParsingDriver.cc +++ b/src/ParsingDriver.cc @@ -2631,6 +2631,19 @@ ParsingDriver::pac_model() error("You must pass the model_name option to the pac_model statement."); auto name = it->second; + bool pac_growth_is_param = false; + if (pac_growth != nullptr && dynamic_cast<VariableNode *>(pac_growth) != nullptr) + { + set<int> params; + pac_growth->collectVariables(SymbolType::parameter, params); + if (params.size() == 1) + pac_growth_is_param = true; + pac_growth->collectVariables(SymbolType::endogenous, params); + pac_growth->collectVariables(SymbolType::exogenous, params); + if (params.size() != 1) + pac_growth_is_param = false; + } + string aux_model_name = ""; it = options_list.string_options.find("pac.aux_model_name"); if (it != options_list.string_options.end()) @@ -2643,6 +2656,13 @@ ParsingDriver::pac_model() warning("when aux_model_name is used in the pac_model statement, steady_state_growth is ignored"); } } + else + if (pac_growth_is_param + && (pac_steady_state_growth_rate_number >= 0 || pac_steady_state_growth_rate_symb_id >=0)) + warning("If growth option is constant, steady_state_growth is ignored"); + else if (pac_growth != nullptr && !pac_growth_is_param + && (pac_steady_state_growth_rate_number < 0 || pac_steady_state_growth_rate_symb_id < 0)) + error("The steady state growth rate of the target must be provided (steady_state_growth option) if option growth is not constant"); if (pac_steady_state_growth_rate_symb_id >= 0 && mod_file->symbol_table.getType(pac_steady_state_growth_rate_symb_id) != SymbolType::parameter) -- GitLab