Show
Ignore:
Timestamp:
02/24/08 20:03:46 (8 months ago)
Author:
otter
Message:

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

Location:
branches/maintenance/2.2.2/Modelica
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • branches/maintenance/2.2.2/Modelica/Mechanics/MultiBody/Forces.mo

    r660 r1051  
    15651565    SI.Position r_rel_0[3]  
    15661566      "Position vector from frame_a to frame_b resolved in world frame"; 
    1567     Real e_rel_0[3]  
     1567    Real e_rel_0[3](each final unit="1")  
    15681568      "Unit vector in direction from frame_a to frame_b, resolved in world frame"; 
    15691569    annotation ( 
     
    18801880    SI.Position r_rel_0[3]  
    18811881      "Position vector from frame_a to frame_b resolved in world frame"; 
    1882     Real e_rel_0[3]  
     1882    Real e_rel_0[3](each final unit="1")  
    18831883      "Unit vector in direction from frame_a to frame_b, resolved in world frame"; 
    18841884    annotation ( 
  • branches/maintenance/2.2.2/Modelica/Mechanics/MultiBody/Frames.mo

    r572 r1051  
    394394    import Modelica.Math; 
    395395    extends Modelica.Icons.Function; 
    396     input Real e[3] "Normalized axis of rotation (must have length=1)"; 
     396    input Real e[3](each final unit="1") "Normalized axis of rotation (must have length=1)"; 
    397397    input Modelica.SIunits.Angle angle  
    398398      "Rotation angle to rotate frame 1 into frame 2 along axis e"; 
     
    409409     
    410410    extends Modelica.Icons.Function; 
    411     input Real e[3]  
     411    input Real e[3](each final unit="1")  
    412412      "Normalized axis of rotation to rotate frame 1 around e into frame 2 (must have length=1)"; 
    413413    input Real v1[3]  
     
    547547      "Rotation angles around the axes defined in 'sequence' such that R=Frames.axesRotation(sequence,angles); -pi < angles[i] <= pi"; 
    548548  protected  
    549     Real e1_1[3] "First rotation axis, resolved in frame 1"; 
    550     Real e2_1a[3] "Second rotation axis, resolved in frame 1a"; 
    551     Real e3_1[3] "Third rotation axis, resolved in frame 1"; 
    552     Real e3_2[3] "Third rotation axis, resolved in frame 2"; 
     549    Real e1_1[3](each final unit="1") "First rotation axis, resolved in frame 1"; 
     550    Real e2_1a[3](each final unit="1") "Second rotation axis, resolved in frame 1a"; 
     551    Real e3_1[3](each final unit="1") "Third rotation axis, resolved in frame 1"; 
     552    Real e3_2[3](each final unit="1") "Third rotation axis, resolved in frame 2"; 
    553553    Real A  
    554554      "Coefficient A in the equation A*cos(angles[1])+B*sin(angles[1]) = 0"; 
     
    703703  function from_nxy "Return fixed orientation object from n_x and n_y vectors"  
    704704    extends Modelica.Icons.Function; 
    705     input Real n_x[3]  
     705    input Real n_x[3](each final unit="1")  
    706706      "Vector in direction of x-axis of frame 2, resolved in frame 1"; 
    707     input Real n_y[3]  
     707    input Real n_y[3](each final unit="1")  
    708708      "Vector in direction of y-axis of frame 2, resolved in frame 1"; 
    709709    output Orientation R "Orientation object to rotate frame 1 into frame 2"; 
    710710  protected  
    711     Real abs_n_x=sqrt(n_x*n_x); 
    712     Real e_x[3]=if abs_n_x < 1.e-10 then {1,0,0} else n_x/abs_n_x; 
    713     Real n_z_aux[3]=cross(e_x, n_y); 
    714     Real n_y_aux[3]=if n_z_aux*n_z_aux > 1.0e-6 then n_y else (if abs(e_x[1]) 
     711    Real abs_n_x(final unit="1")=sqrt(n_x*n_x); 
     712    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; 
     713    Real n_z_aux[3](each final unit="1")=cross(e_x, n_y); 
     714    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]) 
    715715         > 1.0e-6 then {0,1,0} else {1,0,0}); 
    716     Real e_z_aux[3]=cross(e_x, n_y_aux); 
    717     Real e_z[3]=e_z_aux/sqrt(e_z_aux*e_z_aux); 
     716    Real e_z_aux[3](each final unit="1")=cross(e_x, n_y_aux); 
     717    Real e_z[3](each final unit="1")=e_z_aux/sqrt(e_z_aux*e_z_aux); 
    718718  algorithm  
    719719    R := Orientation(T={e_x,cross(e_z, e_x),e_z},w= zeros(3)); 
     
    743743  function from_nxz "Return fixed orientation object from n_x and n_z vectors"  
    744744    extends Modelica.Icons.Function; 
    745     input Real n_x[3]  
     745    input Real n_x[3](each final unit="1")  
    746746      "Vector in direction of x-axis of frame 2, resolved in frame 1"; 
    747     input Real n_z[3]  
     747    input Real n_z[3] (each final unit="1") 
    748748      "Vector in direction of z-axis of frame 2, resolved in frame 1"; 
    749749    output Orientation R "Orientation object to rotate frame 1 into frame 2"; 
    750750  protected  
    751     Real abs_n_x=sqrt(n_x*n_x); 
    752     Real e_x[3]=if abs_n_x < 1.e-10 then {1,0,0} else n_x/abs_n_x; 
    753     Real n_y_aux[3]=cross(n_z, e_x); 
    754     Real n_z_aux[3]=if n_y_aux*n_y_aux > 1.0e-6 then n_z else (if abs(e_x[1]) 
     751    Real abs_n_x(final unit="1")=sqrt(n_x*n_x); 
     752    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; 
     753    Real n_y_aux[3](each final unit="1")=cross(n_z, e_x); 
     754    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]) 
    755755         > 1.0e-6 then {0,0,1} else {1,0,0}); 
    756     Real e_y_aux[3]=cross(n_z_aux, e_x); 
    757     Real e_y[3]=e_y_aux/sqrt(e_y_aux*e_y_aux); 
     756    Real e_y_aux[3](each final unit="1")=cross(n_z_aux, e_x); 
     757    Real e_y[3](each final unit="1")=e_y_aux/sqrt(e_y_aux*e_y_aux); 
    758758  algorithm  
    759759    R := Orientation(T={e_x,e_y,cross(e_x, e_y)},w= zeros(3)); 
     
    918918    extends Modelica.Icons.Function; 
    919919    input Integer axis(min=1, max=3) "Axis vector to be returned"; 
    920     output Real e[3] "Unit axis vector"; 
     920    output Real e[3](each final unit="1") "Unit axis vector"; 
    921921  algorithm  
    922922    e := if axis == 1 then {1,0,0} else (if axis == 2 then {0,1,0} else {0,0,1}); 
     
    12251225      import Modelica.Math; 
    12261226      extends Modelica.Icons.Function; 
    1227       input Real e[3] "Normalized axis of rotation (must have length=1)"; 
     1227      input Real e[3](each final unit="1") "Normalized axis of rotation (must have length=1)"; 
    12281228      input Modelica.SIunits.Angle angle  
    12291229        "Rotation angle to rotate frame 1 into frame 2 along axis e"; 
     
    16211621      import Modelica.Math; 
    16221622      extends Modelica.Icons.Function; 
    1623       input Real e[3] "Normalized axis of rotation (must have length=1)"; 
     1623      input Real e[3](each final unit="1") "Normalized axis of rotation (must have length=1)"; 
    16241624      input Modelica.SIunits.Angle angle  
    16251625        "Rotation angle to rotate frame 1 into frame 2 along axis e"; 
     
    16351635       
    16361636      extends Modelica.Icons.Function; 
    1637       input Real e[3]  
     1637      input Real e[3](each final unit="1")  
    16381638        "Normalized axis of rotation to rotate frame 1 around e into frame 2 (must have length=1)"; 
    16391639      input Real v1[3]  
     
    17621762        "Rotation angles around the axes defined in 'sequence' such that T=TransformationMatrices.axesRotation(sequence,angles); -pi < angles[i] <= pi"; 
    17631763    protected  
    1764       Real e1_1[3] "First rotation axis, resolved in frame 1"; 
    1765       Real e2_1a[3] "Second rotation axis, resolved in frame 1a"; 
    1766       Real e3_1[3] "Third rotation axis, resolved in frame 1"; 
    1767       Real e3_2[3] "Third rotation axis, resolved in frame 2"; 
     1764      Real e1_1[3](each final unit="1") "First rotation axis, resolved in frame 1"; 
     1765      Real e2_1a[3](each final unit="1") "Second rotation axis, resolved in frame 1a"; 
     1766      Real e3_1[3](each final unit="1") "Third rotation axis, resolved in frame 1"; 
     1767      Real e3_2[3](each final unit="1") "Third rotation axis, resolved in frame 2"; 
    17681768      Real A  
    17691769        "Coefficient A in the equation A*cos(angles[1])+B*sin(angles[1]) = 0"; 
     
    19191919    function from_nxy "Return orientation object from n_x and n_y vectors"  
    19201920      extends Modelica.Icons.Function; 
    1921       input Real n_x[3]  
     1921      input Real n_x[3](each final unit="1")  
    19221922        "Vector in direction of x-axis of frame 2, resolved in frame 1"; 
    1923       input Real n_y[3]  
     1923      input Real n_y[3](each final unit="1")  
    19241924        "Vector in direction of y-axis of frame 2, resolved in frame 1"; 
    19251925      output TransformationMatrices.Orientation T  
    19261926        "Orientation object to rotate frame 1 into frame 2"; 
    19271927    protected  
    1928       Real abs_n_x=sqrt(n_x*n_x); 
    1929       Real e_x[3]=if abs_n_x < 1.e-10 then {1,0,0} else n_x/abs_n_x; 
    1930       Real n_z_aux[3]=cross(e_x, n_y); 
    1931       Real n_y_aux[3]=if n_z_aux*n_z_aux > 1.0e-6 then n_y else (if abs(e_x[1]) 
     1928      Real abs_n_x(final unit="1")=sqrt(n_x*n_x); 
     1929      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; 
     1930      Real n_z_aux[3](each final unit="1")=cross(e_x, n_y); 
     1931      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]) 
    19321932           > 1.0e-6 then {0,1,0} else {1,0,0}); 
    1933       Real e_z_aux[3]=cross(e_x, n_y_aux); 
    1934       Real e_z[3]=e_z_aux/sqrt(e_z_aux*e_z_aux); 
     1933      Real e_z_aux[3](each final unit="1")=cross(e_x, n_y_aux); 
     1934      Real e_z[3](each final unit="1")=e_z_aux/sqrt(e_z_aux*e_z_aux); 
    19351935    algorithm  
    19361936      T := {e_x,cross(e_z, e_x),e_z}; 
     
    19601960    function from_nxz "Return orientation object from n_x and n_z vectors"  
    19611961      extends Modelica.Icons.Function; 
    1962       input Real n_x[3]  
     1962      input Real n_x[3](each final unit="1") 
    19631963        "Vector in direction of x-axis of frame 2, resolved in frame 1"; 
    1964       input Real n_z[3]  
     1964      input Real n_z[3](each final unit="1")  
    19651965        "Vector in direction of z-axis of frame 2, resolved in frame 1"; 
    19661966      output TransformationMatrices.Orientation T  
    19671967        "Orientation object to rotate frame 1 into frame 2"; 
    19681968    protected  
    1969       Real abs_n_x=sqrt(n_x*n_x); 
    1970       Real e_x[3]=if abs_n_x < 1.e-10 then {1,0,0} else n_x/abs_n_x; 
    1971       Real n_y_aux[3]=cross(n_z, e_x); 
    1972       Real n_z_aux[3]=if n_y_aux*n_y_aux > 1.0e-6 then n_z else (if abs(e_x[1]) 
     1969      Real abs_n_x(final unit="1")=sqrt(n_x*n_x); 
     1970      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; 
     1971      Real n_y_aux[3](each final unit="1")=cross(n_z, e_x); 
     1972      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]) 
    19731973           > 1.0e-6 then {0,0,1} else {1,0,0}); 
    1974       Real e_y_aux[3]=cross(n_z_aux, e_x); 
    1975       Real e_y[3]=e_y_aux/sqrt(e_y_aux*e_y_aux); 
     1974      Real e_y_aux[3](each final unit="1")=cross(n_z_aux, e_x); 
     1975      Real e_y[3](each final unit="1")=e_y_aux/sqrt(e_y_aux*e_y_aux); 
    19761976    algorithm  
    19771977      T := {e_x,e_y,cross(e_x, e_y)}; 
  • branches/maintenance/2.2.2/Modelica/Mechanics/MultiBody/Interfaces.mo

    r555 r1051  
    624624    SI.Position s  
    625625      "(Guarded) distance between the origin of frame_a and the origin of frame_b (>= s_small))"; 
    626     Real e_a[3]  
     626    Real e_a[3](each final unit="1")  
    627627      "Unit vector on the line connecting the origin of frame_a with the origin of frame_b resolved in frame_a (directed from frame_a to frame_b)"; 
    628     Real r_rel_a[3]  
     628    Modelica.SIunits.Position r_rel_a[3]  
    629629      "Position vector from origin of frame_a to origin of frame_b, resolved in frame_a"; 
    630630  protected  
  • branches/maintenance/2.2.2/Modelica/Mechanics/MultiBody/Joints.mo

    r572 r1051  
    914914  protected  
    915915    parameter Integer ndim=if world.enableAnimation and animation then 1 else 0; 
    916     parameter Real e[3]=Frames.normalize(n); 
     916    parameter Real e[3](each final unit="1")=Frames.normalize(n); 
    917917  protected  
    918918    Visualizers.Advanced.Shape box_x[ndim]( 
     
    16971697    SI.Position rRod_a[3]  
    16981698      "Position vector from frame_a to frame_b resolved in frame_a"; 
    1699     Real eRod_a[3]  
     1699    Real eRod_a[3](each final unit="1")  
    17001700      "Unit vector in direction from frame_a to frame_b, resolved in frame_a"; 
    17011701    SI.Position r_CM_0[3]  
     
    20442044      Frames.length(rRod_ia)  
    20452045      "Length of rod (distance between origin of frame_a and origin of frame_b)"; 
    2046     final parameter Real eRod_ia[3]=Frames.normalize(rRod_ia)  
     2046    final parameter Real eRod_ia[3](each final unit="1")=Frames.normalize(rRod_ia)  
    20472047      "Unit vector from origin of frame_a to origin of frame_b, resolved in frame_ia"; 
    2048     final parameter Real e2_ia[3]=Frames.normalize(cross(n1_a, eRod_ia))  
     2048    final parameter Real e2_ia[3](each final unit="1")=Frames.normalize(cross(n1_a, eRod_ia))  
    20492049      "Unit vector in direction of axis 2 of universal joint, resolved in frame_ia (orthogonal to n1_a and eRod_ia; note: frame_ia is parallel to frame_a when the universal joint angles are zero)"; 
    2050     final parameter Real e3_ia[3]=cross(eRod_ia, e2_ia)  
     2050    final parameter Real e3_ia[3](each final unit="1")=cross(eRod_ia, e2_ia)  
    20512051      "Unit vector perpendicular to eRod_ia and e2_ia, resolved in frame_ia"; 
    20522052    SI.Power totalPower  
     
    20542054    SI.Force f_b_a1[3]  
    20552055      "frame_b.f without f_rod part, resolved in frame_a (needed for analytic loop handling)"; 
    2056     Real eRod_a[3]  
     2056    Real eRod_a[3](each final unit="1")  
    20572057      "Unit vector in direction of rRod_a, resolved in frame_a (needed for analytic loop handling)"; 
    20582058    SI.Position rRod_0[3](start=rRod_ia)  
     
    23272327    SI.Force f_ia_a[3] "frame_ia.f resolved in frame_a"; 
    23282328    SI.Torque t_ia_a[3] "frame_ia.t resolved in frame_a"; 
    2329     Real n2_a[3]  
     2329    Real n2_a[3](each final unit="1")  
    23302330      "Vector in direction of axis 2 of the universal joint (e2_ia), resolved in frame_a"; 
    23312331    Real length2_n2_a(start=1, unit="m2") "Square of length of vector n2_a"; 
    23322332    SI.Length length_n2_a "Length of vector n2_a"; 
    2333     Real e2_a[3]  
     2333    Real e2_a[3](each final unit="1")  
    23342334      "Unit vector in direction of axis 2 of the universal joint (e2_ia), resolved in frame_a"; 
    2335     Real e3_a[3]  
     2335    Real e3_a[3](each final unit="1")  
    23362336      "Unit vector perpendicular to eRod_ia and e2_a, resolved in frame_a"; 
    2337     Real der_rRod_a_L[3] "= der(rRod_a)/rodLength"; 
     2337    Real der_rRod_a_L[3](each final unit="1/s") "= der(rRod_a)/rodLength"; 
    23382338    SI.AngularVelocity w_rel_ia1[3]; 
    23392339    Frames.Orientation R_rel_ia1; 
     
    28382838        "= true, if total power flowing into this component shall be determined (must be zero)" 
    28392839        annotation (Dialog(tab="Advanced")); 
    2840       final parameter Real eAxis_ia[3]=Frames.normalize(nAxis_ia)  
     2840      final parameter Real eAxis_ia[3](each final unit="1")=Frames.normalize(nAxis_ia)  
    28412841        "Unit vector from origin of frame_a to origin of frame_b, resolved in frame_ia"; 
    2842       final parameter Real e2_ia[3]=Frames.normalize(cross(n1_a, eAxis_ia))  
     2842      final parameter Real e2_ia[3](each final unit="1")=Frames.normalize(cross(n1_a, eAxis_ia))  
    28432843        "Unit vector in direction of second rotation axis of universal joint, resolved in frame_ia"; 
    2844       final parameter Real e3_ia[3]=cross(eAxis_ia, e2_ia)  
     2844      final parameter Real e3_ia[3](each final unit="1")=cross(eAxis_ia, e2_ia)  
    28452845        "Unit vector perpendicular to eAxis_ia and e2_ia, resolved in frame_ia"; 
    28462846      SI.Position s  
     
    31673167      SI.Position rAxis_a[3]  
    31683168        "Position vector from origin of frame_a to origin of frame_b resolved in frame_a"; 
    3169       Real eAxis_a[3]  
     3169      Real eAxis_a[3](each final unit="1")  
    31703170        "Unit vector in direction of rAxis_a, resolved in frame_a"; 
    3171       Real e2_a[3]  
     3171      Real e2_a[3](each final unit="1")  
    31723172        "Unit vector in direction of second rotation axis of universal joint, resolved in frame_a"; 
    3173       Real e3_a[3]  
     3173      Real e3_a[3](each final unit="1")  
    31743174        "Unit vector perpendicular to eAxis_a and e2_a, resolved in frame_a"; 
    3175       Real n2_a[3]  
     3175      Real n2_a[3](each final unit="1")  
    31763176        "Vector in direction of second rotation axis of universal joint, resolved in frame_a"; 
    31773177      Real length2_n2_a(unit="m2") "Square of length of vector n2_a"; 
    31783178      SI.Length length_n2_a "Length of vector n2_a"; 
    3179       Real der_rAxis_a_L[3] "= der(rAxis_a)/axisLength"; 
     3179      Real der_rAxis_a_L[3](each final unit="1/s") "= der(rAxis_a)/axisLength"; 
    31803180      SI.AngularVelocity w_rel_ia1[3]; 
    31813181      Frames.Orientation R_ia1_a; 
     
    34773477        "= true, if total power flowing into this component shall be determined (must be zero)" 
    34783478        annotation (Dialog(tab="Advanced")); 
    3479       final parameter Real eRod1_ia[3]=rod1.eRod_ia  
     3479      final parameter Real eRod1_ia[3](each final unit="1")=rod1.eRod_ia  
    34803480        "Unit vector from origin of frame_a to origin of spherical joint, resolved in frame_ia"; 
    3481       final parameter Real e2_ia[3]=rod1.e2_ia  
     3481      final parameter Real e2_ia[3](each final unit="1")=rod1.e2_ia  
    34823482        "Unit vector in direction of axis 2 of universal joint, resolved in frame_ia"; 
    34833483      final parameter SI.Distance rod1Length=rod1.rodLength  
     
    39733973        "= true, if total power flowing into this component shall be determined (must be zero)" 
    39743974        annotation (Dialog(tab="Advanced")); 
    3975       final parameter Real eRod1_ia[3]=rod1.eRod_ia  
     3975      final parameter Real eRod1_ia[3](each final unit="1")=rod1.eRod_ia  
    39763976        "Unit vector from origin of frame_a to origin of spherical joint, resolved in frame_ia"; 
    3977       final parameter Real e2_ia[3]=rod1.e2_ia  
     3977      final parameter Real e2_ia[3](each final unit="1")=rod1.e2_ia  
    39783978        "Unit vector in direction of axis 2 of universal joint, resolved in frame_ia"; 
    39793979      final parameter SI.Distance rod1Length=rod1.rodLength  
     
    51265126        "Axes of revolute joints resolved in frame_a (all axes are parallel to each other)" 
    51275127        annotation (Evaluate=true); 
    5128       final parameter Real n_b[3](fixed=false) = {0,0,1}  
     5128      final parameter Real n_b[3](each final unit="1", fixed=false) = {0,0,1}  
    51295129        "Axis of revolute joint fixed and resolved in frame_b"  
    51305130        annotation (Evaluate=true); 
     
    51605160        "= true, if total power flowing into this component shall be determined (must be zero)" 
    51615161        annotation (Dialog(tab="Advanced")); 
    5162       final parameter Real e_a[3]=Frames.normalize(n_a)  
     5162      final parameter Real e_a[3](each final unit="1")=Frames.normalize(n_a)  
    51635163        "Unit vector along axes of rotations, resolved in frame_a"; 
    5164       final parameter Real e_ia[3]=jointUSR.e2_ia  
     5164      final parameter Real e_ia[3](each final unit="1")=jointUSR.e2_ia  
    51655165        "Unit vector along axes of rotations, resolved in frame_ia"; 
    5166       final parameter Real e_b[3]=jointUSR.revolute.e  
     5166      final parameter Real e_b[3](each final unit="1")=jointUSR.revolute.e  
    51675167        "Unit vector along axes of rotations, resolved in frame_b, frame_ib and frame_im"; 
    51685168      SI.Power totalPower=jointUSR.totalPower  
     
    54705470        "= true, if total power flowing into this component shall be determined (must be zero)" 
    54715471        annotation (Dialog(tab="Advanced")); 
    5472       final parameter Real e_a[3]=Frames.normalize(n_a)  
     5472      final parameter Real e_a[3](each final unit="1")=Frames.normalize(n_a)  
    54735473        "Unit vector along axes of rotations, resolved in frame_a"; 
    5474       final parameter Real e_ia[3]=jointUSP.e2_ia  
     5474      final parameter Real e_ia[3](each final unit="1")=jointUSP.e2_ia  
    54755475        "Unit vector along axes of rotations, resolved in frame_ia"; 
    5476       final parameter Real e_im[3](each fixed=false)  
     5476      final parameter Real e_im[3](each final unit="1",each fixed=false)  
    54775477        "Unit vector along axes of rotations, resolved in frame_im"; 
    5478       final parameter Real e_b[3]=jointUSP.prismatic.e  
     5478      final parameter Real e_b[3](each final unit="1")=jointUSP.prismatic.e  
    54795479        "Unit vector along axes of translation of the prismatic joint, resolved in frame_b and frame_ib"; 
    54805480      SI.Power totalPower=jointUSP.totalPower  
     
    58475847    protected  
    58485848      outer Modelica.Mechanics.MultiBody.World world; 
    5849       parameter Real e[3]=Frames.normalize(n)  
     5849      parameter Real e[3](each final unit="1")=Frames.normalize(n)  
    58505850        "Unit vector in direction of rotation axis, resolved in frame_a (= same as in frame_b)"; 
    5851       parameter Real nnx_a[3]=if abs(e[1]) > 0.1 then {0,1,0} else (if abs(e[2]) 
     5851      parameter Real nnx_a[3](each final unit="1")=if abs(e[1]) > 0.1 then {0,1,0} else (if abs(e[2]) 
    58525852           > 0.1 then {0,0,1} else {1,0,0})  
    58535853        "Arbitrary vector that is not aligned with rotation axis n"  
    58545854        annotation (Evaluate=true); 
    5855       parameter Real ey_a[3]=Frames.normalize(cross(e, nnx_a))  
     5855      parameter Real ey_a[3](each final unit="1")=Frames.normalize(cross(e, nnx_a))  
    58565856        "Unit vector orthogonal to axis n of revolute joint, resolved in frame_a" 
    58575857        annotation (Evaluate=true); 
    5858       parameter Real ex_a[3]=cross(ey_a, e)  
     5858      parameter Real ex_a[3](each final unit="1")=cross(ey_a, e)  
    58595859        "Unit vector orthogonal to axis n of revolute joint and to ey_a, resolved in frame_a" 
    58605860        annotation (Evaluate=true); 
    5861       Real ey_b[3] "ey_a, resolved in frame_b"; 
    5862       Real ex_b[3] "ex_a, resolved in frame_b"; 
     5861      Real ey_b[3](each final unit="1") "ey_a, resolved in frame_b"; 
     5862      Real ex_b[3](each final unit="1") "ex_a, resolved in frame_b"; 
    58635863      Frames.Orientation R_rel  
    58645864        "Dummy or relative orientation object from frame_a to frame_b"; 
    58655865      Frames.Orientation R_rel_inv  
    58665866        "Dummy or relative orientation object from frame_b to frame_a"; 
    5867       Real r_rel_a[3]  
     5867      Modelica.SIunits.Position r_rel_a[3]  
    58685868        "Position vector from origin of frame_a to origin of frame_b, resolved in frame_a"; 
    58695869      SI.Force f_c[2] "Dummy or constraint forces in direction of ex_a, ey_a"; 
     
    60286028        "= true, if generalized variables (s,v) shall be used as states (StateSelect.always)" 
    60296029        annotation (Dialog(tab="Advanced")); 
    6030       final parameter Real e[3]=Frames.normalize(n)  
     6030      final parameter Real e[3](each final unit="1")=Frames.normalize(n)  
    60316031        "Unit vector in direction of prismatic axis n"; 
    60326032       
     
    62316231      final parameter Boolean positiveBranch(fixed=false)  
    62326232        "Based on phi_guess, selection of one of the two solutions of the non-linear constraint equation"; 
    6233       final parameter Real e[3]=Modelica.Mechanics.MultiBody.Frames.normalize(n)  
     6233      final parameter Real e[3](each final unit="1")=Modelica.Mechanics.MultiBody.Frames.normalize(n)  
    62346234        "Unit vector in direction of rotation axis, resolved in frame_a"; 
    62356235       
     
    63766376        import Modelica.Math.*; 
    63776377        input SI.Length L "Length of length constraint"; 
    6378         input Real e[3]  
     6378        input Real e[3](each final unit="1") 
    63796379          "Unit vector along axis of rotation, resolved in frame_a (= same in frame_b)"; 
    63806380        input SI.Angle angle_guess  
     
    65766576      final parameter Boolean positiveBranch(fixed=false)  
    65776577        "Selection of one of the two solutions of the non-linear constraint equation"; 
    6578       final parameter Real e[3]=Modelica.Mechanics.MultiBody.Frames.normalize(n)  
     6578      final parameter Real e[3](each final unit="1")=Modelica.Mechanics.MultiBody.Frames.normalize(n)  
    65796579        "Unit vector in direction of translation axis, resolved in frame_a"; 
    65806580      SI.Position s  
     
    67016701      SI.Position r_b[3]=position_b  
    67026702        "Position vector from frame_b to frame_b side of length constraint, resolved in frame_b of revolute joint"; 
    6703       Real rbra[3] "= rb - ra"; 
     6703      Modelica.SIunits.Position rbra[3] "= rb - ra"; 
    67046704      Real B "Coefficient B of equation: s*s + B*s + C = 0"; 
    67056705      Real C "Coefficient C of equation: s*s + B*s + C = 0"; 
     
    67256725        import Modelica.Math.*; 
    67266726        input SI.Length L "Length of length constraint"; 
    6727         input Real e[3]  
     6727        input Real e[3](each final unit="1")  
    67286728          "Unit vector along axis of translation, resolved in frame_a (= same in frame_b)"; 
    67296729        input SI.Position d_guess  
     
    67356735        output Boolean positiveBranch "Branch of the initial solution"; 
    67366736      protected  
    6737         Real rbra[3] "= rb - ra"; 
     6737        Modelica.SIunits.Position rbra[3] "= rb - ra"; 
    67386738        Real B "Coefficient B of equation: d*d + B*d + C = 0"; 
    67396739        Real C "Coefficient C of equation: d*d + B*d + C = 0"; 
  • branches/maintenance/2.2.2/Modelica/Mechanics/MultiBody/Types.mo

    r1049 r1051  
    1111</HTML>")); 
    1212   
    13   type Axis = Modelica.Icons.TypeReal[3](each unit="1")  
     13  type Axis = Modelica.Icons.TypeReal[3](each final unit="1")  
    1414    "Axis vector with choices for menus"                                      annotation ( 
    1515    preferedView="text", 
  • branches/maintenance/2.2.2/Modelica/Mechanics/MultiBody/Visualizers.mo

    r660 r1051  
    10031003        "Position vector from origin of object frame to shape origin, resolved in object frame" 
    10041004                                                                                                annotation(Dialog); 
    1005       input Real lengthDirection[3]={1,0,0}  
     1005      input Real lengthDirection[3](each final unit="1")={1,0,0}  
    10061006        "Vector in length direction, resolved in object frame"  annotation(Dialog); 
    1007       input Real widthDirection[3]={0,1,0}  
     1007      input Real widthDirection[3](each final unit="1")={0,1,0}  
    10081008        "Vector in width direction, resolved in object frame"  annotation(Dialog); 
    10091009      input SI.Length length=0 "Length of visual object"  annotation(Dialog); 
     
    10121012      input Types.ShapeExtra extra=0.0  
    10131013        "Additional size data for some of the shape types"                                 annotation(Dialog); 
    1014       input Real color[3]={255,0,0} "Color of shape"            annotation(Dialog); 
     1014      input Integer color[3]={255,0,0} "Color of shape"            annotation(Dialog); 
    10151015      input Types.SpecularCoefficient specularCoefficient = 0.7  
    10161016        "Reflection of ambient light (= 0: light is completely absorbed)" annotation(Dialog); 
    10171017      // Real rxry[3, 2]; 
    10181018    protected  
    1019       Real abs_n_x=Frames.length(lengthDirection) annotation (Hide=true); 
    1020       Real e_x[3]=noEvent(if abs_n_x < 1.e-10 then {1,0,0} else lengthDirection 
     1019      Real abs_n_x(final unit="1")=Frames.length(lengthDirection) annotation (Hide=true); 
     1020      Real e_x[3](each final unit="1")=noEvent(if abs_n_x < 1.e-10 then {1,0,0} else lengthDirection 
    10211021          /abs_n_x) annotation (Hide=true); 
    1022       Real n_z_aux[3]=cross(e_x, widthDirection) annotation (Hide=true); 
    1023       Real e_y[3]=noEvent(cross(Frames.normalize(cross(e_x, if n_z_aux*n_z_aux 
     1022      Real n_z_aux[3](each final unit="1")=cross(e_x, widthDirection) annotation (Hide=true); 
     1023      Real e_y[3](each final unit="1")=noEvent(cross(Frames.normalize(cross(e_x, if n_z_aux*n_z_aux 
    10241024           > 1.0e-6 then widthDirection else (if abs(e_x[1]) > 1.0e-6 then {0,1, 
    10251025          0} else {1,0,0}))), e_x)) annotation (Hide=true); 
    10261026      output Real Form annotation (Hide=false); 
    10271027    public  
    1028       output Real rxvisobj[3]  
     1028      output Real rxvisobj[3](each final unit="1")  
    10291029        "x-axis unit vector of shape, resolved in world frame"  
    10301030        annotation (Hide=false); 
    1031       output Real ryvisobj[3]  
     1031      output Real ryvisobj[3](each final unit="1")  
    10321032        "y-axis unit vector of shape, resolved in world frame"  
    10331033        annotation (Hide=false);