- For static model considers two different management cases for temporary terms: one for an evaluated model and another for a simulated model
parent
c6febbccb1
commit
1b5418a882
|
@ -658,6 +658,12 @@ StaticModel::writeModelEquationsCode_Block(const string file_name, const string
|
||||||
|
|
||||||
fbeginblock.write(code_file, instruction_number);
|
fbeginblock.write(code_file, instruction_number);
|
||||||
|
|
||||||
|
// Get the current code_file position and jump if eval = true
|
||||||
|
streampos pos1 = code_file.tellp();
|
||||||
|
FJMPIFEVAL_ fjmp_if_eval(0);
|
||||||
|
fjmp_if_eval.write(code_file, instruction_number);
|
||||||
|
int prev_instruction_number = instruction_number;
|
||||||
|
|
||||||
for (i = 0; i < (int) block_size; i++)
|
for (i = 0; i < (int) block_size; i++)
|
||||||
{
|
{
|
||||||
//The Temporary terms
|
//The Temporary terms
|
||||||
|
@ -740,11 +746,7 @@ StaticModel::writeModelEquationsCode_Block(const string file_name, const string
|
||||||
FENDEQU_ fendequ;
|
FENDEQU_ fendequ;
|
||||||
fendequ.write(code_file, instruction_number);
|
fendequ.write(code_file, instruction_number);
|
||||||
|
|
||||||
// Get the current code_file position and jump if eval = true
|
|
||||||
streampos pos1 = code_file.tellp();
|
|
||||||
FJMPIFEVAL_ fjmp_if_eval(0);
|
|
||||||
fjmp_if_eval.write(code_file, instruction_number);
|
|
||||||
int prev_instruction_number = instruction_number;
|
|
||||||
|
|
||||||
// The Jacobian if we have to solve the block
|
// The Jacobian if we have to solve the block
|
||||||
if (simulation_type != EVALUATE_BACKWARD
|
if (simulation_type != EVALUATE_BACKWARD
|
||||||
|
@ -858,6 +860,7 @@ StaticModel::writeModelEquationsCode_Block(const string file_name, const string
|
||||||
tt2.clear();
|
tt2.clear();
|
||||||
temporary_terms_t tt3;
|
temporary_terms_t tt3;
|
||||||
tt3.clear();
|
tt3.clear();
|
||||||
|
deriv_node_temp_terms_t tef_terms2;
|
||||||
|
|
||||||
for (i = 0; i < (int) block_size; i++)
|
for (i = 0; i < (int) block_size; i++)
|
||||||
{
|
{
|
||||||
|
@ -867,7 +870,7 @@ StaticModel::writeModelEquationsCode_Block(const string file_name, const string
|
||||||
it != v_temporary_terms_local[block][i].end(); it++)
|
it != v_temporary_terms_local[block][i].end(); it++)
|
||||||
{
|
{
|
||||||
if (dynamic_cast<ExternalFunctionNode *>(*it) != NULL)
|
if (dynamic_cast<ExternalFunctionNode *>(*it) != NULL)
|
||||||
(*it)->compileExternalFunctionOutput(code_file, instruction_number, false, tt3, map_idx2[block], false, false, tef_terms);
|
(*it)->compileExternalFunctionOutput(code_file, instruction_number, false, tt3, map_idx2[block], false, false, tef_terms2);
|
||||||
|
|
||||||
FNUMEXPR_ fnumexpr(TemporaryTerm, (int)(map_idx2[block].find((*it)->idx)->second));
|
FNUMEXPR_ fnumexpr(TemporaryTerm, (int)(map_idx2[block].find((*it)->idx)->second));
|
||||||
fnumexpr.write(code_file, instruction_number);
|
fnumexpr.write(code_file, instruction_number);
|
||||||
|
@ -900,16 +903,16 @@ StaticModel::writeModelEquationsCode_Block(const string file_name, const string
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
|
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
|
||||||
lhs = eq_node->get_arg1();
|
lhs = eq_node->get_arg1();
|
||||||
rhs = eq_node->get_arg2();
|
rhs = eq_node->get_arg2();
|
||||||
rhs->compile(code_file, instruction_number, false, tt2/*temporary_terms*/, map_idx2[block], false, false);
|
rhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
|
||||||
lhs->compile(code_file, instruction_number, true, tt2/*temporary_terms*/, map_idx2[block], false, false);
|
lhs->compile(code_file, instruction_number, true, tt2, map_idx2[block], false, false);
|
||||||
}
|
}
|
||||||
else if (equ_type == E_EVALUATE_S)
|
else if (equ_type == E_EVALUATE_S)
|
||||||
{
|
{
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationRenormalizedExpr(block, i);
|
eq_node = (BinaryOpNode *) getBlockEquationRenormalizedExpr(block, i);
|
||||||
lhs = eq_node->get_arg1();
|
lhs = eq_node->get_arg1();
|
||||||
rhs = eq_node->get_arg2();
|
rhs = eq_node->get_arg2();
|
||||||
rhs->compile(code_file, instruction_number, false, tt2/*temporary_terms*/, map_idx2[block], false, false);
|
rhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
|
||||||
lhs->compile(code_file, instruction_number, true, tt2/*temporary_terms*/, map_idx2[block], false, false);
|
lhs->compile(code_file, instruction_number, true, tt2, map_idx2[block], false, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SOLVE_BACKWARD_COMPLETE:
|
case SOLVE_BACKWARD_COMPLETE:
|
||||||
|
@ -928,8 +931,8 @@ StaticModel::writeModelEquationsCode_Block(const string file_name, const string
|
||||||
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
|
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
|
||||||
lhs = eq_node->get_arg1();
|
lhs = eq_node->get_arg1();
|
||||||
rhs = eq_node->get_arg2();
|
rhs = eq_node->get_arg2();
|
||||||
lhs->compile(code_file, instruction_number, false, tt2/*temporary_terms*/, map_idx2[block], false, false);
|
lhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
|
||||||
rhs->compile(code_file, instruction_number, false, tt2/*temporary_terms*/, map_idx2[block], false, false);
|
rhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
|
||||||
|
|
||||||
FBINARY_ fbinary(oMinus);
|
FBINARY_ fbinary(oMinus);
|
||||||
fbinary.write(code_file, instruction_number);
|
fbinary.write(code_file, instruction_number);
|
||||||
|
|
Loading…
Reference in New Issue