diff --git a/Compiler/SimCodeC.mo b/Compiler/SimCodeC.mo index be5a2dc7b50..ab31d20c7b3 100644 --- a/Compiler/SimCodeC.mo +++ b/Compiler/SimCodeC.mo @@ -20282,6 +20282,32 @@ algorithm txt = Tpl.writeText(txt, i_tvar); then (txt, i_preExp, i_varDecls); + case ( txt, + DAE.CALL(tuple_ = false, builtin = true, path = Absyn.IDENT(name = "min"), expLst = {i_array}), + i_context, + i_preExp, + i_varDecls ) + local + DAE.Exp i_array; + Tpl.Text txt_3; + Tpl.Text i_tvar; + Tpl.Text i_arr__tp__str; + Tpl.Text i_expVar; + equation + (i_expVar, i_preExp, i_varDecls) = daeExp(emptyTxt, i_array, i_context, i_preExp, i_varDecls); + i_arr__tp__str = expTypeFromExpArray(emptyTxt, i_array); + txt_3 = expTypeFromExpModelica(emptyTxt, i_array); + (i_tvar, i_varDecls) = tempDecl(emptyTxt, Tpl.textString(txt_3), i_varDecls); + i_preExp = Tpl.writeText(i_preExp, i_tvar); + i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_STRING(" = min_")); + i_preExp = Tpl.writeText(i_preExp, i_arr__tp__str); + i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_STRING("(&")); + i_preExp = Tpl.writeText(i_preExp, i_expVar); + i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_STRING(");")); + i_preExp = Tpl.writeTok(i_preExp, Tpl.ST_NEW_LINE()); + txt = Tpl.writeText(txt, i_tvar); + then (txt, i_preExp, i_varDecls); + case ( txt, DAE.CALL(tuple_ = false, builtin = true, path = Absyn.IDENT(name = "promote"), expLst = {i_A, i_n}), i_context, diff --git a/Compiler/susan_codegen/SimCode/SimCodeC.tpl b/Compiler/susan_codegen/SimCode/SimCodeC.tpl index 2e689ddd29e..96a1fdc3638 100644 --- a/Compiler/susan_codegen/SimCode/SimCodeC.tpl +++ b/Compiler/susan_codegen/SimCode/SimCodeC.tpl @@ -3691,6 +3691,14 @@ template daeExpCall(Exp call, Context context, Text &preExp /*BUFP*/, let tvar = tempDecl(expTypeFromExpModelica(array), &varDecls /*BUFC*/) let &preExp += '<%tvar%> = max_<%arr_tp_str%>(&<%expVar%>);<%\n%>' tvar + case CALL(tuple_=false, builtin=true, + path=IDENT(name="min"), expLst={array}) then + let expVar = daeExp(array, context, &preExp /*BUFC*/, &varDecls /*BUFC*/) + let arr_tp_str = '<%expTypeFromExpArray(array)%>' + let tvar = tempDecl(expTypeFromExpModelica(array), &varDecls /*BUFC*/) + let &preExp += '<%tvar%> = min_<%arr_tp_str%>(&<%expVar%>);<%\n%>' + tvar + case CALL(tuple_=false, builtin=true, path=IDENT(name="promote"), expLst={A, n}) then let var1 = daeExp(A, context, &preExp /*BUFC*/, &varDecls /*BUFC*/)