put orig_eq_nbr and ramsey_eq_nbr in mod_file_struct

time-shift
Michel Juillard 2016-03-14 07:56:16 +01:00
parent 62bdb510ab
commit 7ce07c9abd
3 changed files with 14 additions and 16 deletions

View File

@ -39,8 +39,7 @@ ModFile::ModFile(WarningConsolidation &warnings_arg)
static_model(symbol_table, num_constants, external_functions_table),
steady_state_model(symbol_table, num_constants, external_functions_table, static_model),
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),
differentiate_forward_vars(false), nonstationary_variables(false),
param_used_with_lead_lag(false), warnings(warnings_arg)
{
}
@ -345,7 +344,7 @@ ModFile::transformPass(bool nostrict)
dynamic_model.removeTrendVariableFromEquations();
}
orig_eqn_nbr = dynamic_model.equation_number();
mod_file_struct.orig_eq_nbr = dynamic_model.equation_number();
if (mod_file_struct.ramsey_model_present)
{
StaticModel *planner_objective = NULL;
@ -364,7 +363,7 @@ ModFile::transformPass(bool nostrict)
dynamic_model.cloneDynamic(ramsey_FOC_equations_dynamic_model);
ramsey_FOC_equations_dynamic_model.computeRamseyPolicyFOCs(*planner_objective);
ramsey_FOC_equations_dynamic_model.replaceMyEquations(dynamic_model);
ramsey_eqn_nbr = dynamic_model.equation_number() - orig_eqn_nbr;
mod_file_struct.ramsey_eq_nbr = dynamic_model.equation_number() - mod_file_struct.orig_eq_nbr;
}
if (mod_file_struct.stoch_simul_present
@ -446,7 +445,7 @@ ModFile::transformPass(bool nostrict)
cout << "Found " << dynamic_model.equation_number() << " equation(s)." << endl;
else
{
cout << "Found " << orig_eqn_nbr << " equation(s)." << endl;
cout << "Found " << mod_file_struct.orig_eq_nbr << " equation(s)." << endl;
cout << "Found " << dynamic_model.equation_number() << " FOC equation(s) for Ramsey Problem." << endl;
}
@ -748,9 +747,9 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
if (block && !byte_code)
mOutputFile << "addpath " << basename << ";" << endl;
mOutputFile << "M_.orig_eq_nbr = " << orig_eqn_nbr << ";" << endl
mOutputFile << "M_.orig_eq_nbr = " << mod_file_struct.orig_eq_nbr << ";" << endl
<< "M_.eq_nbr = " << dynamic_model.equation_number() << ";" << endl
<< "M_.ramsey_eq_nbr = " << ramsey_eqn_nbr << ";" << endl;
<< "M_.ramsey_eq_nbr = " << mod_file_struct.ramsey_eq_nbr << ";" << endl;
if (dynamic_model.equation_number() > 0)
{
@ -1133,9 +1132,9 @@ ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output)
<< symbol_table.exo_nbr() << ")" << endl
<< "model.correlation_matrix = ones(Float64, " << symbol_table.exo_nbr() << ", "
<< symbol_table.exo_nbr() << ")" << endl
<< "model.orig_eq_nbr = " << orig_eqn_nbr << endl
<< "model.orig_eq_nbr = " << mod_file_struct.orig_eq_nbr << endl
<< "model.eq_nbr = " << dynamic_model.equation_number() << endl
<< "model.ramsey_eq_nbr = " << ramsey_eqn_nbr << endl;
<< "model.ramsey_eq_nbr = " << mod_file_struct.ramsey_eq_nbr << endl;
if (mod_file_struct.calibrated_measurement_errors)
jlOutputFile << "model.h = zeros(Float64,"

View File

@ -101,12 +101,6 @@ public:
/*! Filled using initval blocks and parameters initializations */
eval_context_t global_eval_context;
//! Stores the original number of equations in the model_block
int orig_eqn_nbr;
//! 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;

View File

@ -91,7 +91,7 @@ public:
bool bayesian_irf_present;
//! Whether there is a data statement present
bool estimation_data_statement_present;
//! Last chain number for Markov Switching statement
//! Last chain number for Markov Switching statement2
int last_markov_switching_chain;
//! Whether a calib_smoother statement is present
bool calib_smoother_present;
@ -118,6 +118,11 @@ public:
bool ms_dsge_present;
//! Whether occbin is present
bool occbin_option;
//! Stores the original number of equations in the model_block
int orig_eq_nbr;
//! Stores the number of equations added to the Ramsey model
int ramsey_eq_nbr;
};
class Statement