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-bf33cf982152
issue#70
ferhat 2010-01-08 11:06:25 +00:00
parent 22000da5ea
commit 0808ba42b7
9 changed files with 32 additions and 6 deletions

View File

@ -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

View File

@ -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
;

View File

@ -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;}

View File

@ -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,7 +193,8 @@ ModFile::computingPass(bool no_tmp_terms)
{
// Compute static model and its derivatives
dynamic_model.toStatic(static_model);
static_model.computingPass(global_eval_context, no_tmp_terms, false, block);
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,7 +380,8 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all
// Create static and dynamic files
if (dynamic_model.equation_number() > 0)
{
static_model.writeStaticFile(basename, block, byte_code);
if (!no_static)
static_model.writeStaticFile(basename, block, byte_code);
if (dynamic_model_needed)
{

View File

@ -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;

View File

@ -365,6 +365,13 @@ ParsingDriver::block()
mod_file->block = true;
}
void
ParsingDriver::no_static()
{
mod_file->no_static = true;
}
void
ParsingDriver::byte_code()
{

View File

@ -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

View File

@ -21,6 +21,7 @@
ModFileStructure::ModFileStructure() :
check_present(false),
steady_present(false),
simul_present(false),
stoch_simul_present(false),
estimation_present(false),

View File

@ -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