---
url: /dyad/dev/stdlib/DiscreteComponents/components/ZeroOrderHold.md
description: Dyad ZeroOrderHold docs.  Zero-order hold block.
---

# `ZeroOrderHold` {#ZeroOrderHold}

Zero-order hold block.

Maps the clocked input signal `u` to the continuous-time output signal `y`. Between the ticks of the clock of `u`, `y` is held constant at the value `u` took at the most recent tick.

Before the clock of `u` has ticked, `y` equals `initial_condition`.

## Usage {#Usage}

`DiscreteComponents.ZeroOrderHold(initial_condition=0)`

## Parameters: {#Parameters:}

|                Name |                                         Description | Units | Default value |
| -------------------:| ---------------------------------------------------:| -----:| -------------:|
| `initial_condition` | The value of `y` before the clock of `u` has ticked |     – |             0 |

## Connectors {#Connectors}

* `u` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

* `y` - This connector represents a real signal as an output from a component ([`RealOutput`](/stdlib/Dyad/connectors/RealOutput#RealOutput))

## Behavior {#Behavior}

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

## Source {#Source}

```dyad
"""
Zero-order hold block.

Maps the clocked input signal `u` to the continuous-time output signal `y`. Between the
ticks of the clock of `u`, `y` is held constant at the value `u` took at the most recent
tick.

Before the clock of `u` has ticked, `y` equals `initial_condition`.
"""
component ZeroOrderHold@[input clk]
  "The clocked input signal"
  u = RealInput@[clk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -40, "y1": 450, "x2": 60, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "The held, continuous-time output signal"
  y = RealOutput() {
    "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 initial_condition::Real = 0
relations
  y = hold(u)
  initial hold(u) = initial_condition
metadata {
  "Dyad": {
    "icons": {"default": "dyad://DiscreteComponents/ZeroOrderHold.svg"},
    "doc": {"behavior": false}
  }
}
end
```

```dyad
"""
Zero-order hold block.

Maps the clocked input signal `u` to the continuous-time output signal `y`. Between the
ticks of the clock of `u`, `y` is held constant at the value `u` took at the most recent
tick.

Before the clock of `u` has ticked, `y` equals `initial_condition`.
"""
component ZeroOrderHold
  "The clocked input signal"
  u = RealInput@[clk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -40, "y1": 450, "x2": 60, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "The held, continuous-time output signal"
  y = RealOutput() {
    "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 initial_condition::Real = 0
relations
  y = hold(u)
  initial hold(u) = initial_condition
metadata {
  "Dyad": {
    "icons": {"default": "dyad://DiscreteComponents/ZeroOrderHold.svg"},
    "doc": {"behavior": false}
  }
}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`SimpleRelayControl`](ZeroOrderHold.md)

  * [`TestDiscreteCascadeServoController`](ZeroOrderHold.md)

  * [`TestDiscreteCascadeServoControllerDrive`](ZeroOrderHold.md)

  * [`TestDiscreteCascadeServoControllerFF`](ZeroOrderHold.md)

  * [`TestNormalNoise`](ZeroOrderHold.md)

  * [`TestSampleWithADEffects`](ZeroOrderHold.md)

  * [`TestUniformNoise`](ZeroOrderHold.md)

  * [`TestZeroOrderHold`](ZeroOrderHold.md)
