Changeset 378
- Timestamp:
- 02/27/2006 12:22:04 PM (3 years ago)
- Location:
- Modelica/trunk/Blocks
- Files:
-
- 2 modified
-
Continuous.mo (modified) (9 diffs)
-
package.mo (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Modelica/trunk/Blocks/Continuous.mo
r377 r378 823 823 824 824 <tr><td><b>SteadyState</b></td> 825 <td> NoInit</td>825 <td>SteadyState</td> 826 826 <td>SteadyState</td></tr> 827 827 … … 840 840 </table> 841 841 842 843 842 <p> 844 843 In many cases, the most useful initial condition is 845 844 <b>SteadyState</b> because initial transients are then no longer 846 present. If initType = InitPID.SteadyState, then the847 integrator is initialized with NoInit. The reason is the845 present. If initType = InitPID.SteadyState, then in some 846 cases difficulties might occur. The reason is the 848 847 equation of the integrator: 849 848 </p> … … 854 853 855 854 <p> 856 The steady state equation \"der(x)=0\" would leadto the condition that the input u to the855 The steady state equation \"der(x)=0\" leads to the condition that the input u to the 857 856 integrator is zero. If the input u is already (directly or indirectly) defined 858 857 by another initial condition, then the initialization problem is <b>singular</b> 859 858 (has none or infinitely many solutions). This situation occurs often 860 859 for 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> 860 since speed is both a state and a derivative, it is natural to 861 initialize it with zero. As sketched this is, however, not possible. 862 The solution is to not initialize u or the variable that is used 863 to compute u by an algebraic equation. 864 </p> 865 872 866 873 867 </HTML> … … 876 870 annotation (extent=[-60,60; -20,100]); 877 871 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 879 875 initType==InitPID.DoNotUse_InitialIntegratorState then 880 876 InitPID.InitialState else InitPID.NoInit) … … 895 891 y = y_start; 896 892 end if; 893 897 894 equation 898 895 connect(u, P.u) annotation (points=[-120,0; -80,0; -80,80; -64,80], style( … … 1096 1093 1097 1094 <tr><td><b>SteadyState</b></td> 1098 <td> NoInit</td>1095 <td>SteadyState</td> 1099 1096 <td>SteadyState</td></tr> 1100 1097 … … 1113 1110 </table> 1114 1111 1115 1116 1112 <p> 1117 1113 In many cases, the most useful initial condition is 1118 1114 <b>SteadyState</b> because initial transients are then no longer 1119 present. If initType = InitPID.SteadyState, then the1120 integrator is initialized with NoInit. The reason is the1115 present. If initType = InitPID.SteadyState, then in some 1116 cases difficulties might occur. The reason is the 1121 1117 equation of the integrator: 1122 1118 </p> … … 1127 1123 1128 1124 <p> 1129 The steady state equation \"der(x)=0\" would leadto the condition that the input u to the1125 The steady state equation \"der(x)=0\" leads to the condition that the input u to the 1130 1126 integrator is zero. If the input u is already (directly or indirectly) defined 1131 1127 by another initial condition, then the initialization problem is <b>singular</b> 1132 1128 (has none or infinitely many solutions). This situation occurs often 1133 1129 for 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. 1130 since speed is both a state and a derivative, it is natural to 1131 initialize it with zero. As sketched this is, however, not possible. 1132 The solution is to not initialize u_m or the variable that is used 1133 to compute u_m by an algebraic equation. 1144 1134 </p> 1145 1135 … … 1161 1151 Blocks.Math.Gain P annotation (extent=[-40, 40; -20, 60]); 1162 1152 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 1164 1156 initType==InitPID.DoNotUse_InitialIntegratorState then 1165 1157 InitPID.InitialState else InitPID.NoInit) if with_I -
Modelica/trunk/Blocks/package.mo
r371 r378 104 104 parameter Modelica.SIunits.Angle driveAngle=1.57; 105 105 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, 112 112 limitsAtInit=false) 113 113 annotation (extent=[-56,-20; -36,0]); 114 114 Modelica.Mechanics.Rotational.Inertia inertia1(initType=Modelica.Mechanics. 115 Rotational.Types.Init.InitialAngle SpeedAcceleration)115 Rotational.Types.Init.InitialAngleAcceleration) 116 116 annotation (extent=[2,-20; 22,0]); 117 117 annotation ( 118 118 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})), 120 120 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"), 124 124 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"), 128 128 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})), 133 133 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}), 136 136 string="plant (simple drive train)")), 137 137 Coordsys( … … 140 140 scale=0), 141 141 experiment(StopTime=4), 142 experimentSetupOutput, 142 experimentSetupOutput, 143 143 Documentation(info="<html> 144 144 145 145 <p> 146 This is a simple drive train controlle rby a PID controller:146 This is a simple drive train controlled by a PID controller: 147 147 </p> 148 148 … … 159 159 is used as PI controller.</li> 160 160 161 <li> The output of the controller is a torque that drive a motor inertia161 <li> The output of the controller is a torque that drives a motor inertia 162 162 \"inertia1\". Via a complöiant spring/damper component, the load 163 163 inertia \"inertia2\" is attached. A constant external torque of 10 Nm … … 165 165 </ul> 166 166 167 < /p>167 <p> 168 168 The PI controller settings included \"limitAtInit=false\", in order that 169 169 the 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. 170 problem. 171 </p> 172 173 <p> 174 The PI controller is initialized in steady state (initType=SteadyState) 175 and the drive shall also be initialized in steady state. 176 However, 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 178 defines that the derivative of the integrator state is zero (= the same 179 condition that was already defined by option SteadyState of the PI controller). 180 Furthermore, one initial condition is missing, because the absolute position 181 of inertia1 or inertia2 is not defined. The solution shown in this examples is 182 to initialize the angle and the angular acceleration of \"inertia1\". 178 183 </p> 179 184 … … 203 208 annotation (extent=[-25,-20; -5,0]); 204 209 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, 206 211 stateSelection=Modelica.Blocks.Types.StateSelection.Prefer) 207 212 annotation (extent=[32,-20; 52,0]); … … 233 238 connect(speedSensor.w, PI.u_m) annotation (points=[1,-40; -46,-40; -46,-22], 234 239 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; 236 241 -67,11; -67,-10; -58,-10], style(color=74, rgbcolor={0,0,127})); 237 242 end PID_Controller; 238 243 239 244 model ShowLogicalSources 240 245 extends Modelica.Icons.Example;
