preprocessor: issue warning when param used with lead/lag. closes #976
parent
a4db6f9be8
commit
c88c17728e
|
@ -495,6 +495,7 @@ M_.exo_histval = [];
|
|||
M_.exo_det_histval = [];
|
||||
M_.Correlation_matrix = [];
|
||||
M_.Correlation_matrix_ME = [];
|
||||
M_.parameter_used_with_lead_lag = false;
|
||||
|
||||
% homotopy for steady state
|
||||
options_.homotopy_mode = 0;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2003-2014 Dynare Team
|
||||
* Copyright (C) 2003-2015 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
|
@ -72,6 +72,16 @@ DataTree::AddVariableInternal(int symb_id, int lag)
|
|||
return new VariableNode(*this, symb_id, lag);
|
||||
}
|
||||
|
||||
bool
|
||||
DataTree::ParamUsedWithLeadLagInternal() const
|
||||
{
|
||||
for (variable_node_map_t::const_iterator it = variable_node_map.begin();
|
||||
it != variable_node_map.end(); it++)
|
||||
if (symbol_table.getType(it->first.first) == eParameter && it->first.second != 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
VariableNode *
|
||||
DataTree::AddVariable(int symb_id, int lag)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2003-2014 Dynare Team
|
||||
* Copyright (C) 2003-2015 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
|
@ -88,6 +88,8 @@ protected:
|
|||
//! Internal implementation of AddVariable(), without the check on the lag
|
||||
VariableNode *AddVariableInternal(int symb_id, int lag);
|
||||
|
||||
//! Internal implementation of ParamUsedWithLeadLag()
|
||||
bool ParamUsedWithLeadLagInternal() const;
|
||||
private:
|
||||
typedef list<expr_t> node_list_t;
|
||||
//! The list of nodes
|
||||
|
|
|
@ -3499,6 +3499,12 @@ DynamicModel::toStatic(StaticModel &static_model) const
|
|||
static_model.addAuxEquation((*it)->toStatic(static_model));
|
||||
}
|
||||
|
||||
bool
|
||||
DynamicModel::ParamUsedWithLeadLag() const
|
||||
{
|
||||
return ParamUsedWithLeadLagInternal();
|
||||
}
|
||||
|
||||
set<int>
|
||||
DynamicModel::findUnusedEndogenous()
|
||||
{
|
||||
|
|
|
@ -469,6 +469,9 @@ public:
|
|||
};
|
||||
bool isModelLocalVariableUsed() const;
|
||||
|
||||
//! Returns true if a parameter was used in the model block with a lead or lag
|
||||
bool ParamUsedWithLeadLag() const;
|
||||
|
||||
//! Writes model initialization and lead/lag incidence matrix to C output
|
||||
void writeCOutput(ostream &output, const string &basename, bool block, bool byte_code, bool use_dll, int order, bool estimation_present) const;
|
||||
//! Writes model initialization and lead/lag incidence matrix to Cpp output
|
||||
|
|
|
@ -41,7 +41,7 @@ ModFile::ModFile(WarningConsolidation &warnings_arg)
|
|||
linear(false), block(false), byte_code(false), use_dll(false), no_static(false),
|
||||
differentiate_forward_vars(false),
|
||||
nonstationary_variables(false), orig_eqn_nbr(0), ramsey_eqn_nbr(0),
|
||||
warnings(warnings_arg)
|
||||
param_used_with_lead_lag(false), warnings(warnings_arg)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -120,6 +120,10 @@ ModFile::checkPass()
|
|||
if (!mod_file_struct.order_option)
|
||||
mod_file_struct.order_option = 2;
|
||||
|
||||
param_used_with_lead_lag = dynamic_model.ParamUsedWithLeadLag();
|
||||
if (param_used_with_lead_lag)
|
||||
warnings << "WARNING: A parameter was used with a lead or a lag in the model block" << endl;
|
||||
|
||||
bool stochastic_statement_present = mod_file_struct.stoch_simul_present
|
||||
|| mod_file_struct.estimation_present
|
||||
|| mod_file_struct.osr_present
|
||||
|
@ -600,6 +604,9 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
|
|||
if (nointeractive)
|
||||
mOutputFile << "options_.nointeractive = 1;" << endl;
|
||||
|
||||
if (param_used_with_lead_lag)
|
||||
mOutputFile << "M_.parameter_used_with_lead_lag = true;" << endl;
|
||||
|
||||
cout << "Processing outputs ..." << endl;
|
||||
|
||||
symbol_table.writeOutput(mOutputFile);
|
||||
|
|
|
@ -107,6 +107,9 @@ public:
|
|||
//! Stores the number of equations added to the Ramsey model
|
||||
int ramsey_eqn_nbr;
|
||||
|
||||
//! Parameter used with lead/lag
|
||||
bool param_used_with_lead_lag;
|
||||
|
||||
//! Stores the list of extra files to be transefered during a parallel run
|
||||
/*! (i.e. option parallel_local_files of model block) */
|
||||
vector<string> parallel_local_files;
|
||||
|
|
Loading…
Reference in New Issue