Test_OverflowIntegratorReset Icon
Test_OverflowIntegratorReset
Usage
PrimitiveComponents.Test_OverflowIntegratorReset()
Behavior
\[ \begin{equation} \left[ \begin{array}{c} \mathrm{connect}\left( periodicsampler_{+}y(t), overflowintegratorfe_{+}u(t) \right) \\ \mathrm{connect}\left( initial_{signal_{+}y(t)}, overflowintegratorfe_{+}ic(t) \right) \\ \mathrm{connect}\left( squarebooleansource_{+}y(t), overflowintegratorfe_{+}reset(t) \right) \\ \mathrm{connect}\left( step_{+}y(t), periodicsampler_{+}u(t) \right) \\ \mathtt{initial\_signal.y}\left( t \right) = \mathtt{initial\_signal.k} \\ \mathtt{overflowintegratorfe.y\_candidate}\left( t \right) = Shift(t, -1)\left( \mathtt{overflowintegratorfe.y}\left( t \right) \right) + \mathtt{overflowintegratorfe.u}\left( t \right) ModelingToolkit.SampleTime \\ \mathtt{overflowintegratorfe.y\_sat}\left( t \right) = clamp\left( \mathtt{overflowintegratorfe.y\_candidate}\left( t \right), \mathtt{overflowintegratorfe.y\_min\_p}, \mathtt{overflowintegratorfe.y\_max\_p} \right) \\ \mathtt{overflowintegratorfe.y}\left( t \right) = ifelse\left( \mathtt{overflowintegratorfe.reset}\left( t \right), \mathtt{overflowintegratorfe.reset\_value}\left( t \right), ifelse\left( isnan\_wrapper\left( \mathtt{overflowintegratorfe.y\_sat}\left( t \right) \right), \mathtt{overflowintegratorfe.reset\_value}\left( t \right), \mathtt{overflowintegratorfe.y\_sat}\left( t \right) \right) \right) \\ \mathtt{overflowintegratorfe.reset\_value}\left( t \right) = ifelse\left( isnan\_wrapper\left( Shift(t, -1)\left( \mathtt{overflowintegratorfe.reset\_value}\left( t \right) \right) \right), \mathtt{overflowintegratorfe.ic}\left( t \right), Shift(t, -1)\left( \mathtt{overflowintegratorfe.reset\_value}\left( t \right) \right) \right) \\ \frac{\mathrm{d} \mathtt{overflowintegratorfe.dummy.l}\left( t \right)}{\mathrm{d}t} = 0 \\ \mathrm{connect}\left( u(t), sampler_{+}u(t) \right) \\ \mathrm{connect}\left( sampler_{+}y(t), y(t), clock_{+}y(t) \right) \\ \frac{\mathrm{d} \mathtt{periodicsampler.clock.dummy.l}\left( t \right)}{\mathrm{d}t} = 0 \\ \mathtt{periodicsampler.sampler.y}\left( t \right) = Sample(ModelingToolkit.InferredClock.var"typeof(InferredClock)"(ModelingToolkit.InferredClock.var"##Storage#InferredDiscrete"(0)))\left( \mathtt{periodicsampler.sampler.u}\left( t \right) \right) \\ \mathtt{squarebooleansource.y}\left( t \right) = ifelse\left( t < \mathtt{squarebooleansource.start\_time}, false, ifelse\left( rem\left( - \mathtt{squarebooleansource.start\_time} + t, \frac{1}{\mathtt{squarebooleansource.frequency}} \right) < \frac{\mathtt{squarebooleansource.amplitude}}{\mathtt{squarebooleansource.frequency}}, true, false \right) \right) \\ \mathtt{step.y}\left( t \right) = ifelse\left( t \geq \mathtt{step.start\_time}, \mathtt{step.height} + \mathtt{step.offset}, \mathtt{step.offset} \right) \\ \end{array} \right] \end{equation} \]
Source
test component Test_OverflowIntegratorReset
initial_signal = BlockComponents.Constant(k = 0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 30, "y1": 450, "x2": 130, "y2": 550, "rot": 0}
},
"tags": []
}
}
overflowintegratorfe = PrimitiveComponents.DiscretePrimitives.OverflowIntegratorFE(y_max = 1.0, y_min = 0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 420, "y1": 190, "x2": 520, "y2": 290, "rot": 0}
},
"tags": []
}
}
periodicsampler = PrimitiveComponents.DiscretePrimitives.PeriodicSampler(offset = 0, dt = 0.1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 170, "y1": 300, "x2": 270, "y2": 400, "rot": 0}
},
"tags": []
}
}
squarebooleansource = PrimitiveComponents.Sources.SquareBooleanSource(frequency = 0.2, offset = 0, start_time = 3, amplitude = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 40, "y1": 130, "x2": 140, "y2": 230, "rot": 0}
},
"tags": []
}
}
step = BlockComponents.Step(start_time = 1, offset = 0, height = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 30, "y1": 300, "x2": 130, "y2": 400, "rot": 0}
},
"tags": []
}
}
relations
connect(periodicsampler.y, overflowintegratorfe.u) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 308, "y": 350}, {"x": 308, "y": 240}], "E": 2}],
"renderStyle": "standard"
}
}
connect(initial_signal.y, overflowintegratorfe.ic) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 370, "y": 500}, {"x": 370, "y": 280}], "E": 2}],
"renderStyle": "standard"
}
}
connect(squarebooleansource.y, overflowintegratorfe.reset) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 280, "y": 180}, {"x": 280, "y": 199}], "E": 2}]
}
}
connect(step.y, periodicsampler.u) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
end
Flattened Source
test component Test_OverflowIntegratorReset
initial_signal = BlockComponents.Constant(k = 0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 30, "y1": 450, "x2": 130, "y2": 550, "rot": 0}
},
"tags": []
}
}
overflowintegratorfe = PrimitiveComponents.DiscretePrimitives.OverflowIntegratorFE(y_max = 1.0, y_min = 0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 420, "y1": 190, "x2": 520, "y2": 290, "rot": 0}
},
"tags": []
}
}
periodicsampler = PrimitiveComponents.DiscretePrimitives.PeriodicSampler(offset = 0, dt = 0.1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 170, "y1": 300, "x2": 270, "y2": 400, "rot": 0}
},
"tags": []
}
}
squarebooleansource = PrimitiveComponents.Sources.SquareBooleanSource(frequency = 0.2, offset = 0, start_time = 3, amplitude = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 40, "y1": 130, "x2": 140, "y2": 230, "rot": 0}
},
"tags": []
}
}
step = BlockComponents.Step(start_time = 1, offset = 0, height = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 30, "y1": 300, "x2": 130, "y2": 400, "rot": 0}
},
"tags": []
}
}
relations
connect(periodicsampler.y, overflowintegratorfe.u) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 308, "y": 350}, {"x": 308, "y": 240}], "E": 2}],
"renderStyle": "standard"
}
}
connect(initial_signal.y, overflowintegratorfe.ic) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 370, "y": 500}, {"x": 370, "y": 280}], "E": 2}],
"renderStyle": "standard"
}
}
connect(squarebooleansource.y, overflowintegratorfe.reset) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 280, "y": 180}, {"x": 280, "y": 199}], "E": 2}]
}
}
connect(step.y, periodicsampler.u) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
metadata {}
endTest Cases
No test cases defined.
Related
- Examples
- Experiments
- Analyses
- Tests