Add new model option no_static : avoid to compute the static model. Useful for models without steady-state.
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3319 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
16794e4ec9
commit
46e144ad80
|
@ -35,6 +35,7 @@ SteadyStatement::SteadyStatement(const OptionsList &options_list_arg) :
|
|||
void
|
||||
SteadyStatement::checkPass(ModFileStructure &mod_file_struct)
|
||||
{
|
||||
mod_file_struct.steady_present = true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -111,7 +111,7 @@ class ParsingDriver;
|
|||
%token MODE_CHECK MODE_COMPUTE MODE_FILE MODEL MODEL_COMPARISON MODEL_INFO MSHOCKS
|
||||
%token MODIFIEDHARMONICMEAN MOMENTS_VARENDO DIFFUSE_FILTER
|
||||
%token <string_val> NAME
|
||||
%token NAN_CONSTANT NOBS NOCONSTANT NOCORR NODIAGNOSTIC NOFUNCTIONS
|
||||
%token NAN_CONSTANT NO_STATIC NOBS NOCONSTANT NOCORR NODIAGNOSTIC NOFUNCTIONS
|
||||
%token NOGRAPH NOMOMENTS NOPRINT NORMAL_PDF
|
||||
%token OBSERVATION_TRENDS OPTIM OPTIM_WEIGHTS ORDER OSR OSR_PARAMS
|
||||
%token PARAMETERS PARAMETER_SET PARTIAL_INFORMATION PERIODS PLANNER_OBJECTIVE PLOT_CONDITIONAL_FORECAST PLOT_PRIORS PREFILTER PRESAMPLE
|
||||
|
@ -463,6 +463,7 @@ model_options : BLOCK { driver.block(); }
|
|||
| o_mfs
|
||||
| BYTECODE { driver.byte_code(); }
|
||||
| USE_DLL { driver.use_dll(); }
|
||||
| NO_STATIC { driver.no_static();}
|
||||
| o_linear
|
||||
;
|
||||
|
||||
|
|
|
@ -416,6 +416,7 @@ int sigma_e = 0;
|
|||
<DYNARE_BLOCK>use_dll {return token::USE_DLL;}
|
||||
<DYNARE_BLOCK>block {return token::BLOCK;}
|
||||
<DYNARE_BLOCK>bytecode {return token::BYTECODE;}
|
||||
<DYNARE_BLOCK>no_static {return token::NO_STATIC;}
|
||||
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>linear {return token::LINEAR;}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ ModFile::ModFile() : expressions_tree(symbol_table, num_constants),
|
|||
static_model(symbol_table, num_constants),
|
||||
dynamic_model(symbol_table, num_constants),
|
||||
linear(false), block(false), byte_code(false),
|
||||
use_dll(false)
|
||||
use_dll(false), no_static(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -134,6 +134,12 @@ ModFile::checkPass()
|
|||
cerr << "ERROR: In 'model' block, can't use option 'bytecode' without option 'block'" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (stochastic_statement_present || mod_file_struct.check_present || mod_file_struct.steady_present && no_static)
|
||||
{
|
||||
cerr << "no_static option is incompatible with stochastic simulation, estimation, optimal policy, steady or check command" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -187,6 +193,7 @@ ModFile::computingPass(bool no_tmp_terms)
|
|||
{
|
||||
// Compute static model and its derivatives
|
||||
dynamic_model.toStatic(static_model);
|
||||
if(!no_static)
|
||||
static_model.computingPass(global_eval_context, no_tmp_terms, false, block);
|
||||
// Set things to compute for dynamic model
|
||||
if (dynamic_model_needed)
|
||||
|
@ -336,7 +343,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all
|
|||
dynamic_model.writeOutput(mOutputFile, basename, block, byte_code, use_dll);
|
||||
else
|
||||
dynamic_model.writeOutput(mOutputFile, basename, false, false, false);
|
||||
if (!byte_code)
|
||||
if (!byte_code && !no_static)
|
||||
static_model.writeOutput(mOutputFile, block);
|
||||
}
|
||||
|
||||
|
@ -356,7 +363,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all
|
|||
|
||||
// Special treatment for load params and steady state statement: insert initial values for the auxiliary variables
|
||||
LoadParamsAndSteadyStateStatement *lpass = dynamic_cast<LoadParamsAndSteadyStateStatement *>(*it);
|
||||
if (lpass)
|
||||
if (lpass && !no_static)
|
||||
static_model.writeAuxVarInitval(mOutputFile);
|
||||
}
|
||||
|
||||
|
@ -373,6 +380,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all
|
|||
// Create static and dynamic files
|
||||
if (dynamic_model.equation_number() > 0)
|
||||
{
|
||||
if (!no_static)
|
||||
static_model.writeStaticFile(basename, block, byte_code);
|
||||
|
||||
if (dynamic_model_needed)
|
||||
|
|
|
@ -60,6 +60,9 @@ public:
|
|||
//! Is the model stored in a MEX file ? (option "use_dll" of "model")
|
||||
bool use_dll;
|
||||
|
||||
//! Is the static model have to computed (no_static=false) or not (no_static=true). Option of 'model'
|
||||
bool no_static;
|
||||
|
||||
//! Global evaluation context
|
||||
/*! Filled using initval blocks and parameters initializations */
|
||||
eval_context_type global_eval_context;
|
||||
|
|
|
@ -365,6 +365,13 @@ ParsingDriver::block()
|
|||
mod_file->block = true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ParsingDriver::no_static()
|
||||
{
|
||||
mod_file->no_static = true;
|
||||
}
|
||||
|
||||
void
|
||||
ParsingDriver::byte_code()
|
||||
{
|
||||
|
|
|
@ -188,6 +188,8 @@ public:
|
|||
void block();
|
||||
//! the model is stored in a binary file
|
||||
void byte_code();
|
||||
//! the static model is not computed
|
||||
void no_static();
|
||||
//! cutoff option of model block
|
||||
void cutoff(string *value);
|
||||
//! mfs option of model block
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
ModFileStructure::ModFileStructure() :
|
||||
check_present(false),
|
||||
steady_present(false),
|
||||
simul_present(false),
|
||||
stoch_simul_present(false),
|
||||
estimation_present(false),
|
||||
|
|
|
@ -34,6 +34,8 @@ public:
|
|||
ModFileStructure();
|
||||
//! Wheter check is present
|
||||
bool check_present;
|
||||
//! Wheter steady is present
|
||||
bool steady_present;
|
||||
//! Whether a simul statement is present
|
||||
bool simul_present;
|
||||
//! Whether a stoch_simul statement is present
|
||||
|
|
Loading…
Reference in New Issue