Test_Abs Test_Abs Icon

Test_Abs

Usage

PrimitiveComponents.Test_Abs()

Behavior

\[ \begin{equation} \left[ \begin{array}{c} \mathrm{connect}\left( sine_{+}y(t), abs_{+}u(t) \right) \\ \mathtt{sine.y}\left( t \right) = \mathtt{sine.offset} + \mathtt{sine.amplitude} ifelse\left( t \geq \mathtt{sine.start\_time}, \sin\left( \mathtt{sine.phase} + 6.2832 \mathtt{sine.frequency} \left( - \mathtt{sine.start\_time} + t \right) \right), \sin\left( \mathtt{sine.phase} \right) \right) \\ \mathtt{abs.y}\left( t \right) = \left|\mathtt{abs.u}\left( t \right)\right| \\ \end{array} \right] \end{equation} \]

Source

component Test_Abs
  sine = BlockComponents.Sine(amplitude = 1, frequency = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"x1": 270, "x2": 370, "y1": 250, "y2": 350, "sh": 0.1, "sw": 0.1, "rot": 0}
      }
    }
  }
  abs = PrimitiveComponents.Mathematical.Abs() {
    "Dyad": {
      "placement": {
        "diagram": {"x1": 640, "x2": 740, "y1": 400, "y2": 500, "sh": 0.1, "sw": 0.1, "rot": 0}
      }
    }
  }
relations
  connect(abs.u, sine.y) {
    "Dyad": {"edges": [{"S": 1, "E": 2, "M": [{"x": 500, "y": 450}, {"x": 500, "y": 300}]}]}
  }
metadata {
  "Dyad": {
    "experiments": {"Test_Abs_": {"stop": 10}},
    "tests": {
      "case1": {
        "stop": 10,
        "abstol": 0.00001,
        "reltol": 0.00001,
        "expect": {"signals": ["abs.u", "abs.y"]}
      }
    }
  }
}
end
Flattened Source
component Test_Abs
  sine = BlockComponents.Sine(amplitude = 1, frequency = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"x1": 270, "x2": 370, "y1": 250, "y2": 350, "sh": 0.1, "sw": 0.1, "rot": 0}
      }
    }
  }
  abs = PrimitiveComponents.Mathematical.Abs() {
    "Dyad": {
      "placement": {
        "diagram": {"x1": 640, "x2": 740, "y1": 400, "y2": 500, "sh": 0.1, "sw": 0.1, "rot": 0}
      }
    }
  }
relations
  connect(abs.u, sine.y) {
    "Dyad": {"edges": [{"S": 1, "E": 2, "M": [{"x": 500, "y": 450}, {"x": 500, "y": 300}]}]}
  }
metadata {
  "Dyad": {
    "experiments": {"Test_Abs_": {"stop": 10}},
    "tests": {
      "case1": {
        "stop": 10,
        "abstol": 0.00001,
        "reltol": 0.00001,
        "expect": {"signals": ["abs.u", "abs.y"]}
      }
    }
  }
}
end


Test Cases

Test Case case1

plt
Example block output
plt
Example block output
  • Examples
  • Experiments
  • Analyses