Test_IntegratorFE Icon
Test_IntegratorFE
Usage
PrimitiveComponents.Test_IntegratorFE()
Behavior
\[ \begin{equation} \left[ \begin{array}{c} \mathrm{connect}\left( reset_{signal_{+}y(t)}, integrator_{+}reset(t) \right) \\ \mathrm{connect}\left( sin_{+}y(t), periodicsampler_{+}u(t) \right) \\ \mathrm{connect}\left( periodicsampler_{+}y(t), integrator_{+}u(t) \right) \\ \mathtt{integrator.y}\left( t \right) = ifelse\left( \mathtt{integrator.reset}\left( t \right) > 0, \mathtt{integrator.reset\_value}\left( t \right), Shift(t, -1)\left( \mathtt{integrator.y}\left( t \right) \right) + ModelingToolkit.SampleTime \mathtt{integrator.u}\left( t \right) \right) \\ \mathtt{integrator.reset\_value}\left( t \right) = ifelse\left( isnan\_wrapper\left( Shift(t, -1)\left( \mathtt{integrator.reset\_value}\left( t \right) \right) \right), 0, Shift(t, -1)\left( \mathtt{integrator.reset\_value}\left( t \right) \right) \right) \\ \frac{\mathrm{d} \mathtt{integrator.dummy.l}\left( t \right)}{\mathrm{d}t} = 0 \\ \mathtt{sin.y}\left( t \right) = \mathtt{sin.offset} + \mathtt{sin.amplitude} ifelse\left( t \geq \mathtt{sin.start\_time}, \sin\left( \mathtt{sin.phase} + 6.2832 \mathtt{sin.frequency} \left( - \mathtt{sin.start\_time} + t \right) \right), \sin\left( \mathtt{sin.phase} \right) \right) \\ \mathtt{reset\_signal.y}\left( t \right) = \mathtt{reset\_signal.k} \\ \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) \\ \end{array} \right] \end{equation} \]
Source
test component Test_IntegratorFE
integrator = PrimitiveComponents.DiscretePrimitives.IntegratorFEwInitial(initial_condition = 0.0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 480, "y1": 140, "x2": 580, "y2": 240, "rot": 0}
},
"tags": []
}
}
sin = BlockComponents.Sine(start_time = 0, offset = 0, amplitude = 1, frequency = 0.1, phase = 0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 40, "y1": 370, "x2": 140, "y2": 470, "rot": 0}
},
"tags": []
}
}
reset_signal = BlockComponents.Constant(k = 0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 40, "y1": 70, "x2": 140, "y2": 170, "rot": 0}
},
"tags": []
}
}
periodicsampler = PrimitiveComponents.DiscretePrimitives.PeriodicSampler(offset = 0, dt = 0.1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 190, "y1": 370, "x2": 290, "y2": 470, "rot": 0}
},
"tags": []
}
}
relations
connect(integrator.reset, reset_signal.y) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 224, "y": 151}, {"x": 224, "y": 120}], "E": 2}],
"renderStyle": "standard"
}
}
connect(sin.y, periodicsampler.u) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
connect(periodicsampler.y, integrator.u) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 384.5, "y": 420}, {"x": 384.5, "y": 190}], "E": 2}]
}
}
end
Flattened Source
test component Test_IntegratorFE
integrator = PrimitiveComponents.DiscretePrimitives.IntegratorFEwInitial(initial_condition = 0.0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 480, "y1": 140, "x2": 580, "y2": 240, "rot": 0}
},
"tags": []
}
}
sin = BlockComponents.Sine(start_time = 0, offset = 0, amplitude = 1, frequency = 0.1, phase = 0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 40, "y1": 370, "x2": 140, "y2": 470, "rot": 0}
},
"tags": []
}
}
reset_signal = BlockComponents.Constant(k = 0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 40, "y1": 70, "x2": 140, "y2": 170, "rot": 0}
},
"tags": []
}
}
periodicsampler = PrimitiveComponents.DiscretePrimitives.PeriodicSampler(offset = 0, dt = 0.1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 190, "y1": 370, "x2": 290, "y2": 470, "rot": 0}
},
"tags": []
}
}
relations
connect(integrator.reset, reset_signal.y) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 224, "y": 151}, {"x": 224, "y": 120}], "E": 2}],
"renderStyle": "standard"
}
}
connect(sin.y, periodicsampler.u) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
connect(periodicsampler.y, integrator.u) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 384.5, "y": 420}, {"x": 384.5, "y": 190}], "E": 2}]
}
}
metadata {}
endTest Cases
No test cases defined.
Related
- Examples
- Experiments
- Analyses
- Tests