Changeset 1019

Show
Ignore:
Timestamp:
01/29/2008 05:35:04 PM (12 months ago)
Author:
otter
Message:

Corrected potential problem with sqrt(..) in MultiBody.Joints.Internal for analytically solving closed (reported by Hubertus).

Files:
1 modified

Legend:

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

    r1002 r1019  
    41914191            extent={{-100,-100},{100,100}}, 
    41924192            grid={1,1}, 
    4193             initialScale=0.2), graphics={ 
     4193            initialScale=0.2), graphics( 
    41944194            Text( 
    41954195              extent={{-140,-41},{140,-66}}, 
     
    43174317              points={{90,30},{90,40},{95,40}}, 
    43184318              color={95,95,95}, 
    4319               thickness=2)}), 
     4319              thickness=2))), 
    43204320        Diagram(coordinateSystem( 
    43214321            preserveAspectRatio=true, 
     
    47334733            extent={{-100,-100},{100,100}}, 
    47344734            grid={1,1}, 
    4735             initialScale=0.2), graphics={ 
     4735            initialScale=0.2), graphics( 
    47364736            Rectangle( 
    47374737              extent={{50,20},{80,-20}}, 
     
    48644864              points={{95,40},{90,40},{90,30}}, 
    48654865              color={135,135,135}, 
    4866               thickness=2)}), 
     4866              thickness=2))), 
    48674867        Diagram(coordinateSystem( 
    48684868            preserveAspectRatio=true, 
    48694869            extent={{-100,-100},{100,100}}, 
    48704870            grid={1,1}, 
    4871             initialScale=0.2), graphics={ 
     4871            initialScale=0.2), graphics( 
    48724872            Line( 
    48734873              points={{-78,30},{-50,30}}, 
     
    48854885              points={{3,30},{-43,30}}, 
    48864886              color={128,128,128}, 
    4887               arrow={Arrow.None,Arrow.Filled})})); 
     4887              arrow={Arrow.None,Arrow.Filled})))); 
    48884888 
    48894889      Modelica.Mechanics.MultiBody.Joints.Internal.PrismaticWithLengthConstraint 
     
    59685968            extent={{-100,-100},{100,100}}, 
    59695969            grid={1,1}, 
    5970             initialScale=0.2), graphics={ 
     5970            initialScale=0.2), graphics( 
    59715971            Rectangle( 
    59725972              extent={{-90,90},{90,-90}}, 
     
    60586058              points={{100,40},{93,40},{93,3}}, 
    60596059              color={95,95,95}, 
    6060               thickness=2)}), 
     6060              thickness=2))), 
    60616061        Diagram(coordinateSystem( 
    60626062            preserveAspectRatio=true, 
     
    67856785        Real k1 "Constant of quadratic equation"; 
    67866786        Real k2 "Constant of quadratic equation"; 
     6787        Real k1a; 
     6788        Real k1b; 
    67876789        Real kcos1 "k1*cos(angle1)"; 
    67886790        Real ksin1 "k1*sin(angle1)"; 
     
    68366838        C := r_a*r_a + r_b*r_b - L*L - 2*e_r_b*e_r_a; 
    68376839        k1 := A*A + B*B; 
    6838         k2 := sqrt(k1 - C*C); 
     6840        k1a :=k1 - C*C; 
     6841        assert(k1a > 1.e-10, " 
     6842Singular position of loop (either no or two analytic solutions; 
     6843the mechanism has lost one-degree-of freedom in this position). 
     6844Try first to use another Modelica.Mechanics.MultiBody.Joints.Assemblies.JointXXX component. 
     6845In most cases it is best that the joints outside of the JointXXX 
     6846component are revolute and NOT prismatic joints. If this also 
     6847lead to singular positions, it could be that this kinematic loop 
     6848cannot be solved analytically. In this case you have to build 
     6849up the loop with basic joints (NO aggregation JointXXX components) 
     6850and rely on dynamic state selection, i.e., during simulation 
     6851the states will be dynamically selected in such a way that in no 
     6852position a degree of freedom is lost. 
     6853"); 
     6854        k1b := max(k1a, 1.0e-12); 
     6855        k2 := sqrt(k1b); 
    68396856 
    68406857        kcos1 := -A*C + B*k2; 
     
    71957212        Real k1 "Constant of quadratic equation solution"; 
    71967213        Real k2 "Constant of quadratic equation solution"; 
     7214        Real k1a; 
     7215        Real k1b; 
    71977216        Real d1 "solution 1 of quadratic equation"; 
    71987217        Real d2 "solution 2 of quadratic equation"; 
     
    72227241        C := rbra*rbra - L*L; 
    72237242        k1 := B/2; 
    7224         k2 := sqrt(k1*k1 - C); 
     7243        k1a :=k1*k1 - C; 
     7244      assert(noEvent(k1a > 1.e-10), " 
     7245Singular position of loop (either no or two analytic solutions; 
     7246the mechanism has lost one-degree-of freedom in this position). 
     7247Try first to use another Modelica.Mechanics.MultiBody.Joints.Assemblies.JointXXX component. 
     7248If this also lead to singular positions, it could be that this 
     7249kinematic loop cannot be solved analytically with a fixed state 
     7250selection. In this case you have to build up the loop with 
     7251basic joints (NO aggregation JointXXX components) and rely on 
     7252dynamic state selection, i.e., during simulation the states will 
     7253be dynamically selected in such a way that in no position a 
     7254degree of freedom is lost. 
     7255"); 
     7256        k1b :=max(k1a, 1.0e-12); 
     7257        k2 :=sqrt(k1b); 
    72257258        d1 := -k1 + k2; 
    72267259        d2 := -k1 - k2;