我想创建一个系统来模拟倒转轮摆,并在下面说明了力矩交换。
到目前为止,我有一个由三个模型组成的系统:
旋转摆锤.mo
model RotationalPendulum
import Modelica.SIunits;
Modelica.Mechanics.Rotational.Interfaces.Flange_a p;
parameter SIunits.Length L = 1.0;
parameter SIunits.Mass m = 1.0;
protected
SIunits.AngularVelocity omega;
SIunits.AngularAcceleration alpha;
parameter SIunits.MomentOfInertia J = m * L ^ 2;
constant Real g = Modelica.Constants.g_n;
equation
// equation to compute p.tau
end RotationalPendulum;
无摩擦关节.mo
model FrictionlessJoint
Modelica.Mechanics.Rotational.Interfaces.Flange_a a;
Modelica.Mechanics.Rotational.Interfaces.Flange_b b;
equation
a.tau = 0;
b.tau = 0;
end FrictionlessJoint;
PendulumSystem.mo
model PendulumSystem "Simple pendulum"
RotationalPendulum pend(m = 1, p(phi(start = 1, fixed = true)));
FrictionlessJoint joint;
Modelica.Mechanics.Rotational.Components.Fixed fixed;
equation
connect(pend.p,joint.a);
connect(joint.b,fixed.flange);
end PendulumSystem;
在 RotationalPendulum.mo 中,模型是一个方程,它应该负责计算 Tau 的值,并具有以下形式:
tau=gamma1*sin(q1)+kp*(q2+gamma2*q1)+kv*(d/dt(q2)+gamma2*d/dt(q1))
其中 gamma1, gamma2, kp, kv 是常数,q1 = theta1, q2 = (theta1 + theta2)。
我遇到的问题是我不知道如何获得 theta1 的值,因为它是杆的角度,但方程位于旋转摆模型中,我只能访问 theta2 的值,即 p.phi (如果我没错的话)。感谢您的任何想法和帮助。