Bug correction in the deterministic simulation: to solve a purely backward or forward looking block requires contemporaneous derivatives only.
parent
0a3c8a4b0c
commit
98c371f735
|
@ -646,12 +646,16 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
|
||||||
unsigned int varr = getBlockVariableID(block, var);
|
unsigned int varr = getBlockVariableID(block, var);
|
||||||
expr_t id = it->second.second;
|
expr_t id = it->second.second;
|
||||||
int lag = it->second.first;
|
int lag = it->second.first;
|
||||||
output << " g1(" << eq+1 << ", " << var+1-block_recursive << ") = ";
|
if (lag == 0)
|
||||||
id->writeOutput(output, local_output_type, local_temporary_terms);
|
{
|
||||||
output << "; % variable=" << symbol_table.getName(symbol_table.getID(eEndogenous, varr))
|
output << " g1(" << eq+1 << ", " << var+1-block_recursive << ") = ";
|
||||||
<< "(" << lag
|
id->writeOutput(output, local_output_type, local_temporary_terms);
|
||||||
<< ") " << varr+1
|
output << "; % variable=" << symbol_table.getName(symbol_table.getID(eEndogenous, varr))
|
||||||
<< ", equation=" << eqr+1 << endl;
|
<< "(" << lag
|
||||||
|
<< ") " << varr+1
|
||||||
|
<< ", equation=" << eqr+1 << endl;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
output << " end;\n";
|
output << " end;\n";
|
||||||
break;
|
break;
|
||||||
|
@ -1195,6 +1199,8 @@ DynamicModel::writeModelEquationsCode_Block(string &file_name, const string &bin
|
||||||
unsigned int varr = getBlockVariableID(block, var);
|
unsigned int varr = getBlockVariableID(block, var);
|
||||||
if (eq >= block_recursive and var >= block_recursive)
|
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)
|
if (!Uf[eqr].Ufl)
|
||||||
{
|
{
|
||||||
Uf[eqr].Ufl = (Uff_l *) malloc(sizeof(Uff_l));
|
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 eq = it->first.first;
|
||||||
unsigned int var = it->first.second;
|
unsigned int var = it->first.second;
|
||||||
int lag = it->second.first;
|
int lag = it->second.first;
|
||||||
|
if (lag != 0 && !is_two_boundaries)
|
||||||
|
continue;
|
||||||
if (eq >= block_recursive && var >= block_recursive)
|
if (eq >= block_recursive && var >= block_recursive)
|
||||||
{
|
{
|
||||||
int v = eq - block_recursive;
|
int v = eq - block_recursive;
|
||||||
|
|
Loading…
Reference in New Issue