Changeset 13990


Ignore:
Timestamp:
Nov 7, 2019 4:20:33 PM (13 days ago)
Author:
Christian Andersson
Message:

Reworked the code for domain checks. Related to ticket:5868

Location:
branches/dev-cw-2658/Compiler/ModelicaCBackEnd
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-cw-2658/Compiler/ModelicaCBackEnd/src/jastadd/CCodeGen/CCodeGenExpressions.jrag

    r13949 r13990  
    3636    @Override
    3737    public void FAbsExp.prettyPrint_C(CodePrinter p, CodeStream str, String indent) {
    38         String prefix = "jmi_abs(";
    39         str.print(myOptions().mathematical_domain_checks.getValue() ? prefix : prefix.toUpperCase());
     38        str.print("JMI_ABS_EQUATION(");
    4039        p.print(getFExp(), str, indent);
    4140        str.print(")");
     
    4443    @Override
    4544    public void FSignExp.prettyPrint_C(CodePrinter p, CodeStream str, String indent) {
    46         String prefix = "jmi_sign(";
    47         str.print(myOptions().mathematical_domain_checks.getValue() ? prefix : prefix.toUpperCase());
     45        str.print("JMI_SIGN_EQUATION(");
    4846        p.print(getFExp(), str, indent);
    4947        str.print(")");
     
    5250    @Override
    5351    public void FMinMaxExp.prettyPrint_C(CodePrinter p, CodeStream str, String indent) {
    54         String prefix = "jmi_" + builtInName() + "(";
    55         str.print(myOptions().mathematical_domain_checks.getValue() ? prefix : prefix.toUpperCase());
     52        str.print("JMI_" + builtInName().toUpperCase() + "_EQUATION(");
    5653        p.print(getX(), str, indent);
    5754        str.print(", ");
     
    421418    protected void RuntimeCallComputation.prettyPrintHead(CodePrinter.ExecuteCodePrinter p, CodeStream str, String indent, FExp ctx, FExp[] inputs, FExp[] outputs) {
    422419        boolean func = ctx.inFunction();
    423         boolean domainCheck = ctx.myOptions().mathematical_domain_checks.getValue();
    424         String prefix = "jmi_" + p.guardedFunctionName(ctx) + (func ? "_function(" : "_equation(");
    425         str.print(domainCheck ? prefix : prefix.toUpperCase());
     420        str.print(("jmi_" + p.guardedFunctionName(ctx) + (func ? "_function(" : "_equation(")).toUpperCase());
    426421        str.print(func ? "\"" + ctx.containingFFunctionDecl().name() + "\", ": "jmi, ");
    427422        p.codePrinter().print(this, str, indent, CFuncParamDirection.INPUT, Arrays.asList(inputs));
  • branches/dev-cw-2658/Compiler/ModelicaCBackEnd/src/jastadd/CCodeGen/CGenerator.jrag

    r13798 r13990  
    310310   
    311311    }
    312 
     312   
     313    /**
     314     * C: defines for the C code
     315     */
     316    public class DAETag_C_defines extends DAETag {
     317       
     318        public DAETag_C_defines(AbstractGenerator myGenerator, FClass fclass) {
     319            super("C_defines", myGenerator, fclass);
     320        }
     321       
     322        public void generate(CodeStream genPrinter) {
     323            if (fclass.myOptions().mathematical_domain_checks.getValue()) {
     324                genPrinter.print("   #define MATHEMATICAL_DOMAIN_CHECKS");
     325            }
     326        }
     327    }
    313328    /**
    314329     * C: macros for C variable aliases
  • branches/dev-cw-2658/Compiler/ModelicaCBackEnd/test/modelica/CCodeGenAlgorithmTests.mo

    r13949 r13990  
    16801680    int ef = 0;
    16811681    JMI_DYNAMIC_INIT()
    1682     _x_0 = jmi_sin_equation(jmi, _time * 10.0, \"sin(time * 10)\");
     1682    _x_0 = JMI_SIN_EQUATION(jmi, _time * 10.0, \"sin(time * 10)\");
    16831683    if (jmi->atInitial || jmi->atEvent) {
    16841684        _sw(1) = jmi_turn_switch(jmi, _x_0 - (0.7), _sw(1), JMI_REL_LT);
     
    17021702    int ef = 0;
    17031703    JMI_DYNAMIC_INIT()
    1704     _x_0 = jmi_sin_equation(jmi, _time * 10.0, \"sin(time * 10)\");
     1704    _x_0 = JMI_SIN_EQUATION(jmi, _time * 10.0, \"sin(time * 10)\");
    17051705    if (jmi->atInitial || jmi->atEvent) {
    17061706        _sw(0) = jmi_turn_switch(jmi, _x_0 - (0.7), _sw(0), JMI_REL_GEQ);
     
    24122412        _x_2 = (tmp_3);
    24132413        if (evaluation_mode & JMI_BLOCK_EVALUATE) {
    2414             (*res)[0] = jmi_divide_equation(jmi, _x_2, 2, \"x / 2\") - (_y_3);
     2414            (*res)[0] = JMI_DIVIDE_EQUATION(jmi, _x_2, 2, \"x / 2\") - (_y_3);
    24152415        }
    24162416    }
  • branches/dev-cw-2658/Compiler/ModelicaCBackEnd/test/modelica/CCodeGenArrayTests.mo

    r13949 r13990  
    4949    }
    5050    temp_1_v = temp_2_v;
    51     y_v = jmi_sqrt_function(\"CCodeGenArrayTests.VectorLength1.f\", temp_1_v, \"sqrt(temp_1)\");
     51    y_v = JMI_SQRT_FUNCTION(\"CCodeGenArrayTests.VectorLength1.f\", temp_1_v, \"sqrt(temp_1)\");
    5252    JMI_RET(GEN, y_o, y_v)
    5353    JMI_DYNAMIC_FREE()
  • branches/dev-cw-2658/Compiler/ModelicaCBackEnd/test/modelica/CCodeGenDynamicStatesTests.mo

    r13168 r13990  
    3333        annotation(__JModelica(UnitTesting(tests={
    3434            CCodeGenTestCase(
    35                 name="DynamicStates_ThreeDSOneEq",
     35                name="ThreeDSOneEq",
    3636                description="Test code gen for dynamic state model with three states in one equation",
    3737                dynamic_states=true,
     
    8383        _a3_2 = __ds_1_s1_5;
    8484        _a1_0 = __ds_1_s2_6;
    85         _a2_1 = jmi_divide_equation(jmi, 1, (_a1_0 * _a3_2), \"1 / (ds(1, a1) * ds(1, a3))\");
     85        _a2_1 = JMI_DIVIDE_EQUATION(jmi, 1, (_a1_0 * _a3_2), \"1 / (ds(1, a1) * ds(1, a3))\");
    8686        __ds_1_a1_4 = _a2_1;
    8787    } else if (jmi_dynamic_state_check_is_state(jmi, 0, 5, 4)) {
    8888        _a2_1 = __ds_1_s1_5;
    8989        _a1_0 = __ds_1_s2_6;
    90         _a3_2 = jmi_divide_equation(jmi, 1, (_a1_0 * _a2_1), \"1 / (ds(1, a1) * ds(1, a2))\");
     90        _a3_2 = JMI_DIVIDE_EQUATION(jmi, 1, (_a1_0 * _a2_1), \"1 / (ds(1, a1) * ds(1, a2))\");
    9191        __ds_1_a1_4 = _a3_2;
    9292    } else if (jmi_dynamic_state_check_is_state(jmi, 0, 5, 6)) {
    9393        _a2_1 = __ds_1_s1_5;
    9494        _a3_2 = __ds_1_s2_6;
    95         _a1_0 = jmi_divide_equation(jmi, 1, (_a2_1 * _a3_2), \"1 / (ds(1, a2) * ds(1, a3))\");
     95        _a1_0 = JMI_DIVIDE_EQUATION(jmi, 1, (_a2_1 * _a3_2), \"1 / (ds(1, a2) * ds(1, a3))\");
    9696        __ds_1_a1_4 = _a1_0;
    9797    }
     
    423423        annotation(__JModelica(UnitTesting(tests={
    424424            CCodeGenTestCase(
    425                 name="DynamicStates_Pendulum",
     425                name="Pendulum",
    426426                description="Test code gen for dynamic state related parts of the pendulum model",
    427427                dynamic_states=true,
     
    501501        __der_y_10 = __ds_1_s1_12;
    502502        _der_y_18 = __der_y_10;
    503         _der_x_17 = jmi_divide_equation(jmi, (- 2 * _y_3 * _der_y_18), (2 * _x_2), \"(- 2 * ds(2, y) * dynDer(y)) / (2 * ds(2, x))\");
     503        _der_x_17 = JMI_DIVIDE_EQUATION(jmi, (- 2 * _y_3 * _der_y_18), (2 * _x_2), \"(- 2 * ds(2, y) * dynDer(y)) / (2 * ds(2, x))\");
    504504        __der_x_9 = _der_x_17;
    505505        __ds_1_a1_11 = __der_x_9;
     
    507507        __der_x_9 = __ds_1_s1_12;
    508508        _der_x_17 = __der_x_9;
    509         _der_y_18 = jmi_divide_equation(jmi, (- 2 * _x_2 * _der_x_17), (2 * _y_3), \"(- 2 * ds(2, x) * dynDer(x)) / (2 * ds(2, y))\");
     509        _der_y_18 = JMI_DIVIDE_EQUATION(jmi, (- 2 * _x_2 * _der_x_17), (2 * _y_3), \"(- 2 * ds(2, x) * dynDer(x)) / (2 * ds(2, y))\");
    510510        __der_y_10 = _der_y_18;
    511511        __ds_1_a1_11 = __der_y_10;
     
    538538        x[0] = 7;
    539539    } else if (evaluation_mode == JMI_BLOCK_EQUATION_NOMINAL_AUTO) {
    540         (*res)[0] = jmi_max(jmi_max(1.0, 1.0), jmi_abs(_L_0));
     540        (*res)[0] = JMI_MAX_EQUATION(JMI_MAX_EQUATION(1.0, 1.0), JMI_ABS_EQUATION(_L_0));
    541541    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    542542        x[0] = _y_3;
     
    561561        x[0] = 6;
    562562    } else if (evaluation_mode == JMI_BLOCK_EQUATION_NOMINAL_AUTO) {
    563         (*res)[0] = jmi_max(jmi_max(1.0, 1.0), jmi_abs(_L_0));
     563        (*res)[0] = JMI_MAX_EQUATION(JMI_MAX_EQUATION(1.0, 1.0), JMI_ABS_EQUATION(_L_0));
    564564    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    565565        x[0] = _x_2;
     
    11511151        name="PreBlock1",
    11521152        description="Dynamic state block inside pre block",
    1153         template="
    1154 $C_dae_blocks_residual_functions$
    1155 ",
    1156     generatedCode="
     1153        template="$C_dae_blocks_residual_functions$",
     1154        generatedCode="
    11571155static int dae_block_1(jmi_t* jmi, jmi_real_t* x, jmi_real_t* residual, int evaluation_mode) {
    11581156    /***** Block: 1.2 *****/
     
    12361234        if (jmi_dynamic_state_check_is_state(jmi, 0, 4)) {
    12371235            _a1_0 = __ds_1_s1_7;
    1238             _a2_1 = jmi_divide_equation(jmi, COND_EXP_EQ(LOG_EXP_AND(_b2_3, LOG_EXP_NOT(pre_b2_3)), JMI_TRUE, 1.0, _time), _a1_0, \"(if b2 and not pre(b2) then 1 else time) / ds(1, a1)\");
     1236            _a2_1 = JMI_DIVIDE_EQUATION(jmi, COND_EXP_EQ(LOG_EXP_AND(_b2_3, LOG_EXP_NOT(pre_b2_3)), JMI_TRUE, 1.0, _time), _a1_0, \"(if b2 and not pre(b2) then 1 else time) / ds(1, a1)\");
    12391237            __ds_1_a1_6 = _a2_1;
    12401238        } else if (jmi_dynamic_state_check_is_state(jmi, 0, 5)) {
    12411239            _a2_1 = __ds_1_s1_7;
    1242             _a1_0 = jmi_divide_equation(jmi, COND_EXP_EQ(LOG_EXP_AND(_b2_3, LOG_EXP_NOT(pre_b2_3)), JMI_TRUE, 1.0, _time), _a2_1, \"(if b2 and not pre(b2) then 1 else time) / ds(1, a2)\");
     1240            _a1_0 = JMI_DIVIDE_EQUATION(jmi, COND_EXP_EQ(LOG_EXP_AND(_b2_3, LOG_EXP_NOT(pre_b2_3)), JMI_TRUE, 1.0, _time), _a2_1, \"(if b2 and not pre(b2) then 1 else time) / ds(1, a2)\");
    12431241            __ds_1_a1_6 = _a1_0;
    12441242        }
     
    12501248    return ef;
    12511249}
     1250
    12521251")})));
    12531252end PreBlock1;
  • branches/dev-cw-2658/Compiler/ModelicaCBackEnd/test/modelica/CCodeGenGlobalsTests.mo

    r13908 r13990  
    10491049    i_0ie = floor((2) - (1));
    10501050    for (i_0i = 1; i_0in <= i_0ie; i_0i = 1 + (++i_0in)) {
    1051         y_v = jmi_pow_function(\"CCodeGenGlobalsTests.GlobalVariables.GlobalConstantForPowInt1.f\", y_v, jmi_array_val_1(JMI_GLOBAL(CCodeGenGlobalsTests_GlobalVariables_GlobalConstantForPowInt1_f_c), i_0i), \"y ^ global(CCodeGenGlobalsTests.GlobalVariables.GlobalConstantForPowInt1.f.c[i])\");
     1051        y_v = JMI_POW_FUNCTION(\"CCodeGenGlobalsTests.GlobalVariables.GlobalConstantForPowInt1.f\", y_v, jmi_array_val_1(JMI_GLOBAL(CCodeGenGlobalsTests_GlobalVariables_GlobalConstantForPowInt1_f_c), i_0i), \"y ^ global(CCodeGenGlobalsTests.GlobalVariables.GlobalConstantForPowInt1.f.c[i])\");
    10521052    }
    10531053    JMI_RET(GEN, y_o, y_v)
  • branches/dev-cw-2658/Compiler/ModelicaCBackEnd/test/modelica/CCodeGenJacobianTests.mo

    r13097 r13990  
    100100        x[1] = 3;
    101101    } else if (evaluation_mode == JMI_BLOCK_EQUATION_NOMINAL_AUTO) {
    102         (*res)[0] = jmi_max(jmi_abs(_b_2_4), jmi_max(1.0, jmi_abs(2.0)));
     102        (*res)[0] = JMI_MAX_EQUATION(JMI_ABS_EQUATION(_b_2_4), JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(2.0)));
    103103    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    104104        x[0] = _x_3_2;
     
    109109            _x_3_2 = x[0];
    110110        }
    111         _x_2_1 = jmi_divide_equation(jmi, (- _b_3_5 + _x_3_2), -2, \"(- b[3] + x[3]) / -2\");
    112         _x_1_0 = jmi_divide_equation(jmi, (- _b_1_3 + _x_2_1), -2, \"(- b[1] + x[2]) / -2\");
     111        _x_2_1 = JMI_DIVIDE_EQUATION(jmi, (- _b_3_5 + _x_3_2), -2, \"(- b[3] + x[3]) / -2\");
     112        _x_1_0 = JMI_DIVIDE_EQUATION(jmi, (- _b_1_3 + _x_2_1), -2, \"(- b[1] + x[2]) / -2\");
    113113        if (evaluation_mode & JMI_BLOCK_EVALUATE) {
    114114            (*res)[0] = _x_1_0 + 2 * _x_3_2 - (_b_2_4);
     
    302302        x[1] = 8;
    303303    } else if (evaluation_mode == JMI_BLOCK_EQUATION_NOMINAL_AUTO) {
    304         (*res)[0] = jmi_max(jmi_abs(_b_3_5), jmi_max(jmi_abs(2.0), 1.0));
     304        (*res)[0] = JMI_MAX_EQUATION(JMI_ABS_EQUATION(_b_3_5), JMI_MAX_EQUATION(JMI_ABS_EQUATION(2.0), 1.0));
    305305    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    306306        x[0] = _x_3_2;
     
    501501        x[1] = 3;
    502502    } else if (evaluation_mode == JMI_BLOCK_EQUATION_NOMINAL_AUTO) {
    503         (*res)[0] = jmi_max(jmi_abs(_b_2_4), jmi_max(1.0, jmi_abs(2.0)));
     503        (*res)[0] = JMI_MAX_EQUATION(JMI_ABS_EQUATION(_b_2_4), JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(2.0)));
    504504    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    505505        x[0] = _x_3_2;
     
    529529            _x_3_2 = x[0];
    530530        }
    531         _x_2_1 = jmi_divide_equation(jmi, (- _b_3_5 + _x_3_2), -2, \"(- b[3] + x[3]) / -2\");
    532         _x_1_0 = jmi_divide_equation(jmi, (- _b_1_3 + _x_2_1), -2, \"(- b[1] + x[2]) / -2\");
     531        _x_2_1 = JMI_DIVIDE_EQUATION(jmi, (- _b_3_5 + _x_3_2), -2, \"(- b[3] + x[3]) / -2\");
     532        _x_1_0 = JMI_DIVIDE_EQUATION(jmi, (- _b_1_3 + _x_2_1), -2, \"(- b[1] + x[2]) / -2\");
    533533        if (evaluation_mode & JMI_BLOCK_EVALUATE) {
    534534            (*res)[0] = _x_1_0 + 2 * _x_3_2 - (_b_2_4);
     
    575575        x[1] = 3;
    576576    } else if (evaluation_mode == JMI_BLOCK_EQUATION_NOMINAL_AUTO) {
    577         (*res)[0] = jmi_max(jmi_abs(_b_2_4), jmi_max(1.0, jmi_abs(2.0)));
     577        (*res)[0] = JMI_MAX_EQUATION(JMI_ABS_EQUATION(_b_2_4), JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(2.0)));
    578578    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    579579        x[0] = _x_3_2;
     
    584584            _x_3_2 = x[0];
    585585        }
    586         _x_2_1 = jmi_divide_equation(jmi, (- _b_3_5 + _x_3_2), -2, \"(- b[3] + x[3]) / -2\");
    587         _x_1_0 = jmi_divide_equation(jmi, (- _b_1_3 + _x_2_1), -2, \"(- b[1] + x[2]) / -2\");
     586        _x_2_1 = JMI_DIVIDE_EQUATION(jmi, (- _b_3_5 + _x_3_2), -2, \"(- b[3] + x[3]) / -2\");
     587        _x_1_0 = JMI_DIVIDE_EQUATION(jmi, (- _b_1_3 + _x_2_1), -2, \"(- b[1] + x[2]) / -2\");
    588588        if (evaluation_mode & JMI_BLOCK_EVALUATE) {
    589589            (*res)[0] = _x_1_0 + 2 * _x_3_2 - (_b_2_4);
     
    777777        x[0] = jmi->offs_sw + 0;
    778778    } else if (evaluation_mode == JMI_BLOCK_EQUATION_NOMINAL_AUTO) {
    779         (*res)[0] = jmi_max(jmi_abs(_b_1_3), jmi_max(jmi_max(jmi_abs(2.0), 1.0), jmi_max(1.0, 1.0)));
     779        (*res)[0] = JMI_MAX_EQUATION(JMI_ABS_EQUATION(_b_1_3), JMI_MAX_EQUATION(JMI_MAX_EQUATION(JMI_ABS_EQUATION(2.0), 1.0), JMI_MAX_EQUATION(1.0, 1.0)));
    780780    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    781781        x[0] = _x_1_0;
     
    805805            _x_1_0 = x[0];
    806806        }
    807         _x_3_2 = jmi_divide_equation(jmi, (- _b_2_4 + _x_1_0), -2, \"(- b[2] + x[1]) / -2\");
    808         _x_2_1 = jmi_divide_equation(jmi, (- _b_3_5 + _x_3_2), -2, \"(- b[3] + x[3]) / -2\");
     807        _x_3_2 = JMI_DIVIDE_EQUATION(jmi, (- _b_2_4 + _x_1_0), -2, \"(- b[2] + x[1]) / -2\");
     808        _x_2_1 = JMI_DIVIDE_EQUATION(jmi, (- _b_3_5 + _x_3_2), -2, \"(- b[3] + x[3]) / -2\");
    809809        if (evaluation_mode & JMI_BLOCK_EVALUATE) {
    810810            if (evaluation_mode & JMI_BLOCK_EVALUATE_NON_REALS) {
  • branches/dev-cw-2658/Compiler/ModelicaCBackEnd/test/modelica/CCodeGenTests.mo

    r13949 r13990  
    8181    JMI_DYNAMIC_INIT()
    8282    JMI_ARR(STACK, jmi_real_t, jmi_array_t, tmp_1, 16, 1)
    83     _x1_0 = jmi_abs(_time);
    84     _x2_1 = jmi_cos_equation(jmi, _time, \"cos(time)\");
    85     _x3_2 = jmi_sin_equation(jmi, _time, \"sin(time)\");
    86     _x4_3 = jmi_tan_equation(jmi, _time, \"tan(time)\");
    87     _x5_4 = jmi_acos_equation(jmi, _time, \"acos(time)\");
    88     _x6_5 = jmi_asin_equation(jmi, _time, \"asin(time)\");
    89     _x7_6 = jmi_atan_equation(jmi, _time, \"atan(time)\");
    90     _x8_7 = jmi_log_equation(jmi, _time, \"log(time)\");
    91     _x9_8 = jmi_log10_equation(jmi, _time, \"log10(time)\");
    92     _x10_9 = jmi_exp_equation(jmi, _time, \"exp(time)\");
    93     _x11_10 = jmi_pow_equation(jmi, _time, 10, \"time ^ 10\");
    94     _x12_11 = jmi_sqrt_equation(jmi, _time, \"sqrt(time)\");
    95     _x13_12 = jmi_sinh_equation(jmi, _time, \"sinh(time)\");
    96     _x14_13 = jmi_cosh_equation(jmi, _time, \"cosh(time)\");
    97     _x15_14 = jmi_tanh_equation(jmi, _time, \"tanh(time)\");
    98     _x16_15 = jmi_atan2_equation(jmi, _time, 2.0 * _time, \"atan2(time, 2 * time)\");
    99     _x17_16 = jmi_divide_equation(jmi, _time, _x16_15, \"time / x16\");
    100     _x18_17 = jmi_sign(_time);
    101     _x19_18 = jmi_max(_time, _x16_15);
    102     _x20_19 = jmi_min(_time, _x16_15);
    103     if (jmi->atInitial || jmi->atEvent) {
    104         _sw(0) = jmi_turn_switch(jmi, ((long)jmi_divide_equation(jmi, _time, 2.0 * _time, \"div(time, 2 * time)\")) - (pre_temp_2_37), _sw(0), JMI_REL_LT);
    105     }
    106     if (jmi->atInitial || jmi->atEvent) {
    107         _sw(1) = jmi_turn_switch(jmi, ((long)jmi_divide_equation(jmi, _time, 2.0 * _time, \"div(time, 2 * time)\")) - (pre_temp_2_37 + 1.0), _sw(1), JMI_REL_GEQ);
    108     }
    109     _temp_2_37 = COND_EXP_EQ(LOG_EXP_OR(LOG_EXP_OR(_sw(0), _sw(1)), _atInitial), JMI_TRUE, ((long)jmi_divide_equation(jmi, _time, 2.0 * _time, \"div(time, 2 * time)\")), pre_temp_2_37);
    110     pre_temp_2_37 = _temp_2_37;
    111     _x21_20 = _temp_2_37;
    112     JMI_ARRAY_INIT_1(STACK, jmi_real_t, jmi_array_t, tmp_1, 16, 1, 16)
    113     func_CCodeGenTests_DomainChecks1_operators_def0(_time, tmp_1);
    114     memcpy(&_o_1_21, &jmi_array_val_1(tmp_1, 1), 16 * sizeof(jmi_real_t));
    115     JMI_DYNAMIC_FREE()
    116     return ef;
    117 }
    118 
    119 void func_CCodeGenTests_DomainChecks1_operators_def0(jmi_real_t t_v, jmi_array_t* o_a) {
    120     JMI_DYNAMIC_INIT()
    121     JMI_ARR(STACK, jmi_real_t, jmi_array_t, o_an, 16, 1)
    122     if (o_a == NULL) {
    123         JMI_ARRAY_INIT_1(STACK, jmi_real_t, jmi_array_t, o_an, 16, 1, 16)
    124         o_a = o_an;
    125     }
    126     jmi_array_ref_1(o_a, 1) = jmi_cos_function(\"CCodeGenTests.DomainChecks1.operators\", t_v, \"cos(t)\");
    127     jmi_array_ref_1(o_a, 2) = jmi_sin_function(\"CCodeGenTests.DomainChecks1.operators\", t_v, \"sin(t)\");
    128     jmi_array_ref_1(o_a, 3) = jmi_acos_function(\"CCodeGenTests.DomainChecks1.operators\", t_v, \"acos(t)\");
    129     jmi_array_ref_1(o_a, 4) = jmi_asin_function(\"CCodeGenTests.DomainChecks1.operators\", t_v, \"asin(t)\");
    130     jmi_array_ref_1(o_a, 5) = jmi_atan_function(\"CCodeGenTests.DomainChecks1.operators\", t_v, \"atan(t)\");
    131     jmi_array_ref_1(o_a, 6) = jmi_log_function(\"CCodeGenTests.DomainChecks1.operators\", t_v, \"log(t)\");
    132     jmi_array_ref_1(o_a, 7) = jmi_log10_function(\"CCodeGenTests.DomainChecks1.operators\", t_v, \"log10(t)\");
    133     jmi_array_ref_1(o_a, 8) = jmi_exp_function(\"CCodeGenTests.DomainChecks1.operators\", t_v, \"exp(t)\");
    134     jmi_array_ref_1(o_a, 9) = jmi_pow_function(\"CCodeGenTests.DomainChecks1.operators\", t_v, 10, \"t ^ 10\");
    135     jmi_array_ref_1(o_a, 10) = jmi_sqrt_function(\"CCodeGenTests.DomainChecks1.operators\", _time, \"sqrt(time)\");
    136     jmi_array_ref_1(o_a, 11) = jmi_cosh_function(\"CCodeGenTests.DomainChecks1.operators\", _time, \"cosh(time)\");
    137     jmi_array_ref_1(o_a, 12) = jmi_sinh_function(\"CCodeGenTests.DomainChecks1.operators\", _time, \"sinh(time)\");
    138     jmi_array_ref_1(o_a, 13) = jmi_tanh_function(\"CCodeGenTests.DomainChecks1.operators\", _time, \"tanh(time)\");
    139     jmi_array_ref_1(o_a, 14) = jmi_atan2_function(\"CCodeGenTests.DomainChecks1.operators\", _time, 2.0 * _time, \"atan2(time, 2 * time)\");
    140     jmi_array_ref_1(o_a, 15) = jmi_divide_function(\"CCodeGenTests.DomainChecks1.operators\", t_v, jmi_array_val_1(o_a, 1), \"t / o[1]\");
    141     jmi_array_ref_1(o_a, 16) = ((long)jmi_divide_function(\"CCodeGenTests.DomainChecks1.operators\", _time, 2.0 * _time, \"div(time, 2 * time)\"));
    142     JMI_DYNAMIC_FREE()
    143     return;
    144 }
    145 
    146 ")})));
    147 end DomainChecks1;
    148 
    149 model DomainChecks2
    150     Real x1 = abs(time);
    151     Real x2 = cos(time);
    152     Real x3 = sin(time);
    153     Real x4 = tan(time);
    154     Real x5 = acos(time);
    155     Real x6 = asin(time);
    156     Real x7 = atan(time);
    157     Real x8 = log(time);
    158     Real x9 = log10(time);
    159     Real x10= exp(time);
    160     Real x11= time^10;
    161     Real x12= sqrt(time);
    162     Real x13= sinh(time);
    163     Real x14= cosh(time);
    164     Real x15= tanh(time);
    165     Real x16= atan2(time, 2*time);
    166     Real x17= time / x16;
    167     Real x18= sign(time);
    168     Real x19= max(time, x16);
    169     Real x20= min(time, x16);
    170     Real x21= div(time, 2*time);
    171 
    172     function operators
    173         input Real t;
    174         output Real[16] o;
    175     algorithm
    176         o[1] := cos(t);
    177         o[2] := sin(t);
    178         o[3] := acos(t);
    179         o[4] := asin(t);
    180         o[5] := atan(t);
    181         o[6] := log(t);
    182         o[7] := log10(t);
    183         o[8] := exp(t);
    184         o[9] := t^10;
    185         o[10]:= sqrt(time);
    186         o[11]:= cosh(time);
    187         o[12]:= sinh(time);
    188         o[13]:= tanh(time);
    189         o[14]:= atan2(time, 2*time);
    190         o[15]:= t / o[1];
    191         o[16]:= div(time, 2*time);
    192     end operators;
    193    
    194     Real o[16] = operators(time);
    195    
    196 annotation(__JModelica(UnitTesting(tests={
    197     CCodeGenTestCase(
    198         name="DomainChecks2",
    199         description="Test of no domain check generation",
    200         mathematical_domain_checks=false,
    201         inline_functions="none",
    202         template="
    203 $C_ode_derivatives$
    204 $C_functions$
    205 ",
    206         generatedCode="
    207 
    208 int model_ode_derivatives_base(jmi_t* jmi) {
    209     int ef = 0;
    210     JMI_DYNAMIC_INIT()
    211     JMI_ARR(STACK, jmi_real_t, jmi_array_t, tmp_1, 16, 1)
    212     _x1_0 = JMI_ABS(_time);
     83    _x1_0 = JMI_ABS_EQUATION(_time);
    21384    _x2_1 = JMI_COS_EQUATION(jmi, _time, \"cos(time)\");
    21485    _x3_2 = JMI_SIN_EQUATION(jmi, _time, \"sin(time)\");
     
    22798    _x16_15 = JMI_ATAN2_EQUATION(jmi, _time, 2.0 * _time, \"atan2(time, 2 * time)\");
    22899    _x17_16 = JMI_DIVIDE_EQUATION(jmi, _time, _x16_15, \"time / x16\");
    229     _x18_17 = JMI_SIGN(_time);
    230     _x19_18 = JMI_MAX(_time, _x16_15);
    231     _x20_19 = JMI_MIN(_time, _x16_15);
     100    _x18_17 = JMI_SIGN_EQUATION(_time);
     101    _x19_18 = JMI_MAX_EQUATION(_time, _x16_15);
     102    _x20_19 = JMI_MIN_EQUATION(_time, _x16_15);
    232103    if (jmi->atInitial || jmi->atEvent) {
    233104        _sw(0) = jmi_turn_switch(jmi, ((long)JMI_DIVIDE_EQUATION(jmi, _time, 2.0 * _time, \"div(time, 2 * time)\")) - (pre_temp_2_37), _sw(0), JMI_REL_LT);
     
    240111    _x21_20 = _temp_2_37;
    241112    JMI_ARRAY_INIT_1(STACK, jmi_real_t, jmi_array_t, tmp_1, 16, 1, 16)
    242     func_CCodeGenTests_DomainChecks2_operators_def0(_time, tmp_1);
     113    func_CCodeGenTests_DomainChecks1_operators_def0(_time, tmp_1);
    243114    memcpy(&_o_1_21, &jmi_array_val_1(tmp_1, 1), 16 * sizeof(jmi_real_t));
    244115    JMI_DYNAMIC_FREE()
     
    246117}
    247118
    248 void func_CCodeGenTests_DomainChecks2_operators_def0(jmi_real_t t_v, jmi_array_t* o_a) {
     119void func_CCodeGenTests_DomainChecks1_operators_def0(jmi_real_t t_v, jmi_array_t* o_a) {
    249120    JMI_DYNAMIC_INIT()
    250121    JMI_ARR(STACK, jmi_real_t, jmi_array_t, o_an, 16, 1)
     
    253124        o_a = o_an;
    254125    }
    255     jmi_array_ref_1(o_a, 1) = JMI_COS_FUNCTION(\"CCodeGenTests.DomainChecks2.operators\", t_v, \"cos(t)\");
    256     jmi_array_ref_1(o_a, 2) = JMI_SIN_FUNCTION(\"CCodeGenTests.DomainChecks2.operators\", t_v, \"sin(t)\");
    257     jmi_array_ref_1(o_a, 3) = JMI_ACOS_FUNCTION(\"CCodeGenTests.DomainChecks2.operators\", t_v, \"acos(t)\");
    258     jmi_array_ref_1(o_a, 4) = JMI_ASIN_FUNCTION(\"CCodeGenTests.DomainChecks2.operators\", t_v, \"asin(t)\");
    259     jmi_array_ref_1(o_a, 5) = JMI_ATAN_FUNCTION(\"CCodeGenTests.DomainChecks2.operators\", t_v, \"atan(t)\");
    260     jmi_array_ref_1(o_a, 6) = JMI_LOG_FUNCTION(\"CCodeGenTests.DomainChecks2.operators\", t_v, \"log(t)\");
    261     jmi_array_ref_1(o_a, 7) = JMI_LOG10_FUNCTION(\"CCodeGenTests.DomainChecks2.operators\", t_v, \"log10(t)\");
    262     jmi_array_ref_1(o_a, 8) = JMI_EXP_FUNCTION(\"CCodeGenTests.DomainChecks2.operators\", t_v, \"exp(t)\");
    263     jmi_array_ref_1(o_a, 9) = JMI_POW_FUNCTION(\"CCodeGenTests.DomainChecks2.operators\", t_v, 10, \"t ^ 10\");
    264     jmi_array_ref_1(o_a, 10) = JMI_SQRT_FUNCTION(\"CCodeGenTests.DomainChecks2.operators\", _time, \"sqrt(time)\");
    265     jmi_array_ref_1(o_a, 11) = JMI_COSH_FUNCTION(\"CCodeGenTests.DomainChecks2.operators\", _time, \"cosh(time)\");
    266     jmi_array_ref_1(o_a, 12) = JMI_SINH_FUNCTION(\"CCodeGenTests.DomainChecks2.operators\", _time, \"sinh(time)\");
    267     jmi_array_ref_1(o_a, 13) = JMI_TANH_FUNCTION(\"CCodeGenTests.DomainChecks2.operators\", _time, \"tanh(time)\");
    268     jmi_array_ref_1(o_a, 14) = JMI_ATAN2_FUNCTION(\"CCodeGenTests.DomainChecks2.operators\", _time, 2.0 * _time, \"atan2(time, 2 * time)\");
    269     jmi_array_ref_1(o_a, 15) = JMI_DIVIDE_FUNCTION(\"CCodeGenTests.DomainChecks2.operators\", t_v, jmi_array_val_1(o_a, 1), \"t / o[1]\");
    270     jmi_array_ref_1(o_a, 16) = ((long)JMI_DIVIDE_FUNCTION(\"CCodeGenTests.DomainChecks2.operators\", _time, 2.0 * _time, \"div(time, 2 * time)\"));
     126    jmi_array_ref_1(o_a, 1) = JMI_COS_FUNCTION(\"CCodeGenTests.DomainChecks1.operators\", t_v, \"cos(t)\");
     127    jmi_array_ref_1(o_a, 2) = JMI_SIN_FUNCTION(\"CCodeGenTests.DomainChecks1.operators\", t_v, \"sin(t)\");
     128    jmi_array_ref_1(o_a, 3) = JMI_ACOS_FUNCTION(\"CCodeGenTests.DomainChecks1.operators\", t_v, \"acos(t)\");
     129    jmi_array_ref_1(o_a, 4) = JMI_ASIN_FUNCTION(\"CCodeGenTests.DomainChecks1.operators\", t_v, \"asin(t)\");
     130    jmi_array_ref_1(o_a, 5) = JMI_ATAN_FUNCTION(\"CCodeGenTests.DomainChecks1.operators\", t_v, \"atan(t)\");
     131    jmi_array_ref_1(o_a, 6) = JMI_LOG_FUNCTION(\"CCodeGenTests.DomainChecks1.operators\", t_v, \"log(t)\");
     132    jmi_array_ref_1(o_a, 7) = JMI_LOG10_FUNCTION(\"CCodeGenTests.DomainChecks1.operators\", t_v, \"log10(t)\");
     133    jmi_array_ref_1(o_a, 8) = JMI_EXP_FUNCTION(\"CCodeGenTests.DomainChecks1.operators\", t_v, \"exp(t)\");
     134    jmi_array_ref_1(o_a, 9) = JMI_POW_FUNCTION(\"CCodeGenTests.DomainChecks1.operators\", t_v, 10, \"t ^ 10\");
     135    jmi_array_ref_1(o_a, 10) = JMI_SQRT_FUNCTION(\"CCodeGenTests.DomainChecks1.operators\", _time, \"sqrt(time)\");
     136    jmi_array_ref_1(o_a, 11) = JMI_COSH_FUNCTION(\"CCodeGenTests.DomainChecks1.operators\", _time, \"cosh(time)\");
     137    jmi_array_ref_1(o_a, 12) = JMI_SINH_FUNCTION(\"CCodeGenTests.DomainChecks1.operators\", _time, \"sinh(time)\");
     138    jmi_array_ref_1(o_a, 13) = JMI_TANH_FUNCTION(\"CCodeGenTests.DomainChecks1.operators\", _time, \"tanh(time)\");
     139    jmi_array_ref_1(o_a, 14) = JMI_ATAN2_FUNCTION(\"CCodeGenTests.DomainChecks1.operators\", _time, 2.0 * _time, \"atan2(time, 2 * time)\");
     140    jmi_array_ref_1(o_a, 15) = JMI_DIVIDE_FUNCTION(\"CCodeGenTests.DomainChecks1.operators\", t_v, jmi_array_val_1(o_a, 1), \"t / o[1]\");
     141    jmi_array_ref_1(o_a, 16) = ((long)JMI_DIVIDE_FUNCTION(\"CCodeGenTests.DomainChecks1.operators\", _time, 2.0 * _time, \"div(time, 2 * time)\"));
    271142    JMI_DYNAMIC_FREE()
    272143    return;
     
    274145
    275146")})));
    276 end DomainChecks2;
     147end DomainChecks1;
    277148
    278149model CCodeGenTest1
     
    403274        generatedCode="
    404275    (*res)[0] = _y_1 - (_der_x_2);
    405     (*res)[1] = (COND_EXP_EQ(COND_EXP_LE(_time, jmi_divide_equation(jmi, 3.141592653589793, 2.0, \"3.141592653589793 / 2\"), JMI_TRUE, JMI_FALSE), JMI_TRUE, jmi_sin_equation(jmi, _time, \"sin(time)\"), _x_0)) - (_der_x_2);
     276    (*res)[1] = (COND_EXP_EQ(COND_EXP_LE(_time, JMI_DIVIDE_EQUATION(jmi, 3.141592653589793, 2.0, \"3.141592653589793 / 2\"), JMI_TRUE, JMI_FALSE), JMI_TRUE, JMI_SIN_EQUATION(jmi, _time, \"sin(time)\"), _x_0)) - (_der_x_2);
    406277")})));
    407278end CCodeGenTest4;
     
    635506  der(x) = (x-0.3)^0.3 + (x-0.3)^3;
    636507
    637     annotation(__JModelica(UnitTesting(tests={
    638         CCodeGenTestCase(
    639             name="CCodeGenTest12",
    640             description="C code generation: test that x^2 is represented by x*x in the generated code.",
    641             variability_propagation=false,
    642             generate_ode=false,
    643             generate_dae=true,
    644             template="$C_DAE_equation_residuals$",
    645             generatedCode="
    646     (*res)[0] = jmi_pow_equation(jmi, (_x_0 - 0.3),0.3,\"(x - 0.3) ^ 0.3\") + (1.0 * ((_x_0 - 0.3)) * ((_x_0 - 0.3)) * ((_x_0 - 0.3))) - (_der_x_1);
     508annotation(__JModelica(UnitTesting(tests={
     509    CCodeGenTestCase(
     510        name="CCodeGenTest12",
     511        description="C code generation: test that x^2 is represented by x*x in the generated code.",
     512        variability_propagation=false,
     513        generate_ode=false,
     514        generate_dae=true,
     515        template="$C_DAE_equation_residuals$",
     516        generatedCode="
     517    (*res)[0] = JMI_POW_EQUATION(jmi, (_x_0 - 0.3), 0.3, \"(x - 0.3) ^ 0.3\") + (1.0 * ((_x_0 - 0.3)) * ((_x_0 - 0.3)) * ((_x_0 - 0.3))) - (_der_x_1);
    647518")})));
    648519end CCodeGenTest12;
     
    962833    Real x = time / f("a", time);
    963834
    964     annotation(__JModelica(UnitTesting(tests={
    965         CCodeGenTestCase(
    966             name="CCodeGenTest19",
    967             description="Check that quotes in divisions are escaped in the string representation",
    968             template="$C_ode_derivatives$",
    969             generatedCode="
     835annotation(__JModelica(UnitTesting(tests={
     836    CCodeGenTestCase(
     837        name="CCodeGenTest19",
     838        description="Check that quotes in divisions are escaped in the string representation",
     839        template="$C_ode_derivatives$",
     840        generatedCode="
    970841
    971842int model_ode_derivatives_base(jmi_t* jmi) {
    972843    int ef = 0;
    973844    JMI_DYNAMIC_INIT()
    974     _x_0 = jmi_divide_equation(jmi, _time,func_CCodeGenTests_CCodeGenTest19_f_exp0(\"a\", _time),\"time / CCodeGenTests.CCodeGenTest19.f(\\\"a\\\", time)\");
     845    _x_0 = JMI_DIVIDE_EQUATION(jmi, _time, func_CCodeGenTests_CCodeGenTest19_f_exp0(\"a\", _time), \"time / CCodeGenTests.CCodeGenTest19.f(\\\"a\\\", time)\");
    975846    JMI_DYNAMIC_FREE()
    976847    return ef;
     
    12261097    int ef = 0;
    12271098    JMI_DYNAMIC_INIT()
    1228     _der_x_1 = jmi_divide_equation(jmi, _x_0, 1234, \"x / 1234\");
     1099    _der_x_1 = JMI_DIVIDE_EQUATION(jmi, _x_0, 1234, \"x / 1234\");
    12291100    JMI_DYNAMIC_FREE()
    12301101    return ef;
     
    15111382    _a_c3_f_7 = - _b_c6_f_19;
    15121383    _a_c2_f_4 = - _a_c1_f_1 - _a_c3_f_7;
    1513     __stream_s_1_21 = jmi_max(_a_c2_f_4, 0.0) + jmi_max(_a_c3_f_7, 0.0);
    1514     __stream_alpha_1_22 = (COND_EXP_EQ(COND_EXP_GT(__stream_s_1_21, jmi_in_stream_eps(jmi) * 0.1, JMI_TRUE, JMI_FALSE), JMI_TRUE, 1.0, COND_EXP_EQ(COND_EXP_GT(__stream_s_1_21, 0.0, JMI_TRUE, JMI_FALSE), JMI_TRUE, jmi_divide_equation(jmi, __stream_s_1_21, (jmi_in_stream_eps(jmi) * 0.1), \"_stream_s_1 / (_inStreamEpsilon * 0.1)\") * (jmi_divide_equation(jmi, __stream_s_1_21, (jmi_in_stream_eps(jmi) * 0.1), \"_stream_s_1 / (_inStreamEpsilon * 0.1)\") * (3.0 - 2.0 * __stream_s_1_21)), 0.0)));
    1515     __stream_positiveMax_1_23 = __stream_alpha_1_22 * jmi_max(_a_c2_f_4, 0.0) + (1 - __stream_alpha_1_22) * (jmi_in_stream_eps(jmi) * 0.1);
     1384    __stream_s_1_21 = JMI_MAX_EQUATION(_a_c2_f_4, 0.0) + JMI_MAX_EQUATION(_a_c3_f_7, 0.0);
     1385    __stream_alpha_1_22 = (COND_EXP_EQ(COND_EXP_GT(__stream_s_1_21, jmi_in_stream_eps(jmi) * 0.1, JMI_TRUE, JMI_FALSE), JMI_TRUE, 1.0, COND_EXP_EQ(COND_EXP_GT(__stream_s_1_21, 0.0, JMI_TRUE, JMI_FALSE), JMI_TRUE, JMI_DIVIDE_EQUATION(jmi, __stream_s_1_21, (jmi_in_stream_eps(jmi) * 0.1), \"_stream_s_1 / (_inStreamEpsilon * 0.1)\") * (JMI_DIVIDE_EQUATION(jmi, __stream_s_1_21, (jmi_in_stream_eps(jmi) * 0.1), \"_stream_s_1 / (_inStreamEpsilon * 0.1)\") * (3.0 - 2.0 * __stream_s_1_21)), 0.0)));
     1386    __stream_positiveMax_1_23 = __stream_alpha_1_22 * JMI_MAX_EQUATION(_a_c2_f_4, 0.0) + (1 - __stream_alpha_1_22) * (jmi_in_stream_eps(jmi) * 0.1);
    15161387    _b_c5_s_17 = 5;
    1517     __stream_positiveMax_2_24 = __stream_alpha_1_22 * jmi_max(_a_c3_f_7, 0.0) + (1 - __stream_alpha_1_22) * (jmi_in_stream_eps(jmi) * 0.1);
     1388    __stream_positiveMax_2_24 = __stream_alpha_1_22 * JMI_MAX_EQUATION(_a_c3_f_7, 0.0) + (1 - __stream_alpha_1_22) * (jmi_in_stream_eps(jmi) * 0.1);
    15181389    _b_c6_s_20 = 6;
    1519     _a_c1_s_2 = jmi_divide_equation(jmi, (__stream_positiveMax_1_23 * _b_c5_s_17 + __stream_positiveMax_2_24 * _b_c6_s_20), (__stream_positiveMax_1_23 + __stream_positiveMax_2_24), \"(_stream_positiveMax_1 * b.c5.s + _stream_positiveMax_2 * b.c6.s) / (_stream_positiveMax_1 + _stream_positiveMax_2)\");
     1390    _a_c1_s_2 = JMI_DIVIDE_EQUATION(jmi, (__stream_positiveMax_1_23 * _b_c5_s_17 + __stream_positiveMax_2_24 * _b_c6_s_20), (__stream_positiveMax_1_23 + __stream_positiveMax_2_24), \"(_stream_positiveMax_1 * b.c5.s + _stream_positiveMax_2 * b.c6.s) / (_stream_positiveMax_1 + _stream_positiveMax_2)\");
    15201391    _a_c2_p_3 = _a_c1_p_0;
    1521     __stream_s_2_25 = jmi_max(_a_c1_f_1, 0.0) + jmi_max(_a_c3_f_7, 0.0);
    1522     __stream_alpha_2_26 = (COND_EXP_EQ(COND_EXP_GT(__stream_s_2_25, jmi_in_stream_eps(jmi) * 0.1, JMI_TRUE, JMI_FALSE), JMI_TRUE, 1.0, COND_EXP_EQ(COND_EXP_GT(__stream_s_2_25, 0.0, JMI_TRUE, JMI_FALSE), JMI_TRUE, jmi_divide_equation(jmi, __stream_s_2_25, (jmi_in_stream_eps(jmi) * 0.1), \"_stream_s_2 / (_inStreamEpsilon * 0.1)\") * (jmi_divide_equation(jmi, __stream_s_2_25, (jmi_in_stream_eps(jmi) * 0.1), \"_stream_s_2 / (_inStreamEpsilon * 0.1)\") * (3.0 - 2.0 * __stream_s_2_25)), 0.0)));
    1523     __stream_positiveMax_3_27 = __stream_alpha_2_26 * jmi_max(_a_c1_f_1, 0.0) + (1 - __stream_alpha_2_26) * (jmi_in_stream_eps(jmi) * 0.1);
     1392    __stream_s_2_25 = JMI_MAX_EQUATION(_a_c1_f_1, 0.0) + JMI_MAX_EQUATION(_a_c3_f_7, 0.0);
     1393    __stream_alpha_2_26 = (COND_EXP_EQ(COND_EXP_GT(__stream_s_2_25, jmi_in_stream_eps(jmi) * 0.1, JMI_TRUE, JMI_FALSE), JMI_TRUE, 1.0, COND_EXP_EQ(COND_EXP_GT(__stream_s_2_25, 0.0, JMI_TRUE, JMI_FALSE), JMI_TRUE, JMI_DIVIDE_EQUATION(jmi, __stream_s_2_25, (jmi_in_stream_eps(jmi) * 0.1), \"_stream_s_2 / (_inStreamEpsilon * 0.1)\") * (JMI_DIVIDE_EQUATION(jmi, __stream_s_2_25, (jmi_in_stream_eps(jmi) * 0.1), \"_stream_s_2 / (_inStreamEpsilon * 0.1)\") * (3.0 - 2.0 * __stream_s_2_25)), 0.0)));
     1394    __stream_positiveMax_3_27 = __stream_alpha_2_26 * JMI_MAX_EQUATION(_a_c1_f_1, 0.0) + (1 - __stream_alpha_2_26) * (jmi_in_stream_eps(jmi) * 0.1);
    15241395    _b_c4_s_14 = 4;
    1525     __stream_positiveMax_4_28 = __stream_alpha_2_26 * jmi_max(_a_c3_f_7, 0.0) + (1 - __stream_alpha_2_26) * (jmi_in_stream_eps(jmi) * 0.1);
    1526     _a_c2_s_5 = jmi_divide_equation(jmi, (__stream_positiveMax_3_27 * _b_c4_s_14 + __stream_positiveMax_4_28 * _b_c6_s_20), (__stream_positiveMax_3_27 + __stream_positiveMax_4_28), \"(_stream_positiveMax_3 * b.c4.s + _stream_positiveMax_4 * b.c6.s) / (_stream_positiveMax_3 + _stream_positiveMax_4)\");
     1396    __stream_positiveMax_4_28 = __stream_alpha_2_26 * JMI_MAX_EQUATION(_a_c3_f_7, 0.0) + (1 - __stream_alpha_2_26) * (jmi_in_stream_eps(jmi) * 0.1);
     1397    _a_c2_s_5 = JMI_DIVIDE_EQUATION(jmi, (__stream_positiveMax_3_27 * _b_c4_s_14 + __stream_positiveMax_4_28 * _b_c6_s_20), (__stream_positiveMax_3_27 + __stream_positiveMax_4_28), \"(_stream_positiveMax_3 * b.c4.s + _stream_positiveMax_4 * b.c6.s) / (_stream_positiveMax_3 + _stream_positiveMax_4)\");
    15271398    _a_c3_p_6 = _a_c2_p_3;
    1528     __stream_s_3_29 = jmi_max(_a_c1_f_1, 0.0) + jmi_max(_a_c2_f_4, 0.0);
    1529     __stream_alpha_3_30 = (COND_EXP_EQ(COND_EXP_GT(__stream_s_3_29, jmi_in_stream_eps(jmi) * 0.1, JMI_TRUE, JMI_FALSE), JMI_TRUE, 1.0, COND_EXP_EQ(COND_EXP_GT(__stream_s_3_29, 0.0, JMI_TRUE, JMI_FALSE), JMI_TRUE, jmi_divide_equation(jmi, __stream_s_3_29, (jmi_in_stream_eps(jmi) * 0.1), \"_stream_s_3 / (_inStreamEpsilon * 0.1)\") * (jmi_divide_equation(jmi, __stream_s_3_29, (jmi_in_stream_eps(jmi) * 0.1), \"_stream_s_3 / (_inStreamEpsilon * 0.1)\") * (3.0 - 2.0 * __stream_s_3_29)), 0.0)));
    1530     __stream_positiveMax_5_31 = __stream_alpha_3_30 * jmi_max(_a_c1_f_1, 0.0) + (1 - __stream_alpha_3_30) * (jmi_in_stream_eps(jmi) * 0.1);
    1531     __stream_positiveMax_6_32 = __stream_alpha_3_30 * jmi_max(_a_c2_f_4, 0.0) + (1 - __stream_alpha_3_30) * (jmi_in_stream_eps(jmi) * 0.1);
    1532     _a_c3_s_8 = jmi_divide_equation(jmi, (__stream_positiveMax_5_31 * _b_c4_s_14 + __stream_positiveMax_6_32 * _b_c5_s_17), (__stream_positiveMax_5_31 + __stream_positiveMax_6_32), \"(_stream_positiveMax_5 * b.c4.s + _stream_positiveMax_6 * b.c5.s) / (_stream_positiveMax_5 + _stream_positiveMax_6)\");
     1399    __stream_s_3_29 = JMI_MAX_EQUATION(_a_c1_f_1, 0.0) + JMI_MAX_EQUATION(_a_c2_f_4, 0.0);
     1400    __stream_alpha_3_30 = (COND_EXP_EQ(COND_EXP_GT(__stream_s_3_29, jmi_in_stream_eps(jmi) * 0.1, JMI_TRUE, JMI_FALSE), JMI_TRUE, 1.0, COND_EXP_EQ(COND_EXP_GT(__stream_s_3_29, 0.0, JMI_TRUE, JMI_FALSE), JMI_TRUE, JMI_DIVIDE_EQUATION(jmi, __stream_s_3_29, (jmi_in_stream_eps(jmi) * 0.1), \"_stream_s_3 / (_inStreamEpsilon * 0.1)\") * (JMI_DIVIDE_EQUATION(jmi, __stream_s_3_29, (jmi_in_stream_eps(jmi) * 0.1), \"_stream_s_3 / (_inStreamEpsilon * 0.1)\") * (3.0 - 2.0 * __stream_s_3_29)), 0.0)));
     1401    __stream_positiveMax_5_31 = __stream_alpha_3_30 * JMI_MAX_EQUATION(_a_c1_f_1, 0.0) + (1 - __stream_alpha_3_30) * (jmi_in_stream_eps(jmi) * 0.1);
     1402    __stream_positiveMax_6_32 = __stream_alpha_3_30 * JMI_MAX_EQUATION(_a_c2_f_4, 0.0) + (1 - __stream_alpha_3_30) * (jmi_in_stream_eps(jmi) * 0.1);
     1403    _a_c3_s_8 = JMI_DIVIDE_EQUATION(jmi, (__stream_positiveMax_5_31 * _b_c4_s_14 + __stream_positiveMax_6_32 * _b_c5_s_17), (__stream_positiveMax_5_31 + __stream_positiveMax_6_32), \"(_stream_positiveMax_5 * b.c4.s + _stream_positiveMax_6 * b.c5.s) / (_stream_positiveMax_5 + _stream_positiveMax_6)\");
    15331404    _a_x1_9 = _b_c4_s_14;
    15341405    _a_x2_10 = _b_c5_s_17;
     
    20781949        template="$C_DAE_equation_residuals$",
    20791950        generatedCode="
    2080     (*res)[0] = jmi_divide_equation(jmi, _y_1_1_4 * _y_1_1_4, jmi_pow_equation(jmi, (_y_1_1_4 + _y_1_1_4 - 2), _y_1_1_4, \"(y[1,1] .+ y[1,1] .- 2) .^ y[1,1]\"), \"y[1,1] .* y[1,1] ./ (y[1,1] .+ y[1,1] .- 2) .^ y[1,1]\") - (_x_1_1_0);
    2081     (*res)[1] = jmi_divide_equation(jmi, _y_1_2_5 * _y_1_2_5, jmi_pow_equation(jmi, (_y_1_2_5 + _y_1_2_5 - 2), _y_1_2_5, \"(y[1,2] .+ y[1,2] .- 2) .^ y[1,2]\"), \"y[1,2] .* y[1,2] ./ (y[1,2] .+ y[1,2] .- 2) .^ y[1,2]\") - (_x_1_2_1);
    2082     (*res)[2] = jmi_divide_equation(jmi, _y_2_1_6 * _y_2_1_6, jmi_pow_equation(jmi, (_y_2_1_6 + _y_2_1_6 - 2), _y_2_1_6, \"(y[2,1] .+ y[2,1] .- 2) .^ y[2,1]\"), \"y[2,1] .* y[2,1] ./ (y[2,1] .+ y[2,1] .- 2) .^ y[2,1]\") - (_x_2_1_2);
    2083     (*res)[3] = jmi_divide_equation(jmi, _y_2_2_7 * _y_2_2_7, jmi_pow_equation(jmi, (_y_2_2_7 + _y_2_2_7 - 2), _y_2_2_7, \"(y[2,2] .+ y[2,2] .- 2) .^ y[2,2]\"), \"y[2,2] .* y[2,2] ./ (y[2,2] .+ y[2,2] .- 2) .^ y[2,2]\") - (_x_2_2_3);
     1951    (*res)[0] = JMI_DIVIDE_EQUATION(jmi, _y_1_1_4 * _y_1_1_4, JMI_POW_EQUATION(jmi, (_y_1_1_4 + _y_1_1_4 - 2), _y_1_1_4, \"(y[1,1] .+ y[1,1] .- 2) .^ y[1,1]\"), \"y[1,1] .* y[1,1] ./ (y[1,1] .+ y[1,1] .- 2) .^ y[1,1]\") - (_x_1_1_0);
     1952    (*res)[1] = JMI_DIVIDE_EQUATION(jmi, _y_1_2_5 * _y_1_2_5, JMI_POW_EQUATION(jmi, (_y_1_2_5 + _y_1_2_5 - 2), _y_1_2_5, \"(y[1,2] .+ y[1,2] .- 2) .^ y[1,2]\"), \"y[1,2] .* y[1,2] ./ (y[1,2] .+ y[1,2] .- 2) .^ y[1,2]\") - (_x_1_2_1);
     1953    (*res)[2] = JMI_DIVIDE_EQUATION(jmi, _y_2_1_6 * _y_2_1_6, JMI_POW_EQUATION(jmi, (_y_2_1_6 + _y_2_1_6 - 2), _y_2_1_6, \"(y[2,1] .+ y[2,1] .- 2) .^ y[2,1]\"), \"y[2,1] .* y[2,1] ./ (y[2,1] .+ y[2,1] .- 2) .^ y[2,1]\") - (_x_2_1_2);
     1954    (*res)[3] = JMI_DIVIDE_EQUATION(jmi, _y_2_2_7 * _y_2_2_7, JMI_POW_EQUATION(jmi, (_y_2_2_7 + _y_2_2_7 - 2), _y_2_2_7, \"(y[2,2] .+ y[2,2] .- 2) .^ y[2,2]\"), \"y[2,2] .* y[2,2] ./ (y[2,2] .+ y[2,2] .- 2) .^ y[2,2]\") - (_x_2_2_3);
    20841955    (*res)[4] = 1 - (_y_1_1_4);
    20851956    (*res)[5] = 2 - (_y_1_2_5);
     
    20971968    Real y = exp(time) + f(time);
    20981969   
    2099     annotation(__JModelica(UnitTesting(tests={
    2100         CCodeGenTestCase(
    2101             name="CCodeGenExpOp",
    2102             description="C code generation of exp operator",
    2103             inline_functions="none",
    2104             template="
     1970annotation(__JModelica(UnitTesting(tests={
     1971    CCodeGenTestCase(
     1972        name="CCodeGenExpOp",
     1973        description="C code generation of exp operator",
     1974        inline_functions="none",
     1975        template="
    21051976$C_ode_derivatives$
    21061977$C_functions$
    21071978",
    2108             generatedCode="
     1979        generatedCode="
    21091980
    21101981int model_ode_derivatives_base(jmi_t* jmi) {
    21111982    int ef = 0;
    21121983    JMI_DYNAMIC_INIT()
    2113     _y_0 = jmi_exp_equation(jmi, _time,\"exp(time)\") + func_CCodeGenTests_CCodeGenExpOp_f_exp0(_time);
     1984    _y_0 = JMI_EXP_EQUATION(jmi, _time, \"exp(time)\") + func_CCodeGenTests_CCodeGenExpOp_f_exp0(_time);
    21141985    JMI_DYNAMIC_FREE()
    21151986    return ef;
     
    21191990    JMI_DYNAMIC_INIT()
    21201991    JMI_DEF(REA, y_v)
    2121     y_v = jmi_exp_function(\"CCodeGenTests.CCodeGenExpOp.f\", x_v,\"exp(x)\");
     1992    y_v = JMI_EXP_FUNCTION(\"CCodeGenTests.CCodeGenExpOp.f\", x_v, \"exp(x)\");
    21221993    JMI_RET(GEN, y_o, y_v)
    21231994    JMI_DYNAMIC_FREE()
     
    21422013    Real y = log(time) + f(time);
    21432014   
    2144     annotation(__JModelica(UnitTesting(tests={
    2145         CCodeGenTestCase(
    2146             name="CCodeGenLogOp",
    2147             description="C code generation of log operator",
    2148             inline_functions="none",
    2149             template="
     2015annotation(__JModelica(UnitTesting(tests={
     2016    CCodeGenTestCase(
     2017        name="CCodeGenLogOp",
     2018        description="C code generation of log operator",
     2019        inline_functions="none",
     2020        template="
    21502021$C_ode_derivatives$
    21512022$C_functions$
    21522023",
    2153             generatedCode="
     2024        generatedCode="
    21542025
    21552026int model_ode_derivatives_base(jmi_t* jmi) {
    21562027    int ef = 0;
    21572028    JMI_DYNAMIC_INIT()
    2158     _y_0 = jmi_log_equation(jmi, _time,\"log(time)\") + func_CCodeGenTests_CCodeGenLogOp_f_exp0(_time);
     2029    _y_0 = JMI_LOG_EQUATION(jmi, _time, \"log(time)\") + func_CCodeGenTests_CCodeGenLogOp_f_exp0(_time);
    21592030    JMI_DYNAMIC_FREE()
    21602031    return ef;
     
    21642035    JMI_DYNAMIC_INIT()
    21652036    JMI_DEF(REA, y_v)
    2166     y_v = jmi_log_function(\"CCodeGenTests.CCodeGenLogOp.f\", x_v,\"log(x)\");
     2037    y_v = JMI_LOG_FUNCTION(\"CCodeGenTests.CCodeGenLogOp.f\", x_v, \"log(x)\");
    21672038    JMI_RET(GEN, y_o, y_v)
    21682039    JMI_DYNAMIC_FREE()
     
    21872058    Real y = log10(time) + f(time);
    21882059   
    2189     annotation(__JModelica(UnitTesting(tests={
    2190         CCodeGenTestCase(
    2191             name="CCodeGenLog10Op",
    2192             description="C code generation of log10 operator",
    2193             inline_functions="none",
    2194             template="
     2060annotation(__JModelica(UnitTesting(tests={
     2061    CCodeGenTestCase(
     2062        name="CCodeGenLog10Op",
     2063        description="C code generation of log10 operator",
     2064        inline_functions="none",
     2065        template="
    21952066$C_ode_derivatives$
    21962067$C_functions$
    21972068",
    2198             generatedCode="
     2069        generatedCode="
    21992070
    22002071int model_ode_derivatives_base(jmi_t* jmi) {
    22012072    int ef = 0;
    22022073    JMI_DYNAMIC_INIT()
    2203     _y_0 = jmi_log10_equation(jmi, _time,\"log10(time)\") + func_CCodeGenTests_CCodeGenLog10Op_f_exp0(_time);
     2074    _y_0 = JMI_LOG10_EQUATION(jmi, _time, \"log10(time)\") + func_CCodeGenTests_CCodeGenLog10Op_f_exp0(_time);
    22042075    JMI_DYNAMIC_FREE()
    22052076    return ef;
     
    22092080    JMI_DYNAMIC_INIT()
    22102081    JMI_DEF(REA, y_v)
    2211     y_v = jmi_log10_function(\"CCodeGenTests.CCodeGenLog10Op.f\", x_v,\"log10(x)\");
     2082    y_v = JMI_LOG10_FUNCTION(\"CCodeGenTests.CCodeGenLog10Op.f\", x_v, \"log10(x)\");
    22122083    JMI_RET(GEN, y_o, y_v)
    22132084    JMI_DYNAMIC_FREE()
     
    22322103    Real y = sinh(time) + f(time);
    22332104   
    2234     annotation(__JModelica(UnitTesting(tests={
    2235         CCodeGenTestCase(
    2236             name="CCodeGenSinhOp",
    2237             description="C code generation of sinh operator",
    2238             inline_functions="none",
    2239             template="
     2105annotation(__JModelica(UnitTesting(tests={
     2106    CCodeGenTestCase(
     2107        name="CCodeGenSinhOp",
     2108        description="C code generation of sinh operator",
     2109        inline_functions="none",
     2110        template="
    22402111$C_ode_derivatives$
    22412112$C_functions$
    22422113",
    2243             generatedCode="
     2114        generatedCode="
    22442115
    22452116int model_ode_derivatives_base(jmi_t* jmi) {
    22462117    int ef = 0;
    22472118    JMI_DYNAMIC_INIT()
    2248     _y_0 = jmi_sinh_equation(jmi, _time,\"sinh(time)\") + func_CCodeGenTests_CCodeGenSinhOp_f_exp0(_time);
     2119    _y_0 = JMI_SINH_EQUATION(jmi, _time, \"sinh(time)\") + func_CCodeGenTests_CCodeGenSinhOp_f_exp0(_time);
    22492120    JMI_DYNAMIC_FREE()
    22502121    return ef;
     
    22542125    JMI_DYNAMIC_INIT()
    22552126    JMI_DEF(REA, y_v)
    2256     y_v = jmi_sinh_function(\"CCodeGenTests.CCodeGenSinhOp.f\", x_v,\"sinh(x)\");
     2127    y_v = JMI_SINH_FUNCTION(\"CCodeGenTests.CCodeGenSinhOp.f\", x_v, \"sinh(x)\");
    22572128    JMI_RET(GEN, y_o, y_v)
    22582129    JMI_DYNAMIC_FREE()
     
    22772148    Real y = cosh(time) + f(time);
    22782149   
    2279     annotation(__JModelica(UnitTesting(tests={
    2280         CCodeGenTestCase(
    2281             name="CCodeGenCoshOp",
    2282             description="C code generation of cosh operator",
    2283             inline_functions="none",
    2284             template="
     2150annotation(__JModelica(UnitTesting(tests={
     2151    CCodeGenTestCase(
     2152        name="CCodeGenCoshOp",
     2153        description="C code generation of cosh operator",
     2154        inline_functions="none",
     2155        template="
    22852156$C_ode_derivatives$
    22862157$C_functions$
    22872158",
    2288             generatedCode="
     2159        generatedCode="
    22892160
    22902161int model_ode_derivatives_base(jmi_t* jmi) {
    22912162    int ef = 0;
    22922163    JMI_DYNAMIC_INIT()
    2293     _y_0 = jmi_cosh_equation(jmi, _time,\"cosh(time)\") + func_CCodeGenTests_CCodeGenCoshOp_f_exp0(_time);
     2164    _y_0 = JMI_COSH_EQUATION(jmi, _time, \"cosh(time)\") + func_CCodeGenTests_CCodeGenCoshOp_f_exp0(_time);
    22942165    JMI_DYNAMIC_FREE()
    22952166    return ef;
     
    22992170    JMI_DYNAMIC_INIT()
    23002171    JMI_DEF(REA, y_v)
    2301     y_v = jmi_cosh_function(\"CCodeGenTests.CCodeGenCoshOp.f\", x_v,\"cosh(x)\");
     2172    y_v = JMI_COSH_FUNCTION(\"CCodeGenTests.CCodeGenCoshOp.f\", x_v, \"cosh(x)\");
    23022173    JMI_RET(GEN, y_o, y_v)
    23032174    JMI_DYNAMIC_FREE()
     
    23222193    Real y = tan(time) + f(time);
    23232194   
    2324     annotation(__JModelica(UnitTesting(tests={
    2325         CCodeGenTestCase(
    2326             name="CCodeGenTanOp",
    2327             description="C code generation of tan operator",
    2328             inline_functions="none",
    2329             template="
     2195annotation(__JModelica(UnitTesting(tests={
     2196    CCodeGenTestCase(
     2197        name="CCodeGenTanOp",
     2198        description="C code generation of tan operator",
     2199        inline_functions="none",
     2200        template="
    23302201$C_ode_derivatives$
    23312202$C_functions$
    23322203",
    2333             generatedCode="
     2204        generatedCode="
    23342205
    23352206int model_ode_derivatives_base(jmi_t* jmi) {
    23362207    int ef = 0;
    23372208    JMI_DYNAMIC_INIT()
    2338     _y_0 = jmi_tan_equation(jmi, _time,\"tan(time)\") + func_CCodeGenTests_CCodeGenTanOp_f_exp0(_time);
     2209    _y_0 = JMI_TAN_EQUATION(jmi, _time, \"tan(time)\") + func_CCodeGenTests_CCodeGenTanOp_f_exp0(_time);
    23392210    JMI_DYNAMIC_FREE()
    23402211    return ef;
     
    23442215    JMI_DYNAMIC_INIT()
    23452216    JMI_DEF(REA, y_v)
    2346     y_v = jmi_tan_function(\"CCodeGenTests.CCodeGenTanOp.f\", x_v,\"tan(x)\");
     2217    y_v = JMI_TAN_FUNCTION(\"CCodeGenTests.CCodeGenTanOp.f\", x_v, \"tan(x)\");
    23472218    JMI_RET(GEN, y_o, y_v)
    23482219    JMI_DYNAMIC_FREE()
     
    23812252    int ef = 0;
    23822253    JMI_DYNAMIC_INIT()
    2383     _y_0 = jmi_atan2_equation(jmi, _time, _time + 1.0, \"atan2(time, time + 1)\") + func_CCodeGenTests_CCodeGenATan2Op_f_exp0(_time);
     2254    _y_0 = JMI_ATAN2_EQUATION(jmi, _time, _time + 1.0, \"atan2(time, time + 1)\") + func_CCodeGenTests_CCodeGenATan2Op_f_exp0(_time);
    23842255    JMI_DYNAMIC_FREE()
    23852256    return ef;
     
    23892260    JMI_DYNAMIC_INIT()
    23902261    JMI_DEF(REA, y_v)
    2391     y_v = jmi_atan2_function(\"CCodeGenTests.CCodeGenATan2Op.f\", x_v, x_v + 1.0, \"atan2(x, x + 1)\");
     2262    y_v = JMI_ATAN2_FUNCTION(\"CCodeGenTests.CCodeGenATan2Op.f\", x_v, x_v + 1.0, \"atan2(x, x + 1)\");
    23922263    JMI_RET(GEN, y_o, y_v)
    23932264    JMI_DYNAMIC_FREE()
     
    24252296    (*res)[2] = 3 - (_x_2_1_2);
    24262297    (*res)[3] = 4 - (_x_2_2_3);
    2427     (*res)[4] = jmi_min(jmi_min(_x_1_1_0, _x_1_2_1), jmi_min(_x_2_1_2, _x_2_2_3)) - (_y1_4);
    2428     (*res)[5] = jmi_min(1.0, 2.0) - (_y2_5);
    2429     (*res)[6] = jmi_max(jmi_max(_x_1_1_0, _x_1_2_1), jmi_max(_x_2_1_2, _x_2_2_3)) - (_y3_6);
    2430     (*res)[7] = jmi_max(1.0, 2.0) - (_y4_7);
     2298    (*res)[4] = JMI_MIN_EQUATION(JMI_MIN_EQUATION(_x_1_1_0, _x_1_2_1), JMI_MIN_EQUATION(_x_2_1_2, _x_2_2_3)) - (_y1_4);
     2299    (*res)[5] = JMI_MIN_EQUATION(1.0, 2.0) - (_y2_5);
     2300    (*res)[6] = JMI_MAX_EQUATION(JMI_MAX_EQUATION(_x_1_1_0, _x_1_2_1), JMI_MAX_EQUATION(_x_2_1_2, _x_2_2_3)) - (_y3_6);
     2301    (*res)[7] = JMI_MAX_EQUATION(1.0, 2.0) - (_y4_7);
    24312302")})));
    24322303end CCodeGenMinMax;
     
    37403611    JMI_ARR(STACK, jmi_real_t, jmi_array_t, tmp_2, 6, 1)
    37413612    _e_3 = _time;
    3742     _f_1_7 = jmi_sin_equation(jmi, _time - 0.5, \"sin(time - 0.5)\");
    3743     _f_2_8 = jmi_sin_equation(jmi, _time, \"sin(time)\");
    3744     _g_10 = jmi_cos_equation(jmi, _time, \"cos(time)\");
    3745     _f_3_9 = jmi_sin_equation(jmi, _time + 0.5, \"sin(time + 0.5)\");
    3746     _h_11 = - jmi_cos_equation(jmi, _time, \"cos(time)\");
     3613    _f_1_7 = JMI_SIN_EQUATION(jmi, _time - 0.5, \"sin(time - 0.5)\");
     3614    _f_2_8 = JMI_SIN_EQUATION(jmi, _time, \"sin(time)\");
     3615    _g_10 = JMI_COS_EQUATION(jmi, _time, \"cos(time)\");
     3616    _f_3_9 = JMI_SIN_EQUATION(jmi, _time + 0.5, \"sin(time + 0.5)\");
     3617    _h_11 = - JMI_COS_EQUATION(jmi, _time, \"cos(time)\");
    37473618    JMI_ARRAY_INIT_1(STACK, jmi_real_t, jmi_array_t, tmp_1, 6, 1, 6)
    37483619    JMI_ARRAY_INIT_1(STACK, jmi_real_t, jmi_array_t, tmp_2, 6, 1, 6)
     
    38483719        temp_2_v = temp_2_v + jmi_array_val_1(x_a, i1_2i);
    38493720    }
    3850     n_v = floor(jmi_divide_function(\"CCodeGenTests.FuncWithArray.g\", temp_1_v, temp_2_v, \"temp_1 / temp_2\"));
     3721    n_v = floor(JMI_DIVIDE_FUNCTION(\"CCodeGenTests.FuncWithArray.g\", temp_1_v, temp_2_v, \"temp_1 / temp_2\"));
    38513722    JMI_RET(GEN, n_o, n_v)
    38523723    JMI_DYNAMIC_FREE()
     
    41904061    int i_1ii;
    41914062    x_v = 0;
    4192     JMI_ARRAY_INIT_1(HEAP, jmi_real_t, jmi_array_t, temp_1_a, jmi_max(n_v, 0.0), 1, jmi_max(n_v, 0.0))
     4063    JMI_ARRAY_INIT_1(HEAP, jmi_real_t, jmi_array_t, temp_1_a, JMI_MAX_EQUATION(n_v, 0.0), 1, JMI_MAX_EQUATION(n_v, 0.0))
    41934064    i1_0in = 0;
    4194     i1_0ie = floor((jmi_max(n_v, 0.0)) - (1));
     4065    i1_0ie = floor((JMI_MAX_EQUATION(n_v, 0.0)) - (1));
    41954066    for (i1_0i = 1; i1_0in <= i1_0ie; i1_0i = 1 + (++i1_0in)) {
    41964067        jmi_array_ref_1(temp_1_a, i1_0i) = (1.0 * (i1_0i) * (i1_0i));
     
    47124583    jmi_int_t i1_2in;
    47134584    out_v = 1.0;
    4714     if (COND_EXP_EQ(jmi_max(floor(2.0 - (i_v + 1.0)) + 1.0, 0.0), 2.0, JMI_TRUE, JMI_FALSE) == JMI_FALSE) {
     4585    if (COND_EXP_EQ(JMI_MAX_EQUATION(floor(2.0 - (i_v + 1.0)) + 1.0, 0.0), 2.0, JMI_TRUE, JMI_FALSE) == JMI_FALSE) {
    47154586        jmi_assert_failed(\"Mismatching sizes in CCodeGenTests.CArrayInput6.f1\", JMI_ASSERT_ERROR);
    47164587    }
    4717     JMI_ARRAY_INIT_1(HEAP, jmi_real_t, jmi_array_t, temp_1_a, jmi_max(floor(2.0 - (i_v + 1.0)) + 1.0, 0.0), 1, jmi_max(floor(2.0 - (i_v + 1.0)) + 1.0, 0.0))
     4588    JMI_ARRAY_INIT_1(HEAP, jmi_real_t, jmi_array_t, temp_1_a, JMI_MAX_EQUATION(floor(2.0 - (i_v + 1.0)) + 1.0, 0.0), 1, JMI_MAX_EQUATION(floor(2.0 - (i_v + 1.0)) + 1.0, 0.0))
    47184589    i1_0in = 0;
    4719     i1_0ie = floor((jmi_max(floor(2.0 - (i_v + 1.0)) + 1.0, 0.0)) - (1));
     4590    i1_0ie = floor((JMI_MAX_EQUATION(floor(2.0 - (i_v + 1.0)) + 1.0, 0.0)) - (1));
    47204591    for (i1_0i = 1; i1_0in <= i1_0ie; i1_0i = 1 + (++i1_0in)) {
    47214592        jmi_array_ref_1(temp_1_a, i1_0i) = i_v + 1 + (i1_0i - 1);
    47224593    }
    47234594    if (COND_EXP_LT(func_CCodeGenTests_CArrayInput6_f2_exp1(temp_1_a), 4, JMI_TRUE, JMI_FALSE)) {
    4724         if (COND_EXP_EQ(jmi_max(floor(6.0 - (i_v + 5.0)) + 1.0, 0.0), 2.0, JMI_TRUE, JMI_FALSE) == JMI_FALSE) {
     4595        if (COND_EXP_EQ(JMI_MAX_EQUATION(floor(6.0 - (i_v + 5.0)) + 1.0, 0.0), 2.0, JMI_TRUE, JMI_FALSE) == JMI_FALSE) {
    47254596            jmi_assert_failed(\"Mismatching sizes in CCodeGenTests.CArrayInput6.f1\", JMI_ASSERT_ERROR);
    47264597        }
    4727         JMI_ARRAY_INIT_1(HEAP, jmi_real_t, jmi_array_t, temp_2_a, jmi_max(floor(6.0 - (i_v + 5.0)) + 1.0, 0.0), 1, jmi_max(floor(6.0 - (i_v + 5.0)) + 1.0, 0.0))
     4598        JMI_ARRAY_INIT_1(HEAP, jmi_real_t, jmi_array_t, temp_2_a, JMI_MAX_EQUATION(floor(6.0 - (i_v + 5.0)) + 1.0, 0.0), 1, JMI_MAX_EQUATION(floor(6.0 - (i_v + 5.0)) + 1.0, 0.0))
    47284599        i1_1in = 0;
    4729         i1_1ie = floor((jmi_max(floor(6.0 - (i_v + 5.0)) + 1.0, 0.0)) - (1));
     4600        i1_1ie = floor((JMI_MAX_EQUATION(floor(6.0 - (i_v + 5.0)) + 1.0, 0.0)) - (1));
    47304601        for (i1_1i = 1; i1_1in <= i1_1ie; i1_1i = 1 + (++i1_1in)) {
    47314602            jmi_array_ref_1(temp_2_a, i1_1i) = i_v + 5 + (i1_1i - 1);
     
    47334604        out_v = func_CCodeGenTests_CArrayInput6_f2_exp1(temp_2_a);
    47344605    } else {
    4735         if (COND_EXP_EQ(jmi_max(floor(8.0 - (i_v + 7.0)) + 1.0, 0.0), 2.0, JMI_TRUE, JMI_FALSE) == JMI_FALSE) {
     4606        if (COND_EXP_EQ(JMI_MAX_EQUATION(floor(8.0 - (i_v + 7.0)) + 1.0, 0.0), 2.0, JMI_TRUE, JMI_FALSE) == JMI_FALSE) {
    47364607            jmi_assert_failed(\"Mismatching sizes in CCodeGenTests.CArrayInput6.f1\", JMI_ASSERT_ERROR);
    47374608        }
    4738         JMI_ARRAY_INIT_1(HEAP, jmi_real_t, jmi_array_t, temp_3_a, jmi_max(floor(8.0 - (i_v + 7.0)) + 1.0, 0.0), 1, jmi_max(floor(8.0 - (i_v + 7.0)) + 1.0, 0.0))
     4609        JMI_ARRAY_INIT_1(HEAP, jmi_real_t, jmi_array_t, temp_3_a, JMI_MAX_EQUATION(floor(8.0 - (i_v + 7.0)) + 1.0, 0.0), 1, JMI_MAX_EQUATION(floor(8.0 - (i_v + 7.0)) + 1.0, 0.0))
    47394610        i1_2in = 0;
    4740         i1_2ie = floor((jmi_max(floor(8.0 - (i_v + 7.0)) + 1.0, 0.0)) - (1));
     4611        i1_2ie = floor((JMI_MAX_EQUATION(floor(8.0 - (i_v + 7.0)) + 1.0, 0.0)) - (1));
    47414612        for (i1_2i = 1; i1_2in <= i1_2ie; i1_2i = 1 + (++i1_2in)) {
    47424613            jmi_array_ref_1(temp_3_a, i1_2i) = i_v + 7 + (i1_2i - 1);
     
    54045275 Real y = -2;
    54055276
    5406     annotation(__JModelica(UnitTesting(tests={
    5407         CCodeGenTestCase(
    5408             name="CAbsTest1",
    5409             description="C code generation for abs() operator",
    5410             variability_propagation=false,
    5411             generate_ode=false,
    5412             generate_dae=true,
    5413             template="$C_DAE_equation_residuals$",
    5414             generatedCode="
    5415     (*res)[0] = jmi_abs(_y_1) - (_x_0);
     5277annotation(__JModelica(UnitTesting(tests={
     5278    CCodeGenTestCase(
     5279        name="CAbsTest1",
     5280        description="C code generation for abs() operator",
     5281        variability_propagation=false,
     5282        generate_ode=false,
     5283        generate_dae=true,
     5284        template="$C_DAE_equation_residuals$",
     5285        generatedCode="
     5286    (*res)[0] = JMI_ABS_EQUATION(_y_1) - (_x_0);
    54165287    (*res)[1] = -2 - (_y_1);
    54175288")})));
     
    60095880    i_0ie = floor((m_v) - (1));
    60105881    for (i_0i = 1; i_0in <= i_0ie; i_0i = 1 + (++i_0in)) {
    6011         JMI_ARRAY_INIT_1(HEAP, R1_1_r, R1_1_ra, temp_1_a, jmi_max(m_v, 0.0), 1, jmi_max(m_v, 0.0))
     5882        JMI_ARRAY_INIT_1(HEAP, R1_1_r, R1_1_ra, temp_1_a, JMI_MAX_EQUATION(m_v, 0.0), 1, JMI_MAX_EQUATION(m_v, 0.0))
    60125883        i1_1in = 0;
    6013         i1_1ie = floor((jmi_max(m_v, 0.0)) - (1));
     5884        i1_1ie = floor((JMI_MAX_EQUATION(m_v, 0.0)) - (1));
    60145885        for (i1_1i = 1; i1_1in <= i1_1ie; i1_1i = 1 + (++i1_1in)) {
    60155886            JMI_ARRAY_INIT_1(STACK, R2_0_r, R2_0_ra, temp_2_a, 1, 1, 1)
     
    60515922    return;
    60525923}
     5924
    60535925")})));
    60545926end CUnknownArray7;
     
    63256197    i_0ie = floor((jmi_array_size(x_a, 0)) - (1));
    63266198    for (i_0i = 1; i_0in <= i_0ie; i_0i = 1 + (++i_0in)) {
    6327         JMI_ARRAY_INIT_1(HEAP, jmi_real_t, jmi_array_t, temp_1_a, (jmi_array_size(x_a, 0) + jmi_max(i_0i, 0.0)), 1, jmi_array_size(x_a, 0) + jmi_max(i_0i, 0.0))
     6199        JMI_ARRAY_INIT_1(HEAP, jmi_real_t, jmi_array_t, temp_1_a, (jmi_array_size(x_a, 0) + JMI_MAX_EQUATION(i_0i, 0.0)), 1, jmi_array_size(x_a, 0) + JMI_MAX_EQUATION(i_0i, 0.0))
    63286200        i1_1in = 0;
    63296201        i1_1ie = floor((jmi_array_size(x_a, 0)) - (1));
     
    63326204        }
    63336205        i1_2in = 0;
    6334         i1_2ie = floor((jmi_max(i_0i, 0.0)) - (1));
     6206        i1_2ie = floor((JMI_MAX_EQUATION(i_0i, 0.0)) - (1));
    63356207        for (i1_2i = 1; i1_2in <= i1_2ie; i1_2i = 1 + (++i1_2in)) {
    63366208            jmi_array_ref_1(temp_1_a, i1_2i + jmi_array_size(x_a, 0)) = i1_2i;
     
    76757547        template="$C_DAE_equation_residuals$",
    76767548        generatedCode="
    7677     (*res)[0] = jmi_pow_equation(jmi, 10, 10, \"10 ^ 10\") - (_x_0);
     7549    (*res)[0] = JMI_POW_EQUATION(jmi, 10, 10, \"10 ^ 10\") - (_x_0);
    76787550")})));
    76797551end CIntegerExp4;
     
    76927564        template="$C_DAE_equation_residuals$",
    76937565        generatedCode="
    7694     (*res)[0] = jmi_pow_equation(jmi, 10, -10, \"10 ^ -10\") - (_x_0);
     7566    (*res)[0] = JMI_POW_EQUATION(jmi, 10, -10, \"10 ^ -10\") - (_x_0);
    76957567")})));
    76967568end CIntegerExp5;
     
    80687940        generatedCode="
    80697941    jmi_real_t nSamp;
    8070     if (SURELY_LT_ZERO(COND_EXP_EQ(LOG_EXP_NOT(_atInitial), JMI_TRUE, _time - (pre__sampleItr_1_4 * jmi_divide_equation(jmi, 2, 3, \"(2 / 3)\")), 1.0))) {
    8071         jmi_min_time_event(nextTimeEvent, 1, 0, pre__sampleItr_1_4 * jmi_divide_equation(jmi, 2, 3, \"(2 / 3)\"));
    8072     }
    8073     if (SURELY_LT_ZERO(_time - ((pre__sampleItr_1_4 + 1.0) * jmi_divide_equation(jmi, 2.0, 3.0, \"(2 / 3)\")))) {
    8074         jmi_min_time_event(nextTimeEvent, 1, 0, (pre__sampleItr_1_4 + 1.0) * jmi_divide_equation(jmi, 2.0, 3.0, \"(2 / 3)\"));
    8075     }
    8076     if (SURELY_LT_ZERO(COND_EXP_EQ(LOG_EXP_NOT(_atInitial), JMI_TRUE, _time - (pre__sampleItr_2_6 * jmi_divide_equation(jmi, 1, 3, \"(1 / 3)\")), 1.0))) {
    8077         jmi_min_time_event(nextTimeEvent, 1, 0, pre__sampleItr_2_6 * jmi_divide_equation(jmi, 1, 3, \"(1 / 3)\"));
    8078     }
    8079     if (SURELY_LT_ZERO(_time - ((pre__sampleItr_2_6 + 1.0) * jmi_divide_equation(jmi, 1.0, 3.0, \"(1 / 3)\")))) {
    8080         jmi_min_time_event(nextTimeEvent, 1, 0, (pre__sampleItr_2_6 + 1.0) * jmi_divide_equation(jmi, 1.0, 3.0, \"(1 / 3)\"));
     7942    if (SURELY_LT_ZERO(COND_EXP_EQ(LOG_EXP_NOT(_atInitial), JMI_TRUE, _time - (pre__sampleItr_1_4 * JMI_DIVIDE_EQUATION(jmi, 2, 3, \"(2 / 3)\")), 1.0))) {
     7943        jmi_min_time_event(nextTimeEvent, 1, 0, pre__sampleItr_1_4 * JMI_DIVIDE_EQUATION(jmi, 2, 3, \"(2 / 3)\"));
     7944    }
     7945    if (SURELY_LT_ZERO(_time - ((pre__sampleItr_1_4 + 1.0) * JMI_DIVIDE_EQUATION(jmi, 2.0, 3.0, \"(2 / 3)\")))) {
     7946        jmi_min_time_event(nextTimeEvent, 1, 0, (pre__sampleItr_1_4 + 1.0) * JMI_DIVIDE_EQUATION(jmi, 2.0, 3.0, \"(2 / 3)\"));
     7947    }
     7948    if (SURELY_LT_ZERO(COND_EXP_EQ(LOG_EXP_NOT(_atInitial), JMI_TRUE, _time - (pre__sampleItr_2_6 * JMI_DIVIDE_EQUATION(jmi, 1, 3, \"(1 / 3)\")), 1.0))) {
     7949        jmi_min_time_event(nextTimeEvent, 1, 0, pre__sampleItr_2_6 * JMI_DIVIDE_EQUATION(jmi, 1, 3, \"(1 / 3)\"));
     7950    }
     7951    if (SURELY_LT_ZERO(_time - ((pre__sampleItr_2_6 + 1.0) * JMI_DIVIDE_EQUATION(jmi, 1.0, 3.0, \"(1 / 3)\")))) {
     7952        jmi_min_time_event(nextTimeEvent, 1, 0, (pre__sampleItr_2_6 + 1.0) * JMI_DIVIDE_EQUATION(jmi, 1.0, 3.0, \"(1 / 3)\"));
    80817953    }
    80827954 
     
    80877959    _der_dummy_13 = 0;
    80887960    if (jmi->atInitial || jmi->atEvent) {
    8089         _sw(3) = jmi_turn_switch_time(jmi, _time - ((pre__sampleItr_2_6 + 1.0) * jmi_divide_equation(jmi, 1.0, 3.0, \"(1 / 3)\")), _sw(3), JMI_REL_LT);
     7961        _sw(3) = jmi_turn_switch_time(jmi, _time - ((pre__sampleItr_2_6 + 1.0) * JMI_DIVIDE_EQUATION(jmi, 1.0, 3.0, \"(1 / 3)\")), _sw(3), JMI_REL_LT);
    80907962    }
    80917963    if (jmi->atInitial || jmi->atEvent) {
    8092         _sw(2) = jmi_turn_switch_time(jmi, _time - (pre__sampleItr_2_6 * jmi_divide_equation(jmi, 1, 3, \"(1 / 3)\")), _sw(2), JMI_REL_GEQ);
     7964        _sw(2) = jmi_turn_switch_time(jmi, _time - (pre__sampleItr_2_6 * JMI_DIVIDE_EQUATION(jmi, 1, 3, \"(1 / 3)\")), _sw(2), JMI_REL_GEQ);
    80937965    }
    80947966    ef |= jmi_solve_block_residual(jmi->dae_block_residuals[0]);
    80957967    if (jmi->atInitial || jmi->atEvent) {
    8096         _sw(1) = jmi_turn_switch_time(jmi, _time - ((pre__sampleItr_1_4 + 1.0) * jmi_divide_equation(jmi, 2.0, 3.0, \"(2 / 3)\")), _sw(1), JMI_REL_LT);
     7968        _sw(1) = jmi_turn_switch_time(jmi, _time - ((pre__sampleItr_1_4 + 1.0) * JMI_DIVIDE_EQUATION(jmi, 2.0, 3.0, \"(2 / 3)\")), _sw(1), JMI_REL_LT);
    80977969    }
    80987970    if (jmi->atInitial || jmi->atEvent) {
    8099         _sw(0) = jmi_turn_switch_time(jmi, _time - (pre__sampleItr_1_4 * jmi_divide_equation(jmi, 2, 3, \"(2 / 3)\")), _sw(0), JMI_REL_GEQ);
     7971        _sw(0) = jmi_turn_switch_time(jmi, _time - (pre__sampleItr_1_4 * JMI_DIVIDE_EQUATION(jmi, 2, 3, \"(2 / 3)\")), _sw(0), JMI_REL_GEQ);
    81007972    }
    81017973    ef |= jmi_solve_block_residual(jmi->dae_block_residuals[1]);
     
    81127984        _sw_init(0) = jmi_turn_switch_time(jmi, _time - (0.0), _sw_init(0), JMI_REL_LT);
    81137985    }
    8114     __sampleItr_1_4 = COND_EXP_EQ(_sw_init(0), JMI_TRUE, 0.0, ceil(jmi_divide_equation(jmi, _time, jmi_divide_equation(jmi, 2.0, 3.0, \"(2 / 3)\"), \"time / (2 / 3)\")));
     7986    __sampleItr_1_4 = COND_EXP_EQ(_sw_init(0), JMI_TRUE, 0.0, ceil(JMI_DIVIDE_EQUATION(jmi, _time, JMI_DIVIDE_EQUATION(jmi, 2.0, 3.0, \"(2 / 3)\"), \"time / (2 / 3)\")));
    81157987    pre__sampleItr_1_4 = __sampleItr_1_4;
    81167988    if (jmi->atInitial || jmi->atEvent) {
    8117         _sw(0) = jmi_turn_switch_time(jmi, _time - (pre__sampleItr_1_4 * jmi_divide_equation(jmi, 2, 3, \"(2 / 3)\")), _sw(0), JMI_REL_GEQ);
     7989        _sw(0) = jmi_turn_switch_time(jmi, _time - (pre__sampleItr_1_4 * JMI_DIVIDE_EQUATION(jmi, 2, 3, \"(2 / 3)\")), _sw(0), JMI_REL_GEQ);
    81187990    }
    81197991    _temp_1_3 = LOG_EXP_AND(LOG_EXP_NOT(_atInitial), _sw(0));
    81207992    if (jmi->atInitial || jmi->atEvent) {
    8121         _sw(1) = jmi_turn_switch_time(jmi, _time - ((pre__sampleItr_1_4 + 1.0) * jmi_divide_equation(jmi, 2.0, 3.0, \"(2 / 3)\")), _sw(1), JMI_REL_LT);
     7993        _sw(1) = jmi_turn_switch_time(jmi, _time - ((pre__sampleItr_1_4 + 1.0) * JMI_DIVIDE_EQUATION(jmi, 2.0, 3.0, \"(2 / 3)\")), _sw(1), JMI_REL_LT);
    81227994    }
    81237995    if (_sw(1) == JMI_FALSE) {
     
    81277999        _sw_init(0) = jmi_turn_switch_time(jmi, _time - (0.0), _sw_init(0), JMI_REL_LT);
    81288000    }
    8129     __sampleItr_2_6 = COND_EXP_EQ(_sw_init(0), JMI_TRUE, 0.0, ceil(jmi_divide_equation(jmi, _time, jmi_divide_equation(jmi, 1.0, 3.0, \"(1 / 3)\"), \"time / (1 / 3)\")));
     8001    __sampleItr_2_6 = COND_EXP_EQ(_sw_init(0), JMI_TRUE, 0.0, ceil(JMI_DIVIDE_EQUATION(jmi, _time, JMI_DIVIDE_EQUATION(jmi, 1.0, 3.0, \"(1 / 3)\"), \"time / (1 / 3)\")));
    81308002    pre__sampleItr_2_6 = __sampleItr_2_6;
    81318003    if (jmi->atInitial || jmi->atEvent) {
    8132         _sw(2) = jmi_turn_switch_time(jmi, _time - (pre__sampleItr_2_6 * jmi_divide_equation(jmi, 1, 3, \"(1 / 3)\")), _sw(2), JMI_REL_GEQ);
     8004        _sw(2) = jmi_turn_switch_time(jmi, _time - (pre__sampleItr_2_6 * JMI_DIVIDE_EQUATION(jmi, 1, 3, \"(1 / 3)\")), _sw(2), JMI_REL_GEQ);
    81338005    }
    81348006    _temp_2_5 = LOG_EXP_AND(LOG_EXP_NOT(_atInitial), _sw(2));
    81358007    if (jmi->atInitial || jmi->atEvent) {
    8136         _sw(3) = jmi_turn_switch_time(jmi, _time - ((pre__sampleItr_2_6 + 1.0) * jmi_divide_equation(jmi, 1.0, 3.0, \"(1 / 3)\")), _sw(3), JMI_REL_LT);
     8008        _sw(3) = jmi_turn_switch_time(jmi, _time - ((pre__sampleItr_2_6 + 1.0) * JMI_DIVIDE_EQUATION(jmi, 1.0, 3.0, \"(1 / 3)\")), _sw(3), JMI_REL_LT);
    81378009    }
    81388010    if (_sw(3) == JMI_FALSE) {
     
    81688040        }
    81698041        if (evaluation_mode & JMI_BLOCK_EVALUATE_NON_REALS) {
    8170             _sw(3) = jmi_turn_switch_time(jmi, _time - ((pre__sampleItr_2_6 + 1.0) * jmi_divide_equation(jmi, 1.0, 3.0, \"(1 / 3)\")), _sw(3), JMI_REL_LT);
     8042            _sw(3) = jmi_turn_switch_time(jmi, _time - ((pre__sampleItr_2_6 + 1.0) * JMI_DIVIDE_EQUATION(jmi, 1.0, 3.0, \"(1 / 3)\")), _sw(3), JMI_REL_LT);
    81718043        }
    81728044        if (_sw(3) == JMI_FALSE) {
     
    81758047        if (evaluation_mode & JMI_BLOCK_EVALUATE_NON_REALS) {
    81768048            if (evaluation_mode & JMI_BLOCK_EVALUATE_NON_REALS) {
    8177                 _sw(2) = jmi_turn_switch_time(jmi, _time - (pre__sampleItr_2_6 * jmi_divide_equation(jmi, 1, 3, \"(1 / 3)\")), _sw(2), JMI_REL_GEQ);
     8049                _sw(2) = jmi_turn_switch_time(jmi, _time - (pre__sampleItr_2_6 * JMI_DIVIDE_EQUATION(jmi, 1, 3, \"(1 / 3)\")), _sw(2), JMI_REL_GEQ);
    81788050            }
    81798051            _temp_2_5 = LOG_EXP_AND(LOG_EXP_NOT(_atInitial), _sw(2));
     
    82088080        }
    82098081        if (evaluation_mode & JMI_BLOCK_EVALUATE_NON_REALS) {
    8210             _sw(1) = jmi_turn_switch_time(jmi, _time - ((pre__sampleItr_1_4 + 1.0) * jmi_divide_equation(jmi, 2.0, 3.0, \"(2 / 3)\")), _sw(1), JMI_REL_LT);
     8082            _sw(1) = jmi_turn_switch_time(jmi, _time - ((pre__sampleItr_1_4 + 1.0) * JMI_DIVIDE_EQUATION(jmi, 2.0, 3.0, \"(2 / 3)\")), _sw(1), JMI_REL_LT);
    82118083        }
    82128084        if (_sw(1) == JMI_FALSE) {
     
    82158087        if (evaluation_mode & JMI_BLOCK_EVALUATE_NON_REALS) {
    82168088            if (evaluation_mode & JMI_BLOCK_EVALUATE_NON_REALS) {
    8217                 _sw(0) = jmi_turn_switch_time(jmi, _time - (pre__sampleItr_1_4 * jmi_divide_equation(jmi, 2, 3, \"(2 / 3)\")), _sw(0), JMI_REL_GEQ);
     8089                _sw(0) = jmi_turn_switch_time(jmi, _time - (pre__sampleItr_1_4 * JMI_DIVIDE_EQUATION(jmi, 2, 3, \"(2 / 3)\")), _sw(0), JMI_REL_GEQ);
    82188090            }
    82198091            _temp_1_3 = LOG_EXP_AND(LOG_EXP_NOT(_atInitial), _sw(0));
     
    83038175        _sw_init(0) = jmi_turn_switch_time(jmi, _time - (0.0), _sw_init(0), JMI_REL_LT);
    83048176    }
    8305     __sampleItr_1_12 = COND_EXP_EQ(_sw_init(0), JMI_TRUE, 0.0, ceil(jmi_divide_equation(jmi, _time, _h_11, \"time / h\")));
     8177    __sampleItr_1_12 = COND_EXP_EQ(_sw_init(0), JMI_TRUE, 0.0, ceil(JMI_DIVIDE_EQUATION(jmi, _time, _h_11, \"time / h\")));
    83068178    pre__sampleItr_1_12 = __sampleItr_1_12;
    83078179    if (jmi->atInitial || jmi->atEvent) {
     
    83768248    } else if (evaluation_mode == JMI_BLOCK_EQUATION_NOMINAL_AUTO) {
    83778249        (*res)[0] = 1;
    8378         (*res)[1] = jmi_max(1.0, jmi_max(jmi_abs(_a_c_8), jmi_abs(_b_c_9)));
     8250        (*res)[1] = JMI_MAX_EQUATION(1.0, JMI_MAX_EQUATION(JMI_ABS_EQUATION(_a_c_8), JMI_ABS_EQUATION(_b_c_9)));
    83798251    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    83808252        x[0] = pre_x_c_3;
     
    85238395        _sw_init(0) = jmi_turn_switch_time(jmi, _time - (0.0), _sw_init(0), JMI_REL_LT);
    85248396    }
    8525     __sampleItr_1_13 = COND_EXP_EQ(_sw_init(0), JMI_TRUE, 0.0, ceil(jmi_divide_equation(jmi, _time, _h_11, \"time / h\")));
     8397    __sampleItr_1_13 = COND_EXP_EQ(_sw_init(0), JMI_TRUE, 0.0, ceil(JMI_DIVIDE_EQUATION(jmi, _time, _h_11, \"time / h\")));
    85268398    pre__sampleItr_1_13 = __sampleItr_1_13;
    85278399    if (jmi->atInitial || jmi->atEvent) {
     
    87838655        }
    87848656        if (evaluation_mode & JMI_BLOCK_EVALUATE) {
    8785             (*res)[0] = COND_EXP_EQ(LOG_EXP_AND(_temp_1_6, LOG_EXP_NOT(pre_temp_1_6)), JMI_TRUE, jmi_sin_equation(jmi, _x_0, \"sin(x)\") + 3.0, pre_x_0) - (_x_0);
     8657            (*res)[0] = COND_EXP_EQ(LOG_EXP_AND(_temp_1_6, LOG_EXP_NOT(pre_temp_1_6)), JMI_TRUE, JMI_SIN_EQUATION(jmi, _x_0, \"sin(x)\") + 3.0, pre_x_0) - (_x_0);
    87868658        }
    87878659    }
     
    94729344    JMI_DEF(REA, tmp_6)
    94739345    if (_sw(0)) {
    9474         func_CCodeGenTests_dummyFunc_def0(jmi_divide_equation(jmi, _time * _time * _time, 2.0, \"time * time * time / 2\"), &tmp_1, &tmp_2);
     9346        func_CCodeGenTests_dummyFunc_def0(JMI_DIVIDE_EQUATION(jmi, _time * _time * _time, 2.0, \"time * time * time / 2\"), &tmp_1, &tmp_2);
    94759347        _x_0 = (tmp_1);
    94769348        _y_1 = (tmp_2);
     
    1015110023        }
    1015210024        if (evaluation_mode & JMI_BLOCK_EVALUATE) {
    10153             (*res)[0] = _z1_2 + 2 - (jmi_sin_equation(jmi, _z1_2, \"sin(z1)\") * 3);
     10025            (*res)[0] = _z1_2 + 2 - (JMI_SIN_EQUATION(jmi, _z1_2, \"sin(z1)\") * 3);
    1015410026        }
    1015510027    }
     
    1017510047        }
    1017610048        if (evaluation_mode & JMI_BLOCK_EVALUATE) {
    10177             (*res)[0] = _z1_2 + 2 - (jmi_sin_equation(jmi, _z1_2, \"sin(z1)\") * 3);
     10049            (*res)[0] = _z1_2 + 2 - (JMI_SIN_EQUATION(jmi, _z1_2, \"sin(z1)\") * 3);
    1017810050        }
    1017910051    }
     
    1031710189        (*res)[0] = 1;
    1031810190        (*res)[1] = 1;
    10319         (*res)[2] = jmi_max(1.0, jmi_max(jmi_max(jmi_abs(_f0_1), jmi_abs(_f1_2)), jmi_max(jmi_max(jmi_abs(_f0_1), jmi_abs(_f1_2)), jmi_abs(_f0_1))));
    10320         (*res)[3] = jmi_max(jmi_abs(_m_0), jmi_max(1.0, 1.0));
     10191        (*res)[2] = JMI_MAX_EQUATION(1.0, JMI_MAX_EQUATION(JMI_MAX_EQUATION(JMI_ABS_EQUATION(_f0_1), JMI_ABS_EQUATION(_f1_2)), JMI_MAX_EQUATION(JMI_MAX_EQUATION(JMI_ABS_EQUATION(_f0_1), JMI_ABS_EQUATION(_f1_2)), JMI_ABS_EQUATION(_f0_1))));
     10192        (*res)[3] = JMI_MAX_EQUATION(JMI_ABS_EQUATION(_m_0), JMI_MAX_EQUATION(1.0, 1.0));
    1032110193    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    1032210194        x[0] = _a_4;
     
    1039910271        (*res)[0] = 1;
    1040010272        (*res)[1] = 1;
    10401         (*res)[2] = jmi_max(1.0, jmi_max(jmi_max(jmi_abs(_f0_1), jmi_abs(_f1_2)), jmi_max(jmi_max(jmi_abs(_f0_1), jmi_abs(_f1_2)), jmi_abs(_f0_1))));
    10402         (*res)[3] = jmi_max(jmi_abs(_m_0), jmi_max(1.0, 1.0));
     10273        (*res)[2] = JMI_MAX_EQUATION(1.0, JMI_MAX_EQUATION(JMI_MAX_EQUATION(JMI_ABS_EQUATION(_f0_1), JMI_ABS_EQUATION(_f1_2)), JMI_MAX_EQUATION(JMI_MAX_EQUATION(JMI_ABS_EQUATION(_f0_1), JMI_ABS_EQUATION(_f1_2)), JMI_ABS_EQUATION(_f0_1))));
     10274        (*res)[3] = JMI_MAX_EQUATION(JMI_ABS_EQUATION(_m_0), JMI_MAX_EQUATION(1.0, 1.0));
    1040310275    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    1040410276        x[0] = _a_4;
     
    1045210324    JMI_DYNAMIC_INIT()
    1045310325    _der_dummy_15 = 1;
    10454     _u_6 = 2 * jmi_sin_equation(jmi, _time, \"sin(time)\");
     10326    _u_6 = 2 * JMI_SIN_EQUATION(jmi, _time, \"sin(time)\");
    1045510327    if (jmi->atInitial || jmi->atEvent) {
    1045610328        _sw(2) = jmi_turn_switch(jmi, _v_3 - (0.0), _sw(2), JMI_REL_GT);
     
    1046910341    JMI_DYNAMIC_INIT()
    1047010342    _der_dummy_15 = 1;
    10471     _u_6 = 2 * jmi_sin_equation(jmi, _time, \"sin(time)\");
     10343    _u_6 = 2 * JMI_SIN_EQUATION(jmi, _time, \"sin(time)\");
    1047210344    pre_mode_10 = 2;
    1047310345    _v_3 = 0.0;
     
    1082410696        x[1] = 7;
    1082510697    } else if (evaluation_mode == JMI_BLOCK_EQUATION_NOMINAL_AUTO) {
    10826         (*res)[0] = jmi_max(jmi_max(jmi_abs(_p_12) * jmi_abs(_A_2_1_2), jmi_abs(_p_12) * jmi_abs(_A_2_2_3)), 1.0);
    10827         (*res)[1] = jmi_max(jmi_max(jmi_abs(_p_12) * jmi_abs(_A_1_1_0), jmi_abs(_p_12) * jmi_abs(_A_1_2_1)), 1.0);
     10698        (*res)[0] = JMI_MAX_EQUATION(JMI_MAX_EQUATION(JMI_ABS_EQUATION(_p_12) * JMI_ABS_EQUATION(_A_2_1_2), JMI_ABS_EQUATION(_p_12) * JMI_ABS_EQUATION(_A_2_2_3)), 1.0);
     10699        (*res)[1] = JMI_MAX_EQUATION(JMI_MAX_EQUATION(JMI_ABS_EQUATION(_p_12) * JMI_ABS_EQUATION(_A_1_1_0), JMI_ABS_EQUATION(_p_12) * JMI_ABS_EQUATION(_A_1_2_1)), 1.0);
    1082810700    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    1082910701        x[0] = _y_2_7;
     
    1088810760        x[1] = 9;
    1088910761    } else if (evaluation_mode == JMI_BLOCK_EQUATION_NOMINAL_AUTO) {
    10890         (*res)[0] = jmi_max(jmi_max(jmi_max(1.0, jmi_abs(1.0)) * jmi_abs(_A_2_1_2), jmi_max(1.0, jmi_abs(1.0)) * jmi_abs(_A_2_2_3)), jmi_max(1.0, jmi_abs(2.0)));
    10891         (*res)[1] = jmi_max(jmi_max(jmi_max(1.0, jmi_abs(1.0)) * jmi_abs(_A_1_1_0), jmi_max(1.0, jmi_abs(1.0)) * jmi_abs(_A_1_2_1)), jmi_max(1.0, jmi_abs(2.0)));
     10762        (*res)[0] = JMI_MAX_EQUATION(JMI_MAX_EQUATION(JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(1.0)) * JMI_ABS_EQUATION(_A_2_1_2), JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(1.0)) * JMI_ABS_EQUATION(_A_2_2_3)), JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(2.0)));
     10763        (*res)[1] = JMI_MAX_EQUATION(JMI_MAX_EQUATION(JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(1.0)) * JMI_ABS_EQUATION(_A_1_1_0), JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(1.0)) * JMI_ABS_EQUATION(_A_1_2_1)), JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(2.0)));
    1089210764    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    1089310765        x[0] = _z_2_9;
     
    1092210794        x[1] = 11;
    1092310795    } else if (evaluation_mode == JMI_BLOCK_EQUATION_NOMINAL_AUTO) {
    10924         (*res)[0] = jmi_max(jmi_max(jmi_max(1.0, jmi_abs(1.0)) * jmi_abs(_A_2_1_2), jmi_max(1.0, jmi_abs(1.0)) * jmi_abs(_A_2_2_3)), jmi_max(1.0, jmi_abs(3.0)));
    10925         (*res)[1] = jmi_max(jmi_max(jmi_max(1.0, jmi_abs(1.0)) * jmi_abs(_A_1_1_0), jmi_max(1.0, jmi_abs(1.0)) * jmi_abs(_A_1_2_1)), jmi_max(1.0, jmi_abs(3.0)));
     10796        (*res)[0] = JMI_MAX_EQUATION(JMI_MAX_EQUATION(JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(1.0)) * JMI_ABS_EQUATION(_A_2_1_2), JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(1.0)) * JMI_ABS_EQUATION(_A_2_2_3)), JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(3.0)));
     10797        (*res)[1] = JMI_MAX_EQUATION(JMI_MAX_EQUATION(JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(1.0)) * JMI_ABS_EQUATION(_A_1_1_0), JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(1.0)) * JMI_ABS_EQUATION(_A_1_2_1)), JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(3.0)));
    1092610798    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    1092710799        x[0] = _w_2_11;
     
    1099110863        x[1] = 7;
    1099210864    } else if (evaluation_mode == JMI_BLOCK_EQUATION_NOMINAL_AUTO) {
    10993         (*res)[0] = jmi_max(jmi_max(jmi_abs(_p_12) * jmi_abs(_A_2_1_2), jmi_abs(_p_12) * jmi_abs(_A_2_2_3)), 1.0);
    10994         (*res)[1] = jmi_max(jmi_max(jmi_abs(_p_12) * jmi_abs(_A_1_1_0), jmi_abs(_p_12) * jmi_abs(_A_1_2_1)), 1.0);
     10865        (*res)[0] = JMI_MAX_EQUATION(JMI_MAX_EQUATION(JMI_ABS_EQUATION(_p_12) * JMI_ABS_EQUATION(_A_2_1_2), JMI_ABS_EQUATION(_p_12) * JMI_ABS_EQUATION(_A_2_2_3)), 1.0);
     10866        (*res)[1] = JMI_MAX_EQUATION(JMI_MAX_EQUATION(JMI_ABS_EQUATION(_p_12) * JMI_ABS_EQUATION(_A_1_1_0), JMI_ABS_EQUATION(_p_12) * JMI_ABS_EQUATION(_A_1_2_1)), 1.0);
    1099510867    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    1099610868        x[0] = _y_2_7;
     
    1102510897        x[1] = 9;
    1102610898    } else if (evaluation_mode == JMI_BLOCK_EQUATION_NOMINAL_AUTO) {
    11027         (*res)[0] = jmi_max(jmi_max(jmi_max(1.0, jmi_abs(1.0)) * jmi_abs(_A_2_1_2), jmi_max(1.0, jmi_abs(1.0)) * jmi_abs(_A_2_2_3)), jmi_max(1.0, jmi_abs(2.0)));
    11028         (*res)[1] = jmi_max(jmi_max(jmi_max(1.0, jmi_abs(1.0)) * jmi_abs(_A_1_1_0), jmi_max(1.0, jmi_abs(1.0)) * jmi_abs(_A_1_2_1)), jmi_max(1.0, jmi_abs(2.0)));
     10899        (*res)[0] = JMI_MAX_EQUATION(JMI_MAX_EQUATION(JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(1.0)) * JMI_ABS_EQUATION(_A_2_1_2), JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(1.0)) * JMI_ABS_EQUATION(_A_2_2_3)), JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(2.0)));
     10900        (*res)[1] = JMI_MAX_EQUATION(JMI_MAX_EQUATION(JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(1.0)) * JMI_ABS_EQUATION(_A_1_1_0), JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(1.0)) * JMI_ABS_EQUATION(_A_1_2_1)), JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(2.0)));
    1102910901    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    1103010902        x[0] = _z_2_9;
     
    1105910931        x[1] = 11;
    1106010932    } else if (evaluation_mode == JMI_BLOCK_EQUATION_NOMINAL_AUTO) {
    11061         (*res)[0] = jmi_max(jmi_max(jmi_max(1.0, jmi_abs(1.0)) * jmi_abs(_A_2_1_2), jmi_max(1.0, jmi_abs(1.0)) * jmi_abs(_A_2_2_3)), jmi_max(1.0, jmi_abs(3.0)));
    11062         (*res)[1] = jmi_max(jmi_max(jmi_max(1.0, jmi_abs(1.0)) * jmi_abs(_A_1_1_0), jmi_max(1.0, jmi_abs(1.0)) * jmi_abs(_A_1_2_1)), jmi_max(1.0, jmi_abs(3.0)));
     10933        (*res)[0] = JMI_MAX_EQUATION(JMI_MAX_EQUATION(JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(1.0)) * JMI_ABS_EQUATION(_A_2_1_2), JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(1.0)) * JMI_ABS_EQUATION(_A_2_2_3)), JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(3.0)));
     10934        (*res)[1] = JMI_MAX_EQUATION(JMI_MAX_EQUATION(JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(1.0)) * JMI_ABS_EQUATION(_A_1_1_0), JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(1.0)) * JMI_ABS_EQUATION(_A_1_2_1)), JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(3.0)));
    1106310935    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    1106410936        x[0] = _w_2_11;
     
    1115411026        }
    1115511027        if (evaluation_mode & JMI_BLOCK_EVALUATE) {
    11156             (*res)[0] = jmi_sin_equation(jmi, _b_1, \"sin(b)\") * COND_EXP_EQ(_d_2, JMI_TRUE, 1.0, 2.0) - (_a_0);
     11028            (*res)[0] = JMI_SIN_EQUATION(jmi, _b_1, \"sin(b)\") * COND_EXP_EQ(_d_2, JMI_TRUE, 1.0, 2.0) - (_a_0);
    1115711029            (*res)[1] = 1 - _b_1 - (_a_0);
    1115811030        }
     
    1119511067        }
    1119611068        if (evaluation_mode & JMI_BLOCK_EVALUATE) {
    11197             (*res)[0] = jmi_sin_equation(jmi, _b_1, \"sin(b)\") * COND_EXP_EQ(_d_2, JMI_TRUE, 1.0, 2.0) - (_a_0);
     11069            (*res)[0] = JMI_SIN_EQUATION(jmi, _b_1, \"sin(b)\") * COND_EXP_EQ(_d_2, JMI_TRUE, 1.0, 2.0) - (_a_0);
    1119811070            (*res)[1] = 1 - _b_1 - (_a_0);
    1119911071        }
     
    1222612098        JMI_RECORD_STATIC(R_0_r, tmp_2)
    1222712099        tmp_2->y = _p_y_0;
    12228         (*res)[0] = jmi_max(jmi_abs(func_CCodeGenTests_BlockTest22_f_exp0(tmp_2)), 1.0);
     12100        (*res)[0] = JMI_MAX_EQUATION(JMI_ABS_EQUATION(func_CCodeGenTests_BlockTest22_f_exp0(tmp_2)), 1.0);
    1222912101    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    1223012102        x[0] = _x_1;
     
    1232812200        name="BlockTest25",
    1232912201        description="Nominal with global constant in record",
     12202        variability_propagation=false,
    1233012203        template="$C_dae_blocks_residual_functions$",
    12331         variability_propagation=false,
    1233212204        generatedCode="
    1233312205static int dae_block_0(jmi_t* jmi, jmi_real_t* x, jmi_real_t* residual, int evaluation_mode) {
     
    1233912211        x[0] = 1;
    1234012212    } else if (evaluation_mode == JMI_BLOCK_EQUATION_NOMINAL_AUTO) {
    12341         (*res)[0] = jmi_max(1.0, jmi_max(jmi_abs(jmi_array_rec_1(JMI_GLOBAL(CCodeGenTests_BlockTest25_f_p), _i_0)->y), 1.0));
     12213        (*res)[0] = JMI_MAX_EQUATION(1.0, JMI_MAX_EQUATION(JMI_ABS_EQUATION(jmi_array_rec_1(JMI_GLOBAL(CCodeGenTests_BlockTest25_f_p), _i_0)->y), 1.0));
    1234212214    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    1234312215        x[0] = _x_1;
     
    1235312225    return ef;
    1235412226}
     12227
    1235512228")})));
    1235612229end BlockTest25;
     
    1239212265        }
    1239312266        if (evaluation_mode & JMI_BLOCK_EVALUATE) {
    12394             (*res)[0] = jmi_asin_equation(jmi, _b_1, \"asin(b)\") - (_a_0);
     12267            (*res)[0] = JMI_ASIN_EQUATION(jmi, _b_1, \"asin(b)\") - (_a_0);
    1239512268        }
    1239612269    }
     
    1311412987        x[2] = 7;
    1311512988    } else if (evaluation_mode == JMI_BLOCK_EQUATION_NOMINAL_AUTO) {
    13116         (*res)[0] = jmi_max(1.0, jmi_abs(_R3_10));
    13117         (*res)[1] = jmi_max(1.0, jmi_abs(_R2_9));
     12989        (*res)[0] = JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(_R3_10));
     12990        (*res)[1] = JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(_R2_9));
    1311812991    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    1311912992        x[0] = _i2_5;
     
    1323413107        x[1] = jmi->offs_sw + 1;
    1323513108    } else if (evaluation_mode == JMI_BLOCK_EQUATION_NOMINAL_AUTO) {
    13236         (*res)[0] = jmi_max(jmi_abs(_m_0), jmi_max(1.0, 1.0));
     13109        (*res)[0] = JMI_MAX_EQUATION(JMI_ABS_EQUATION(_m_0), JMI_MAX_EQUATION(1.0, 1.0));
    1323713110    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    1323813111        x[0] = _sa_7;
     
    1332113194        x[1] = jmi->offs_sw + 0;
    1332213195    } else if (evaluation_mode == JMI_BLOCK_EQUATION_NOMINAL_AUTO) {
    13323         (*res)[0] = jmi_max(jmi_abs(_m_0), jmi_max(1.0, 1.0));
     13196        (*res)[0] = JMI_MAX_EQUATION(JMI_ABS_EQUATION(_m_0), JMI_MAX_EQUATION(1.0, 1.0));
    1332413197    } else if (evaluation_mode == JMI_BLOCK_INITIALIZE) {
    1332513198        x[0] = _sa_7;
     
    1395913832        }
    1396013833    }
    13961     lda_v = jmi_max(1.0, jmi_array_size(A_a, 0));
    13962     ldb_v = jmi_max(1.0, jmi_array_size(b_a, 0));
     13834    lda_v = JMI_MAX_EQUATION(1.0, jmi_array_size(A_a, 0));
     13835    ldb_v = JMI_MAX_EQUATION(1.0, jmi_array_size(b_a, 0));
    1396313836    JMI_ARRAY_INIT_1(HEAP, jmi_real_t, jmi_array_t, ipiv_a, jmi_array_size(A_a, 0), 1, jmi_array_size(A_a, 0))
    1396413837    tmp_1 = (int)1;
     
    1406813941        }
    1406913942    }
    14070     lda_v = jmi_max(1.0, jmi_array_size(A_a, 0));
    14071     ldb_v = jmi_max(1.0, jmi_array_size(B_a, 0));
     13943    lda_v = JMI_MAX_EQUATION(1.0, jmi_array_size(A_a, 0));
     13944    ldb_v = JMI_MAX_EQUATION(1.0, jmi_array_size(B_a, 0));
    1407213945    JMI_ARRAY_INIT_1(HEAP, jmi_real_t, jmi_array_t, ipiv_a, jmi_array_size(A_a, 0), 1, jmi_array_size(A_a, 0))
    1407313946    JMI_ARRAY_INIT_2(HEAP, jmi_real_t, jmi_array_t, tmp_1, jmi_array_size(Awork_a, 0) * jmi_array_size(Awork_a, 1), 2, jmi_array_size(Awork_a, 0), jmi_array_size(Awork_a, 1))
     
    1464414517    }
    1464514518    if (jmi->atInitial || jmi->atEvent) {
    14646         _sw(0) = jmi_turn_switch(jmi, jmi_divide_equation(jmi, (pre_j_17 + 1.0), 4.0, \"(pre(j) + 1) / 4\") - (pre_temp_2_20), _sw(0), JMI_REL_LT);
     14519        _sw(0) = jmi_turn_switch(jmi, JMI_DIVIDE_EQUATION(jmi, (pre_j_17 + 1.0), 4.0, \"(pre(j) + 1) / 4\") - (pre_temp_2_20), _sw(0), JMI_REL_LT);
    1464714520    }
    1464814521    if (jmi->atInitial || jmi->atEvent) {
    14649         _sw(1) = jmi_turn_switch(jmi, jmi_divide_equation(jmi, (pre_j_17 + 1.0), 4.0, \"(pre(j) + 1) / 4\") - (pre_temp_2_20 + 1.0), _sw(1), JMI_REL_GEQ);
     14522        _sw(1) = jmi_turn_switch(jmi, JMI_DIVIDE_EQUATION(jmi, (pre_j_17 + 1.0), 4.0, \"(pre(j) + 1) / 4\") - (pre_temp_2_20 + 1.0), _sw(1), JMI_REL_GEQ);
    1465014523    }
    1465114524    ef |= jmi_solve_block_residual(jmi->dae_block_residuals[0]);
     
    1469314566    }
    1469414567    if (jmi->atInitial || jmi->atEvent) {
    14695         _sw(0) = jmi_turn_switch(jmi, jmi_divide_equation(jmi, (pre_j_16 + 1.0), 4.0, \"(pre(j) + 1) / 4\") - (pre_temp_2_20), _sw(0), JMI_REL_LT);
     14568        _sw(0) = jmi_turn_switch(jmi, JMI_DIVIDE_EQUATION(jmi, (pre_j_16 + 1.0), 4.0, \"(pre(j) + 1) / 4\") - (pre_temp_2_20), _sw(0), JMI_REL_LT);
    1469614569    }
    1469714570    if (jmi->atInitial || jmi->atEvent) {
    14698         _sw(1) = jmi_turn_switch(jmi, jmi_divide_equation(jmi, (pre_j_16 + 1.0), 4.0, \"(pre(j) + 1) / 4\") - (pre_temp_2_20 + 1.0), _sw(1), JMI_REL_GEQ);
     14571        _sw(1) = jmi_turn_switch(jmi, JMI_DIVIDE_EQUATION(jmi, (pre_j_16 + 1.0), 4.0, \"(pre(j) + 1) / 4\") - (pre_temp_2_20 + 1.0), _sw(1), JMI_REL_GEQ);
    1469914572    }
    1470014573    ef |= jmi_solve_block_residual(jmi->dae_block_residuals[0]);
     
    1538915262        jmi_array_ref_1(tmp_1, 1) = 0.1;
    1539015263        jmi_array_ref_1(tmp_1, 2) = 0.5;
    15391         _sw(0) = jmi_turn_switch(jmi, (_time + _p_0 - (_x_1)) / jmi_max(jmi_max(1.0, jmi_abs(_p_0)), jmi_abs(func_CCodeGenTests_TestRelationalOp10_f_exp0(tmp_1))), _sw(0), JMI_REL_GT);
     15264        _sw(0) = jmi_turn_switch(jmi, (_time + _p_0 - (_x_1)) / JMI_MAX_EQUATION(JMI_MAX_EQUATION(1.0, JMI_ABS_EQUATION(_p_0)), JMI_ABS_EQUATION(func_CCodeGenTests_TestRelationalOp10_f_exp0(tmp_1))), _sw(0), JMI_REL_GT);
    1539215265    }
    1539315266    _b1_2 = _sw(0);
     
    1556115434    int ef = 0;
    1556215435    JMI_DYNAMIC_INIT()
    15563     _b_1 = jmi_cos_equation(jmi, _time, \"cos(time)\");
     15436    _b_1 = JMI_COS_EQUATION(jmi, _time, \"cos(time)\");
    1556415437    if (jmi->atInitial || jmi->atEvent) {
    1556515438        _sw(0) = jmi_turn_switch(jmi, _b_1 - (0.0), _sw(0), JMI_REL_GT);
     
    1559815471    int ef = 0;
    1559915472    JMI_DYNAMIC_INIT()
    15600     _b_1 = jmi_cos_equation(jmi, _time, \"cos(time)\");
     15473    _b_1 = JMI_COS_EQUATION(jmi, _time, \"cos(time)\");
    1560115474    if (jmi->atInitial || jmi->atEvent) {
    1560215475        _sw(0) = jmi_turn_switch(jmi, _b_1 - (0.0), _sw(0), JMI_REL_GT);
     
    1563315506    JMI_DYNAMIC_INIT()
    1563415507    if (jmi->atInitial || jmi->atEvent) {
    15635         _sw(0) = jmi_turn_switch(jmi, jmi_sin_equation(jmi, _time, \"sin(time)\") - (0.0), _sw(0), JMI_REL_GT);
     15508        _sw(0) = jmi_turn_switch(jmi, JMI_SIN_EQUATION(jmi, _time, \"sin(time)\") - (0.0), _sw(0), JMI_REL_GT);
    1563615509    }
    1563715510    if (jmi->atInitial || jmi->atEvent) {
    15638         _sw(1) = jmi_turn_switch(jmi, jmi_cos_equation(jmi, _time, \"cos(time)\") - (0.0), _sw(1), JMI_REL_GT);
     15511        _sw(1) = jmi_turn_switch(jmi, JMI_COS_EQUATION(jmi, _time, \"cos(time)\") - (0.0), _sw(1), JMI_REL_GT);
    1563915512    }
    1564015513    _a_0 = COND_EXP_EQ(LOG_EXP_AND(_sw(0), _sw(1)), JMI_TRUE, 1.0, _time);
    1564115514    if (jmi->atInitial || jmi->atEvent) {
    15642         _sw(0) = jmi_turn_switch(jmi, jmi_sin_equation(jmi, _time, \"sin(time)\") - (0.0), _sw(0), JMI_REL_GT);
     15515        _sw(0) = jmi_turn_switch(jmi, JMI_SIN_EQUATION(jmi, _time, \"sin(time)\") - (0.0), _sw(0), JMI_REL_GT);
    1564315516    }
    1564415517    if (jmi->atInitial || jmi->atEvent) {
    15645         _sw(2) = jmi_turn_switch(jmi, jmi_cos_equation(jmi, _time, \"cos(time)\") - (0.0), _sw(2), JMI_REL_GT);
     15518        _sw(2) = jmi_turn_switch(jmi, JMI_COS_EQUATION(jmi, _time, \"cos(time)\") - (0.0), _sw(2), JMI_REL_GT);
    1564615519    }
    1564715520    _b_1 = COND_EXP_EQ(LOG_EXP_AND(_sw(0), _sw(2)), JMI_TRUE, _time, 1.0);
     
    1565215525    int ef = 0;
    1565315526    JMI_DYNAMIC_INIT()
    15654     (*res)[0] = jmi_sin_equation(jmi, _time, \"sin(time)\") - (0.0);
    15655     (*res)[1] = COND_EXP_EQ(_sw(0), JMI_TRUE, jmi_cos_equation(jmi, _time, \"cos(time)\") - (0.0), 1.0);
    15656     (*res)[2] = COND_EXP_EQ(_sw(0), JMI_TRUE, jmi_cos_equation(jmi, _time, \"cos(time)\") - (0.0), 1.0);
     15527    (*res)[0] = JMI_SIN_EQUATION(jmi, _time, \"sin(time)\") - (0.0);
     15528    (*res)[1] = COND_EXP_EQ(_sw(0), JMI_TRUE, JMI_COS_EQUATION(jmi, _time, \"cos(time)\") - (0.0), 1.0);
     15529    (*res)[2] = COND_EXP_EQ(_sw(0), JMI_TRUE, JMI_COS_EQUATION(jmi, _time, \"cos(time)\") - (0.0), 1.0);
    1565715530    JMI_DYNAMIC_FREE()
    1565815531    return ef;
     
    1568015553    JMI_DYNAMIC_INIT()
    1568115554    if (jmi->atInitial || jmi->atEvent) {
    15682         _sw(0) = jmi_turn_switch(jmi, jmi_sin_equation(jmi, _time, \"sin(time)\") - (0.0), _sw(0), JMI_REL_GT);
     15555        _sw(0) = jmi_turn_switch(jmi, JMI_SIN_EQUATION(jmi, _time, \"sin(time)\") - (0.0), _sw(0), JMI_REL_GT);
    1568315556    }
    1568415557    if (jmi->atInitial || jmi->atEvent) {
    15685         _sw(1) = jmi_turn_switch(jmi, jmi_cos_equation(jmi, _time, \"cos(time)\") - (0.0), _sw(1), JMI_REL_GT);
     15558        _sw(1) = jmi_turn_switch(jmi, JMI_COS_EQUATION(jmi, _time, \"cos(time)\") - (0.0), _sw(1), JMI_REL_GT);
    1568615559    }
    1568715560    if (jmi->atInitial || jmi->atEvent) {
    15688         _sw(2) = jmi_turn_switch(jmi, jmi_cos_equation(jmi, _time + 0.5, \"cos(time + 0.5)\") - (0.0), _sw(2), JMI_REL_GT);
     15561        _sw(2) = jmi_turn_switch(jmi, JMI_COS_EQUATION(jmi, _time + 0.5, \"cos(time + 0.5)\") - (0.0), _sw(2), JMI_REL_GT);
    1568915562    }
    1569015563    _a_0 = COND_EXP_EQ(LOG_EXP_AND(LOG_EXP_AND(_sw(0), _sw(1)), _sw(2)), JMI_TRUE, 1.0, _time);
    1569115564    if (jmi->atInitial || jmi->atEvent) {
    15692         _sw(0) = jmi_turn_switch(jmi, jmi_sin_equation(jmi, _time, \"sin(time)\") - (0.0), _sw(0), JMI_REL_GT);
     15565        _sw(0) = jmi_turn_switch(jmi, JMI_SIN_EQUATION(jmi, _time, \"sin(time)\") - (0.0), _sw(0), JMI_REL_GT);
    1569315566    }
    1569415567    if (jmi->atInitial || jmi->atEvent) {
    15695         _sw(3) = jmi_turn_switch(jmi, jmi_cos_equation(jmi, _time, \"cos(time)\") - (0.0), _sw(3), JMI_REL_GT);
     15568        _sw(3) = jmi_turn_switch(jmi, JMI_COS_EQUATION(jmi, _time, \"cos(time)\") - (0.0), _sw(3), JMI_REL_GT);
    1569615569    }
    1569715570    if (jmi->atInitial || jmi->atEvent) {
    15698         _sw(4) = jmi_turn_switch(jmi, jmi_cos_equation(jmi, _time + 0.5, \"cos(time + 0.5)\") - (0.0), _sw(4), JMI_REL_GT);
     15571        _sw(4) = jmi_turn_switch(jmi, JMI_COS_EQUATION(jmi, _time + 0.5, \"cos(time + 0.5)\") - (0.0), _sw(4), JMI_REL_GT);
    1569915572    }
    1570015573    _b_1 = COND_EXP_EQ(LOG_EXP_AND(LOG_EXP_AND(_sw(0), _sw(3)), _sw(4)), JMI_TRUE, _time, 1.0);
     
    1570515578    int ef = 0;
    1570615579    JMI_DYNAMIC_INIT()
    15707     (*res)[0] = jmi_sin_equation(jmi, _time, \"sin(time)\") - (0.0);
    15708     (*res)[1] = COND_EXP_EQ(_sw(0), JMI_TRUE, jmi_cos_equation(jmi, _time, \"cos(time)\") - (0.0), 1.0);
    15709     (*res)[2] = COND_EXP_EQ(LOG_EXP_AND(_sw(0), _sw(1)), JMI_TRUE, jmi_cos_equation(jmi, _time + 0.5, \"cos(time + 0.5)\") - (0.0), 1.0);
    15710     (*res)[3] = COND_EXP_EQ(_sw(0), JMI_TRUE, jmi_cos_equation(jmi, _time, \"cos(time)\") - (0.0), 1.0);
    15711     (*res)[4] = COND_EXP_EQ(LOG_EXP_AND(_sw(0), _sw(3)), JMI_TRUE, jmi_cos_equation(jmi, _time + 0.5, \"cos(time + 0.5)\") - (0.0), 1.0);
     15580    (*res)[0] = JMI_SIN_EQUATION(jmi, _time, \"sin(time)\") - (0.0);
     15581    (*res)[1] = COND_EXP_EQ(_sw(0), JMI_TRUE, JMI_COS_EQUATION(jmi, _time, \"cos(time)\") - (0.0), 1.0);
     15582    (*res)[2] = COND_EXP_EQ(LOG_EXP_AND(_sw(0), _sw(1)), JMI_TRUE, JMI_COS_EQUATION(jmi, _time + 0.5, \"cos(time + 0.5)\") - (0.0), 1.0);
     15583    (*res)[3] = COND_EXP_EQ(_sw(0), JMI_TRUE, JMI_COS_EQUATION(jmi, _time, \"cos(time)\") - (0.0), 1.0);
     15584    (*res)[4] = COND_EXP_EQ(LOG_EXP_AND(_sw(0), _sw(3)), JMI_TRUE, JMI_COS_EQUATION(jmi, _time + 0.5, \"cos(time + 0.5)\") - (0.0), 1.0);
    1571215585    JMI_DYNAMIC_FREE()
    1571315586    return ef;
     
    1574015613    int ef = 0;
    1574115614    JMI_DYNAMIC_INIT()
    15742     _x_0 = jmi_sin_equation(jmi, _time, \"sin(time)\");
     15615    _x_0 = JMI_SIN_EQUATION(jmi, _time, \"sin(time)\");
    1574315616    if (jmi->atInitial || jmi->atEvent) {
    1574415617        _sw(1) = jmi_turn_switch(jmi, _x_0 - (-0.5), _sw(1), JMI_REL_LT);
     
    1646116334    JMI_ARRAY_INIT_1(HEAP, jmi_string_t, jmi_string_array_t, s_a, n_v, 1, n_v)
    1646216335    y_v = x_v;
    16463     JMI_ARRAY_INIT_1(HEAP, jmi_string_t, jmi_string_array_t, temp_1_a, jmi_max(n_v, 0.0), 1, jmi_max(n_v, 0.0))
     16336    JMI_ARRAY_INIT_1(HEAP, jmi_string_t, jmi_string_array_t, temp_1_a, JMI_MAX_EQUATION(n_v, 0.0), 1, JMI_MAX_EQUATION(n_v, 0.0))
    1646416337    i1_0in = 0;
    16465     i1_0ie = floor((jmi_max(n_v, 0.0)) - (1));
     16338    i1_0ie = floor((JMI_MAX_EQUATION(n_v, 0.0)) - (1));
    1646616339    for (i1_0i = 1; i1_0in <= i1_0ie; i1_0i = 1 + (++i1_0in)) {
    1646716340        JMI_ASG(STR, jmi_array_ref_1(temp_1_a, i1_0i), \"str\")
     
    1793617809    Real y = abs(time + 0.5);
    1793717810
    17938     annotation(__JModelica(UnitTesting(tests={
    17939         CCodeGenTestCase(
    17940             name="SwitchesAsNoEvent1",
    17941             description="Test so that no switches are generated when generate_event_switches is set to false.",
    17942             generate_event_switches=false,
    17943             template="
     17811annotation(__JModelica(UnitTesting(tests={
     17812    CCodeGenTestCase(
     17813        name="SwitchesAsNoEvent1",
     17814        description="Test so that no switches are generated when generate_event_switches is set to false.",
     17815        generate_event_switches=false,
     17816        template="
    1794417817$C_DAE_initial_relations$
    1794517818$C_DAE_relations$
    1794617819$C_ode_derivatives$
    1794717820",
    17948             generatedCode="
     17821        generatedCode="
    1794917822static const int N_initial_relations = 0;
    1795017823static const int DAE_initial_relations[] = { -1 };
     
    1795717830    _x_0 = COND_EXP_GT(_time, 0.5, JMI_TRUE, JMI_FALSE);
    1795817831    pre_x_0 = _x_0;
    17959     _y_1 = jmi_abs(_time + 0.5);
     17832    _y_1 = JMI_ABS_EQUATION(_time + 0.5);
    1796017833    JMI_DYNAMIC_FREE()
    1796117834    return ef;
     
    1797017843    x = time / (sum(a_really_long_variable_name));
    1797117844
    17972     annotation(__JModelica(UnitTesting(tests={
    17973         CCodeGenTestCase(
    17974             name="TruncDivString1",
    17975             description="Test code gen for active switch indexes in block.",
    17976             eliminate_linear_equations=false,
    17977             template="$C_ode_derivatives$",
    17978             generatedCode="
     17845annotation(__JModelica(UnitTesting(tests={
     17846    CCodeGenTestCase(
     17847        name="TruncDivString1",
     17848        description="Test code gen for active switch indexes in block.",
     17849        eliminate_linear_equations=false,
     17850        template="$C_ode_derivatives$",
     17851        generatedCode="
    1797917852
    1798017853int model_ode_derivatives_base(jmi_t* jmi) {
     
    1800617879    _a_really_long_variable_name_5_4_23 = _time;
    1800717880    _a_really_long_variable_name_5_5_24 = _time;
    18008     _x_25 = jmi_divide_equation(jmi, _time,(_a_really_long_variable_name_1_1_0 + _a_really_long_variable_name_1_2_1 + (_a_really_long_variable_name_1_3_2 + _a_really_long_variable_name_1_4_3) + (_a_really_long_variable_name_1_5_4 + _a_really_long_variable_name_2_1_5 + _a_really_long_variable_name_2_2_6) + (_a_really_long_variable_name_2_3_7 + _a_really_long_variable_name_2_4_8 + _a_really_long_variable_name_2_5_9 + (_a_really_long_variable_name_3_1_10 + _a_really_long_variable_name_3_2_11 + _a_really_long_variable_name_3_3_12)) + (_a_really_long_variable_name_3_4_13 + _a_really_long_variable_name_3_5_14 + _a_really_long_variable_name_4_1_15 + (_a_really_long_variable_name_4_2_16 + _a_really_long_variable_name_4_3_17 + _a_really_long_variable_name_4_4_18) + (_a_really_long_variable_name_4_5_19 + _a_really_long_variable_name_5_1_20 + _a_really_long_variable_name_5_2_21 + (_a_really_long_variable_name_5_3_22 + _a_really_long_variable_name_5_4_23 + _a_really_long_variable_name_5_5_24)))),\"(truncated) time / (a_really_long_variable_name[1,1] + a_really_long_variable_name[1,2] + (a_really_long_variable_name[1,3] + a_really_long_variable_name[1,4]) + (a_really_long_variable_name[1,5] + a_really_long_variable_name[2,1] + a_really_long_variable_name[2,2]) + (a_really_long_variable_name[2,3] + a_really_long_variable_name[2,4] + a_really_long_variable_name[2,5] + (a_really_long_variable_name[3,1] + a_really_long_variable_name[3,2] + a_really_long_variable_name[3,3])) + (a_really_long_variable...\");
     17881    _x_25 = JMI_DIVIDE_EQUATION(jmi, _time, (_a_really_long_variable_name_1_1_0 + _a_really_long_variable_name_1_2_1 + (_a_really_long_variable_name_1_3_2 + _a_really_long_variable_name_1_4_3) + (_a_really_long_variable_name_1_5_4 + _a_really_long_variable_name_2_1_5 + _a_really_long_variable_name_2_2_6) + (_a_really_long_variable_name_2_3_7 + _a_really_long_variable_name_2_4_8 + _a_really_long_variable_name_2_5_9 + (_a_really_long_variable_name_3_1_10 + _a_really_long_variable_name_3_2_11 + _a_really_long_variable_name_3_3_12)) + (_a_really_long_variable_name_3_4_13 + _a_really_long_variable_name_3_5_14 + _a_really_long_variable_name_4_1_15 + (_a_really_long_variable_name_4_2_16 + _a_really_long_variable_name_4_3_17 + _a_really_long_variable_name_4_4_18) + (_a_really_long_variable_name_4_5_19 + _a_really_long_variable_name_5_1_20 + _a_really_long_variable_name_5_2_21 + (_a_really_long_variable_name_5_3_22 + _a_really_long_variable_name_5_4_23 + _a_really_long_variable_name_5_5_24)))), \"(truncated) time / (a_really_long_variable_name[1,1] + a_really_long_variable_name[1,2] + (a_really_long_variable_name[1,3] + a_really_long_variable_name[1,4]) + (a_really_long_variable_name[1,5] + a_really_long_variable_name[2,1] + a_really_long_variable_name[2,2]) + (a_really_long_variable_name[2,3] + a_really_long_variable_name[2,4] + a_really_long_variable_name[2,5] + (a_really_long_variable_name[3,1] + a_really_long_variable_name[3,2] + a_really_long_variable_name[3,3])) + (a_really_long_variable...\");
    1800917882    JMI_DYNAMIC_FREE()
    1801017883    return ef;
     
    2032520198    int ef = 0;
    2032620199    JMI_DYNAMIC_INIT()
    20327     _tmp_2 = jmi_sin_equation(jmi, _time * 100.0, \"sin(time * 100)\");
     20200    _tmp_2 = JMI_SIN_EQUATION(jmi, _time * 100.0, \"sin(time * 100)\");
    2032820201    if (jmi->atInitial || jmi->atEvent) {
    2032920202        _sw(0) = jmi_turn_switch(jmi, __eventIndicator_1_3, _sw(0), JMI_REL_GEQ);
     
    2034920222    }
    2035020223    ef |= jmi_solve_block_residual(jmi->dae_block_residuals[0]);
    20351     _tmp_2 = jmi_sin_equation(jmi, _time * 100.0, \"sin(time * 100)\");
     20224    _tmp_2 = JMI_SIN_EQUATION(jmi, _time * 100.0, \"sin(time * 100)\");
    2035220225    __eventIndicator_2_4 = jmi_delay_first_event_indicator_exp(jmi, 0, _tmp_2);
    2035320226    __eventIndicator_3_5 = jmi_delay_second_event_indicator_exp(jmi, 0, _tmp_2);
Note: See TracChangeset for help on using the changeset viewer.