t now Latest Latest Icon

Latest

Move a value from one clock to another. At each tick of the clock of y, the output is the value that u had at the most recent tick of the clock of u. Before the clock of u has ticked, the output is init.

A tick of the clock of u that occurs at the same instant as a tick of the clock of y is included. Therefore, if the period of y is a multiple of the period of u, the output is the value that u receives at that same instant, and the transition adds no delay.

This block is not equivalent to the sequence u -> ZeroOrderHold -> Sampler -> y. That sequence returns the value from the previous tick of the clock of u, because the hold is a continuous signal that the sampler reads. This block transfers the value at the instant that u receives it.

The block applies to any two clocks. A declared relation between the two clocks is not necessary, and the block does not make one.

Usage

DiscreteComponents.Latest(init=0.0)

Parameters:

NameDescriptionUnitsDefault value
initThe value of y before the clock of u has ticked–0.0

Connectors

  • u - 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)

Behavior

Behavior of this component cannot be rendered because it includes path variables.

Source

"""
Move a value from one clock to another. At each tick of the clock of `y`, the output is the value
that `u` had at the most recent tick of the clock of `u`. Before the clock of `u` has ticked, the
output is `init`.

A tick of the clock of `u` that occurs at the same instant as a tick of the clock of `y` is
included. Therefore, if the period of `y` is a multiple of the period of `u`, the output is the
value that `u` receives at that same instant, and the transition adds no delay.

This block is not equivalent to the sequence `u -> ZeroOrderHold -> Sampler -> y`. That sequence
returns the value from the previous tick of the clock of `u`, because the hold is a continuous
signal that the sampler reads. This block transfers the value at the instant that `u` receives
it.

The block applies to any two clocks. A declared relation between the two clocks is not necessary,
and the block does not make one.
"""
component Latest@[input inclk, input outclk]
  "The input value, on its own clock"
  u = RealInput@[inclk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -40, "y1": 450, "x2": 60, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "The most recent value of `u`, on the clock of `y`"
  y = RealOutput@[outclk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 960, "y1": 450, "x2": 1060, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "The value of `y` before the clock of `u` has ticked"
  parameter init::Real = 0.0
relations
  y@outclk = latest(u, init)
metadata {
  "Dyad": {
    "icons": {"default": "dyad://DiscreteComponents/Latest.svg"},
    "doc": {"behavior": false}
  }
}
end
Flattened Source
"""
Move a value from one clock to another. At each tick of the clock of `y`, the output is the value
that `u` had at the most recent tick of the clock of `u`. Before the clock of `u` has ticked, the
output is `init`.

A tick of the clock of `u` that occurs at the same instant as a tick of the clock of `y` is
included. Therefore, if the period of `y` is a multiple of the period of `u`, the output is the
value that `u` receives at that same instant, and the transition adds no delay.

This block is not equivalent to the sequence `u -> ZeroOrderHold -> Sampler -> y`. That sequence
returns the value from the previous tick of the clock of `u`, because the hold is a continuous
signal that the sampler reads. This block transfers the value at the instant that `u` receives
it.

The block applies to any two clocks. A declared relation between the two clocks is not necessary,
and the block does not make one.
"""
component Latest
  "The input value, on its own clock"
  u = RealInput@[inclk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -40, "y1": 450, "x2": 60, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "The most recent value of `u`, on the clock of `y`"
  y = RealOutput@[outclk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 960, "y1": 450, "x2": 1060, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "The value of `y` before the clock of `u` has ticked"
  parameter init::Real = 0.0
relations
  y@outclk = latest(u, init)
metadata {
  "Dyad": {
    "icons": {"default": "dyad://DiscreteComponents/Latest.svg"},
    "doc": {"behavior": false}
  }
}
end


Test Cases

No test cases defined.

  • Examples
  • Experiments
  • Analyses