Changeset 378

Show
Ignore:
Timestamp:
02/27/2006 12:22:04 PM (3 years ago)
Author:
Martin
Message:

Changed initialization for PID and LimPID block such that SteadyState means also that the derivative
of the integrator state is zero. Changed documentations of these blocks and the example
Blocks.Examples.PID_Controller correspondingly

Location:
Modelica/trunk/Blocks
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • Modelica/trunk/Blocks/Continuous.mo

    r377 r378  
    823823  
    824824  <tr><td><b>SteadyState</b></td> 
    825       <td>NoInit</td> 
     825      <td>SteadyState</td> 
    826826      <td>SteadyState</td></tr> 
    827827  
     
    840840</table> 
    841841  
    842   
    843842<p> 
    844843In many cases, the most useful initial condition is 
    845844<b>SteadyState</b> because initial transients are then no longer 
    846 present. If initType = InitPID.SteadyState, then the 
    847 integrator is initialized with NoInit. The reason is the  
     845present. If initType = InitPID.SteadyState, then in some 
     846cases difficulties might occur. The reason is the  
    848847equation of the integrator: 
    849848</p> 
     
    854853  
    855854<p> 
    856 The steady state equation \"der(x)=0\" would lead to the condition that the input u to the 
     855The steady state equation \"der(x)=0\" leads to the condition that the input u to the 
    857856integrator is zero. If the input u is already (directly or indirectly) defined 
    858857by another initial condition, then the initialization problem is <b>singular</b> 
    859858(has none or infinitely many solutions). This situation occurs often 
    860859for mechanical systems, where, e.g., u = desiredSpeed - measuredSpeed and 
    861 since speed is both a state and a derivative, it is always defined by 
    862 InitialState or SteadyState initializtion. 
    863 </p> 
    864   
    865 <p> 
    866 Since <b>NoInit</b> is used for the integrator in SteadyState, 
    867 an additional initial equation has to be added to the system 
    868 to which the integrator is connected. E.g., useful initial conditions 
    869 for a 1-dim. rotational inertia controlled by a PI controller are: 
    870 <b>angle</b>, <b>speed</b>, and <b>acceleration</b> of the inertia are zero. 
    871 </p> 
     860since speed is both a state and a derivative, it is natural to 
     861initialize it with zero. As sketched this is, however, not possible. 
     862The solution is to not initialize u or the variable that is used 
     863to compute u by an algebraic equation. 
     864</p> 
     865 
    872866  
    873867</HTML> 
     
    876870      annotation (extent=[-60,60; -20,100]); 
    877871    Blocks.Continuous.Integrator I(k=1/Ti, y_start=xi_start, 
    878       initType=if initType==InitPID.InitialState or  
     872      initType=if initType==InitPID.SteadyState then  
     873                  InitPID.SteadyState else  
     874               if initType==InitPID.InitialState or  
    879875                  initType==InitPID.DoNotUse_InitialIntegratorState then  
    880876                  InitPID.InitialState else InitPID.NoInit)  
     
    895891       y = y_start; 
    896892    end if; 
     893     
    897894  equation  
    898895    connect(u, P.u) annotation (points=[-120,0; -80,0; -80,80; -64,80], style( 
     
    10961093  
    10971094  <tr><td><b>SteadyState</b></td> 
    1098       <td>NoInit</td> 
     1095      <td>SteadyState</td> 
    10991096      <td>SteadyState</td></tr> 
    11001097  
     
    11131110</table> 
    11141111  
    1115   
    11161112<p> 
    11171113In many cases, the most useful initial condition is 
    11181114<b>SteadyState</b> because initial transients are then no longer 
    1119 present. If initType = InitPID.SteadyState, then the 
    1120 integrator is initialized with NoInit. The reason is the  
     1115present. If initType = InitPID.SteadyState, then in some 
     1116cases difficulties might occur. The reason is the  
    11211117equation of the integrator: 
    11221118</p> 
     
    11271123  
    11281124<p> 
    1129 The steady state equation \"der(x)=0\" would lead to the condition that the input u to the 
     1125The steady state equation \"der(x)=0\" leads to the condition that the input u to the 
    11301126integrator is zero. If the input u is already (directly or indirectly) defined 
    11311127by another initial condition, then the initialization problem is <b>singular</b> 
    11321128(has none or infinitely many solutions). This situation occurs often 
    11331129for mechanical systems, where, e.g., u = desiredSpeed - measuredSpeed and 
    1134 since speed is both a state and a derivative, it is always defined by 
    1135 InitialState or SteadyState initializtion. 
    1136 </p> 
    1137   
    1138 <p> 
    1139 Since <b>NoInit</b> is used for the integrator in SteadyState, 
    1140 an additional initial equation has to be added to the system 
    1141 to which the integrator is connected. E.g., useful initial conditions 
    1142 for a 1-dim. rotational inertia controlled by a PI controller are: 
    1143 <b>angle</b>, <b>speed</b>, and <b>acceleration</b> of the inertia are zero. 
     1130since speed is both a state and a derivative, it is natural to 
     1131initialize it with zero. As sketched this is, however, not possible. 
     1132The solution is to not initialize u_m or the variable that is used 
     1133to compute u_m by an algebraic equation. 
    11441134</p> 
    11451135 
     
    11611151    Blocks.Math.Gain P annotation (extent=[-40, 40; -20, 60]); 
    11621152    Blocks.Continuous.Integrator I(k=1/Ti, y_start=xi_start, 
    1163       initType=if initType==InitPID.InitialState or  
     1153      initType=if initType==InitPID.SteadyState then  
     1154                  InitPID.SteadyState else  
     1155               if initType==InitPID.InitialState or  
    11641156                  initType==InitPID.DoNotUse_InitialIntegratorState then  
    11651157                  InitPID.InitialState else InitPID.NoInit) if with_I  
  • Modelica/trunk/Blocks/package.mo

    r371 r378  
    104104    parameter Modelica.SIunits.Angle driveAngle=1.57; 
    105105    Modelica.Blocks.Continuous.LimPID PI( 
    106       controllerType=Modelica.Blocks.Types.SimpleController.PI,  
    107       k=100,  
    108       Ti=0.1,  
    109       yMax=12,  
    110       Ni=0.1,  
    111       initType=Modelica.Blocks.Types.Init.SteadyState,  
     106      controllerType=Modelica.Blocks.Types.SimpleController.PI, 
     107      k=100, 
     108      Ti=0.1, 
     109      yMax=12, 
     110      Ni=0.1, 
     111      initType=Modelica.Blocks.Types.Init.SteadyState, 
    112112      limitsAtInit=false)  
    113113      annotation (extent=[-56,-20; -36,0]); 
    114114    Modelica.Mechanics.Rotational.Inertia inertia1(initType=Modelica.Mechanics. 
    115           Rotational.Types.Init.InitialAngleSpeedAcceleration)  
     115          Rotational.Types.Init.InitialAngleAcceleration)  
    116116                                              annotation (extent=[2,-20; 22,0]); 
    117117    annotation ( 
    118118      Diagram( 
    119         Rectangle(extent=[-99,48; -32,8], style(color=1, rgbcolor={255,0,0})),  
     119        Rectangle(extent=[-99,48; -32,8], style(color=1, rgbcolor={255,0,0})), 
    120120        Text( 
    121           extent=[-98,59; -31,51],  
    122           style(color=1, rgbcolor={255,0,0}),  
    123           string="reference speed generation"),  
     121          extent=[-98,59; -31,51], 
     122          style(color=1, rgbcolor={255,0,0}), 
     123          string="reference speed generation"), 
    124124        Text( 
    125           extent=[-98,-46; -60,-52],  
    126           style(color=1, rgbcolor={255,0,0}),  
    127           string="PI controller"),  
     125          extent=[-98,-46; -60,-52], 
     126          style(color=1, rgbcolor={255,0,0}), 
     127          string="PI controller"), 
    128128        Line(points=[-76,-44; -57,-23], style( 
    129             color=1,  
    130             rgbcolor={255,0,0},  
    131             arrow=1)),  
    132         Rectangle(extent=[-25,6; 99,-50], style(color=1, rgbcolor={255,0,0})),  
     129            color=1, 
     130            rgbcolor={255,0,0}, 
     131            arrow=1)), 
     132        Rectangle(extent=[-25,6; 99,-50], style(color=1, rgbcolor={255,0,0})), 
    133133        Text( 
    134           extent=[4,14; 71,7],  
    135           style(color=1, rgbcolor={255,0,0}),  
     134          extent=[4,14; 71,7], 
     135          style(color=1, rgbcolor={255,0,0}), 
    136136          string="plant (simple drive train)")), 
    137137      Coordsys( 
     
    140140        scale=0), 
    141141      experiment(StopTime=4), 
    142       experimentSetupOutput,  
     142      experimentSetupOutput, 
    143143      Documentation(info="<html> 
    144144 
    145145<p> 
    146 This is a simple drive train controller by a PID controller: 
     146This is a simple drive train controlled by a PID controller: 
    147147</p> 
    148148 
     
    159159     is used as PI controller.</li> 
    160160 
    161 <li> The output of the controller is a torque that drive a motor inertia 
     161<li> The output of the controller is a torque that drives a motor inertia 
    162162     \"inertia1\". Via a complöiant spring/damper component, the load 
    163163     inertia \"inertia2\" is attached. A constant external torque of 10 Nm 
     
    165165</ul> 
    166166 
    167 </p> 
     167<p> 
    168168The PI controller settings included \"limitAtInit=false\", in order that 
    169169the controller output limits of 12 Nm are removed from the initialization 
    170 problem. The PI controller is initialized in steady state (initType=SteadyState). 
    171 This means that the integrator part is <b>not</b> initialized (see discussion 
    172 in the info layer of block  
    173 <a href=\"Modelica://Modelica.Blocks.Continuous.LimPID\">LimPID</a>). 
    174 Therefore, <b>one extra initial equation</b> has to be added to the plant. 
    175 For this reason, angle, speed and acceleration are initialized for \"inertia1\" 
    176 (i.e., 3 instead of 2 conditions) and component \"spring\" is also 
    177 initialized in SteadyState. 
     170problem.  
     171</p> 
     172 
     173<p> 
     174The PI controller is initialized in steady state (initType=SteadyState) 
     175and the drive shall also be initialized in steady state. 
     176However, it is not possible to initialize \"inertia1\" in SteadyState, because 
     177\"der(inertia1.phi)=inertia1.w=0\" is an input to the PI controller that 
     178defines that the derivative of the integrator state is zero (= the same 
     179condition that was already defined by option SteadyState of the PI controller). 
     180Furthermore, one initial condition is missing, because the absolute position 
     181of inertia1 or inertia2 is not defined. The solution shown in this examples is 
     182to initialize the angle and the angular acceleration of \"inertia1\". 
    178183</p> 
    179184 
     
    203208      annotation (extent=[-25,-20; -5,0]); 
    204209    Modelica.Mechanics.Rotational.SpringDamper spring(c=1e4, d=100, 
    205       initType=Modelica.Mechanics.Rotational.Types.Init.SteadyState,  
     210      initType=Modelica.Mechanics.Rotational.Types.Init.SteadyState, 
    206211      stateSelection=Modelica.Blocks.Types.StateSelection.Prefer)  
    207212      annotation (extent=[32,-20; 52,0]); 
     
    233238    connect(speedSensor.w, PI.u_m)  annotation (points=[1,-40; -46,-40; -46,-22], 
    234239        style(color=74, rgbcolor={0,0,127})); 
    235     connect(integrator.y, PI.u_s)  annotation (points=[-42,30; -37,30; -37,11;  
     240    connect(integrator.y, PI.u_s)  annotation (points=[-42,30; -37,30; -37,11; 
    236241          -67,11; -67,-10; -58,-10], style(color=74, rgbcolor={0,0,127})); 
    237242  end PID_Controller; 
    238  
     243   
    239244     model ShowLogicalSources  
    240245       extends Modelica.Icons.Example;