Skip to content

Commit

Permalink
Fixed bug (infinite loop) in building when equations.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@2087 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Feb 6, 2006
1 parent 992c674 commit 9cb1bce
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Compiler/Main.rml
Expand Up @@ -409,9 +409,10 @@ relation optimize_dae: (SCode.Program, DAE.DAElist, DAE.DAElist, Absyn.Path) =>
& Debug.fcall("bltdump", DAELow.dump,dlow')
& Debug.fcall("bltdump", DAELow.dump_matching, v1)
& DAELow.strong_components(m,mT,v1,v2) => (comps)
& Debug.fcall("bltdump",DAELow.dump_components,comps)
& modpar(dlow',v1,v2,comps)
& simcodegen(classname,p,daeimpl,dlow',v1,v2,m,mT,comps)
& Debug.fcall("bltdump",DAELow.dump_components,comps)

-----------------------
optimize_dae(p,dae,daeimpl,classname) => ()

Expand Down
15 changes: 8 additions & 7 deletions Compiler/SimCodegen.rml
Expand Up @@ -1505,11 +1505,13 @@ relation add_missing_equations: (int, int list) => int list =
--------------------------------------------------
add_missing_equations(n,lst) => lst'


(* missing equations must be added in correct order,
required in building when_condiriont_cheks4*)
rule n - 1 => n' &
add_missing_equations(n',n::lst) => lst'
add_missing_equations(n',lst) => lst' &
list_append(lst',[n]) => lst''
--------------------------------------------------
add_missing_equations(n,lst) => lst'
add_missing_equations(n,lst) => lst''
end


Expand Down Expand Up @@ -1867,12 +1869,11 @@ relation generate_ode_system2_nonlinear_residuals: (Exp.ComponentRef list,
int_string(id) => str_id &
list_length(eqns) => eqn_size & int_string(eqn_size) => size_str &
string_append("residualFunc",str_id) => func_name &
Codegen.c_make_function("int",func_name,[],["int *n",
"double* xloca",
Codegen.c_make_function("void",func_name,[],["int *n",
"double* xloc",
"double* res",
"int* iflag"]
)=> res_func' &
Codegen.c_add_cleanups(res_func', ["return 0;"]) => res_func &
)=> res_func &
Codegen.c_merge_fns([res_func,s1]) => func &

generate_ode_system2_nonlinear_setvector(crs,0,cg_id1)
Expand Down
3 changes: 3 additions & 0 deletions c_runtime/modelica.h
Expand Up @@ -63,6 +63,9 @@ typedef modelica_real sin_rettype;
typedef modelica_real pre_rettype;
typedef modelica_real edge_rettype;
typedef modelica_real initial_rettype;
typedef modelica_real exp_rettype;


#if defined(__cplusplus)
}
#endif
Expand Down

0 comments on commit 9cb1bce

Please sign in to comment.