LIBRARY
Math.Tests.Asin
Computes the arc sine of constant and time-varying inputs.
Connects a constant source with value 0 to an Asin block and verifies that asin(0) = 0. A second Asin block is driven by a sine wave (amplitude 0.9) that stays within the valid domain [-1, 1] while sweeping negative and positive values, exercising the full output range [-π/2, π/2].
Usage
BlockComponents.Math.Tests.Asin()
Behavior
Source
dyad
"""
Computes the arc sine of constant and time-varying inputs.
Connects a constant source with value 0 to an Asin block and verifies that
asin(0) = 0. A second Asin block is driven by a sine wave (amplitude 0.9)
that stays within the valid domain [-1, 1] while sweeping negative and
positive values, exercising the full output range [-π/2, π/2].
"""
test component Asin
"Constant source providing the input value"
c1 = BlockComponents.Sources.Constant(k = 0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
},
"tags": []
}
}
"Sine source sweeping the valid input domain"
sine = BlockComponents.Sources.Sine(amplitude = 0.9, frequency = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 20, "y1": 140, "x2": 120, "y2": 240, "rot": 0}
},
"tags": []
}
}
"Asin block under test"
asin_block = BlockComponents.Math.Asin() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 160, "y1": 20, "x2": 260, "y2": 120, "rot": 0}
},
"tags": []
}
}
"Second Asin block driven by the sine source"
asin_block_2 = BlockComponents.Math.Asin() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 160, "y1": 140, "x2": 260, "y2": 240, "rot": 0}
},
"tags": []
}
}
relations
connect(c1.y, asin_block.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
connect(sine.y, asin_block_2.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {
"Dyad": {
"icons": {"default": "dyad://BlockComponents/Example.svg"},
"tests": {
"case1": {"stop": 1, "expect": {"signals": ["asin_block.y", "asin_block_2.y", "sine.y"]}}
}
}
}
endFlattened Source
dyad
"""
Computes the arc sine of constant and time-varying inputs.
Connects a constant source with value 0 to an Asin block and verifies that
asin(0) = 0. A second Asin block is driven by a sine wave (amplitude 0.9)
that stays within the valid domain [-1, 1] while sweeping negative and
positive values, exercising the full output range [-π/2, π/2].
"""
test component Asin
"Constant source providing the input value"
c1 = BlockComponents.Sources.Constant(k = 0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
},
"tags": []
}
}
"Sine source sweeping the valid input domain"
sine = BlockComponents.Sources.Sine(amplitude = 0.9, frequency = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 20, "y1": 140, "x2": 120, "y2": 240, "rot": 0}
},
"tags": []
}
}
"Asin block under test"
asin_block = BlockComponents.Math.Asin() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 160, "y1": 20, "x2": 260, "y2": 120, "rot": 0}
},
"tags": []
}
}
"Second Asin block driven by the sine source"
asin_block_2 = BlockComponents.Math.Asin() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 160, "y1": 140, "x2": 260, "y2": 240, "rot": 0}
},
"tags": []
}
}
relations
connect(c1.y, asin_block.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
connect(sine.y, asin_block_2.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {
"Dyad": {
"icons": {"default": "dyad://BlockComponents/Example.svg"},
"tests": {
"case1": {"stop": 1, "expect": {"signals": ["asin_block.y", "asin_block_2.y", "sine.y"]}}
}
}
}
endTest Cases
Test Case case1
julia
pltjulia
pltjulia
plt