Changeset 13935


Ignore:
Timestamp:
Nov 2, 2019 12:02:37 PM (2 weeks ago)
Author:
Christian Andersson
Message:

Updated tests for MSL 3.2.3. Related to ticket:5867

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

Legend:

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

    r13491 r13935  
    22272227    JMI_DEF(INT, n_v)
    22282228    JMI_DEF(INT, lwork_v)
     2229    JMI_DEF(INT, ldvl_v)
    22292230    JMI_ARR(HEAP, jmi_real_t, jmi_array_t, Awork_a, -1, 2)
    22302231    JMI_ARR(HEAP, jmi_real_t, jmi_array_t, work_a, -1, 1)
     
    22452246    JMI_DEF(INT_EXT, tmp_9)
    22462247    JMI_DEF(INT_EXT, tmp_10)
     2248    JMI_DEF(INT_EXT, tmp_11)
    22472249    extern void dgeev_(const char*, const char*, int*, double*, int*, double*, double*, double*, int*, double*, int*, double*, int*, int*);
    22482250    if (eigenReal_a == NULL) {
     
    22612263    n_v = jmi_array_size(A_a, 0);
    22622264    lwork_v = 12 * n_v;
     2265    ldvl_v = 1;
    22632266    JMI_ARRAY_INIT_2(HEAP, jmi_real_t, jmi_array_t, Awork_a, jmi_array_size(A_a, 0) * jmi_array_size(A_a, 0), 2, jmi_array_size(A_a, 0), jmi_array_size(A_a, 0))
    22642267    i1_0in = 0;
     
    22722275    }
    22732276    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))
    2274     JMI_ASG(STR, tmp_1, \"N\")
    2275     JMI_ASG(STR, tmp_2, \"V\")
     2277    JMI_ASG(STR, tmp_1, "N")
     2278    JMI_ASG(STR, tmp_2, "V")
    22762279    tmp_3 = (int)n_v;
    22772280    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))
     
    22802283    JMI_ARRAY_INIT_2(HEAP, jmi_real_t, jmi_array_t, tmp_6, jmi_array_size(dummy_a, 0) * jmi_array_size(dummy_a, 1), 2, jmi_array_size(dummy_a, 0), jmi_array_size(dummy_a, 1))
    22812284    jmi_matrix_to_fortran_real(dummy_a, dummy_a->var, tmp_6->var);
    2282     tmp_7 = (int)1;
     2285    tmp_7 = (int)ldvl_v;
    22832286    JMI_ARRAY_INIT_2(HEAP, jmi_real_t, jmi_array_t, tmp_8, jmi_array_size(eigenVectors_a, 0) * jmi_array_size(eigenVectors_a, 1), 2, jmi_array_size(eigenVectors_a, 0), jmi_array_size(eigenVectors_a, 1))
    22842287    jmi_matrix_to_fortran_real(eigenVectors_a, eigenVectors_a->var, tmp_8->var);
    22852288    tmp_9 = (int)n_v;
    2286     tmp_10 = (int)info_v;
    2287     dgeev_(tmp_1, tmp_2, &tmp_9, tmp_4->var, &tmp_9, eigenReal_a->var, eigenImag_a->var, tmp_6->var, &tmp_7, tmp_8->var, &tmp_9, work_a->var, &jmi_array_size(work_a, 0), &tmp_10);
     2289    tmp_10 = (int)lwork_v;
     2290    tmp_11 = (int)info_v;
     2291    dgeev_(tmp_1, tmp_2, &tmp_9, tmp_4->var, &tmp_9, eigenReal_a->var, eigenImag_a->var, tmp_6->var, &tmp_7, tmp_8->var, &tmp_9, work_a->var, &tmp_10, &tmp_11);
    22882292    jmi_matrix_from_fortran_real(eigenVectors_a, tmp_8->var, eigenVectors_a->var);
    2289     info_v = tmp_10;
     2293    info_v = tmp_11;
    22902294    JMI_RET(GEN, info_o, info_v)
    22912295    JMI_DYNAMIC_FREE()
    22922296    return;
    22932297}
     2298
    22942299
    22952300")})));
  • branches/dev-MSL323-MVD/Compiler/ModelicaCBackEnd/test/modelica/CCodeGenTests.mo

    r13168 r13935  
    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()
     
    1366213662    JMI_ARR(HEAP, jmi_real_t, jmi_array_t, x_an, -1, 1)
    1366313663    JMI_DEF(INT, info_v)
     13664    JMI_DEF(INT, n_v)
     13665    JMI_DEF(INT, nrhs_v)
    1366413666    JMI_ARR(HEAP, jmi_real_t, jmi_array_t, Awork_a, -1, 2)
    1366513667    JMI_DEF(INT, lda_v)
     
    1367613678    jmi_int_t i2_2in;
    1367713679    JMI_DEF(INT_EXT, tmp_1)
    13678     JMI_ARR(HEAP, jmi_real_t, jmi_array_t, tmp_2, -1, 2)
    13679     JMI_DEF(INT_EXT, tmp_3)
    13680     JMI_ARR(HEAP, jmi_int_t, jmi_int_array_t, tmp_4, -1, 1)
    13681     JMI_DEF(INT_EXT, tmp_5)
     13680    JMI_DEF(INT_EXT, tmp_2)
     13681    JMI_ARR(HEAP, jmi_real_t, jmi_array_t, tmp_3, -1, 2)
     13682    JMI_DEF(INT_EXT, tmp_4)
     13683    JMI_ARR(HEAP, jmi_int_t, jmi_int_array_t, tmp_5, -1, 1)
    1368213684    JMI_DEF(INT_EXT, tmp_6)
     13685    JMI_DEF(INT_EXT, tmp_7)
    1368313686    extern void dgesv_(int*, int*, double*, int*, int*, double*, int*, int*);
    1368413687    if (x_a == NULL) {
     
    1369113694        jmi_array_ref_1(x_a, i1_0i) = jmi_array_val_1(b_a, i1_0i);
    1369213695    }
     13696    n_v = jmi_array_size(A_a, 0);
     13697    nrhs_v = 1;
    1369313698    JMI_ARRAY_INIT_2(HEAP, jmi_real_t, jmi_array_t, Awork_a, jmi_array_size(A_a, 0) * jmi_array_size(A_a, 0), 2, jmi_array_size(A_a, 0), jmi_array_size(A_a, 0))
    1369413699    i1_1in = 0;
     
    1370413709    ldb_v = jmi_max(1.0, jmi_array_size(b_a, 0));
    1370513710    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))
    13706     tmp_1 = (int)1;
    13707     JMI_ARRAY_INIT_2(HEAP, jmi_real_t, jmi_array_t, tmp_2, 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))
    13708     jmi_matrix_to_fortran_real(Awork_a, Awork_a->var, tmp_2->var);
    13709     tmp_3 = (int)lda_v;
    13710     JMI_ARRAY_INIT_1(HEAP, jmi_int_t, jmi_int_array_t, tmp_4, jmi_array_size(ipiv_a, 0), 1, jmi_array_size(ipiv_a, 0))
    13711     jmi_matrix_to_fortran_int(ipiv_a, ipiv_a->var, tmp_4->var);
    13712     tmp_5 = (int)ldb_v;
    13713     tmp_6 = (int)info_v;
    13714     dgesv_(&jmi_array_size(A_a, 0), &tmp_1, tmp_2->var, &tmp_3, tmp_4->var, x_a->var, &tmp_5, &tmp_6);
    13715     info_v = tmp_6;
     13711    tmp_1 = (int)n_v;
     13712    tmp_2 = (int)nrhs_v;
     13713    JMI_ARRAY_INIT_2(HEAP, jmi_real_t, jmi_array_t, tmp_3, 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))
     13714    jmi_matrix_to_fortran_real(Awork_a, Awork_a->var, tmp_3->var);
     13715    tmp_4 = (int)lda_v;
     13716    JMI_ARRAY_INIT_1(HEAP, jmi_int_t, jmi_int_array_t, tmp_5, jmi_array_size(ipiv_a, 0), 1, jmi_array_size(ipiv_a, 0))
     13717    jmi_matrix_to_fortran_int(ipiv_a, ipiv_a->var, tmp_5->var);
     13718    tmp_6 = (int)ldb_v;
     13719    tmp_7 = (int)info_v;
     13720    dgesv_(&tmp_1, &tmp_2, tmp_3->var, &tmp_4, tmp_5->var, x_a->var, &tmp_6, &tmp_7);
     13721    info_v = tmp_7;
    1371613722    JMI_RET(GEN, info_o, info_v)
    1371713723    JMI_DYNAMIC_FREE()
    1371813724    return;
    1371913725}
     13726
    1372013727
    1372113728")})));
     
    1375413761    func_Modelica_Math_Matrices_LAPACK_dgesv_def1(A_a, B_a, X_a, &info_v);
    1375513762    if (COND_EXP_EQ(info_v, 0.0, JMI_TRUE, JMI_FALSE) == JMI_FALSE) {
    13756         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);
    1375713764    }
    1375813765    JMI_DYNAMIC_FREE()
     
    1376413771    JMI_ARR(HEAP, jmi_real_t, jmi_array_t, X_an, -1, 2)
    1376513772    JMI_DEF(INT, info_v)
     13773    JMI_DEF(INT, n_v)
     13774    JMI_DEF(INT, nrhs_v)
    1376613775    JMI_ARR(HEAP, jmi_real_t, jmi_array_t, Awork_a, -1, 2)
    1376713776    JMI_DEF(INT, lda_v)
     
    1378013789    jmi_int_t i2_3ie;
    1378113790    jmi_int_t i2_3in;
    13782     JMI_ARR(HEAP, jmi_real_t, jmi_array_t, tmp_1, -1, 2)
     13791    JMI_DEF(INT_EXT, tmp_1)
    1378313792    JMI_DEF(INT_EXT, tmp_2)
    13784     JMI_ARR(HEAP, jmi_int_t, jmi_int_array_t, tmp_3, -1, 1)
    13785     JMI_ARR(HEAP, jmi_real_t, jmi_array_t, tmp_4, -1, 2)
    13786     JMI_DEF(INT_EXT, tmp_5)
    13787     JMI_DEF(INT_EXT, tmp_6)
     13793    JMI_ARR(HEAP, jmi_real_t, jmi_array_t, tmp_3, -1, 2)
     13794    JMI_DEF(INT_EXT, tmp_4)
     13795    JMI_ARR(HEAP, jmi_int_t, jmi_int_array_t, tmp_5, -1, 1)
     13796    JMI_ARR(HEAP, jmi_real_t, jmi_array_t, tmp_6, -1, 2)
     13797    JMI_DEF(INT_EXT, tmp_7)
     13798    JMI_DEF(INT_EXT, tmp_8)
    1378813799    extern void dgesv_(int*, int*, double*, int*, int*, double*, int*, int*);
    1378913800    if (X_a == NULL) {
     
    1380013811        }
    1380113812    }
     13813    n_v = jmi_array_size(A_a, 0);
     13814    nrhs_v = jmi_array_size(B_a, 1);
    1380213815    JMI_ARRAY_INIT_2(HEAP, jmi_real_t, jmi_array_t, Awork_a, jmi_array_size(A_a, 0) * jmi_array_size(A_a, 0), 2, jmi_array_size(A_a, 0), jmi_array_size(A_a, 0))
    1380313816    i1_2in = 0;
     
    1381313826    ldb_v = jmi_max(1.0, jmi_array_size(B_a, 0));
    1381413827    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))
    13815     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))
    13816     jmi_matrix_to_fortran_real(Awork_a, Awork_a->var, tmp_1->var);
    13817     tmp_2 = (int)lda_v;
    13818     JMI_ARRAY_INIT_1(HEAP, jmi_int_t, jmi_int_array_t, tmp_3, jmi_array_size(ipiv_a, 0), 1, jmi_array_size(ipiv_a, 0))
    13819     jmi_matrix_to_fortran_int(ipiv_a, ipiv_a->var, tmp_3->var);
    13820     JMI_ARRAY_INIT_2(HEAP, jmi_real_t, jmi_array_t, tmp_4, jmi_array_size(X_a, 0) * jmi_array_size(X_a, 1), 2, jmi_array_size(X_a, 0), jmi_array_size(X_a, 1))
    13821     jmi_matrix_to_fortran_real(X_a, X_a->var, tmp_4->var);
    13822     tmp_5 = (int)ldb_v;
    13823     tmp_6 = (int)info_v;
    13824     dgesv_(&jmi_array_size(A_a, 0), &jmi_array_size(B_a, 1), tmp_1->var, &tmp_2, tmp_3->var, tmp_4->var, &tmp_5, &tmp_6);
    13825     jmi_matrix_from_fortran_real(X_a, tmp_4->var, X_a->var);
    13826     info_v = tmp_6;
     13828    tmp_1 = (int)n_v;
     13829    tmp_2 = (int)nrhs_v;
     13830    JMI_ARRAY_INIT_2(HEAP, jmi_real_t, jmi_array_t, tmp_3, 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))
     13831    jmi_matrix_to_fortran_real(Awork_a, Awork_a->var, tmp_3->var);
     13832    tmp_4 = (int)lda_v;
     13833    JMI_ARRAY_INIT_1(HEAP, jmi_int_t, jmi_int_array_t, tmp_5, jmi_array_size(ipiv_a, 0), 1, jmi_array_size(ipiv_a, 0))
     13834    jmi_matrix_to_fortran_int(ipiv_a, ipiv_a->var, tmp_5->var);
     13835    JMI_ARRAY_INIT_2(HEAP, jmi_real_t, jmi_array_t, tmp_6, jmi_array_size(X_a, 0) * jmi_array_size(X_a, 1), 2, jmi_array_size(X_a, 0), jmi_array_size(X_a, 1))
     13836    jmi_matrix_to_fortran_real(X_a, X_a->var, tmp_6->var);
     13837    tmp_7 = (int)ldb_v;
     13838    tmp_8 = (int)info_v;
     13839    dgesv_(&tmp_1, &tmp_2, tmp_3->var, &tmp_4, tmp_5->var, tmp_6->var, &tmp_7, &tmp_8);
     13840    jmi_matrix_from_fortran_real(X_a, tmp_6->var, X_a->var);
     13841    info_v = tmp_8;
    1382713842    JMI_RET(GEN, info_o, info_v)
    1382813843    JMI_DYNAMIC_FREE()
    1382913844    return;
    1383013845}
     13846
    1383113847
    1383213848")})));
  • branches/dev-MSL323-MVD/Compiler/ModelicaFrontEnd/test/modelica/FunctionTests.mo

    r12766 r13935  
    1362413624  output Integer[:] p;
    1362513625  output Integer info;
     13626  Integer m;
    1362613627  Integer lda;
    1362713628  Integer ncol;
     
    1363913640   p[i1] := 0;
    1364013641  end for;
     13642  m := size(A, 1);
    1364113643  lda := max(1, size(A, 1));
    1364213644  ncol := size(A, 2);
    1364313645  init work as Real[3 * size(A, 2)];
    13644   external \"FORTRAN 77\" dgeqpf(size(A, 1), ncol, QR, lda, p, tau, work, info);
     13646  external "FORTRAN 77" dgeqpf(m, ncol, QR, lda, p, tau, work, info);
    1364513647  return;
    1364613648 end Modelica.Math.Matrices.LAPACK.dgeqpf;
     
    1370113703  ncol := size(A, 2);
    1370213704  init tau as Real[size(A, 2)];
    13703   assert(nrow >= ncol, \"\\nInput matrix A[\" + String(nrow) + \",\" + String(ncol) + \"] has more columns as rows.
    13704 This is not allowed when calling Modelica.Matrices.QR(A).\");
     13705  assert(nrow >= ncol, "\nInput matrix A[" + String(nrow) + "," + String(ncol) + "] has more columns as rows.
     13706This is not allowed when calling Modelica.Matrices.QR(A).");
    1370513707  if pivoting then
    1370613708   (Q, tau, p) := Modelica.Math.Matrices.LAPACK.dgeqpf(A);
     
    1373113733  output Integer[:] p;
    1373213734  output Integer info;
     13735  Integer m;
    1373313736  Integer lda;
    1373413737  Integer ncol;
     
    1374613749   p[i1] := 0;
    1374713750  end for;
     13751  m := size(A, 1);
    1374813752  lda := max(1, size(A, 1));
    1374913753  ncol := size(A, 2);
    1375013754  init work as Real[3 * size(A, 2)];
    13751   external \"FORTRAN 77\" dgeqpf(size(A, 1), ncol, QR, lda, p, tau, work, info);
     13755  external "FORTRAN 77" dgeqpf(m, ncol, QR, lda, p, tau, work, info);
    1375213756  return;
    1375313757 end Modelica.Math.Matrices.LAPACK.dgeqpf;
     
    1377613780  lda := max(1, m);
    1377713781  lwork := 3 * max(1, n);
    13778   external \"FORTRAN 77\" dgeqrf(m, n, Aout, lda, tau, work, lwork, info);
     13782  external "FORTRAN 77" dgeqrf(m, n, Aout, lda, tau, work, lwork, info);
    1377913783  return;
    1378013784 end Modelica.Math.Matrices.LAPACK.dgeqrf;
     
    1378513789  output Real[:,:] Q;
    1378613790  output Integer info;
     13791  Integer m;
     13792  Integer n;
     13793  Integer k;
    1378713794  Integer lda;
    1378813795  Integer lwork;
     
    1379513802   end for;
    1379613803  end for;
     13804  m := size(QR, 1);
     13805  n := size(QR, 2);
     13806  k := size(tau, 1);
    1379713807  lda := max(1, size(Q, 1));
    1379813808  lwork := max(1, min(10, size(QR, 2)) * size(QR, 2));
    1379913809  init work as Real[max(1, min(10, size(QR, 2)) * size(QR, 2))];
    13800   external \"FORTRAN 77\" dorgqr(size(QR, 1), size(QR, 2), size(tau, 1), Q, lda, tau, work, lwork, info);
     13810  external "FORTRAN 77" dorgqr(m, n, k, Q, lda, tau, work, lwork, info);
    1380113811  return;
    1380213812 end Modelica.Math.Matrices.LAPACK.dorgqr;
  • branches/dev-MSL323-MVD/Compiler/ModelicaMiddleEnd/test/modelica/IndexReduction.mo

    r12754 r13935  
    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 \"Reaction torque in the support/housing\";
    149  Modelica.SIunits.Torque inertia2.flange_b.tau \"Cut torque in the flange\";
    150  parameter Modelica.SIunits.MomentOfInertia inertia2.J(min = 0,start = 1) = 2 \"Moment of inertia\" /* 2 */;
    151  parameter StateSelect inertia2.stateSelect = StateSelect.default \"Priority to use phi and w as states\" /* StateSelect.default */;
    152  Modelica.SIunits.Angle inertia2.phi(fixed = true,start = 0,stateSelect = inertia2.stateSelect) \"Absolute rotation angle of component\";
    153  Modelica.SIunits.AngularVelocity inertia2.w(fixed = true,start = 0,stateSelect = inertia2.stateSelect) \"Absolute angular velocity of component (= der(phi))\";
    154  Modelica.SIunits.AngularAcceleration inertia2.a \"Absolute angular acceleration of component (= der(w))\";
    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  constant Modelica.SIunits.Torque inertia3.flange_b.tau = 0.0 \"Cut torque in the flange\";
    160  parameter Modelica.SIunits.RotationalDampingConstant damper.d(final min = 0,start = 0) \"Damping constant\";
    161  parameter StateSelect inertia3.stateSelect = StateSelect.default \"Priority to use phi and w as states\" /* StateSelect.default */;
    162  Modelica.SIunits.Angle inertia3.phi(stateSelect = inertia3.stateSelect) \"Absolute rotation angle of component\";
    163  Modelica.SIunits.AngularVelocity inertia3.w(fixed = true,start = 0,stateSelect = inertia3.stateSelect) \"Absolute angular velocity of component (= der(phi))\";
    164  Modelica.SIunits.AngularAcceleration inertia3.a \"Absolute angular acceleration of component (= der(w))\";
    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\" /* 0 */;
    177  parameter Modelica.SIunits.Time sine.startTime = 0 \"Output = 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 the support/housing\";
    181  parameter Modelica.SIunits.Angle torque.support.phi \"Absolute rotation angle of the support/housing\";
     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

    r12754 r13935  
    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;
     
    768768  output Real[:] x;
    769769  output Integer info;
     770  Integer n;
     771  Integer nrhs;
    770772  Real[:,:] Awork;
    771773  Integer lda;
     
    777779   x[i1] := b[i1];
    778780  end for;
     781  n := size(A, 1);
     782  nrhs := 1;
    779783  init Awork as Real[size(A, 1), size(A, 1)];
    780784  for i1 in 1:size(A, 1) loop
     
    786790  ldb := max(1, size(b, 1));
    787791  init ipiv as Integer[size(A, 1)];
    788   external \"FORTRAN 77\" dgesv(size(A, 1), 1, Awork, lda, ipiv, x, ldb, info);
     792  external "FORTRAN 77" dgesv(n, nrhs, Awork, lda, ipiv, x, ldb, info);
    789793  return;
    790794 end Modelica.Math.Matrices.LAPACK.dgesv_vec;
Note: See TracChangeset for help on using the changeset viewer.