Modelica中的倒立摆角值

时间:2014-01-17 12:49:20

标签: physics modelica openmodelica

我想创建一个模拟倒车轮摆的系统,下面用力矩交换。

enter image description here

到目前为止,我有一个由三个模型组成的系统:

RotationalPendulum.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;

FrictionlessJoint.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(如果我没记错的话)。感谢您的任何想法和帮助。

2 个答案:

答案 0 :(得分:2)

我不知道你有什么限制,但我会使用Modelica MultiBody库。您的模型将包括地面,无质量杆和圆柱体。地面和杆将通过旋转接头连接,杆和缸也将通过旋转接头连接。默认情况下,旋转关节是无摩擦的。

注意:我不完全理解解决omega2的问题。这个轮是对称的吗?如果是这样,车轮将继续以其初始速度旋转。那么为什么不将它视为点质量呢?

答案 1 :(得分:0)

查看Modelica_LinearSystems2中定义的类似双摆模型:

Modelica_LinearSystems2.Controller.Examples.Components.DoublePendulum

在github上找到:https://github.com/modelica/Modelica_LinearSystems2

相关问题