diff --git a/Compiler/SimCode.mo b/Compiler/SimCode.mo
index 5316005c9a6..4eaca806f00 100644
--- a/Compiler/SimCode.mo
+++ b/Compiler/SimCode.mo
@@ -7547,6 +7547,27 @@ algorithm
end matchcontinue;
end printExpOptStrIfConst;
+public function makeCrefRecordExp
+"function: makeCrefRecordExp
+ Helper function to generate records."
+ input DAE.ComponentRef inCRefRecord;
+ input DAE.ExpVar inVar;
+ output DAE.Exp outExp;
+algorithm
+ outExp := matchcontinue (inCRefRecord,inVar)
+ local
+ DAE.ComponentRef cr,cr1;
+ String name;
+ DAE.ExpType tp;
+ case (cr,DAE.COMPLEX_VAR(name=name,tp=tp))
+ equation
+ cr1 = Exp.extendCref(cr,tp,name,{});
+ outExp = Exp.makeCrefExp(cr1,tp);
+ then
+ outExp;
+ end matchcontinue;
+end makeCrefRecordExp;
+
/*****************************************************************************/
/* */
/* END OF DIRTY SIMCODEGEN FUNCTIONS */
diff --git a/Compiler/SimCodeC.mo b/Compiler/SimCodeC.mo
index 9d46ae989de..036c1963809 100644
--- a/Compiler/SimCodeC.mo
+++ b/Compiler/SimCodeC.mo
@@ -17750,6 +17750,7 @@ protected function fun_409
input Tpl.Text in_txt;
input SimCode.Context in_i_context;
input DAE.ComponentRef in_i_cr;
+ input DAE.ExpType in_i_t;
input Tpl.Text in_i_varDecls;
input Tpl.Text in_i_preExp;
input DAE.Exp in_i_exp;
@@ -17759,10 +17760,11 @@ protected function fun_409
output Tpl.Text out_i_preExp;
algorithm
(out_txt, out_i_varDecls, out_i_preExp) :=
- matchcontinue(in_txt, in_i_context, in_i_cr, in_i_varDecls, in_i_preExp, in_i_exp)
+ matchcontinue(in_txt, in_i_context, in_i_cr, in_i_t, in_i_varDecls, in_i_preExp, in_i_exp)
local
Tpl.Text txt;
DAE.ComponentRef i_cr;
+ DAE.ExpType i_t;
Tpl.Text i_varDecls;
Tpl.Text i_preExp;
DAE.Exp i_exp;
@@ -17770,6 +17772,7 @@ algorithm
case ( txt,
(i_context as SimCode.FUNCTION_CONTEXT()),
_,
+ _,
i_varDecls,
i_preExp,
i_exp )
@@ -17782,13 +17785,14 @@ algorithm
case ( txt,
i_context,
i_cr,
+ i_t,
i_varDecls,
i_preExp,
_ )
local
SimCode.Context i_context;
equation
- (txt, i_preExp, i_varDecls) = daeExpRecordCrefRhs(txt, i_cr, i_context, i_preExp, i_varDecls);
+ (txt, i_preExp, i_varDecls) = daeExpRecordCrefRhs(txt, i_t, i_cr, i_context, i_preExp, i_varDecls);
then (txt, i_varDecls, i_preExp);
end matchcontinue;
end fun_409;
@@ -17813,15 +17817,16 @@ algorithm
Tpl.Text i_varDecls;
case ( txt,
- (i_exp as DAE.CREF(componentRef = (i_cr as DAE.CREF_IDENT(subscriptLst = {})), ty = DAE.ET_COMPLEX(complexClassType = ClassInf.RECORD(path = _)))),
+ (i_exp as DAE.CREF(componentRef = i_cr, ty = (i_t as DAE.ET_COMPLEX(complexClassType = ClassInf.RECORD(path = _))))),
i_context,
i_preExp,
i_varDecls )
local
+ DAE.ExpType i_t;
DAE.ComponentRef i_cr;
DAE.Exp i_exp;
equation
- (txt, i_varDecls, i_preExp) = fun_409(txt, i_context, i_cr, i_varDecls, i_preExp, i_exp);
+ (txt, i_varDecls, i_preExp) = fun_409(txt, i_context, i_cr, i_t, i_varDecls, i_preExp, i_exp);
then (txt, i_preExp, i_varDecls);
case ( txt,
@@ -18384,7 +18389,44 @@ algorithm
end matchcontinue;
end lm_420;
-protected function fun_421
+protected function lm_421
+ input Tpl.Text in_txt;
+ input list