Changeset 13939


Ignore:
Timestamp:
Nov 3, 2019 6:11:13 PM (2 weeks ago)
Author:
Christian Andersson
Message:

Updated escape of characters in tests (more). Related to ticket:5867

Location:
branches/dev-MSL323-MVD/Compiler
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-MSL323-MVD/Compiler/ModelicaCBackEnd/test/modelica/CCodeGenExternalTests.mo

    r13935 r13939  
    22752275    }
    22762276    JMI_ARRAY_INIT_1(HEAP, jmi_real_t, jmi_array_t, work_a, 12 * jmi_array_size(A_a, 0), 1, 12 * jmi_array_size(A_a, 0))
    2277     JMI_ASG(STR, tmp_1, "N")
    2278     JMI_ASG(STR, tmp_2, "V")
     2277    JMI_ASG(STR, tmp_1, \"N\")
     2278    JMI_ASG(STR, tmp_2, \"V\")
    22792279    tmp_3 = (int)n_v;
    22802280    JMI_ARRAY_INIT_2(HEAP, jmi_real_t, jmi_array_t, tmp_4, 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))
  • branches/dev-MSL323-MVD/Compiler/ModelicaCBackEnd/test/modelica/CCodeGenTests.mo

    r13935 r13939  
    1365213652    func_Modelica_Math_Matrices_LAPACK_dgesv_vec_def1(A_a, b_a, x_a, &info_v);
    1365313653    if (COND_EXP_EQ(info_v, 0.0, JMI_TRUE, JMI_FALSE) == JMI_FALSE) {
    13654         jmi_assert_failed("Solving a linear system of equations with function\n\"Matrices.solve\" is not possible, because the system has either\nno or infinitely many solutions (A is singular).", JMI_ASSERT_ERROR);
     13654        jmi_assert_failed(\"Solving a linear system of equations with function\\n\\\"Matrices.solve\\\" is not possible, because the system has either\\nno or infinitely many solutions (A is singular).\", JMI_ASSERT_ERROR);
    1365513655    }
    1365613656    JMI_DYNAMIC_FREE()
     
    1376113761    func_Modelica_Math_Matrices_LAPACK_dgesv_def1(A_a, B_a, X_a, &info_v);
    1376213762    if (COND_EXP_EQ(info_v, 0.0, JMI_TRUE, JMI_FALSE) == JMI_FALSE) {
    13763         jmi_assert_failed("Solving a linear system of equations with function\n\"Matrices.solve2\" is not possible, because the system has either\nno or infinitely many solutions (A is singular).", JMI_ASSERT_ERROR);
     13763        jmi_assert_failed(\"Solving a linear system of equations with function\\n\\\"Matrices.solve2\\\" is not possible, because the system has either\\nno or infinitely many solutions (A is singular).\", JMI_ASSERT_ERROR);
    1376413764    }
    1376513765    JMI_DYNAMIC_FREE()
  • branches/dev-MSL323-MVD/Compiler/ModelicaMiddleEnd/test/modelica/IndexReduction.mo

    r13935 r13939  
    126126            flatModel="
    127127fclass IndexReduction.IndexReduction2_Mechanical
    128  parameter Modelica.SIunits.Torque amplitude = 10 "Amplitude of driving torque" /* 10 */;
    129  parameter Modelica.SIunits.Frequency freqHz = 5 "Frequency of driving torque" /* 5 */;
    130  parameter Modelica.SIunits.MomentOfInertia Jmotor(min = 0) = 0.1 "Motor inertia" /* 0.1 */;
    131  parameter Modelica.SIunits.MomentOfInertia Jload(min = 0) = 2 "Load inertia" /* 2 */;
    132  parameter Real ratio = 10 "Gear ratio" /* 10 */;
    133  parameter Real damping = 10 "Damping in bearing of gear" /* 10 */;
    134  parameter Modelica.SIunits.Angle fixed.phi0 = 0 "Fixed offset angle of housing" /* 0 */;
    135  Modelica.SIunits.Torque fixed.flange.tau "Cut torque in the flange";
    136  Modelica.Blocks.Interfaces.RealInput torque.tau(unit = "N.m") "Accelerating torque acting at flange (= -flange.tau)";
    137  eval parameter Boolean torque.useSupport = true "= true, if support flange enabled, otherwise implicitly grounded" /* true */;
    138  parameter Modelica.SIunits.MomentOfInertia inertia1.J(min = 0,start = 1) "Moment of inertia";
    139  parameter Real idealGear.ratio(start = 1) "Transmission ratio (flange_a.phi/flange_b.phi)";
    140  parameter StateSelect inertia1.stateSelect = StateSelect.default "Priority to use phi and w as states" /* StateSelect.default */;
    141  Modelica.SIunits.Angle inertia1.phi(stateSelect = inertia1.stateSelect) "Absolute rotation angle of component";
    142  Modelica.SIunits.AngularVelocity inertia1.w(stateSelect = inertia1.stateSelect) "Absolute angular velocity of component (= der(phi))";
    143  Modelica.SIunits.AngularAcceleration inertia1.a "Absolute angular acceleration of component (= der(w))";
    144  parameter Modelica.SIunits.MomentOfInertia inertia3.J(min = 0,start = 1) "Moment of inertia";
    145  Modelica.SIunits.Angle idealGear.phi_a "Angle between left shaft flange and support";
    146  Modelica.SIunits.Torque idealGear.flange_a.tau "Cut torque in the flange";
    147  Modelica.SIunits.Torque idealGear.flange_b.tau "Cut torque in the flange";
    148  Modelica.SIunits.Torque idealGear.support.tau "Cut torque in the flange";
    149  parameter Modelica.SIunits.MomentOfInertia inertia2.J(min = 0,start = 1) = 2 "Moment of inertia" /* 2 */;
    150  parameter StateSelect inertia2.stateSelect = StateSelect.default "Priority to use phi and w as states" /* StateSelect.default */;
    151  Modelica.SIunits.Angle inertia2.phi(fixed = true,start = 0,stateSelect = inertia2.stateSelect) "Absolute rotation angle of component";
    152  Modelica.SIunits.AngularVelocity inertia2.w(fixed = true,start = 0,stateSelect = inertia2.stateSelect) "Absolute angular velocity of component (= der(phi))";
    153  Modelica.SIunits.AngularAcceleration inertia2.a "Absolute angular acceleration of component (= der(w))";
    154  Modelica.SIunits.Torque inertia2.flange_b.tau "Cut torque in the flange";
    155  parameter Modelica.SIunits.RotationalSpringConstant spring.c(final min = 0,start = 100000.0) = 10000.0 "Spring constant" /* 10000.0 */;
    156  parameter Modelica.SIunits.Angle spring.phi_rel0 = 0 "Unstretched spring angle" /* 0 */;
    157  Modelica.SIunits.Angle spring.phi_rel(fixed = true,start = 0) "Relative rotation angle (= flange_b.phi - flange_a.phi)";
    158  Modelica.SIunits.Torque spring.tau "Torque between flanges (= flange_b.tau)";
    159  parameter Modelica.SIunits.RotationalDampingConstant damper.d(final min = 0,start = 0) "Damping constant";
    160  parameter StateSelect inertia3.stateSelect = StateSelect.default "Priority to use phi and w as states" /* StateSelect.default */;
    161  Modelica.SIunits.Angle inertia3.phi(stateSelect = inertia3.stateSelect) "Absolute rotation angle of component";
    162  Modelica.SIunits.AngularVelocity inertia3.w(fixed = true,start = 0,stateSelect = inertia3.stateSelect) "Absolute angular velocity of component (= der(phi))";
    163  Modelica.SIunits.AngularAcceleration inertia3.a "Absolute angular acceleration of component (= der(w))";
    164  constant Modelica.SIunits.Torque inertia3.flange_b.tau = 0.0 "Cut torque in the flange";
    165  parameter Real sine.amplitude "Amplitude of sine wave";
    166  Modelica.SIunits.Angle damper.phi_rel(stateSelect = StateSelect.always,start = 0,nominal = if damper.phi_nominal >= 1.0E-15 then damper.phi_nominal else 1) "Relative rotation angle (= flange_b.phi - flange_a.phi)";
    167  Modelica.SIunits.AngularVelocity damper.w_rel(stateSelect = StateSelect.always,start = 0) "Relative angular velocity (= der(phi_rel))";
    168  Modelica.SIunits.AngularAcceleration damper.a_rel(start = 0) "Relative angular acceleration (= der(w_rel))";
    169  Modelica.SIunits.Torque damper.tau "Torque between flanges (= flange_b.tau)";
    170  parameter Modelica.SIunits.Angle damper.phi_nominal(displayUnit = "rad",min = 0.0) = 1.0E-4 "Nominal value of phi_rel (used for scaling)" /* 1.0E-4 */;
    171  parameter StateSelect damper.stateSelect = StateSelect.prefer "Priority to use phi_rel and w_rel as states" /* StateSelect.prefer */;
    172  eval parameter Boolean damper.useHeatPort = false "=true, if heatPort is enabled" /* false */;
    173  Modelica.SIunits.Power damper.lossPower "Loss power leaving component via heatPort (> 0, if heat is flowing out of component)";
    174  parameter Modelica.SIunits.Frequency sine.freqHz(start = 1) "Frequency of sine wave";
    175  parameter Modelica.SIunits.Angle sine.phase = 0 "Phase of sine wave" /* 0 */;
    176  parameter Real sine.offset = 0 "Offset of output signal y" /* 0 */;
    177  parameter Modelica.SIunits.Time sine.startTime = 0 "Output y = offset for time < startTime" /* 0 */;
    178  parameter Modelica.SIunits.Angle damper.flange_b.phi "Absolute rotation angle of flange";
    179  parameter Modelica.SIunits.Angle fixed.flange.phi "Absolute rotation angle of flange";
    180  parameter Modelica.SIunits.Angle idealGear.support.phi "Absolute rotation angle of flange";
    181  parameter Modelica.SIunits.Angle torque.support.phi "Absolute rotation angle of flange";
     128 parameter Modelica.SIunits.Torque amplitude = 10 \"Amplitude of driving torque\" /* 10 */;
     129 parameter Modelica.SIunits.Frequency freqHz = 5 \"Frequency of driving torque\" /* 5 */;
     130 parameter Modelica.SIunits.MomentOfInertia Jmotor(min = 0) = 0.1 \"Motor inertia\" /* 0.1 */;
     131 parameter Modelica.SIunits.MomentOfInertia Jload(min = 0) = 2 \"Load inertia\" /* 2 */;
     132 parameter Real ratio = 10 \"Gear ratio\" /* 10 */;
     133 parameter Real damping = 10 \"Damping in bearing of gear\" /* 10 */;
     134 parameter Modelica.SIunits.Angle fixed.phi0 = 0 \"Fixed offset angle of housing\" /* 0 */;
     135 Modelica.SIunits.Torque fixed.flange.tau \"Cut torque in the flange\";
     136 Modelica.Blocks.Interfaces.RealInput torque.tau(unit = \"N.m\") \"Accelerating torque acting at flange (= -flange.tau)\";
     137 eval parameter Boolean torque.useSupport = true \"= true, if support flange enabled, otherwise implicitly grounded\" /* true */;
     138 parameter Modelica.SIunits.MomentOfInertia inertia1.J(min = 0,start = 1) \"Moment of inertia\";
     139 parameter Real idealGear.ratio(start = 1) \"Transmission ratio (flange_a.phi/flange_b.phi)\";
     140 parameter StateSelect inertia1.stateSelect = StateSelect.default \"Priority to use phi and w as states\" /* StateSelect.default */;
     141 Modelica.SIunits.Angle inertia1.phi(stateSelect = inertia1.stateSelect) \"Absolute rotation angle of component\";
     142 Modelica.SIunits.AngularVelocity inertia1.w(stateSelect = inertia1.stateSelect) \"Absolute angular velocity of component (= der(phi))\";
     143 Modelica.SIunits.AngularAcceleration inertia1.a \"Absolute angular acceleration of component (= der(w))\";
     144 parameter Modelica.SIunits.MomentOfInertia inertia3.J(min = 0,start = 1) \"Moment of inertia\";
     145 Modelica.SIunits.Angle idealGear.phi_a \"Angle between left shaft flange and support\";
     146 Modelica.SIunits.Torque idealGear.flange_a.tau \"Cut torque in the flange\";
     147 Modelica.SIunits.Torque idealGear.flange_b.tau \"Cut torque in the flange\";
     148 Modelica.SIunits.Torque idealGear.support.tau \"Cut torque in the flange\";
     149 parameter Modelica.SIunits.MomentOfInertia inertia2.J(min = 0,start = 1) = 2 \"Moment of inertia\" /* 2 */;
     150 parameter StateSelect inertia2.stateSelect = StateSelect.default \"Priority to use phi and w as states\" /* StateSelect.default */;
     151 Modelica.SIunits.Angle inertia2.phi(fixed = true,start = 0,stateSelect = inertia2.stateSelect) \"Absolute rotation angle of component\";
     152 Modelica.SIunits.AngularVelocity inertia2.w(fixed = true,start = 0,stateSelect = inertia2.stateSelect) \"Absolute angular velocity of component (= der(phi))\";
     153 Modelica.SIunits.AngularAcceleration inertia2.a \"Absolute angular acceleration of component (= der(w))\";
     154 Modelica.SIunits.Torque inertia2.flange_b.tau \"Cut torque in the flange\";
     155 parameter Modelica.SIunits.RotationalSpringConstant spring.c(final min = 0,start = 100000.0) = 10000.0 \"Spring constant\" /* 10000.0 */;
     156 parameter Modelica.SIunits.Angle spring.phi_rel0 = 0 \"Unstretched spring angle\" /* 0 */;
     157 Modelica.SIunits.Angle spring.phi_rel(fixed = true,start = 0) \"Relative rotation angle (= flange_b.phi - flange_a.phi)\";
     158 Modelica.SIunits.Torque spring.tau \"Torque between flanges (= flange_b.tau)\";
     159 parameter Modelica.SIunits.RotationalDampingConstant damper.d(final min = 0,start = 0) \"Damping constant\";
     160 parameter StateSelect inertia3.stateSelect = StateSelect.default \"Priority to use phi and w as states\" /* StateSelect.default */;
     161 Modelica.SIunits.Angle inertia3.phi(stateSelect = inertia3.stateSelect) \"Absolute rotation angle of component\";
     162 Modelica.SIunits.AngularVelocity inertia3.w(fixed = true,start = 0,stateSelect = inertia3.stateSelect) \"Absolute angular velocity of component (= der(phi))\";
     163 Modelica.SIunits.AngularAcceleration inertia3.a \"Absolute angular acceleration of component (= der(w))\";
     164 constant Modelica.SIunits.Torque inertia3.flange_b.tau = 0.0 \"Cut torque in the flange\";
     165 parameter Real sine.amplitude \"Amplitude of sine wave\";
     166 Modelica.SIunits.Angle damper.phi_rel(stateSelect = StateSelect.always,start = 0,nominal = if damper.phi_nominal >= 1.0E-15 then damper.phi_nominal else 1) \"Relative rotation angle (= flange_b.phi - flange_a.phi)\";
     167 Modelica.SIunits.AngularVelocity damper.w_rel(stateSelect = StateSelect.always,start = 0) \"Relative angular velocity (= der(phi_rel))\";
     168 Modelica.SIunits.AngularAcceleration damper.a_rel(start = 0) \"Relative angular acceleration (= der(w_rel))\";
     169 Modelica.SIunits.Torque damper.tau \"Torque between flanges (= flange_b.tau)\";
     170 parameter Modelica.SIunits.Angle damper.phi_nominal(displayUnit = \"rad\",min = 0.0) = 1.0E-4 \"Nominal value of phi_rel (used for scaling)\" /* 1.0E-4 */;
     171 parameter StateSelect damper.stateSelect = StateSelect.prefer \"Priority to use phi_rel and w_rel as states\" /* StateSelect.prefer */;
     172 eval parameter Boolean damper.useHeatPort = false \"=true, if heatPort is enabled\" /* false */;
     173 Modelica.SIunits.Power damper.lossPower \"Loss power leaving component via heatPort (> 0, if heat is flowing out of component)\";
     174 parameter Modelica.SIunits.Frequency sine.freqHz(start = 1) \"Frequency of sine wave\";
     175 parameter Modelica.SIunits.Angle sine.phase = 0 \"Phase of sine wave\" /* 0 */;
     176 parameter Real sine.offset = 0 \"Offset of output signal y\" /* 0 */;
     177 parameter Modelica.SIunits.Time sine.startTime = 0 \"Output y = offset for time < startTime\" /* 0 */;
     178 parameter Modelica.SIunits.Angle damper.flange_b.phi \"Absolute rotation angle of flange\";
     179 parameter Modelica.SIunits.Angle fixed.flange.phi \"Absolute rotation angle of flange\";
     180 parameter Modelica.SIunits.Angle idealGear.support.phi \"Absolute rotation angle of flange\";
     181 parameter Modelica.SIunits.Angle torque.support.phi \"Absolute rotation angle of flange\";
    182182 Real inertia1._der_phi;
    183183 Real inertia2._der_phi;
    184184 Real idealGear._der_phi_a;
    185185protected
    186  parameter Modelica.SIunits.Angle torque.phi_support "Absolute angle of support flange";
    187  parameter Modelica.SIunits.Angle idealGear.phi_support "Absolute angle of support flange";
     186 parameter Modelica.SIunits.Angle torque.phi_support \"Absolute angle of support flange\";
     187 parameter Modelica.SIunits.Angle idealGear.phi_support \"Absolute angle of support flange\";
    188188initial equation
    189189 inertia2.phi = 0;
     
    233233
    234234public
    235  type StateSelect = enumeration(never "Do not use as state at all.", avoid "Use as state, if it cannot be avoided (but only if variable appears differentiated and no other potential state with attribute default, prefer, or always can be selected).", default "Use as state if appropriate, but only if variable appears differentiated.", prefer "Prefer it as state over those having the default value (also variables can be selected, which do not appear differentiated).", always "Do use it as a state.");
    236 
    237  type Modelica.SIunits.Torque = Real(final quantity = "Torque",final unit = "N.m");
    238  type Modelica.SIunits.Frequency = Real(final quantity = "Frequency",final unit = "Hz");
    239  type Modelica.SIunits.MomentOfInertia = Real(final quantity = "MomentOfInertia",final unit = "kg.m2");
    240  type Modelica.SIunits.Angle = Real(final quantity = "Angle",final unit = "rad",displayUnit = "deg");
     235 type StateSelect = enumeration(never \"Do not use as state at all.\", avoid \"Use as state, if it cannot be avoided (but only if variable appears differentiated and no other potential state with attribute default, prefer, or always can be selected).\", default \"Use as state if appropriate, but only if variable appears differentiated.\", prefer \"Prefer it as state over those having the default value (also variables can be selected, which do not appear differentiated).\", always \"Do use it as a state.\");
     236
     237 type Modelica.SIunits.Torque = Real(final quantity = \"Torque\",final unit = \"N.m\");
     238 type Modelica.SIunits.Frequency = Real(final quantity = \"Frequency\",final unit = \"Hz\");
     239 type Modelica.SIunits.MomentOfInertia = Real(final quantity = \"MomentOfInertia\",final unit = \"kg.m2\");
     240 type Modelica.SIunits.Angle = Real(final quantity = \"Angle\",final unit = \"rad\",displayUnit = \"deg\");
    241241 type Modelica.Blocks.Interfaces.RealInput = Real;
    242  type Modelica.SIunits.AngularVelocity = Real(final quantity = "AngularVelocity",final unit = "rad/s");
    243  type Modelica.SIunits.AngularAcceleration = Real(final quantity = "AngularAcceleration",final unit = "rad/s2");
    244  type Modelica.SIunits.RotationalSpringConstant = Real(final quantity = "RotationalSpringConstant",final unit = "N.m/rad");
    245  type Modelica.SIunits.RotationalDampingConstant = Real(final quantity = "RotationalDampingConstant",final unit = "N.m.s/rad");
    246  type Modelica.SIunits.Power = Real(final quantity = "Power",final unit = "W");
    247  type Modelica.SIunits.Time = Real(final quantity = "Time",final unit = "s");
     242 type Modelica.SIunits.AngularVelocity = Real(final quantity = \"AngularVelocity\",final unit = \"rad/s\");
     243 type Modelica.SIunits.AngularAcceleration = Real(final quantity = \"AngularAcceleration\",final unit = \"rad/s2\");
     244 type Modelica.SIunits.RotationalSpringConstant = Real(final quantity = \"RotationalSpringConstant\",final unit = \"N.m/rad\");
     245 type Modelica.SIunits.RotationalDampingConstant = Real(final quantity = \"RotationalDampingConstant\",final unit = \"N.m.s/rad\");
     246 type Modelica.SIunits.Power = Real(final quantity = \"Power\",final unit = \"W\");
     247 type Modelica.SIunits.Time = Real(final quantity = \"Time\",final unit = \"s\");
    248248 type Modelica.Blocks.Interfaces.RealOutput = Real;
    249249end IndexReduction.IndexReduction2_Mechanical;
  • branches/dev-MSL323-MVD/Compiler/ModelicaMiddleEnd/test/modelica/VariabilityPropagationTests.mo

    r13935 r13939  
    757757  init x as Real[size(b, 1)];
    758758  (x, info) := Modelica.Math.Matrices.LAPACK.dgesv_vec(A, b);
    759   assert(info == 0, "Solving a linear system of equations with function
    760 \"Matrices.solve\" is not possible, because the system has either
    761 no or infinitely many solutions (A is singular).");
     759  assert(info == 0, \"Solving a linear system of equations with function
     760\\\"Matrices.solve\\\" is not possible, because the system has either
     761no or infinitely many solutions (A is singular).\");
    762762  return;
    763763 end Modelica.Math.Matrices.solve;
     
    790790  ldb := max(1, size(b, 1));
    791791  init ipiv as Integer[size(A, 1)];
    792   external "FORTRAN 77" dgesv(n, nrhs, Awork, lda, ipiv, x, ldb, info);
     792  external \"FORTRAN 77\" dgesv(n, nrhs, Awork, lda, ipiv, x, ldb, info);
    793793  return;
    794794 end Modelica.Math.Matrices.LAPACK.dgesv_vec;
Note: See TracChangeset for help on using the changeset viewer.