Test_LeadingEdgeDetector Test_LeadingEdgeDetector Icon

Test_LeadingEdgeDetector

Usage

PrimitiveComponents.Test_LeadingEdgeDetector()

Behavior

\[ \begin{equation} \left[ \begin{array}{c} \mathrm{connect}\left( sqwave_{+}y(t), led1_{+}u(t) \right) \\ \mathrm{connect}\left( u(t), memory_{+}u(t), and_{logical\_1_{+}u1(t)} \right) \\ \mathrm{connect}\left( memory_{+}y(t), not_{logical\_1_{+}u(t)} \right) \\ \mathrm{connect}\left( not_{logical\_1_{+}y(t)}, and_{logical\_1_{+}u2(t)} \right) \\ \mathrm{connect}\left( y(t), and_{logical\_1_{+}y(t)} \right) \\ \mathtt{led1.memory.y}\left( t \right) = Shift(t, -1)\left( \mathtt{led1.memory.u}\left( t \right) \right) \\ \frac{\mathrm{d} \mathtt{led1.memory.dummy.l}\left( t \right)}{\mathrm{d}t} = 0 \\ \mathtt{led1.and\_logical\_1.c1}\left( t \right) = check\_with\_target\_value\left( \mathtt{led1.and\_logical\_1.u1}\left( t \right), \mathtt{led1.and\_logical\_1.target\_value}, \mathtt{led1.and\_logical\_1.abs\_tol} \right) \\ \mathtt{led1.and\_logical\_1.c2}\left( t \right) = check\_with\_target\_value\left( \mathtt{led1.and\_logical\_1.u2}\left( t \right), \mathtt{led1.and\_logical\_1.target\_value}, \mathtt{led1.and\_logical\_1.abs\_tol} \right) \\ \mathtt{led1.and\_logical\_1.y}\left( t \right) = ifelse\left( \neg \mathtt{led1.and\_logical\_1.c1}\left( t \right) \wedge \neg \mathtt{led1.and\_logical\_1.c2}\left( t \right), 1, 0 \right) \\ \mathtt{led1.not\_logical\_1.c}\left( t \right) = check\_with\_target\_value\left( \mathtt{led1.not\_logical\_1.u}\left( t \right), \mathtt{led1.not\_logical\_1.target\_value}, \mathtt{led1.not\_logical\_1.abs\_tol} \right) \\ \mathtt{led1.not\_logical\_1.y}\left( t \right) = ifelse\left( \mathtt{led1.not\_logical\_1.c}\left( t \right), 1, 0 \right) \\ \mathtt{sqwave.y}\left( t \right) = ifelse\left( \mathtt{sqwave.start\_time} < t, \mathtt{sqwave.offset} + \mathtt{sqwave.amplitude} \left( 1 + 4 \left\lfloor \mathtt{sqwave.frequency} \left( - \mathtt{sqwave.start\_time} + t \right)\right\rfloor - 2 \left\lfloor 2 \mathtt{sqwave.frequency} \left( - \mathtt{sqwave.start\_time} + t \right)\right\rfloor \right), \mathtt{sqwave.offset} \right) \\ \end{array} \right] \end{equation} \]

Source

test component Test_LeadingEdgeDetector
  led1 = PrimitiveComponents.Detectors.LeadingEdgeDetector() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 280, "y1": 290, "x2": 380, "y2": 390, "rot": 0}
      },
      "tags": []
    }
  }
  sqwave = BlockComponents.Square(start_time = 1.0, offset = 0.5, amplitude = 0.5, frequency = 1.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 50, "y1": 300, "x2": 150, "y2": 400, "rot": 0}
      }
    }
  }
relations
  connect(sqwave.y, led1.u) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 224, "y": 350}, {"x": 224, "y": 317}], "E": 2}],
      "renderStyle": "standard"
    }
  }
end
Flattened Source
test component Test_LeadingEdgeDetector
  led1 = PrimitiveComponents.Detectors.LeadingEdgeDetector() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 280, "y1": 290, "x2": 380, "y2": 390, "rot": 0}
      },
      "tags": []
    }
  }
  sqwave = BlockComponents.Square(start_time = 1.0, offset = 0.5, amplitude = 0.5, frequency = 1.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 50, "y1": 300, "x2": 150, "y2": 400, "rot": 0}
      }
    }
  }
relations
  connect(sqwave.y, led1.u) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 224, "y": 350}, {"x": 224, "y": 317}], "E": 2}],
      "renderStyle": "standard"
    }
  }
metadata {}
end


Test Cases

No test cases defined.