change variable/parameter collections, finish printing SymbolTable info
parent
5ad0a4a96f
commit
432dbbb785
10
ModFile.cc
10
ModFile.cc
|
@ -1077,15 +1077,15 @@ ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output)
|
||||||
}
|
}
|
||||||
|
|
||||||
jlOutputFile << "module " << basename << endl
|
jlOutputFile << "module " << basename << endl
|
||||||
<< "#" << endl
|
<< "##" << endl
|
||||||
<< " # Note : this file was automatically generated by Dynare" << endl
|
<< " # Note : this file was automatically generated by Dynare" << endl
|
||||||
<< " # from " << basename << ".mod" << endl
|
<< " # from " << basename << ".mod" << endl
|
||||||
<< "#" << endl
|
<< "##" << endl
|
||||||
<< "using model" << endl
|
<< "using DynareModel" << endl
|
||||||
<< "using utils" << endl
|
<< "using Utils" << endl
|
||||||
<< "export dynamicmodel!, staticmodel!, steadystate!" << endl
|
<< "export dynamicmodel!, staticmodel!, steadystate!" << endl
|
||||||
<< "export model__" << endl
|
<< "export model__" << endl
|
||||||
<< "model__ = modeldescription()" << endl
|
<< "model__ = Model()" << endl
|
||||||
<< "model__.fname = \"" << basename << "\"" << endl;
|
<< "model__.fname = \"" << basename << "\"" << endl;
|
||||||
|
|
||||||
symbol_table.writeJuliaOutput(jlOutputFile);
|
symbol_table.writeJuliaOutput(jlOutputFile);
|
||||||
|
|
136
SymbolTable.cc
136
SymbolTable.cc
|
@ -725,68 +725,88 @@ SymbolTable::writeJuliaOutput(ostream &output) const throw (NotYetFrozenExceptio
|
||||||
if (!frozen)
|
if (!frozen)
|
||||||
throw NotYetFrozenException();
|
throw NotYetFrozenException();
|
||||||
|
|
||||||
if (exo_nbr() > 0)
|
output << "# Endogenous Variables" << endl;
|
||||||
{
|
|
||||||
output << "model__.exonames = [\"" << getName(exo_ids[0]) << "\"";
|
|
||||||
for (int id = 1; id < exo_nbr(); id++)
|
|
||||||
output << ", \"" << getName(exo_ids[id]) << "\"";
|
|
||||||
output << "]" << endl
|
|
||||||
<< "model__.tex_exonames = [\"" << getTeXName(exo_ids[0]) << "\"";
|
|
||||||
for (int id = 1; id < exo_nbr(); id++)
|
|
||||||
output << ", \"" << getTeXName(exo_ids[id]) << "\"";
|
|
||||||
output << "]" << endl
|
|
||||||
<< "model__.long_exonames = [\"" << getLongName(exo_ids[0]) << "\"";
|
|
||||||
for (int id = 1; id < exo_nbr(); id++)
|
|
||||||
output << ", \"" << getLongName(exo_ids[id]) << "\"";
|
|
||||||
output << "]" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (exo_det_nbr() > 0)
|
|
||||||
{
|
|
||||||
output << "model__.exodetnames = [\"" << getName(exo_det_ids[0]) << "\"";
|
|
||||||
for (int id = 1; id < exo_det_nbr(); id++)
|
|
||||||
output << ", \"" << getName(exo_det_ids[id]) << "\"";
|
|
||||||
output << "]" << endl
|
|
||||||
<< "model__.tex_exodetnames = [\"" << getTeXName(exo_det_ids[0]) << "\"";
|
|
||||||
for (int id = 1; id < exo_det_nbr(); id++)
|
|
||||||
output << ", \"" << getTeXName(exo_det_ids[id]) << "\"";
|
|
||||||
output << "]" << endl
|
|
||||||
<< "model__.long_exodetnames = [\"" << getLongName(exo_det_ids[0]) << "\"";
|
|
||||||
for (int id = 1; id < exo_det_nbr(); id++)
|
|
||||||
output << ", \"" << getLongName(exo_det_ids[id]) << "\"";
|
|
||||||
output << "]" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (endo_nbr() > 0)
|
if (endo_nbr() > 0)
|
||||||
{
|
for (int id = 0; id < endo_nbr(); id++)
|
||||||
output << "model__.endonames = [\"" << getName(endo_ids[0]) << "\"";
|
output << "push!(model__.endo, DynareModel.Endo(\""
|
||||||
for (int id = 1; id < endo_nbr(); id++)
|
<< getName(endo_ids[id]) << "\", \""
|
||||||
output << ", \"" << getName(endo_ids[id]) << "\"";
|
<< getTeXName(endo_ids[id]) << "\", \""
|
||||||
output << "]" << endl
|
<< getLongName(endo_ids[id]) << "\"))" << endl;
|
||||||
<< "model__.tex_endonames = [\"" << getTeXName(endo_ids[0]) << "\"";
|
|
||||||
for (int id = 1; id < endo_nbr(); id++)
|
|
||||||
output << ", \"" << getTeXName(endo_ids[id]) << "\"";
|
|
||||||
output << "]" << endl
|
|
||||||
<< "model__.long_endonames = [\"" << getLongName(endo_ids[0]) << "\"";
|
|
||||||
for (int id = 1; id < endo_nbr(); id++)
|
|
||||||
output << ", \"" << getLongName(endo_ids[id]) << "\"";
|
|
||||||
output << "]" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
output << "# Exogenous Variables" << endl;
|
||||||
|
if (exo_nbr() > 0)
|
||||||
|
for (int id = 0; id < exo_nbr(); id++)
|
||||||
|
output << "push!(model__.exo, DynareModel.Exo(\""
|
||||||
|
<< getName(exo_ids[id]) << "\", \""
|
||||||
|
<< getTeXName(exo_ids[id]) << "\", \""
|
||||||
|
<< getLongName(exo_ids[id]) << "\"))" << endl;
|
||||||
|
|
||||||
|
output << "# Exogenous Deterministic Variables" << endl;
|
||||||
|
if (exo_det_nbr() > 0)
|
||||||
|
for (int id = 0; id < exo_det_nbr(); id++)
|
||||||
|
output << "push!(model__.exo_det, DynareModel.ExoDet(\""
|
||||||
|
<< getName(exo_det_ids[id]) << "\", \""
|
||||||
|
<< getTeXName(exo_det_ids[id]) << "\", \""
|
||||||
|
<< getLongName(exo_det_ids[id]) << "\"))" << endl;
|
||||||
|
|
||||||
|
output << "# Parameters" << endl;
|
||||||
if (param_nbr() > 0)
|
if (param_nbr() > 0)
|
||||||
|
for (int id = 0; id < param_nbr(); id++)
|
||||||
|
output << "push!(model__.param, DynareModel.Param(\""
|
||||||
|
<< getName(param_ids[id]) << "\", \""
|
||||||
|
<< getTeXName(param_ids[id]) << "\", \""
|
||||||
|
<< getLongName(param_ids[id]) << "\"))" << endl;
|
||||||
|
|
||||||
|
output << "model__.orig_endo_nbr = " << orig_endo_nbr() << endl;
|
||||||
|
|
||||||
|
if (aux_vars.size() > 0)
|
||||||
|
for (int i = 0; i < (int) aux_vars.size(); i++)
|
||||||
{
|
{
|
||||||
output << "model__.paramnames = [\"" << getName(param_ids[0]) << "\"";
|
output << "push!(model__.aux_vars, "
|
||||||
for (int id = 1; id < param_nbr(); id++)
|
<< getTypeSpecificID(aux_vars[i].get_symb_id()) + 1 << ", "
|
||||||
output << ", \"" << getName(param_ids[id]) << "\"";
|
<< aux_vars[i].get_type() << ", ";
|
||||||
output << "]" << endl
|
switch (aux_vars[i].get_type())
|
||||||
<< "model__.tex_paramnames = [\"" << getTeXName(param_ids[0]) << "\"";
|
{
|
||||||
for (int id = 1; id < param_nbr(); id++)
|
case avEndoLead:
|
||||||
output << ", \"" << getTeXName(param_ids[id]) << "\"";
|
case avExoLead:
|
||||||
output << "]" << endl
|
break;
|
||||||
<< "model__.long_paramnames = [\"" << getLongName(param_ids[0]) << "\"";
|
case avEndoLag:
|
||||||
for (int id = 1; id < param_nbr(); id++)
|
case avExoLag:
|
||||||
output << ", \"" << getLongName(param_ids[id]) << "\"";
|
output << getTypeSpecificID(aux_vars[i].get_orig_symb_id()) + 1 << ", "
|
||||||
output << "]" << endl;
|
<< aux_vars[i].get_orig_lead_lag() << ", ";
|
||||||
|
break;
|
||||||
|
case avMultiplier:
|
||||||
|
output << "NaN, NaN, " << aux_vars[i].get_equation_number_for_multiplier() + 1 << ", " << endl;
|
||||||
|
break;
|
||||||
|
case avDiffForward:
|
||||||
|
output << getTypeSpecificID(aux_vars[i].get_orig_symb_id())+1 << ", NaN, ";
|
||||||
|
break;
|
||||||
|
case avExpectation:
|
||||||
|
output << "NaN, NaN, NaN, \"\\mathbb{E}_{t"
|
||||||
|
<< (aux_vars[i].get_information_set() < 0 ? "" : "+")
|
||||||
|
<< aux_vars[i].get_information_set() << "}(";
|
||||||
|
aux_vars[i].get_expectation_expr_node()->writeOutput(output, oLatexDynamicModel);
|
||||||
|
output << ")\"" << endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (predeterminedNbr() > 0)
|
||||||
|
{
|
||||||
|
output << "model__.pred_vars = [ ";
|
||||||
|
for (set<int>::const_iterator it = predetermined_variables.begin();
|
||||||
|
it != predetermined_variables.end(); it++)
|
||||||
|
output << getTypeSpecificID(*it)+1 << "; ";
|
||||||
|
output << "];" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (observedVariablesNbr() > 0)
|
||||||
|
{
|
||||||
|
output << "options_.obs_vars = [ ";
|
||||||
|
for (vector<int>::const_iterator it = varobs.begin();
|
||||||
|
it != varobs.end(); it++)
|
||||||
|
output << getTypeSpecificID(*it)+1 << "; ";
|
||||||
|
output << " ];" << endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue