Skip to content
LIBRARY
Examples.Integrator.IntegratorFEwInitialSimpler.md

Examples.Integrator.IntegratorFEwInitialSimpler ​

Usage ​

DiscreteComponents.Examples.Integrator.IntegratorFEwInitialSimpler()

Parameters: ​

NameDescriptionUnitsDefault 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 ​

NameDescriptionUnits
reset_value–

Behavior ​

Source ​

dyad
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.LastValue() {
    "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
dyad
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.LastValue() {
    "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 {}
end


Test Cases ​

No test cases defined.