Show
Ignore:
Timestamp:
02/24/08 19:43:25 (9 months ago)
Author:
otter
Message:

Unit errors in MultiBody corrected (unit="1" added for unit vectors, many missing units added, e.g. for RealInput)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/Modelica/Mechanics/MultiBody/Frames.mo

    r937 r1050  
    404404    import Modelica.Math; 
    405405    extends Modelica.Icons.Function; 
    406     input Real e[3] "Normalized axis of rotation (must have length=1)"; 
     406    input Real e[3](each final unit="1") "Normalized axis of rotation (must have length=1)"; 
    407407    input Modelica.SIunits.Angle angle 
    408408      "Rotation angle to rotate frame 1 into frame 2 along axis e"; 
     
    420420 
    421421    extends Modelica.Icons.Function; 
    422     input Real e[3] 
     422    input Real e[3](each final unit="1") 
    423423      "Normalized axis of rotation to rotate frame 1 around e into frame 2 (must have length=1)"; 
    424424    input Real v1[3] 
     
    606606</HTML>")); 
    607607  protected 
    608     Real e1_1[3] "First rotation axis, resolved in frame 1"; 
    609     Real e2_1a[3] "Second rotation axis, resolved in frame 1a"; 
    610     Real e3_1[3] "Third rotation axis, resolved in frame 1"; 
    611     Real e3_2[3] "Third rotation axis, resolved in frame 2"; 
     608    Real e1_1[3](each final unit="1") "First rotation axis, resolved in frame 1"; 
     609    Real e2_1a[3](each final unit="1") "Second rotation axis, resolved in frame 1a"; 
     610    Real e3_1[3](each final unit="1") "Third rotation axis, resolved in frame 1"; 
     611    Real e3_2[3](each final unit="1") "Third rotation axis, resolved in frame 2"; 
    612612    Real A 
    613613      "Coefficient A in the equation A*cos(angles[1])+B*sin(angles[1]) = 0"; 
     
    718718  function from_nxy "Return fixed orientation object from n_x and n_y vectors" 
    719719    extends Modelica.Icons.Function; 
    720     input Real n_x[3] 
     720    input Real n_x[3](each final unit="1") 
    721721      "Vector in direction of x-axis of frame 2, resolved in frame 1"; 
    722     input Real n_y[3] 
     722    input Real n_y[3](each final unit="1") 
    723723      "Vector in direction of y-axis of frame 2, resolved in frame 1"; 
    724724    output Orientation R "Orientation object to rotate frame 1 into frame 2"; 
     
    746746  protected 
    747747    Real abs_n_x=sqrt(n_x*n_x); 
    748     Real e_x[3]=if abs_n_x < 1.e-10 then {1,0,0} else n_x/abs_n_x; 
    749     Real n_z_aux[3]=cross(e_x, n_y); 
    750     Real n_y_aux[3]=if n_z_aux*n_z_aux > 1.0e-6 then n_y else (if abs(e_x[1]) 
     748    Real e_x[3](each final unit="1")=if abs_n_x < 1.e-10 then {1,0,0} else n_x/abs_n_x; 
     749    Real n_z_aux[3](each final unit="1")=cross(e_x, n_y); 
     750    Real n_y_aux[3](each final unit="1")=if n_z_aux*n_z_aux > 1.0e-6 then n_y else (if abs(e_x[1]) 
    751751         > 1.0e-6 then {0,1,0} else {1,0,0}); 
    752     Real e_z_aux[3]=cross(e_x, n_y_aux); 
    753     Real e_z[3]=e_z_aux/sqrt(e_z_aux*e_z_aux); 
     752    Real e_z_aux[3](each final unit="1")=cross(e_x, n_y_aux); 
     753    Real e_z[3](each final unit="1")=e_z_aux/sqrt(e_z_aux*e_z_aux); 
    754754  algorithm 
    755755    R := Orientation(T={e_x,cross(e_z, e_x),e_z},w= zeros(3)); 
     
    758758  function from_nxz "Return fixed orientation object from n_x and n_z vectors" 
    759759    extends Modelica.Icons.Function; 
    760     input Real n_x[3] 
     760    input Real n_x[3](each final unit="1") 
    761761      "Vector in direction of x-axis of frame 2, resolved in frame 1"; 
    762     input Real n_z[3] 
     762    input Real n_z[3](each final unit="1") 
    763763      "Vector in direction of z-axis of frame 2, resolved in frame 1"; 
    764764    output Orientation R "Orientation object to rotate frame 1 into frame 2"; 
     
    786786  protected 
    787787    Real abs_n_x=sqrt(n_x*n_x); 
    788     Real e_x[3]=if abs_n_x < 1.e-10 then {1,0,0} else n_x/abs_n_x; 
    789     Real n_y_aux[3]=cross(n_z, e_x); 
    790     Real n_z_aux[3]=if n_y_aux*n_y_aux > 1.0e-6 then n_z else (if abs(e_x[1]) 
     788    Real e_x[3](each final unit="1")=if abs_n_x < 1.e-10 then {1,0,0} else n_x/abs_n_x; 
     789    Real n_y_aux[3](each final unit="1")=cross(n_z, e_x); 
     790    Real n_z_aux[3](each final unit="1")=if n_y_aux*n_y_aux > 1.0e-6 then n_z else (if abs(e_x[1]) 
    791791         > 1.0e-6 then {0,0,1} else {1,0,0}); 
    792     Real e_y_aux[3]=cross(n_z_aux, e_x); 
    793     Real e_y[3]=e_y_aux/sqrt(e_y_aux*e_y_aux); 
     792    Real e_y_aux[3](each final unit="1")=cross(n_z_aux, e_x); 
     793    Real e_y[3](each final unit="1")=e_y_aux/sqrt(e_y_aux*e_y_aux); 
    794794  algorithm 
    795795    R := Orientation(T={e_x,e_y,cross(e_x, e_y)},w= zeros(3)); 
     
    925925    extends Modelica.Icons.Function; 
    926926    input Integer axis(min=1, max=3) "Axis vector to be returned"; 
    927     output Real e[3] "Unit axis vector"; 
     927    output Real e[3](each final unit="1") "Unit axis vector"; 
    928928    annotation(Inline=true); 
    929929  algorithm 
     
    12451245      import Modelica.Math; 
    12461246      extends Modelica.Icons.Function; 
    1247       input Real e[3] "Normalized axis of rotation (must have length=1)"; 
     1247      input Real e[3](each final unit="1") "Normalized axis of rotation (must have length=1)"; 
    12481248      input Modelica.SIunits.Angle angle 
    12491249        "Rotation angle to rotate frame 1 into frame 2 along axis e"; 
     
    16601660      import Modelica.Math; 
    16611661      extends Modelica.Icons.Function; 
    1662       input Real e[3] "Normalized axis of rotation (must have length=1)"; 
     1662      input Real e[3](each final unit="1") "Normalized axis of rotation (must have length=1)"; 
    16631663      input Modelica.SIunits.Angle angle 
    16641664        "Rotation angle to rotate frame 1 into frame 2 along axis e"; 
     
    16751675 
    16761676      extends Modelica.Icons.Function; 
    1677       input Real e[3] 
     1677      input Real e[3](each final unit="1") 
    16781678        "Normalized axis of rotation to rotate frame 1 around e into frame 2 (must have length=1)"; 
    16791679      input Real v1[3] 
     
    18501850</HTML>")); 
    18511851    protected 
    1852       Real e1_1[3] "First rotation axis, resolved in frame 1"; 
    1853       Real e2_1a[3] "Second rotation axis, resolved in frame 1a"; 
    1854       Real e3_1[3] "Third rotation axis, resolved in frame 1"; 
    1855       Real e3_2[3] "Third rotation axis, resolved in frame 2"; 
     1852      Real e1_1[3](each final unit="1") "First rotation axis, resolved in frame 1"; 
     1853      Real e2_1a[3](each final unit="1") "Second rotation axis, resolved in frame 1a"; 
     1854      Real e3_1[3](each final unit="1") "Third rotation axis, resolved in frame 1"; 
     1855      Real e3_2[3](each final unit="1") "Third rotation axis, resolved in frame 2"; 
    18561856      Real A 
    18571857        "Coefficient A in the equation A*cos(angles[1])+B*sin(angles[1]) = 0"; 
     
    19631963    function from_nxy "Return orientation object from n_x and n_y vectors" 
    19641964      extends Modelica.Icons.Function; 
    1965       input Real n_x[3] 
     1965      input Real n_x[3](each final unit="1") 
    19661966        "Vector in direction of x-axis of frame 2, resolved in frame 1"; 
    1967       input Real n_y[3] 
     1967      input Real n_y[3](each final unit="1") 
    19681968        "Vector in direction of y-axis of frame 2, resolved in frame 1"; 
    19691969      output TransformationMatrices.Orientation T 
     
    19921992    protected 
    19931993      Real abs_n_x=sqrt(n_x*n_x); 
    1994       Real e_x[3]=if abs_n_x < 1.e-10 then {1,0,0} else n_x/abs_n_x; 
    1995       Real n_z_aux[3]=cross(e_x, n_y); 
    1996       Real n_y_aux[3]=if n_z_aux*n_z_aux > 1.0e-6 then n_y else (if abs(e_x[1]) 
     1994      Real e_x[3](each final unit="1")=if abs_n_x < 1.e-10 then {1,0,0} else n_x/abs_n_x; 
     1995      Real n_z_aux[3](each final unit="1")=cross(e_x, n_y); 
     1996      Real n_y_aux[3](each final unit="1")=if n_z_aux*n_z_aux > 1.0e-6 then n_y else (if abs(e_x[1]) 
    19971997           > 1.0e-6 then {0,1,0} else {1,0,0}); 
    1998       Real e_z_aux[3]=cross(e_x, n_y_aux); 
    1999       Real e_z[3]=e_z_aux/sqrt(e_z_aux*e_z_aux); 
     1998      Real e_z_aux[3](each final unit="1")=cross(e_x, n_y_aux); 
     1999      Real e_z[3](each final unit="1")=e_z_aux/sqrt(e_z_aux*e_z_aux); 
    20002000    algorithm 
    20012001      T := {e_x,cross(e_z, e_x),e_z}; 
     
    20042004    function from_nxz "Return orientation object from n_x and n_z vectors" 
    20052005      extends Modelica.Icons.Function; 
    2006       input Real n_x[3] 
     2006      input Real n_x[3](each final unit="1") 
    20072007        "Vector in direction of x-axis of frame 2, resolved in frame 1"; 
    2008       input Real n_z[3] 
     2008      input Real n_z[3](each final unit="1") 
    20092009        "Vector in direction of z-axis of frame 2, resolved in frame 1"; 
    20102010      output TransformationMatrices.Orientation T 
     
    20332033    protected 
    20342034      Real abs_n_x=sqrt(n_x*n_x); 
    2035       Real e_x[3]=if abs_n_x < 1.e-10 then {1,0,0} else n_x/abs_n_x; 
    2036       Real n_y_aux[3]=cross(n_z, e_x); 
    2037       Real n_z_aux[3]=if n_y_aux*n_y_aux > 1.0e-6 then n_z else (if abs(e_x[1]) 
     2035      Real e_x[3](each final unit="1")=if abs_n_x < 1.e-10 then {1,0,0} else n_x/abs_n_x; 
     2036      Real n_y_aux[3](each final unit="1")=cross(n_z, e_x); 
     2037      Real n_z_aux[3](each final unit="1")=if n_y_aux*n_y_aux > 1.0e-6 then n_z else (if abs(e_x[1]) 
    20382038           > 1.0e-6 then {0,0,1} else {1,0,0}); 
    2039       Real e_y_aux[3]=cross(n_z_aux, e_x); 
    2040       Real e_y[3]=e_y_aux/sqrt(e_y_aux*e_y_aux); 
     2039      Real e_y_aux[3](each final unit="1")=cross(n_z_aux, e_x); 
     2040      Real e_y[3](each final unit="1")=e_y_aux/sqrt(e_y_aux*e_y_aux); 
    20412041    algorithm 
    20422042      T := {e_x,e_y,cross(e_x, e_y)};