TestPolynomial TestPolynomial Icon

Mathematical.TestPolynomial

Usage

PrimitiveComponents.Mathematical.TestPolynomial()

Behavior

\[ \begin{equation} \left[ \begin{array}{c} \mathrm{connect}\left( source_{+}y(t), poly_{+}u(t) \right) \\ \mathtt{source.y}\left( t \right) = ifelse\left( \mathtt{source.start\_time} < t, ifelse\left( t < \mathtt{source.duration} + \mathtt{source.start\_time}, \mathtt{source.offset} + \frac{\mathtt{source.height} \left( - \mathtt{source.start\_time} + t \right)}{\mathtt{source.duration}}, \mathtt{source.height} + \mathtt{source.offset} \right), \mathtt{source.offset} \right) \\ \mathtt{poly.y}\left( t \right) = \mathtt{poly.c0} + \mathtt{poly.c1} \mathtt{poly.u}\left( t \right) + \left( \mathtt{poly.u}\left( t \right) \right)^{2} \mathtt{poly.c2} + \left( \mathtt{poly.u}\left( t \right) \right)^{3} \mathtt{poly.c3} \\ \end{array} \right] \end{equation} \]

Source

# TEST HARNESS - Quadratic polynomial: y = 1 + 2*u - 0.5*u^2
test component TestPolynomial
  "Ramp input from -2 to 2"
  source = BlockComponents.Ramp(height = 4.0, duration = 2.0, offset = -2.0)
  "Polynomial component: y = 1 + 2*u - 0.5*u^2"
  poly = Polynomial(c0 = 1.0, c1 = 2.0, c2 = -0.5, c3 = 0.0)
relations
  connect(source.y, poly.u)
end
Flattened Source
test component TestPolynomial
  "Ramp input from -2 to 2"
  source = BlockComponents.Ramp(height = 4.0, duration = 2.0, offset = -2.0)
  "Polynomial component: y = 1 + 2*u - 0.5*u^2"
  poly = Polynomial(c0 = 1.0, c1 = 2.0, c2 = -0.5, c3 = 0.0)
relations
  connect(source.y, poly.u)
metadata {}
end


Test Cases

No test cases defined.