Commit 98c371f7 authored by Ferhat Mihoubi's avatar Ferhat Mihoubi Committed by Sébastien Villemot
Browse files

Bug correction in the deterministic simulation: to solve a purely backward or...

Bug correction in the deterministic simulation: to solve a purely backward or forward looking block requires contemporaneous derivatives only.
parent 0a3c8a4b
......@@ -646,12 +646,16 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
unsigned int varr = getBlockVariableID(block, var);
expr_t id = it->second.second;
int lag = it->second.first;
output << " g1(" << eq+1 << ", " << var+1-block_recursive << ") = ";
id->writeOutput(output, local_output_type, local_temporary_terms);
output << "; % variable=" << symbol_table.getName(symbol_table.getID(eEndogenous, varr))
<< "(" << lag
<< ") " << varr+1
<< ", equation=" << eqr+1 << endl;
if (lag == 0)
{
output << " g1(" << eq+1 << ", " << var+1-block_recursive << ") = ";
id->writeOutput(output, local_output_type, local_temporary_terms);
output << "; % variable=" << symbol_table.getName(symbol_table.getID(eEndogenous, varr))
<< "(" << lag
<< ") " << varr+1
<< ", equation=" << eqr+1 << endl;
}
}
output << " end;\n";
break;
......@@ -1195,6 +1199,8 @@ DynamicModel::writeModelEquationsCode_Block(string &file_name, const string &bin
unsigned int varr = getBlockVariableID(block, var);
if (eq >= block_recursive and var >= block_recursive)
{
if (lag != 0 && (simulation_type == SOLVE_FORWARD_COMPLETE || simulation_type == SOLVE_BACKWARD_COMPLETE))
continue;
if (!Uf[eqr].Ufl)
{
Uf[eqr].Ufl = (Uff_l *) malloc(sizeof(Uff_l));
......@@ -1547,6 +1553,8 @@ DynamicModel::Write_Inf_To_Bin_File_Block(const string &dynamic_basename, const
unsigned int eq = it->first.first;
unsigned int var = it->first.second;
int lag = it->second.first;
if (lag != 0 && !is_two_boundaries)
continue;
if (eq >= block_recursive && var >= block_recursive)
{
int v = eq - block_recursive;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment