$(instance)TwoInertiasWithDrivingTorque Icon

TwoInertiasWithDrivingTorque

Usage

TwoInertiasWithDrivingTorque()

Behavior

\[ \begin{equation} \left[ \begin{array}{c} \mathrm{connect}\left( sine_{+}y(t), torque_{+}tau(t) \right) \\ \mathrm{connect}\left( torque_{+}support, fixed_{+}spline \right) \\ \mathrm{connect}\left( torque_{+}spline, inertia1_{+}spline_{a} \right) \\ \mathrm{connect}\left( inertia1_{+}spline_{b}, spring_{+}spline_{a}, damper_{+}spline_{a} \right) \\ \mathrm{connect}\left( spring_{+}spline_{b}, damper_{+}spline_{b}, inertia2_{+}spline_{a} \right) \\ \mathtt{fixed.spline.phi}\left( t \right) = \mathtt{fixed.phi0} \\ \mathtt{torque.support.phi}\left( t \right) = \mathtt{torque.phi\_support}\left( t \right) \\ \mathtt{torque.support.tau}\left( t \right) = - \mathtt{torque.spline.tau}\left( t \right) \\ \mathtt{torque.phi}\left( t \right) = \mathtt{torque.spline.phi}\left( t \right) - \mathtt{torque.phi\_support}\left( t \right) \\ \mathtt{torque.spline.tau}\left( t \right) = - \mathtt{torque.tau}\left( t \right) \\ \mathtt{inertia1.phi}\left( t \right) = \mathtt{inertia1.spline\_a.phi}\left( t \right) \\ \mathtt{inertia1.phi}\left( t \right) = \mathtt{inertia1.spline\_b.phi}\left( t \right) \\ \frac{\mathrm{d} \mathtt{inertia1.phi}\left( t \right)}{\mathrm{d}t} = \mathtt{inertia1.w}\left( t \right) \\ \frac{\mathrm{d} \mathtt{inertia1.w}\left( t \right)}{\mathrm{d}t} = \mathtt{inertia1.a}\left( t \right) \\ \mathtt{inertia1.J} \mathtt{inertia1.a}\left( t \right) = \mathtt{inertia1.spline\_b.tau}\left( t \right) + \mathtt{inertia1.spline\_a.tau}\left( t \right) \\ \mathtt{inertia2.phi}\left( t \right) = \mathtt{inertia2.spline\_a.phi}\left( t \right) \\ \mathtt{inertia2.phi}\left( t \right) = \mathtt{inertia2.spline\_b.phi}\left( t \right) \\ \frac{\mathrm{d} \mathtt{inertia2.phi}\left( t \right)}{\mathrm{d}t} = \mathtt{inertia2.w}\left( t \right) \\ \frac{\mathrm{d} \mathtt{inertia2.w}\left( t \right)}{\mathrm{d}t} = \mathtt{inertia2.a}\left( t \right) \\ \mathtt{inertia2.J} \mathtt{inertia2.a}\left( t \right) = \mathtt{inertia2.spline\_b.tau}\left( t \right) + \mathtt{inertia2.spline\_a.tau}\left( t \right) \\ \mathtt{spring.phi\_rel}\left( t \right) = \mathtt{spring.spline\_b.phi}\left( t \right) - \mathtt{spring.spline\_a.phi}\left( t \right) \\ \mathtt{spring.spline\_b.tau}\left( t \right) = \mathtt{spring.tau}\left( t \right) \\ \mathtt{spring.spline\_a.tau}\left( t \right) = - \mathtt{spring.tau}\left( t \right) \\ \mathtt{spring.tau}\left( t \right) = \mathtt{spring.c} \left( - \mathtt{spring.phi\_rel0} + \mathtt{spring.phi\_rel}\left( t \right) \right) \\ \mathtt{damper.phi\_rel}\left( t \right) = - \mathtt{damper.spline\_a.phi}\left( t \right) + \mathtt{damper.spline\_b.phi}\left( t \right) \\ \mathtt{damper.spline\_b.tau}\left( t \right) = \mathtt{damper.tau}\left( t \right) \\ \mathtt{damper.spline\_a.tau}\left( t \right) = - \mathtt{damper.tau}\left( t \right) \\ \frac{\mathrm{d} \mathtt{damper.phi\_rel}\left( t \right)}{\mathrm{d}t} = \mathtt{damper.w\_rel}\left( t \right) \\ \frac{\mathrm{d} \mathtt{damper.w\_rel}\left( t \right)}{\mathrm{d}t} = \mathtt{damper.a\_rel}\left( t \right) \\ \mathtt{damper.tau}\left( t \right) = \mathtt{damper.d} \mathtt{damper.w\_rel}\left( t \right) \\ \mathtt{sine.y}\left( t \right) = ifelse\left( \mathtt{sine.start\_time} < t, \mathtt{sine.offset} + \mathtt{sine.amplitude} \sin\left( \mathtt{sine.phase} + 6.2832 \mathtt{sine.frequency} \left( - \mathtt{sine.start\_time} + t \right) \right), \mathtt{sine.offset} \right) \\ \end{array} \right] \end{equation} \]

Source

test component TwoInertiasWithDrivingTorque
  fixed = Fixed()
  torque = TorqueSource()
  inertia1 = Inertia(J=2)
  inertia2 = Inertia(J=4)
  spring = Spring(c=1e4)
  damper = Damper(d=10)
  sine = BlockComponents.Sine(amplitude=10, frequency=5)
relations
  initial inertia1.phi = 1
  initial inertia2.phi = 0.5
  initial inertia2.a = 0
  connect(sine.y, torque.tau)
  connect(torque.support, fixed.spline)
  connect(torque.spline, inertia1.spline_a)
  connect(inertia1.spline_b, spring.spline_a, damper.spline_a)
  connect(spring.spline_b, damper.spline_b, inertia2.spline_a)
metadata {
  "JuliaSim": {
    "tests": {
      "case1": {
        "stop": 1,
        "expect": {
          "initial": {"inertia1.phi": 1, "inertia2.phi": 0.5, "inertia1.w": -500, "inertia2.w ": 0}
        }
      }
    }
  }
}
end
Flattened Source
test component TwoInertiasWithDrivingTorque
  fixed = Fixed()
  torque = TorqueSource()
  inertia1 = Inertia(J=2)
  inertia2 = Inertia(J=4)
  spring = Spring(c=1e4)
  damper = Damper(d=10)
  sine = BlockComponents.Sine(amplitude=10, frequency=5)
relations
  initial inertia1.phi = 1
  initial inertia2.phi = 0.5
  initial inertia2.a = 0
  connect(sine.y, torque.tau)
  connect(torque.support, fixed.spline)
  connect(torque.spline, inertia1.spline_a)
  connect(inertia1.spline_b, spring.spline_a, damper.spline_a)
  connect(spring.spline_b, damper.spline_b, inertia2.spline_a)
metadata {
  "JuliaSim": {
    "tests": {
      "case1": {
        "stop": 1,
        "expect": {
          "initial": {"inertia1.phi": 1, "inertia2.phi": 0.5, "inertia1.w": -500, "inertia2.w ": 0}
        }
      }
    }
  }
}
end

Test Cases

Test Case case1