IntegratorFEwInitialSimpler Icon
Examples.Integrator.IntegratorFEwInitialSimpler
Usage
DiscreteComponents.Examples.Integrator.IntegratorFEwInitialSimpler()
Parameters:
| Name | Description | Units | Default value |
|---|---|---|---|
dt | – | 0.1 |
Connectors
u- This connector represents a real signal as an input to a component (RealInput)ic- This connector represents a real signal as an input to a component (RealInput)reset- This connector represents a real signal as an input to a component (RealInput)y- This connector represents a real signal as an output from a component (RealOutput)
Variables
| Name | Description | Units |
|---|---|---|
reset_value | – |
Behavior
28-element Vector{Symbolics.Equation}:
reset_value(t) ~ NaN
connect(y(t), unitdelay.u(t))
connect(unitdelay.y(t), add.u1(t))
connect(sampletimeblock.y(t), multiply.u2(t))
connect(multiply.y(t), add.u2(t))
connect(lastvalue.y(t), periodicclockprovoker.y(t))
connect(u(t), lastvalue.u(t))
connect(lastvalue.y(t), multiply.u1(t))
connect(add.y(t), y(t))
connect(ic(t), sampler1.u(t))
⋮
multiply₊y(t) ~ multiply₊u1(t)*multiply₊u2(t)
sampletimeblock₊y(t) ~ ModelingToolkitBase.SampleTime(ModelingToolkitBase.ShiftIndex(InferredClock.Inferred(Base.UUID("214657b0-9583-4390-98a1-e988b5387d00")), 0), nothing)()
lastvalue₊y(t) ~ SynchToolkit.Latest()(lastvalue₊u(t), lastvalue₊init)
sampler1₊y(t) ~ Sample(InferredClock.InferredDiscrete(0))(sampler1₊u(t))
clockpropagator₊dummy(t) ~ ifelse(clockpropagator₊u(t) < clockpropagator₊y(t), 0.1, 0.1)
sampler₊y(t) ~ Sample(InferredClock.InferredDiscrete(0))(sampler₊u(t))
clockpropagator1₊dummy(t) ~ ifelse(clockpropagator1₊u(t) < clockpropagator1₊y(t), 0.1, 0.1)
constant1₊y(t) ~ constant1₊k
lessthan₊y(t) ~ lessthan₊u1(t) < lessthan₊u2(t)Source
component IntegratorFEwInitialSimpler@[output clk, input inclk]
u = RealInput@[inclk]() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -50, "y1": 450, "x2": 50, "y2": 550, "rot": 0}
},
"tags": []
}
}
ic = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -50, "y1": 200, "x2": 50, "y2": 300, "rot": 0}
},
"tags": []
}
}
reset = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -50, "y1": 20, "x2": 50, "y2": 120, "rot": 0}
},
"tags": []
}
}
y = RealOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 1000, "y1": 440, "x2": 1100, "y2": 540, "rot": 0}
},
"tags": []
}
}
unitdelay = DiscreteComponents.UnitDelay() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 850, "y1": 300, "x2": 750, "y2": 400, "rot": 0}
},
"tags": []
}
}
add = BlockComponents.Math.Add() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 670, "y1": 450, "x2": 770, "y2": 550, "rot": 0}
},
"tags": []
}
}
multiply = BlockComponents.Math.Product() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 550, "y1": 550, "x2": 650, "y2": 650, "rot": 0}
},
"tags": []
}
}
sampletimeblock = DiscreteComponents.SampleTimeSource() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 410, "y1": 620, "x2": 510, "y2": 720, "rot": 0}
},
"tags": []
}
}
lastvalue = DiscreteComponents.Latest() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 120, "y1": 450, "x2": 220, "y2": 550, "rot": 0}
},
"tags": []
}
}
periodicclockprovoker = DiscreteComponents.PeriodicClock(dt = dt) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 260, "y1": 600, "x2": 360, "y2": 700, "rot": 0}
},
"tags": []
}
}
sampler1 = DiscreteComponents.Sampler() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 160, "y1": 200, "x2": 260, "y2": 300, "rot": 0}
},
"tags": []
}
}
clockpropagator = DiscreteComponents.ClockPropagator() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 330, "y1": 320, "x2": 430, "y2": 420, "rot": 0}
},
"tags": []
}
}
sampler = DiscreteComponents.Sampler() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 160, "y1": 20, "x2": 260, "y2": 120, "rot": 0}
},
"tags": []
}
}
clockpropagator1 = DiscreteComponents.ClockPropagator() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 330, "y1": 100, "x2": 430, "y2": 200, "rot": 0}
},
"tags": []
}
}
constant1 = BlockComponents.Sources.Constant() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 480, "y1": 190, "x2": 530, "y2": 240, "rot": 0}
},
"tags": []
}
}
lessthan = DiscreteComponents.Examples.Integrator.LessThan() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 650, "y1": 130, "x2": 750, "y2": 230, "rot": 0}
},
"tags": []
}
}
structural parameter dt::Real = 0.1
variable reset_value::Real = NaN
relations
"""
y@(clk) = ifelse(0.0 < reset, sample(reset_value, clk), y@(clk-1) + u(clk) * dt)
reset_value@(clk) = ifelse(
isnan_wrapper(sample(reset_value, clk)@(clk-1)),
ic@(clk),
reset_value@(clk-1)
)
"""
initial u@(inclk-1) = 0.0
initial reset_value@(clk-1) = 0.0
initial y@(clk-1) = 0.0
connect(unitdelay.u, y) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 1050, "y": 350}], "E": 2}],
"renderStyle": "standard"
}
}
connect(unitdelay.y, add.u1) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 640, "y": 350}, {"x": 640, "y": 470}], "E": 2}],
"renderStyle": "standard"
}
}
connect(sampletimeblock.y, multiply.u2) {
"Dyad": {
"edges": [
{
"S": 1,
"M": [
{"x": 543.5, "y": 670},
{"x": 543.5, "y": 660},
{"x": 540, "y": 660},
{"x": 540, "y": 623}
],
"E": 2
}
],
"renderStyle": "standard"
}
}
connect(multiply.y, add.u2) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 660, "y": 600}, {"x": 660, "y": 530}], "E": 2}],
"renderStyle": "standard"
}
}
connect(lastvalue.y, periodicclockprovoker.y) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 240, "y": 500}, {"x": 240, "y": 650}], "E": 2}],
"renderStyle": "standard"
}
}
connect(u, lastvalue.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
connect(lastvalue.y, multiply.u1) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 431, "y": 500}, {"x": 431, "y": 575}], "E": 2}],
"renderStyle": "standard"
}
}
connect(add.y, y) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 1050, "y": 500}], "E": 2}]
}
}
connect(ic, sampler1.u) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
connect(lastvalue.y, clockpropagator.y) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 275.5, "y": 500}, {"x": 275.5, "y": 405}], "E": 2}]
}
}
connect(sampler1.y, clockpropagator.u) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 295.5, "y": 250}, {"x": 295.5, "y": 335}], "E": 2}]
}
}
connect(reset, sampler.u) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
connect(sampler.y, clockpropagator1.u) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 295.5, "y": 70}, {"x": 295.5, "y": 115}], "E": 2}]
}
}
connect(clockpropagator1.y, sampler1.y) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 295.5, "y": 185}, {"x": 295.5, "y": 250}], "E": 2}]
}
}
connect(constant1.y, lessthan.u2) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 591.75, "y": 215}, {"x": 591.75, "y": 207}], "E": 2}]
}
}
connect(sampler.y, lessthan.u1) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 455.5, "y": 70}, {"x": 455.5, "y": 156}], "E": 2}]
}
}
end
Flattened Source
component IntegratorFEwInitialSimpler
u = RealInput@[inclk]() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -50, "y1": 450, "x2": 50, "y2": 550, "rot": 0}
},
"tags": []
}
}
ic = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -50, "y1": 200, "x2": 50, "y2": 300, "rot": 0}
},
"tags": []
}
}
reset = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -50, "y1": 20, "x2": 50, "y2": 120, "rot": 0}
},
"tags": []
}
}
y = RealOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 1000, "y1": 440, "x2": 1100, "y2": 540, "rot": 0}
},
"tags": []
}
}
unitdelay = DiscreteComponents.UnitDelay() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 850, "y1": 300, "x2": 750, "y2": 400, "rot": 0}
},
"tags": []
}
}
add = BlockComponents.Math.Add() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 670, "y1": 450, "x2": 770, "y2": 550, "rot": 0}
},
"tags": []
}
}
multiply = BlockComponents.Math.Product() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 550, "y1": 550, "x2": 650, "y2": 650, "rot": 0}
},
"tags": []
}
}
sampletimeblock = DiscreteComponents.SampleTimeSource() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 410, "y1": 620, "x2": 510, "y2": 720, "rot": 0}
},
"tags": []
}
}
lastvalue = DiscreteComponents.Latest() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 120, "y1": 450, "x2": 220, "y2": 550, "rot": 0}
},
"tags": []
}
}
periodicclockprovoker = DiscreteComponents.PeriodicClock(dt = dt) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 260, "y1": 600, "x2": 360, "y2": 700, "rot": 0}
},
"tags": []
}
}
sampler1 = DiscreteComponents.Sampler() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 160, "y1": 200, "x2": 260, "y2": 300, "rot": 0}
},
"tags": []
}
}
clockpropagator = DiscreteComponents.ClockPropagator() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 330, "y1": 320, "x2": 430, "y2": 420, "rot": 0}
},
"tags": []
}
}
sampler = DiscreteComponents.Sampler() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 160, "y1": 20, "x2": 260, "y2": 120, "rot": 0}
},
"tags": []
}
}
clockpropagator1 = DiscreteComponents.ClockPropagator() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 330, "y1": 100, "x2": 430, "y2": 200, "rot": 0}
},
"tags": []
}
}
constant1 = BlockComponents.Sources.Constant() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 480, "y1": 190, "x2": 530, "y2": 240, "rot": 0}
},
"tags": []
}
}
lessthan = DiscreteComponents.Examples.Integrator.LessThan() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 650, "y1": 130, "x2": 750, "y2": 230, "rot": 0}
},
"tags": []
}
}
structural parameter dt::Real = 0.1
variable reset_value::Real = NaN
relations
"""
y@(clk) = ifelse(0.0 < reset, sample(reset_value, clk), y@(clk-1) + u(clk) * dt)
reset_value@(clk) = ifelse(
isnan_wrapper(sample(reset_value, clk)@(clk-1)),
ic@(clk),
reset_value@(clk-1)
)
"""
initial u@(inclk-1) = 0.0
initial reset_value@(clk-1) = 0.0
initial y@(clk-1) = 0.0
connect(unitdelay.u, y) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 1050, "y": 350}], "E": 2}],
"renderStyle": "standard"
}
}
connect(unitdelay.y, add.u1) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 640, "y": 350}, {"x": 640, "y": 470}], "E": 2}],
"renderStyle": "standard"
}
}
connect(sampletimeblock.y, multiply.u2) {
"Dyad": {
"edges": [
{
"S": 1,
"M": [
{"x": 543.5, "y": 670},
{"x": 543.5, "y": 660},
{"x": 540, "y": 660},
{"x": 540, "y": 623}
],
"E": 2
}
],
"renderStyle": "standard"
}
}
connect(multiply.y, add.u2) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 660, "y": 600}, {"x": 660, "y": 530}], "E": 2}],
"renderStyle": "standard"
}
}
connect(lastvalue.y, periodicclockprovoker.y) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 240, "y": 500}, {"x": 240, "y": 650}], "E": 2}],
"renderStyle": "standard"
}
}
connect(u, lastvalue.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
connect(lastvalue.y, multiply.u1) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 431, "y": 500}, {"x": 431, "y": 575}], "E": 2}],
"renderStyle": "standard"
}
}
connect(add.y, y) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 1050, "y": 500}], "E": 2}]
}
}
connect(ic, sampler1.u) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
connect(lastvalue.y, clockpropagator.y) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 275.5, "y": 500}, {"x": 275.5, "y": 405}], "E": 2}]
}
}
connect(sampler1.y, clockpropagator.u) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 295.5, "y": 250}, {"x": 295.5, "y": 335}], "E": 2}]
}
}
connect(reset, sampler.u) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
connect(sampler.y, clockpropagator1.u) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 295.5, "y": 70}, {"x": 295.5, "y": 115}], "E": 2}]
}
}
connect(clockpropagator1.y, sampler1.y) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 295.5, "y": 185}, {"x": 295.5, "y": 250}], "E": 2}]
}
}
connect(constant1.y, lessthan.u2) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 591.75, "y": 215}, {"x": 591.75, "y": 207}], "E": 2}]
}
}
connect(sampler.y, lessthan.u1) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 455.5, "y": 70}, {"x": 455.5, "y": 156}], "E": 2}]
}
}
metadata {}
endTest Cases
No test cases defined.
Related
- Examples
- Experiments
- Analyses
- Tests