{
  "node": {
    "id": "block:native-discrete-pid",
    "type": "Block",
    "label": "Discrete weighted PID",
    "properties": {
      "id": "native-discrete-pid",
      "name": "Discrete weighted PID",
      "kind": "studio",
      "summary": "Combines proportional, integral and filtered derivative control with setpoint weights and limits.",
      "behavior": "e = reference − measurement. I candidate = I previous + Ki × elapsed_time × e. u = clamp(Kp × (b reference − measurement) + I + filtered derivative, lower, upper). The worked example connects this operation to signals in Lemonergy Studio.",
      "ports": [
        {
          "name": "in0",
          "direction": "input",
          "unit": "1",
          "description": "Setpoint; real scalar.",
          "shape": [],
          "elementType": "real"
        },
        {
          "name": "in1",
          "direction": "input",
          "unit": "1",
          "description": "Measurement; real scalar.",
          "shape": [],
          "elementType": "real"
        },
        {
          "name": "out0",
          "direction": "output",
          "unit": "1",
          "description": "Control; real scalar.",
          "shape": [],
          "elementType": "real"
        }
      ],
      "parameters": [
        {
          "key": "sampleTimeS",
          "label": "Sample period",
          "unit": "s",
          "default": 0.1,
          "description": "Exact sample grid period. Elapsed-time integration begins after initialization.",
          "min": 1e-06
        },
        {
          "key": "params[0]",
          "label": "Proportional gain",
          "unit": "1",
          "default": 1,
          "description": "Configured finite numerical parameter."
        },
        {
          "key": "params[1]",
          "label": "Integral gain",
          "unit": "1",
          "default": 0.5,
          "description": "Configured finite numerical parameter."
        },
        {
          "key": "params[2]",
          "label": "Derivative gain",
          "unit": "1",
          "default": 0,
          "description": "Configured finite numerical parameter."
        },
        {
          "key": "params[3]",
          "label": "Derivative filter time",
          "unit": "s",
          "default": 0.1,
          "description": "Configured finite numerical parameter."
        },
        {
          "key": "params[4]",
          "label": "Lower output limit",
          "unit": "1",
          "default": -10,
          "description": "Configured finite numerical parameter."
        },
        {
          "key": "params[5]",
          "label": "Upper output limit",
          "unit": "1",
          "default": 10,
          "description": "Configured finite numerical parameter."
        },
        {
          "key": "params[6]",
          "label": "Proportional setpoint weight",
          "unit": "1",
          "default": 1,
          "description": "Configured finite numerical parameter."
        },
        {
          "key": "params[7]",
          "label": "Derivative setpoint weight",
          "unit": "1",
          "default": 0,
          "description": "Configured finite numerical parameter."
        },
        {
          "key": "tables[0]",
          "label": "Initial integral state",
          "unit": "1",
          "default": [
            0
          ],
          "description": "Configured coefficients or initial values in column-major order."
        }
      ],
      "equations": [
        "e = reference − measurement",
        "I candidate = I previous + Ki × elapsed_time × e",
        "u = clamp(Kp × (b reference − measurement) + I + filtered derivative, lower, upper)"
      ],
      "example": {
        "title": "Discrete weighted PID — worked example",
        "text": "Setpoint = 1; Measurement = 0. Control at 1 s = 1.5.",
        "url": "https://design.lemonergy.com/cosim.html?example=block-native-discrete-pid",
        "label": "Open Studio example",
        "inputs": [
          {
            "port": "in0",
            "label": "Setpoint",
            "value": 1,
            "unit": "1"
          },
          {
            "port": "in1",
            "label": "Measurement",
            "value": 0,
            "unit": "1"
          }
        ],
        "checks": [
          {
            "port": "out0",
            "label": "Control",
            "atS": 1,
            "value": 1.5,
            "unit": "1",
            "tolerance": 1e-08
          }
        ]
      },
      "limits": [
        "Shapes and element types are explicit. Values must be finite; automatic reshaping and unit conversion are not performed."
      ],
      "references": [
        "astrom-murray-feedback"
      ],
      "caseIds": [
        "native-native-discrete-pid"
      ],
      "availability": {
        "status": "released",
        "label": "Available in Lemonergy Studio",
        "detail": "The bundled example is available in the production release verified on 28 October 2026. The parameters and examples here are synthetic teaching fixtures, not a characterized cell or a validated operating limit."
      },
      "evidence": [
        "docs/glossary/native-block-verification.json"
      ],
      "sourceRepository": "Lemonergy Studio public contract",
      "sourceRevision": "verification-2026-10-27",
      "exampleTraces": [
        {
          "id": "native-discrete-pid",
          "url": "https://lemonergy.com/learn/glossary/api/traces/native-discrete-pid.json?v=5a216d42acbf",
          "title": "Discrete weighted PID recorded example",
          "exampleId": "block-native-discrete-pid",
          "source": "Executed synthetic Lemonergy Studio example",
          "recordedOn": "2026-10-28",
          "points": 11,
          "channels": 1,
          "omittedChannels": 0,
          "interpolation": "step",
          "solver": {
            "method": "dormand-prince-45",
            "reason": "no-continuous-states"
          }
        }
      ],
      "type": "native-discrete-pid",
      "implementationId": "native-discrete-pid",
      "url": "https://lemonergy.com/learn/glossary/blocks/native-discrete-pid/",
      "documentationUrl": "https://lemonergy.com/learn/glossary/blocks/native-discrete-pid/",
      "sourceFile": "block-library.json",
      "reviewed": "2026-10-27",
      "releaseEvidence": {
        "environment": "production",
        "status": "verified",
        "revision": "e76cadfc203e15eb41f3478d8b1044a5b851953d",
        "verifiedOn": "2026-10-28",
        "exampleUrls": [
          "https://design.lemonergy.com/cosim.html?example=block-native-discrete-pid"
        ]
      }
    }
  },
  "incoming": [
    {
      "id": "edge:usesBlock/native-native-discrete-pid/0",
      "type": "usesBlock",
      "source": "workflow:native-native-discrete-pid",
      "target": "block:native-discrete-pid",
      "properties": {
        "sourceFile": "wiki-blocks.json",
        "position": 0,
        "name": "Discrete weighted PID",
        "type": "native-discrete-pid",
        "role": "e = reference − measurement. I candidate = I previous + Ki × elapsed_time × e. u = clamp(Kp × (b reference − measurement) + I + filtered derivative, lower, upper). The worked example connects this operation to signals in Lemonergy Studio.",
        "settings": [
          "Use the block reference for settings and connections.",
          "Bundled example verified on the production release of 28 October 2026."
        ]
      }
    }
  ],
  "outgoing": [
    {
      "id": "edge:cites/block:native-discrete-pid/reference:astrom-murray-feedback",
      "type": "cites",
      "source": "block:native-discrete-pid",
      "target": "reference:astrom-murray-feedback",
      "properties": {
        "sourceFile": "block-library.json",
        "scope": "Scientific or mathematical background; implementation scope is stated by the block contract"
      }
    }
  ],
  "neighbors": [
    {
      "id": "workflow:native-native-discrete-pid",
      "type": "Workflow",
      "label": "Discrete weighted PID — worked example",
      "properties": {
        "id": "native-native-discrete-pid",
        "title": "Discrete weighted PID — worked example",
        "kind": "studio",
        "summary": "Combines proportional, integral and filtered derivative control with setpoint weights and limits.",
        "steps": [
          "Review the interface, units and model limits.",
          "Open the Studio example and run its bundled model.",
          "Compare outputs with the numerical checks; change one input and run again."
        ],
        "example": "Setpoint = 1; Measurement = 0. Control at 1 s = 1.5.",
        "observe": "Inspect the output channels and checks on the block reference page.",
        "limits": "Shapes and element types are explicit. Values must be finite; automatic reshaping and unit conversion are not performed.",
        "url": "https://design.lemonergy.com/cosim.html?example=block-native-discrete-pid",
        "label": "Open Studio example",
        "evidence": [
          "docs/glossary/native-block-verification.json"
        ]
      }
    },
    {
      "id": "reference:astrom-murray-feedback",
      "type": "Reference",
      "label": "Feedback Systems: An Introduction for Scientists and Engineers, second edition",
      "properties": {
        "title": "Feedback Systems: An Introduction for Scientists and Engineers, second edition",
        "publisher": "Princeton University Press; author-maintained FBSwiki",
        "url": "https://fbswiki.org/wiki/index.php/Feedback_Systems%3A_An_Introduction_for_Scientists_and_Engineers",
        "type": "Textbook",
        "scope": "State-space modeling, feedback and PID control. These mathematical foundations do not establish a particular software implementation.",
        "year": 2021,
        "authors": [
          "Karl J. Åström",
          "Richard M. Murray"
        ],
        "accessed": "2026-10-27"
      }
    }
  ]
}
