Skip to content

Commit 2a9a46e

Browse files
author
x02lucpo
committed
implemented translateModel
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1872 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 846eb9d commit 2a9a46e

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

Compiler/Ceval.rml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,14 +1108,30 @@ end
11081108
ceval_interactive_functions (env, Exp.CALL(Absyn.IDENT("jacobian"),[Exp.CREF(cr,_)],_,_),st as Interactive.SYMBOLTABLE(p,sp,ic,iv,cf))
11091109
=> (Values.STRING(res),Interactive.SYMBOLTABLE(p,sp,ic',iv,cf))
11101110

1111-
rule System.read_env("OPENMODELICAHOME") => omhome &
1112-
Static.component_ref_to_path(cr) => path &
1113-
Absyn.path_string path => pathstr &
1114-
Print.print_error_buf "#Failed to instantiate " &
1115-
Print.print_error_buf pathstr & Print.print_error_buf " .\n" &
1116-
Print.get_error_string() => str
1111+
rule Static.component_ref_to_path(cr) => classname &
1112+
SCode.elaborate(p) => p' &
1113+
Inst.instantiate_class(p',classname) => (dae as DAE.DAE(dael),env) &
1114+
Interactive.add_instantiated_class(ic,Interactive.INSTCLASS(classname,dael,env))
1115+
=> ic' &
1116+
DAELow.lower(dae) => dlow &
1117+
DAELow.incidence_matrix(dlow) => m &
1118+
DAELow.transpose_matrix(m) => mT &
1119+
DAELow.matching_algorithm(dlow,m,mT) => (ass1,ass2,dlow',m,mT) &
1120+
DAELow.strong_components(m,mT,ass1,ass2) => (comps) &
1121+
DAELow.translate_dae (dlow') => indexed_dlow &
1122+
DAELow.calculate_values(indexed_dlow) => indexed_dlow' &
1123+
Absyn.path_string(classname) => cname_str &
1124+
Util.string_append_list([cname_str,".cpp"]) => filename &
1125+
Util.string_append_list([cname_str,"_functions.cpp"]) => funcfilename &
1126+
Util.string_append_list([cname_str,".makefile"]) => makefilename &
1127+
SimCodegen.generate_functions(dae,indexed_dlow',classname,funcfilename) &
1128+
SimCodegen.generate_simulation_code(dae,indexed_dlow',ass1,ass2,m,mT,comps,classname,filename) &
1129+
SimCodegen.generate_makefile(makefilename,classname)
1130+
(* Util.string_append_list(["make -f ",cname_str, ".makefile\n"]) => s_call &
1131+
*)
11171132
-------------------------
1118-
ceval_interactive_functions (env, Exp.CALL(Absyn.IDENT("translateModel"),[Exp.CREF(cr,_)],_,_),st as Interactive.SYMBOLTABLE(p,sp,ic,iv,cf)) => (Values.STRING(str),st)
1133+
ceval_interactive_functions (env, Exp.CALL(Absyn.IDENT("translateModel"),[Exp.CREF(cr,_)],_,_),st as Interactive.SYMBOLTABLE(p,sp,ic,iv,cf))
1134+
=> (Values.STRING("The model have been translated"),st)
11191135

11201136
axiom
11211137
ceval_interactive_functions (env, Exp.CALL(Absyn.IDENT("translateModel"),[Exp.CREF(cr,_)],_,_),st as Interactive.SYMBOLTABLE(p,sp,ic,iv,cf))

0 commit comments

Comments
 (0)