| 1656 | | Line(points={{-96,0},{-60,0}}, color={0,0,0}), |
| 1657 | | Line(points={{-60,-30},{-60,30}}, color={0,0,0}), |
| 1658 | | Line(points={{-60,-30},{60,-30}}, color={0,0,0}), |
| 1659 | | Line(points={{-60,30},{60,30}}, color={0,0,0}), |
| 1660 | | Rectangle( |
| 1661 | | extent={{-60,30},{30,-30}}, |
| 1662 | | lineColor={0,0,0}, |
| 1663 | | fillColor={192,192,192}, |
| 1664 | | fillPattern=FillPattern.Solid), |
| 1665 | | Line(points={{30,0},{96,0}}, color={0,0,0}), |
| 1666 | | Line(points={{-68,0},{-68,65}}, color={128,128,128}), |
| 1667 | | Text( |
| 1668 | | extent={{-22,62},{18,87}}, |
| 1669 | | lineColor={0,0,255}, |
| 1670 | | textString="phi_rel"), |
| 1671 | | Line(points={{-68,60},{72,60}}, color={128,128,128}), |
| 1672 | | Line(points={{72,0},{72,65}}, color={128,128,128}), |
| | 1656 | Line(points={{-96,0},{-60,0}}, color={0,0,0}), |
| | 1657 | Line(points={{-60,-30},{-60,30}}, color={0,0,0}), |
| | 1658 | Line(points={{-60,-30},{60,-30}}, color={0,0,0}), |
| | 1659 | Line(points={{-60,30},{60,30}}, color={0,0,0}), |
| | 1660 | Rectangle( |
| | 1661 | extent={{-60,30},{30,-30}}, |
| | 1662 | lineColor={0,0,0}, |
| | 1663 | fillColor={192,192,192}, |
| | 1664 | fillPattern=FillPattern.Solid), |
| | 1665 | Line(points={{30,0},{96,0}}, color={0,0,0}), |
| | 1666 | Line(points={{-68,0},{-68,65}}, color={128,128,128}), |
| | 1667 | Text( |
| | 1668 | extent={{-22,62},{18,87}}, |
| | 1669 | lineColor={0,0,255}, |
| | 1670 | textString="phi_rel"), |
| | 1671 | Line(points={{-68,60},{72,60}}, color={128,128,128}), |
| | 1672 | Line(points={{72,0},{72,65}}, color={128,128,128}), |
| 1753 | | points={{62,95},{72,92},{62,89},{62,95}}, |
| 1754 | | lineColor={128,128,128}, |
| 1755 | | fillColor={128,128,128}, |
| 1756 | | fillPattern=FillPattern.Solid), |
| 1757 | | Text( |
| 1758 | | extent={{-20,72},{20,97}}, |
| 1759 | | lineColor={0,0,255}, |
| 1760 | | textString="phi_rel"), |
| 1761 | | Rectangle( |
| 1762 | | extent={{-50,-20},{40,-80}}, |
| 1763 | | lineColor={0,0,0}, |
| 1764 | | fillColor={192,192,192}, |
| 1765 | | fillPattern=FillPattern.Solid), |
| 1766 | | Line(points={{-50,-80},{68,-80}}, color={0,0,0}), |
| 1767 | | Line(points={{-50,-20},{68,-20}}, color={0,0,0}), |
| 1768 | | Line(points={{40,-50},{80,-50}}, color={0,0,0}), |
| 1769 | | Line(points={{-80,-50},{-50,-50}}, color={0,0,0}), |
| 1770 | | Line(points={{-80,32},{-80,-50}}, color={0,0,0}), |
| 1771 | | Line(points={{80,32},{80,-50}}, color={0,0,0}), |
| 1772 | | Line(points={{-96,0},{-80,0}}, color={0,0,0}), |
| | 1753 | points={{62,95},{72,92},{62,89},{62,95}}, |
| | 1754 | lineColor={128,128,128}, |
| | 1755 | fillColor={128,128,128}, |
| | 1756 | fillPattern=FillPattern.Solid), |
| | 1757 | Text( |
| | 1758 | extent={{-20,72},{20,97}}, |
| | 1759 | lineColor={0,0,255}, |
| | 1760 | textString="phi_rel"), |
| | 1761 | Rectangle( |
| | 1762 | extent={{-50,-20},{40,-80}}, |
| | 1763 | lineColor={0,0,0}, |
| | 1764 | fillColor={192,192,192}, |
| | 1765 | fillPattern=FillPattern.Solid), |
| | 1766 | Line(points={{-50,-80},{68,-80}}, color={0,0,0}), |
| | 1767 | Line(points={{-50,-20},{68,-20}}, color={0,0,0}), |
| | 1768 | Line(points={{40,-50},{80,-50}}, color={0,0,0}), |
| | 1769 | Line(points={{-80,-50},{-50,-50}}, color={0,0,0}), |
| | 1770 | Line(points={{-80,32},{-80,-50}}, color={0,0,0}), |
| | 1771 | Line(points={{80,32},{80,-50}}, color={0,0,0}), |
| | 1772 | Line(points={{-96,0},{-80,0}}, color={0,0,0}), |
| 4072 | | model ElastoBacklash2 |
| 4073 | | "Backlash connected in series to linear spring and damper (backlash is modeled with elasticity)" |
| 4074 | | import SI = Modelica.SIunits; |
| 4075 | | |
| 4076 | | parameter Real c( |
| 4077 | | final unit="N.m/rad", |
| 4078 | | final min=Modelica.Constants.small, start=1.0e5) |
| 4079 | | "Spring constant (c > 0 required)"; |
| 4080 | | parameter Real d( |
| 4081 | | final unit="N.m.s/rad", |
| 4082 | | final min=0) = 0 "Damping constant"; |
| 4083 | | parameter SI.Angle b(final min=0) = 0 "Total backlash"; |
| 4084 | | parameter SI.Angle phi_rel0=0 "Unstretched spring angle"; |
| 4085 | | |
| 4086 | | extends Rotational.Interfaces.PartialCompliantWithRelativeStates; |
| 4087 | | protected |
| 4088 | | SI.Torque tau_c; |
| 4089 | | SI.Torque tau_d; |
| 4090 | | SI.Angle phi_diff = phi_rel - phi_rel0; |
| 4091 | | |
| 4092 | | // A minimum backlash is defined in order to avoid an infinite |
| 4093 | | // number of state events if backlash b is set to zero. |
| 4094 | | constant SI.Angle bEps = 1e-10 "minimum backlash"; |
| 4095 | | annotation ( |
| 4096 | | Window( |
| 4097 | | x=0.45, |
| 4098 | | y=0.01, |
| 4099 | | width=0.44, |
| 4100 | | height=0.65), |
| 4101 | | Documentation(info="<html> |
| 4102 | | <p> |
| 4103 | | This element consists of a <b>backlash</b> element <b>connected in series</b> |
| 4104 | | to a <b>spring</b> and <b>damper</b> element which are <b>connected in parallel</b>. |
| 4105 | | The spring constant shall be non-zero, otherwise the component cannot be used. |
| 4106 | | </p> |
| 4107 | | |
| 4108 | | <p> |
| 4109 | | In combination with components IdealGear, the ElastoBacklash model |
| 4110 | | can be used to model a gear box with backlash, elasticity and damping. |
| 4111 | | </p> |
| 4112 | | |
| 4113 | | <p> |
| 4114 | | The linear spring and damper torques are slightly modified in order that |
| 4115 | | the reaction torque only \"pushes\" and cannot \"pull\" (which is unphysical). |
| 4116 | | </p> |
| 4117 | | |
| 4118 | | <p> |
| 4119 | | During initialization, the backlash characteristic is replaced by a continuous |
| 4120 | | approximation in the backlash region, in order to reduce problems during |
| 4121 | | initialization, especially for inverse models. |
| 4122 | | </p> |
| 4123 | | |
| 4124 | | <p> |
| 4125 | | If the backlash b is smaller as 1e-10 (especially, if b=0), |
| 4126 | | then the backlash is ignored and the component reduces to a spring/damper |
| 4127 | | element in parallel. |
| 4128 | | </p> |
| 4129 | | |
| 4130 | | </html> |
| 4131 | | "), Icon(coordinateSystem( |
| 4132 | | preserveAspectRatio=true, |
| 4133 | | extent={{-100,-100},{100,100}}, |
| 4134 | | grid={1,1}), graphics={ |
| 4135 | | Line( |
| 4136 | | points={{-80,32},{-58,32},{-48,0},{-34,61},{-20,0},{-8,60},{0,30}, |
| 4137 | | {20,30}}, |
| 4138 | | color={0,0,0}, |
| 4139 | | pattern=LinePattern.Solid, |
| 4140 | | thickness=1, |
| 4141 | | arrow={Arrow.None,Arrow.None}), |
| 4142 | | Rectangle( |
| 4143 | | extent={{-60,-10},{-10,-50}}, |
| 4144 | | lineColor={0,0,0}, |
| 4145 | | pattern=LinePattern.Solid, |
| 4146 | | lineThickness=1, |
| 4147 | | fillColor={192,192,192}, |
| 4148 | | fillPattern=FillPattern.Solid), |
| 4149 | | Line( |
| 4150 | | points={{-60,-50},{0,-50}}, |
| 4151 | | color={0,0,0}, |
| 4152 | | pattern=LinePattern.Solid, |
| 4153 | | thickness=1, |
| 4154 | | arrow={Arrow.None,Arrow.None}), |
| 4155 | | Line( |
| 4156 | | points={{-60,-10},{0,-10}}, |
| 4157 | | color={0,0,0}, |
| 4158 | | pattern=LinePattern.Solid, |
| 4159 | | thickness=1, |
| 4160 | | arrow={Arrow.None,Arrow.None}), |
| 4161 | | Line( |
| 4162 | | points={{-10,-30},{20,-30}}, |
| 4163 | | color={0,0,0}, |
| 4164 | | pattern=LinePattern.Solid, |
| 4165 | | thickness=1, |
| 4166 | | arrow={Arrow.None,Arrow.None}), |
| 4167 | | Line( |
| 4168 | | points={{-80,-30},{-60,-30}}, |
| 4169 | | color={0,0,0}, |
| 4170 | | pattern=LinePattern.Solid, |
| 4171 | | thickness=1, |
| 4172 | | arrow={Arrow.None,Arrow.None}), |
| 4173 | | Line( |
| 4174 | | points={{-80,32},{-80,-30}}, |
| 4175 | | color={0,0,0}, |
| 4176 | | pattern=LinePattern.Solid, |
| 4177 | | thickness=1, |
| 4178 | | arrow={Arrow.None,Arrow.None}), |
| 4179 | | Line( |
| 4180 | | points={{20,30},{20,-30}}, |
| 4181 | | color={0,0,0}, |
| 4182 | | pattern=LinePattern.Solid, |
| 4183 | | thickness=1, |
| 4184 | | arrow={Arrow.None,Arrow.None}), |
| 4185 | | Line( |
| 4186 | | points={{-90,0},{-80,0}}, |
| 4187 | | color={0,0,0}, |
| 4188 | | pattern=LinePattern.Solid, |
| 4189 | | thickness=1, |
| 4190 | | arrow={Arrow.None,Arrow.None}), |
| 4191 | | Line( |
| 4192 | | points={{90,0},{80,0}}, |
| 4193 | | color={0,0,0}, |
| 4194 | | pattern=LinePattern.Solid, |
| 4195 | | thickness=1, |
| 4196 | | arrow={Arrow.None,Arrow.None}), |
| 4197 | | Line( |
| 4198 | | points={{20,0},{60,0},{60,-30}}, |
| 4199 | | color={0,0,0}, |
| 4200 | | pattern=LinePattern.Solid, |
| 4201 | | thickness=1, |
| 4202 | | arrow={Arrow.None,Arrow.None}), |
| 4203 | | Line( |
| 4204 | | points={{40,-12},{40,-40},{80,-40},{80,0}}, |
| 4205 | | color={0,0,0}, |
| 4206 | | pattern=LinePattern.Solid, |
| 4207 | | thickness=1, |
| 4208 | | arrow={Arrow.None,Arrow.None}), |
| 4209 | | Text( |
| 4210 | | extent={{-150,-130},{150,-90}}, |
| 4211 | | lineColor={0,0,0}, |
| 4212 | | textString="b=%b"), |
| 4213 | | Text( |
| 4214 | | extent={{-150,100},{150,60}}, |
| 4215 | | lineColor={0,0,255}, |
| 4216 | | textString="%name"), |
| 4217 | | Text( |
| 4218 | | extent={{-152,-92},{148,-52}}, |
| 4219 | | lineColor={0,0,0}, |
| 4220 | | textString="c=%c")}), |
| 4221 | | Diagram(coordinateSystem( |
| 4222 | | preserveAspectRatio=true, |
| 4223 | | extent={{-100,-100},{100,100}}, |
| 4224 | | grid={1,1}), graphics={ |
| 4225 | | Line( |
| 4226 | | points={{-80,32},{-58,32},{-48,0},{-34,60},{-20,0},{-8,60},{0,30}, |
| 4227 | | {20,30}}, |
| 4228 | | color={0,0,0}, |
| 4229 | | thickness=2), |
| 4230 | | Line(points={{-68,32},{-68,97}}, color={128,128,128}), |
| 4231 | | Line(points={{80,0},{80,96}}, color={128,128,128}), |
| 4232 | | Line(points={{-68,92},{72,92}}, color={128,128,128}), |
| 4233 | | Polygon( |
| 4234 | | points={{70,95},{80,92},{70,89},{70,95}}, |
| 4235 | | lineColor={128,128,128}, |
| 4236 | | fillColor={128,128,128}, |
| 4237 | | fillPattern=FillPattern.Solid), |
| 4238 | | Text( |
| 4239 | | extent={{-10,70},{30,95}}, |
| 4240 | | lineColor={128,128,128}, |
| 4241 | | textString="phi_rel"), |
| 4242 | | Rectangle( |
| 4243 | | extent={{-60,-20},{-10,-80}}, |
| 4244 | | lineColor={0,0,0}, |
| 4245 | | lineThickness=2, |
| 4246 | | fillColor={192,192,192}, |
| 4247 | | fillPattern=FillPattern.Solid), |
| 4248 | | Line( |
| 4249 | | points={{-52,-80},{0,-80}}, |
| 4250 | | color={0,0,0}, |
| 4251 | | thickness=2), |
| 4252 | | Line( |
| 4253 | | points={{-52,-20},{0,-20}}, |
| 4254 | | color={0,0,0}, |
| 4255 | | thickness=2), |
| 4256 | | Line( |
| 4257 | | points={{-10,-50},{20,-50}}, |
| 4258 | | color={0,0,0}, |
| 4259 | | thickness=2), |
| 4260 | | Line( |
| 4261 | | points={{-80,-50},{-60,-50}}, |
| 4262 | | color={0,0,0}, |
| 4263 | | thickness=2), |
| 4264 | | Line( |
| 4265 | | points={{-80,32},{-80,-50}}, |
| 4266 | | color={0,0,0}, |
| 4267 | | thickness=2), |
| 4268 | | Line( |
| 4269 | | points={{20,30},{20,-50}}, |
| 4270 | | color={0,0,0}, |
| 4271 | | thickness=2), |
| 4272 | | Line(points={{-96,0},{-80,0}}, color={0,0,0}), |
| 4273 | | Line( |
| 4274 | | points={{96,0},{80,0}}, |
| 4275 | | color={0,0,0}, |
| 4276 | | thickness=2), |
| 4277 | | Line( |
| 4278 | | points={{20,0},{60,0},{60,-30}}, |
| 4279 | | color={0,0,0}, |
| 4280 | | thickness=2), |
| 4281 | | Line( |
| 4282 | | points={{40,-12},{40,-40},{80,-40},{80,0}}, |
| 4283 | | color={0,0,0}, |
| 4284 | | thickness=2), |
| 4285 | | Line(points={{30,0},{30,64}}, color={128,128,128}), |
| 4286 | | Line(points={{30,60},{80,60}}, color={128,128,128}), |
| 4287 | | Polygon( |
| 4288 | | points={{70,63},{80,60},{70,57},{70,63}}, |
| 4289 | | lineColor={128,128,128}, |
| 4290 | | fillColor={128,128,128}, |
| 4291 | | fillPattern=FillPattern.Solid), |
| 4292 | | Text( |
| 4293 | | extent={{39,60},{68,46}}, |
| 4294 | | lineColor={160,160,164}, |
| 4295 | | fillColor={192,192,192}, |
| 4296 | | fillPattern=FillPattern.Solid, |
| 4297 | | textString="b")})); |
| 4298 | | equation |
| 4299 | | if initial() then |
| 4300 | | /* During initialization the characteristic is modified, in order that |
| 4301 | | it is a strict monoton rising function. Otherwise, initialization might |
| 4302 | | result in a singular system when the characteristic has to be |
| 4303 | | inverted. The characteristic is modified in the range 1.5*bMin <= phi_rel - phi_rel0 <= 1.5 bMax, |
| 4304 | | so that in this range a linear characteristic is present that approaches the original |
| 4305 | | function continuously at its limits, e.g., |
| 4306 | | original: tau(1.5*bMax) = c*(phi_diff - bMax) |
| 4307 | | = c*(0.5*bMax) |
| 4308 | | initial : tau(1.5*bMax) = (c/3)*phi_diff |
| 4309 | | = (c/3)*(3/2)*bMax |
| 4310 | | = (c/2)*bMax |
| 4311 | | */ |
| 4312 | | tau_c = if phi_diff > 1.5*bMax then c*(phi_diff - bMax) else |
| 4313 | | if phi_diff < 1.5*bMin then c*(phi_diff - bMin) else (c/3)*phi_diff; |
| 4314 | | tau_d = d*w_rel; |
| 4315 | | tau = tau_c + tau_d; |
| 4316 | | else |
| 4317 | | /* |
| 4318 | | if abs(b) <= bEps then |
| 4319 | | tau_c = c*phi_rel; |
| 4320 | | tau_d = d*w_rel; |
| 4321 | | tau = tau_c + tau_d; |
| 4322 | | elseif phi_rel > bMax then |
| 4323 | | tau_c = c*(phi_diff - bMax); |
| 4324 | | tau_d = d*w_rel; |
| 4325 | | tau = smooth(0, noEvent(if tau_c + tau_d <= 0 then 0 else tau_c + min(tau_c,tau_d))); |
| 4326 | | elseif phi_rel < bMin then |
| 4327 | | tau_c = c*(phi_diff - bMin); |
| 4328 | | tau_d = d*w_rel; |
| 4329 | | tau = smooth(0, noEvent(if tau_c + tau_d >= 0 then 0 else tau_c + max(tau_c,tau_d))); |
| 4330 | | else |
| 4331 | | tau_c = 0; |
| 4332 | | tau_d = 0; |
| 4333 | | tau = 0; |
| 4334 | | end if; |
| 4335 | | |
| 4336 | | This is written in the form below, in order that parameter "b" |
| 4337 | | is not evaluated during translation (i.e., in the above form |
| 4338 | | it cannot be changed anymore after translation). |
| 4339 | | */ |
| 4340 | | |
| 4341 | | tau_c = if abs(b) <= bEps then c*phi_diff else |
| 4342 | | if phi_diff > bMax then c*(phi_diff - bMax) else |
| 4343 | | if phi_diff < bMin then c*(phi_diff - bMin) else 0; |
| 4344 | | tau_d = d*w_rel; |
| 4345 | | tau = if abs(b) <= bEps then tau_c + tau_d else |
| 4346 | | if phi_rel > bMax then |
| 4347 | | smooth(0, noEvent(if tau_c + tau_d <= 0 then 0 else tau_c + min(tau_c,tau_d))) else |
| 4348 | | if phi_rel < bMin then |
| 4349 | | smooth(0, noEvent(if tau_c + tau_d >= 0 then 0 else tau_c + max(tau_c,tau_d))) else 0; |
| 4350 | | end if; |
| 4351 | | |
| 4352 | | end ElastoBacklash2; |
| 4986 | | extent={{-70,70},{70,-70}}, |
| 4987 | | lineColor={0,0,0}, |
| 4988 | | fillColor={255,255,255}, |
| 4989 | | fillPattern=FillPattern.Solid), |
| 4990 | | Line(points={{0,70},{0,40}}, color={0,0,0}), |
| 4991 | | Line(points={{22.9,32.8},{40.2,57.3}}, color={0,0,0}), |
| 4992 | | Line(points={{-22.9,32.8},{-40.2,57.3}}, color={0,0,0}), |
| 4993 | | Line(points={{37.6,13.7},{65.8,23.9}}, color={0,0,0}), |
| 4994 | | Line(points={{-37.6,13.7},{-65.8,23.9}}, color={0,0,0}), |
| 4995 | | Line(points={{0,0},{9.02,28.6}}, color={0,0,0}), |
| | 4705 | extent={{-70,70},{70,-70}}, |
| | 4706 | lineColor={0,0,0}, |
| | 4707 | fillColor={255,255,255}, |
| | 4708 | fillPattern=FillPattern.Solid), |
| | 4709 | Line(points={{0,70},{0,40}}, color={0,0,0}), |
| | 4710 | Line(points={{22.9,32.8},{40.2,57.3}}, color={0,0,0}), |
| | 4711 | Line(points={{-22.9,32.8},{-40.2,57.3}}, color={0,0,0}), |
| | 4712 | Line(points={{37.6,13.7},{65.8,23.9}}, color={0,0,0}), |
| | 4713 | Line(points={{-37.6,13.7},{-65.8,23.9}}, color={0,0,0}), |
| | 4714 | Line(points={{0,0},{9.02,28.6}}, color={0,0,0}), |