---
url: /dyad/dev/stdlib/DiscreteComponents/components/Examples.SimplePID.md
description: Dyad Examples.SimplePID docs.  DiscreteComponents.Examples.SimplePID()
---

# `Examples.SimplePID` {#Examples.SimplePID}

## Usage {#Usage}

`DiscreteComponents.Examples.SimplePID()`

## Behavior {#Behavior}

## Source {#Source}

```dyad
component SimplePID
  zeroorderhold = DiscreteComponents.ZeroOrderHold() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 440, "y1": 440, "x2": 540, "y2": 540, "rot": 0}
      },
      "tags": []
    }
  }
  discretepidstandard = DiscreteComponents.DiscretePIDStandard(Imethod = DiscretizationMethod.Forward(), Dmethod = DiscretizationMethod.Backward(), with_I = true, with_D = true) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 250, "y1": 440, "x2": 350, "y2": 540, "rot": 0}
      },
      "tags": []
    }
  }
  constant1 = BlockComponents.Sources.Constant(k = 2) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 50, "y1": 410, "x2": 150, "y2": 510, "rot": 0}
      },
      "tags": []
    }
  }
  secondorder = BlockComponents.Continuous.SecondOrder() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 580, "y1": 440, "x2": 680, "y2": 540, "rot": 0}
      },
      "tags": []
    }
  }
  samplewithadeffects = DiscreteComponents.SampleWithADEffects(y_max = 10, y_min = -10) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 540, "y1": 630, "x2": 440, "y2": 730, "rot": 0}
      },
      "tags": []
    }
  }
  periodicclock = DiscreteComponents.PeriodicClock(dt = 0.1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 440, "y1": 760, "x2": 540, "y2": 860, "rot": 0}
      },
      "tags": []
    }
  }
relations
  initial secondorder.x = 1
  initial secondorder.xd = 0
  connect(constant1.y, discretepidstandard.u_s) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 190, "y": 460}, {"x": 190, "y": 462}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(discretepidstandard.y, zeroorderhold.u) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
  connect(zeroorderhold.y, secondorder.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(samplewithadeffects.u, secondorder.y) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 730, "y": 680}, {"x": 730, "y": 490}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(samplewithadeffects.y, discretepidstandard.u_m, periodicclock.y) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [{"x": 200, "y": 680}, {"x": 200, "y": 514}], "E": 2},
        {"S": 3, "M": [{"x": 370, "y": 810}], "E": -1}
      ],
      "junctions": [{"x": 370, "y": 680}],
      "renderStyle": "standard"
    }
  }
end
```

```dyad
component SimplePID
  zeroorderhold = DiscreteComponents.ZeroOrderHold() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 440, "y1": 440, "x2": 540, "y2": 540, "rot": 0}
      },
      "tags": []
    }
  }
  discretepidstandard = DiscreteComponents.DiscretePIDStandard(Imethod = DiscretizationMethod.Forward(), Dmethod = DiscretizationMethod.Backward(), with_I = true, with_D = true) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 250, "y1": 440, "x2": 350, "y2": 540, "rot": 0}
      },
      "tags": []
    }
  }
  constant1 = BlockComponents.Sources.Constant(k = 2) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 50, "y1": 410, "x2": 150, "y2": 510, "rot": 0}
      },
      "tags": []
    }
  }
  secondorder = BlockComponents.Continuous.SecondOrder() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 580, "y1": 440, "x2": 680, "y2": 540, "rot": 0}
      },
      "tags": []
    }
  }
  samplewithadeffects = DiscreteComponents.SampleWithADEffects(y_max = 10, y_min = -10) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 540, "y1": 630, "x2": 440, "y2": 730, "rot": 0}
      },
      "tags": []
    }
  }
  periodicclock = DiscreteComponents.PeriodicClock(dt = 0.1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 440, "y1": 760, "x2": 540, "y2": 860, "rot": 0}
      },
      "tags": []
    }
  }
relations
  initial secondorder.x = 1
  initial secondorder.xd = 0
  connect(constant1.y, discretepidstandard.u_s) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 190, "y": 460}, {"x": 190, "y": 462}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(discretepidstandard.y, zeroorderhold.u) {"Dyad": {"renderStyle": "standard", "edges": [{"S": 1, "E": 2, "M": []}]}}
  connect(zeroorderhold.y, secondorder.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(samplewithadeffects.u, secondorder.y) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 730, "y": 680}, {"x": 730, "y": 490}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(samplewithadeffects.y, discretepidstandard.u_m, periodicclock.y) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [{"x": 200, "y": 680}, {"x": 200, "y": 514}], "E": 2},
        {"S": 3, "M": [{"x": 370, "y": 810}], "E": -1}
      ],
      "junctions": [{"x": 370, "y": 680}],
      "renderStyle": "standard"
    }
  }
metadata {}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses
