# 高级旋转组件¶

## 建模齿隙¶

$\begin{split}\tau = \left\{ \begin{array}{cc} c (\Delta \varphi - \frac{b}{2}) \ \ &\mathrm{if}\ \Delta \varphi>\frac{b}{2} \\ c (\Delta \varphi + \frac{b}{2}) \ \ &\mathrm{if}\ \Delta \varphi<-\frac{b}{2} \\ 0 \ \ &\mathrm{otherwise} \end{array} \right.\end{split}$

within ModelicaByExample.Components.Rotational.Components;
model Backlash "A rotational backlash model"
parameter Modelica.SIunits.RotationalSpringConstant c;
parameter Modelica.SIunits.Angle b(final min=0) "Total lash";
extends ModelicaByExample.Components.Rotational.Interfaces.Compliant;
equation
if phi_rel>b/2 then
tau = c*(phi_rel-b/2);
elseif phi_rel<-b/2 then
tau = c*(phi_rel+b/2);
else
tau = 0 "In the lash region";
end if;
end Backlash;


within ModelicaByExample.Components.Rotational.Examples;
model SMD_WithBacklash "The spring-mass-damper system with backlash"
extends SMD(inertia2(phi(fixed=true, start=0)), inertia1(phi(fixed=true, start=0), w(start=5)));
Components.Backlash backlash(c=1000, b(displayUnit="rad") = 0.5)
annotation (Placement(transformation(extent={{-50,-10},{-30,10}})));
equation
connect(inertia1.flange_b, backlash.flange_a) annotation (Line(
points={{-70,0},{-50,0}},
color={0,0,0},
smooth=Smooth.None));
connect(backlash.flange_b, inertia2.flange_a) annotation (Line(
points={{-30,0},{-10,0}},
color={0,0,0},
smooth=Smooth.None));
end SMD_WithBacklash;


## 地面扭矩与反作用扭矩¶

$\omega_a = R \omega_b$

$\tau_a \omega_a + \tau_b \omega_b = 0$

$\tau_a R \omega_b + \tau_b \omega_b = 0$

$\tau_b = -R \tau_a$

$J \ddot{\varphi} = \sum_i \tau_i$

$\sum_i \tau_i = 0$

$\tau_a + \tau_b = \tau_a - R \tau_a = \tau_a (1-R) = 0$

$\tau_a - R \tau_a = 0$

within ModelicaByExample.Components.Rotational.Components;
model GroundedGear "An ideal non-reversing gear with grounded housing"
parameter Real ratio "Ratio of phi_a/phi_b";
extends Interfaces.TwoFlange;
equation
ratio*flange_a.tau + flange_b.tau = 0 "No storage";
flange_a.phi = ratio*flange_b.phi "Kinematic constraint";
annotation (Icon(graphics={
Rectangle(
extent={{-100,10},{-40,-10}},
lineColor={0,0,0},
fillPattern=FillPattern.HorizontalCylinder,
fillColor={192,192,192}),
Rectangle(
extent={{-40,20},{-20,-20}},
lineColor={0,0,0},
fillPattern=FillPattern.HorizontalCylinder,
fillColor={192,192,192}),
Rectangle(
extent={{-40,100},{-20,20}},
lineColor={0,0,0},
fillPattern=FillPattern.HorizontalCylinder,
fillColor={192,192,192}),
Rectangle(
extent={{-20,70},{20,50}},
lineColor={0,0,0},
fillPattern=FillPattern.HorizontalCylinder,
fillColor={192,192,192}),
Rectangle(
extent={{20,80},{40,39}},
lineColor={0,0,0},
fillPattern=FillPattern.HorizontalCylinder,
fillColor={192,192,192}),
Rectangle(
extent={{20,40},{40,-40}},
lineColor={0,0,0},
fillPattern=FillPattern.HorizontalCylinder,
fillColor={192,192,192}),
Rectangle(
extent={{40,10},{100,-10}},
lineColor={0,0,0},
fillPattern=FillPattern.HorizontalCylinder,
fillColor={192,192,192}),
Text(
extent={{-100,140},{100,100}},
lineColor={0,0,0},
fillColor={255,255,255},
fillPattern=FillPattern.Solid,
textString="ratio=%ratio"),
Text(
extent={{-100,-40},{100,-80}},
lineColor={0,0,0},
fillColor={255,255,255},
fillPattern=FillPattern.Solid,
textString="%name")}));
end GroundedGear;


## 比较¶

$(1-R)\varphi_h = \varphi_a - R \varphi_b$

$\tau_b = -R \tau_a \tau_h = -(1-R) \tau_a$

within ModelicaByExample.Components.Rotational.Components;
model UngroundedGear "An ideal non-reversing gear with a free housing"
parameter Real ratio "Ratio of phi_a/phi_b";
extends Interfaces.TwoFlange;
Modelica.Mechanics.Rotational.Interfaces.Flange_b housing
"Connection for housing"
annotation (Placement(transformation(extent={{-10,-110},{10,-90}})));
equation
(1-ratio)*housing.phi = flange_a.phi - ratio*flange_b.phi;
flange_b.tau = -ratio*flange_a.tau;
housing.tau = -(1-ratio)*flange_a.tau;
end UngroundedGear;


## 可选地面连接器¶

within ModelicaByExample.Components.Rotational.Components;
model ConfigurableGear
"An ideal non-reversing gear which can be free or grounded"
parameter Real ratio "Ratio of phi_a/phi_b";
parameter Boolean grounded(start=false) "Set if housing should be grounded";
extends Interfaces.TwoFlange;
Modelica.Mechanics.Rotational.Interfaces.Flange_b housing(phi=housing_phi,
tau = -flange_a.tau-flange_b.tau) if not grounded "Connection for housing"
annotation (Placement(transformation(extent={{-10,-110},{10,-90}})));
protected
Modelica.SIunits.Angle housing_phi;
equation
if grounded then
housing_phi = 0;
end if;
(1-ratio)*housing_phi = flange_a.phi - ratio*flange_b.phi;
flange_b.tau = -ratio*flange_a.tau;
end ConfigurableGear;


grounded==true grounded==false

flow变量总数

2 3

1（housing_phi

1（housing_phi

3 4

0

2（housing内）

equation区域的方程数

3 2

3 4