Test_Deadzone Icon
Test_Deadzone
Usage
PrimitiveComponents.Test_Deadzone()
Behavior
\[ \begin{equation} \left[ \begin{array}{c} \mathrm{connect}\left( source_{+}y(t), dz_{+}u(t) \right) \\ \mathtt{source.y}\left( t \right) = ifelse\left( \mathtt{source.start\_time} < t, ifelse\left( t < \mathtt{source.duration} + \mathtt{source.start\_time}, \mathtt{source.offset} + \frac{\mathtt{source.height} \left( - \mathtt{source.start\_time} + t \right)}{\mathtt{source.duration}}, \mathtt{source.height} + \mathtt{source.offset} \right), \mathtt{source.offset} \right) \\ \mathtt{dz.y}\left( t \right) = ifelse\left( \mathtt{dz.u}\left( t \right) > \mathtt{dz.u\_max}, - \mathtt{dz.u\_max} + \mathtt{dz.u}\left( t \right), ifelse\left( \mathtt{dz.u}\left( t \right) < - \mathtt{dz.u\_max}, \mathtt{dz.u\_max} + \mathtt{dz.u}\left( t \right), 0 \right) \right) \\ \end{array} \right] \end{equation} \]
Source
test component Test_Deadzone
"Step input that sweeps through deadzone"
source = BlockComponents.Ramp(height = 4.0, duration = 2.0, offset = -2.0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
},
"tags": []
}
}
"Deadzone component under test"
dz = PrimitiveComponents.Discontinuous.Deadzone(u_max = 0.5) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 150, "y1": 20, "x2": 250, "y2": 120, "rot": 0}
},
"tags": []
}
}
relations
connect(source.y, dz.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {
"Dyad": {
"experiments": {},
"tests": {
"case1": {
"stop": 10,
"abstol": 0.00001,
"reltol": 0.00001,
"expect": {"signals": ["dz.y"]}
}
},
"_links": {
"source": {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
},
"tags": []
}
},
"dz": {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 160, "y1": 65, "x2": 260, "y2": 165, "rot": 0}
},
"tags": []
}
},
"id3": {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
}
}
}
end
Flattened Source
test component Test_Deadzone
"Step input that sweeps through deadzone"
source = BlockComponents.Ramp(height = 4.0, duration = 2.0, offset = -2.0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
},
"tags": []
}
}
"Deadzone component under test"
dz = PrimitiveComponents.Discontinuous.Deadzone(u_max = 0.5) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 150, "y1": 20, "x2": 250, "y2": 120, "rot": 0}
},
"tags": []
}
}
relations
connect(source.y, dz.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {
"Dyad": {
"experiments": {},
"tests": {
"case1": {
"stop": 10,
"abstol": 0.00001,
"reltol": 0.00001,
"expect": {"signals": ["dz.y"]}
}
},
"_links": {
"source": {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 20, "y1": 20, "x2": 120, "y2": 120, "rot": 0}
},
"tags": []
}
},
"dz": {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 160, "y1": 65, "x2": 260, "y2": 165, "rot": 0}
},
"tags": []
}
},
"id3": {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
}
}
}
endTest Cases
Test Case case1
plt