Skip to content
LIBRARY
Examples.TestUniformNoise.md

Examples.TestUniformNoise ​

Test component that validates the UniformNoise block.

Connects a UniformNoise source (default params: l=0, u=1, seed=1) to a ZeroOrderHold and then to an integrator for continuous dynamics. A PeriodicClock defines the discrete clock. The output should be deterministic (seeded) uniform random values in [0, 1].

Usage ​

DiscreteComponents.Examples.TestUniformNoise()

Behavior ​

Behavior of this component cannot be rendered because it includes path variables.

Source ​

dyad
"""
Test component that validates the UniformNoise block.

Connects a UniformNoise source (default params: l=0, u=1, seed=1) to a ZeroOrderHold
and then to an integrator for continuous dynamics. A PeriodicClock defines the discrete
clock. The output should be deterministic (seeded) uniform random values in [0, 1].
"""
test component TestUniformNoise
  zoh = DiscreteComponents.ZeroOrderHold() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 300, "y1": 450, "x2": 400, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  integrator = BlockComponents.Continuous.Integrator() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 530, "y1": 450, "x2": 630, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  periodicclock = DiscreteComponents.PeriodicClock(dt = 0.1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 140, "y1": 250, "x2": 40, "y2": 350, "rot": 0}
      },
      "tags": []
    }
  }
  uniformnoise = DiscreteComponents.UniformNoise() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 40, "y1": 450, "x2": 140, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
relations
  connect(zoh.y, integrator.u) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
  connect(uniformnoise.y, zoh.u, periodicclock.y) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [], "E": 2},
        {"S": 3, "M": [{"x": 230, "y": 300}], "E": -1}
      ],
      "junctions": [{"x": 230, "y": 500}],
      "renderStyle": "standard"
    }
  }
metadata {
  "Dyad": {
    "tests": {"case1": {"stop": 10, "expect": {"signals": ["uniformnoise.y", "zoh.y"]}}},
    "doc": {"behavior": false}
  }
}
end
Flattened Source
dyad
"""
Test component that validates the UniformNoise block.

Connects a UniformNoise source (default params: l=0, u=1, seed=1) to a ZeroOrderHold
and then to an integrator for continuous dynamics. A PeriodicClock defines the discrete
clock. The output should be deterministic (seeded) uniform random values in [0, 1].
"""
test component TestUniformNoise
  zoh = DiscreteComponents.ZeroOrderHold() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 300, "y1": 450, "x2": 400, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  integrator = BlockComponents.Continuous.Integrator() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 530, "y1": 450, "x2": 630, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  periodicclock = DiscreteComponents.PeriodicClock(dt = 0.1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 140, "y1": 250, "x2": 40, "y2": 350, "rot": 0}
      },
      "tags": []
    }
  }
  uniformnoise = DiscreteComponents.UniformNoise() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 40, "y1": 450, "x2": 140, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
relations
  connect(zoh.y, integrator.u) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
  connect(uniformnoise.y, zoh.u, periodicclock.y) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [], "E": 2},
        {"S": 3, "M": [{"x": 230, "y": 300}], "E": -1}
      ],
      "junctions": [{"x": 230, "y": 500}],
      "renderStyle": "standard"
    }
  }
metadata {
  "Dyad": {
    "tests": {"case1": {"stop": 10, "expect": {"signals": ["uniformnoise.y", "zoh.y"]}}},
    "doc": {"behavior": false}
  }
}
end


Test Cases ​

Test Case case1 ​

julia
plt

julia
plt