---
url: /dyad/stable/stdlib/DiscreteComponents/components/PeriodicClock.md
description: >-
  Dyad PeriodicClock docs.  A periodic clock that ticks once every dt time
  units.
---

# `PeriodicClock` {#PeriodicClock}

A periodic clock that ticks once every `dt` time units.

Connect any real output to the input `y` here, to force it to be on the clock defined by `dt`.

## Usage {#Usage}

`DiscreteComponents.PeriodicClock()`

## Parameters: {#Parameters:}

|     Name |                                                 Description | Units | Default value |
| --------:| -----------------------------------------------------------:| -----:| -------------:|
|     `dt` |      The period between ticks, in the same units as `time`. |     – |               |
| `offset` | Doesn't work yet - don't set this to anything other than 0! |     – |           0.0 |

## Connectors {#Connectors}

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

## Behavior {#Behavior}

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

## Source {#Source}

```dyad
"""
A periodic clock that ticks once every `dt` time units.

Connect any real output to the input `y` here, to force it to be on the clock defined by `dt`.
"""
external component PeriodicClock@[output clk extends Periodic]
  "Connect any output here, to force it to be on the clock defined in this component."
  y = RealInput@[clk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 50, "y1": 450, "x2": -50, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "The period between ticks, in the same units as `time`."
  structural parameter dt::Real
  "Doesn't work yet - don't set this to anything other than 0!"
  structural parameter offset::Real = 0.0
relations
metadata {
  "Dyad": {
    "icons": {"default": "dyad://DiscreteComponents/PeriodicClock.svg"},
    "doc": {"behavior": false}
  }
}
end
```

```dyad
"""
A periodic clock that ticks once every `dt` time units.

Connect any real output to the input `y` here, to force it to be on the clock defined by `dt`.
"""
external component PeriodicClock
  "Connect any output here, to force it to be on the clock defined in this component."
  y = RealInput@[clk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 50, "y1": 450, "x2": -50, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "The period between ticks, in the same units as `time`."
  structural parameter dt::Real
  "Doesn't work yet - don't set this to anything other than 0!"
  structural parameter offset::Real = 0.0
relations
metadata {
  "Dyad": {
    "icons": {"default": "dyad://DiscreteComponents/PeriodicClock.svg"},
    "doc": {"behavior": false}
  }
}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`IntegratorFEwInitialTest`](PeriodicClock.md)

  * [`ResetValueTrackerTest`](PeriodicClock.md)

  * [`SimpleRelayControl`](PeriodicClock.md)

  * [`TestClockPropagator`](PeriodicClock.md)

  * [`TestDiscreteCascadeServoController`](PeriodicClock.md)

  * [`TestDiscreteCascadeServoControllerDrive`](PeriodicClock.md)

  * [`TestDiscreteCascadeServoControllerFF`](PeriodicClock.md)

  * [`TestDiscreteIntegrator`](PeriodicClock.md)

  * [`TestNDelay`](PeriodicClock.md)

  * [`TestNormalNoise`](PeriodicClock.md)

  * [`TestPeriodicClock`](PeriodicClock.md)

  * [`TestSampleWithADEffects`](PeriodicClock.md)

  * [`TestUniformNoise`](PeriodicClock.md)

  * [`TestUnitDelay`](PeriodicClock.md)

  * [`TestUnitDifference`](PeriodicClock.md)

  * [`TestZeroOrderHold`](PeriodicClock.md)
