LIBRARY
Examples.TestNormalNoise ​
Test component that validates the NormalNoise block.
Connects a NormalNoise source (default params: mu=0, sigma=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) Gaussian random values.
Usage ​
DiscreteComponents.Examples.TestNormalNoise()
Behavior ​
Behavior of this component cannot be rendered because it includes path variables.
Source ​
dyad
"""
Test component that validates the NormalNoise block.
Connects a NormalNoise source (default params: mu=0, sigma=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) Gaussian random values.
"""
test component TestNormalNoise
normalnoise = DiscreteComponents.NormalNoise() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 70, "y1": 450, "x2": 170, "y2": 550, "rot": 0}
},
"tags": []
}
}
periodicclock = DiscreteComponents.PeriodicClock(dt = 0.1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 170, "y1": 300, "x2": 70, "y2": 400, "rot": 0}
},
"tags": []
}
}
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": []
}
}
relations
connect(normalnoise.y, periodicclock.y) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 210, "y": 500}, {"x": 210, "y": 350}], "E": 2}],
"renderStyle": "standard"
}
}
connect(normalnoise.y, zoh.u) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
connect(zoh.y, integrator.u) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
metadata {
"Dyad": {
"tests": {"case1": {"stop": 10, "expect": {"signals": ["normalnoise.y", "zoh.y"]}}},
"doc": {"behavior": false}
}
}
endFlattened Source
dyad
"""
Test component that validates the NormalNoise block.
Connects a NormalNoise source (default params: mu=0, sigma=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) Gaussian random values.
"""
test component TestNormalNoise
normalnoise = DiscreteComponents.NormalNoise() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 70, "y1": 450, "x2": 170, "y2": 550, "rot": 0}
},
"tags": []
}
}
periodicclock = DiscreteComponents.PeriodicClock(dt = 0.1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 170, "y1": 300, "x2": 70, "y2": 400, "rot": 0}
},
"tags": []
}
}
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": []
}
}
relations
connect(normalnoise.y, periodicclock.y) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 210, "y": 500}, {"x": 210, "y": 350}], "E": 2}],
"renderStyle": "standard"
}
}
connect(normalnoise.y, zoh.u) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
connect(zoh.y, integrator.u) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
metadata {
"Dyad": {
"tests": {"case1": {"stop": 10, "expect": {"signals": ["normalnoise.y", "zoh.y"]}}},
"doc": {"behavior": false}
}
}
endTest Cases ​
Test Case case1 ​
julia
pltjulia
pltRelated ​
Examples
Experiments
Analyses
Tests