Show
Ignore:
Timestamp:
10/03/2007 10:22:21 PM (15 months ago)
Author:
otter
Message:

Changed MultiBody.Parts.Rotor1D/.Mounting1D that it is according to Modelica 3.0

Files:
1 modified

Legend:

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

    r572 r651  
    18371837    Modelica.Mechanics.Rotational.Interfaces.Flange_b flange_b  
    18381838      "(right) flange fixed in housing" annotation (extent=[110, 10; 90, -10]); 
    1839     Modelica.Mechanics.MultiBody.Interfaces.Frame_a frame_a(f=zeros(3), t=-n*flange_b.tau) if world.driveTrainMechanics3D  
     1839    Modelica.Mechanics.MultiBody.Interfaces.Frame_a frame_a if world.driveTrainMechanics3D  
    18401840      "Frame in which housing is fixed (connector is removed, if world.driveTrainMechanics3D=false)" 
    18411841      annotation (extent=[-20, -120; 20, -80], rotation=90); 
     
    18761876  protected  
    18771877    outer World world; 
     1878     
     1879    encapsulated model Housing  
     1880      import Modelica; 
     1881      input Modelica.SIunits.Torque t[3]; 
     1882      Modelica.Mechanics.MultiBody.Interfaces.Frame_a frame_a  
     1883                                 annotation (extent=[-116,-16; -84,16]); 
     1884      annotation (Icon(Rectangle(extent=[-100,100; 100,-100], style( 
     1885              color=0, 
     1886              rgbcolor={0,0,0}, 
     1887              fillColor=7, 
     1888              rgbfillColor={255,255,255}, 
     1889              fillPattern=1)), Text( 
     1890            extent=[-150,110; 150,150], 
     1891            style( 
     1892              color=3, 
     1893              rgbcolor={0,0,255}, 
     1894              fillColor=7, 
     1895              rgbfillColor={255,255,255}, 
     1896              fillPattern=1), 
     1897            string="%name"))); 
     1898    equation  
     1899      frame_a.f=zeros(3); 
     1900      frame_a.t=t; 
     1901    end Housing; 
     1902    Housing housing(t=-n*flange_b.tau) if world.driveTrainMechanics3D  
     1903                    annotation (extent=[20,-60; 40,-40]); 
    18781904  equation  
    18791905    flange_b.phi = phi0; 
     1906    connect(housing.frame_a, frame_a) annotation (points=[20,-50; 0,-50; 0,-100], 
     1907        style( 
     1908        color=10, 
     1909        rgbcolor={95,95,95}, 
     1910        thickness=2, 
     1911        smooth=0)); 
    18801912  end Mounting1D; 
    18811913   
     
    19251957      "= true, if exact calculations; false if influence of bearing on rotor acceleration is neglected to avoid an algebraic loop" 
    19261958      annotation (Dialog(tab="Advanced")); 
    1927     SI.AngularVelocity w_a[3]  
    1928       "Angular velocity of frame_a, resolved in frame_a"; 
     1959     
    19291960    SI.Angle phi(start=Cv.from_deg(phi_start), stateSelect=if enforceStates then  
    19301961                StateSelect.always else StateSelect.default)  
     
    19421973      "(right) driven flange (flange axis directed OUT OF cut plane)"  
    19431974      annotation (extent=[90, -10; 110, 10]); 
    1944     Modelica.Mechanics.MultiBody.Interfaces.Frame_a frame_a( 
    1945         r_0=r_0, 
    1946         R=R, 
    1947         f=zeros(3), 
    1948         t=nJ*a + cross(w_a, nJ*w)) if world.driveTrainMechanics3D  
     1975    Modelica.Mechanics.MultiBody.Interfaces.Frame_a frame_a if world.driveTrainMechanics3D  
    19491976      "Frame in which rotor housing is fixed (connector is removed, if world.driveTrainMechanics3D=false)" 
    19501977      annotation (extent=[-20, -120; 20, -80], rotation=90); 
     
    19521979      Documentation(info="<html> 
    19531980<p>This component is used to model the gyroscopic torques exerted by a 1-dim. 
     1981inertia (so called <i>rotor</i>) on its 3-dim. carrier body. Gyroscopic torques 
     1982appear, if the vector of the carrier body's angular velocity is not parallel 
     1983to the vector of the rotor's. The axis of rotation of the rotor is defined by 
     1984the parameter <tt>n</tt>, which has to be given in the local coordinate system 
     1985of <tt>frame_a</tt>. The default animation of this component is 
     1986shown in the figure below. </p> 
     1987      <IMG SRC=\"../Images/MultiBody/Parts/Rotor1D.png\" ALT=\"model Parts.Rotor1D\"> 
     1988<p>This component is a replacement for  
     1989<a href=\"Modelica://Modelica.Mechanics.Rotational.Inertia\">Modelica.Mechanics.Rotational.Inertia</a> 
     1990for the case, that a 1-dim.-rotational mechanical system should be attached with a 3-dim. 
     1991carrier body.</p> 
     1992<p>The Boolean parameter <tt>exact</tt> was introduced due to performance 
     1993reasons. If <tt>exact</tt> is set to true, the influence of the carrier body 
     1994motion on the angular velocity of the rotor is neglected. This influence is usually 
     1995negligible if the 1-dim.-rotational mechanical system accelerates much faster as the base body (this is, 
     1996e.g., the case in vehicle powertrains). The essential advantage is 
     1997that an algebraic loop is removed since then there is only an 
     1998action on acceleration level from the powertrain to the base body 
     1999but not vice versa.</p> 
     2000<p><b>Reference</b><br> 
     2001<span style=\"font-variant:small-caps\">Schweiger</span>, Christian ; 
     2002<span style=\"font-variant:small-caps\">Otter</span>, Martin: 
     2003<a href=\"http://www.modelica.org/Conference2003/papers/h06_Schweiger_powertrains_v5.pdf\">Modelling 
     20043D Mechanical Effects of 1-dim. Powertrains</a>. In: <i>Proceedings of the 3rd International 
     2005Modelica Conference</i>. Link&ouml;ping : The Modelica Association and Link&ouml;ping University, 
     2006November 3-4, 2003, pp. 149-158</p> 
     2007</HTML> 
     2008"),   Icon( 
     2009        Line(points=[-80, -25; -60, -25], style(color=0)), 
     2010        Line(points=[60, -25; 80, -25], style(color=0)), 
     2011        Line(points=[-70, -25; -70, -70], style(color=0)), 
     2012        Line(points=[70, -25; 70, -70], style(color=0)), 
     2013        Line(points=[-80, 25; -60, 25], style(color=0)), 
     2014        Line(points=[60, 25; 80, 25], style(color=0)), 
     2015        Line(points=[-70, 45; -70, 25], style(color=0)), 
     2016        Line(points=[70, 45; 70, 25], style(color=0)), 
     2017        Line(points=[-70, -70; 70, -70], style(color=0)), 
     2018        Rectangle(extent=[-50, 50; 50, -50], style( 
     2019            color=0, 
     2020            gradient=2, 
     2021            fillColor=8)), 
     2022        Rectangle(extent=[-100,10; -50,-10],  style( 
     2023            color=0, 
     2024            gradient=2, 
     2025            fillColor=8)), 
     2026        Rectangle(extent=[50,10; 100,-10],  style( 
     2027            color=0, 
     2028            gradient=2, 
     2029            fillColor=8)), 
     2030        Text(extent=[-148,112; 152,72],    string="%name=%J"), 
     2031        Line(points=[0, -70; 0, -100], style(color=0))), 
     2032      Diagram); 
     2033     
     2034  protected  
     2035    outer Modelica.Mechanics.MultiBody.World world; 
     2036    parameter Real e[3]=Frames.normalize(n)  
     2037      "Unit vector in direction of rotor axis, resolved in frame_a"; 
     2038    Visualizers.Advanced.Shape cylinder( 
     2039      shapeType="cylinder", 
     2040      color=cylinderColor, 
     2041      specularCoefficient=specularCoefficient, 
     2042      length=cylinderLength, 
     2043      width=cylinderDiameter, 
     2044      height=cylinderDiameter, 
     2045      lengthDirection=n, 
     2046      widthDirection={0,1,0}, 
     2047      extra=1, 
     2048      r_shape=r_center - e*(cylinderLength/2), 
     2049      r=zeros(3), 
     2050      R=Frames.planarRotation(e, phi, 0)) if  world.enableAnimation and animation and not world.driveTrainMechanics3D; 
     2051     
     2052  public  
     2053  encapsulated model RotorWith3DEffects  
     2054      "1D inertia attachable on 3-dim. bodies (3D dynamic effects are taken into account)"  
     2055       
     2056    import Modelica; 
     2057    import Modelica.Mechanics.MultiBody.Frames; 
     2058    import Modelica.Mechanics.MultiBody.Types; 
     2059    import SI = Modelica.SIunits; 
     2060    import Cv = Modelica.SIunits.Conversions; 
     2061       
     2062    parameter Boolean animation=true  
     2063        "= true, if animation shall be enabled (show rotor as cylinder)"; 
     2064    parameter SI.Inertia J(min=0)=1  
     2065        "Moment of inertia of rotor around its axis of rotation"; 
     2066    parameter Types.Axis n={1,0,0} "Axis of rotation resolved in frame_a"; 
     2067    parameter Types.Init.Temp initType=Modelica.Mechanics.MultiBody.Types.Init.Free  
     2068        "Type of initialization (defines usage of start values below)"  
     2069      annotation (Dialog(group="Initialization")); 
     2070    parameter Cv.NonSIunits.Angle_deg phi_start=0  
     2071        "Initial value of rotor rotation angle phi (fixed or guess value)"  
     2072      annotation (Evaluate=false, Dialog(group="Initialization")); 
     2073    parameter Types.AngularVelocity_degs w_start=0  
     2074        "Initial value of relative angular velocity w = der(phi)"  
     2075      annotation (Evaluate=false, Dialog(group="Initialization")); 
     2076    parameter Types.AngularAcceleration_degs2 a_start= 
     2077              0 "Initial value of relative angular acceleration a = der(w)"  
     2078      annotation (Evaluate=false, Dialog(group="Initialization")); 
     2079    parameter SI.Position r_center[3]=zeros(3)  
     2080        "Position vector from origin of frame_a to center of cylinder"  
     2081      annotation (Dialog(tab="Animation", group="if animation = true", enable=animation)); 
     2082    parameter SI.Distance cylinderLength=2*world.defaultJointLength  
     2083        "Length of cylinder representing the rotor"  
     2084      annotation (Dialog(tab="Animation", group="if animation = true", enable=animation)); 
     2085    parameter SI.Distance cylinderDiameter=2*world.defaultJointWidth  
     2086        "Diameter of cylinder representing the rotor"  
     2087      annotation (Dialog(tab="Animation", group="if animation = true", enable=animation)); 
     2088    input Types.Color cylinderColor=Modelica.Mechanics.MultiBody.Types.Defaults.RodColor  
     2089        "Color of cylinder representing the rotor"  
     2090      annotation (Dialog(tab="Animation", group="if animation = true", enable=animation)); 
     2091    input Types.SpecularCoefficient specularCoefficient =                              world.defaultSpecularCoefficient  
     2092        "Reflection of ambient light (= 0: light is completely absorbed)"  
     2093      annotation (Dialog(tab="Animation", group="if animation = true", enable=animation)); 
     2094    parameter Boolean enforceStates=false  
     2095        "= true, if rotor angle (phi) and rotor speed (w) shall be used as states" 
     2096      annotation (Dialog(tab="Advanced")); 
     2097    parameter Boolean exact=true  
     2098        "= true, if exact calculations; false if influence of bearing on rotor acceleration is neglected to avoid an algebraic loop" 
     2099      annotation (Dialog(tab="Advanced")); 
     2100    SI.AngularVelocity w_a[3]  
     2101        "Angular velocity of frame_a, resolved in frame_a"; 
     2102    SI.Angle phi(start=Cv.from_deg(phi_start), stateSelect=if enforceStates then  
     2103                StateSelect.always else StateSelect.default)  
     2104        "Rotation angle of rotor with respect to frame_a (= flange_a.phi = flange_b.phi)"; 
     2105    SI.AngularVelocity w(stateSelect=if enforceStates then StateSelect.always else  
     2106                StateSelect.default)  
     2107        "Angular velocity of rotor with respect to frame_a"; 
     2108    SI.AngularAcceleration a  
     2109        "Angular acceleration of rotor with respect to frame_a"; 
     2110       
     2111    Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a  
     2112        "(left) driving flange (flange axis directed INTO cut plane)"  
     2113      annotation (extent=[-110, -10; -90, 10]); 
     2114    Modelica.Mechanics.Rotational.Interfaces.Flange_b flange_b  
     2115        "(right) driven flange (flange axis directed OUT OF cut plane)"  
     2116      annotation (extent=[90, -10; 110, 10]); 
     2117    Modelica.Mechanics.MultiBody.Interfaces.Frame_a frame_a  
     2118        "Frame in which rotor housing is fixed"  
     2119      annotation (extent=[-20, -120; 20, -80], rotation=90); 
     2120    annotation ( 
     2121      Documentation(info="<html> 
     2122<p> 
     2123This component is used to model the gyroscopic torques exerted by a 1-dim. 
    19542124inertia (so called <i>rotor</i>) on its 3-dim. carrier body. Gyroscopic torques 
    19552125appear, if the vector of the carrier body's angular velocity is not parallel 
     
    20372207        Text(extent=[25, 77; 77, 65], string="w = der(phi) "), 
    20382208        Line(points=[0, -70; 0, -100], style(color=0)))); 
    2039      
    2040   protected  
     2209       
     2210    protected  
    20412211    outer Modelica.Mechanics.MultiBody.World world; 
    20422212    parameter Real e[3]=Frames.normalize(n)  
    2043       "Unit vector in direction of rotor axis, resolved in frame_a"; 
     2213        "Unit vector in direction of rotor axis, resolved in frame_a"; 
    20442214    parameter SI.Inertia nJ[3]=J*e; 
    2045     Visualizers.Advanced.Shape cylinder( 
     2215    Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape cylinder( 
    20462216      shapeType="cylinder", 
    20472217      color=cylinderColor, 
     
    20542224      extra=1, 
    20552225      r_shape=r_center - e*(cylinderLength/2), 
    2056       r=r_0, 
    2057       R=Frames.absoluteRotation(R, Frames.planarRotation(e, phi, 0))) if  
     2226      r=frame_a.r_0, 
     2227      R=Frames.absoluteRotation(frame_a.R, Frames.planarRotation(e, phi, 0))) if  
    20582228         world.enableAnimation and animation; 
    2059      
    2060     SI.Position r_0[3]  
    2061       "Position vector from world frame to the connector frame origin, resolved in world frame"; 
    2062     Frames.Orientation R  
    2063       "Orientation object to rotate the world frame into the connector frame"; 
    20642229  initial equation  
    20652230    if initType == Types.Init.PositionVelocity then 
     
    20862251    w = der(phi); 
    20872252    a = der(w); 
    2088      
    2089     w_a = Modelica.Mechanics.MultiBody.Frames.angularVelocity2(R); 
     2253       
     2254    w_a = Modelica.Mechanics.MultiBody.Frames.angularVelocity2(frame_a.R); 
    20902255    if exact then 
    20912256      J*a = flange_a.tau + flange_b.tau - nJ*der(w_a); 
     
    20932258      J*a = flange_a.tau + flange_b.tau; 
    20942259    end if; 
    2095      
    2096     if not world.driveTrainMechanics3D then 
    2097       r_0 = zeros(3); 
    2098       R.T = identity(3); 
    2099       R.w = zeros(3); 
    2100     end if; 
     2260       
     2261    frame_a.f = zeros(3); 
     2262    frame_a.t = nJ*a + cross(w_a, nJ*w); 
     2263  end RotorWith3DEffects; 
     2264     
     2265  protected  
     2266    Rotational.Inertia inertia( 
     2267      J=J, 
     2268      initType=initType, 
     2269      phi_start=phi_start*Modelica.Constants.D2R, 
     2270      w_start=w_start*Modelica.Constants.D2R, 
     2271      a_start=a_start*Modelica.Constants.D2R) if  not world.driveTrainMechanics3D  
     2272      annotation (extent=[-20,-20; 20,20]); 
     2273    RotorWith3DEffects rotorWith3DEffects( 
     2274      animation=animation, 
     2275      J=J, 
     2276      n=n, 
     2277      initType=initType, 
     2278      phi_start=phi_start, 
     2279      w_start=w_start, 
     2280      a_start=a_start, 
     2281      r_center=r_center, 
     2282      cylinderLength=cylinderLength, 
     2283      cylinderDiameter=cylinderDiameter, 
     2284      cylinderColor=cylinderColor, 
     2285      specularCoefficient=specularCoefficient, 
     2286      exact=exact) if world.driveTrainMechanics3D annotation (extent=[-20,-80; 20,-40]); 
     2287  equation  
     2288    phi = flange_a.phi; 
     2289    w = der(phi); 
     2290    a = der(w); 
     2291     
     2292    connect(inertia.flange_a, flange_a) annotation (points=[-20,0; -100,0], style( 
     2293        color=0, 
     2294        rgbcolor={0,0,0}, 
     2295        smooth=0)); 
     2296    connect(inertia.flange_b, flange_b) annotation (points=[20,0; 100,0], style( 
     2297        color=0, 
     2298        rgbcolor={0,0,0}, 
     2299        smooth=0)); 
     2300    connect(rotorWith3DEffects.flange_b, flange_b) annotation (points=[20,-60; 60, 
     2301          -60; 60,0; 100,0], style( 
     2302        color=0, 
     2303        rgbcolor={0,0,0}, 
     2304        smooth=0)); 
     2305    connect(rotorWith3DEffects.flange_a, flange_a) annotation (points=[-20,-60; 
     2306          -60,-60; -60,0; -100,0], style( 
     2307        color=0, 
     2308        rgbcolor={0,0,0}, 
     2309        smooth=0)); 
     2310    connect(rotorWith3DEffects.frame_a, frame_a) annotation (points=[0,-80; 0, 
     2311          -100], style( 
     2312        color=10, 
     2313        rgbcolor={95,95,95}, 
     2314        thickness=2, 
     2315        smooth=0)); 
    21012316  end Rotor1D; 
    21022317