{
  "node": {
    "id": "block:battery-incremental-cccv",
    "type": "Block",
    "label": "Incremental CC-CV controller",
    "properties": {
      "id": "battery-incremental-cccv",
      "name": "Incremental CC-CV controller",
      "kind": "studio",
      "summary": "Updates a bounded charge request from voltage error each sample.",
      "behavior": "Adds a proportional voltage-error correction to the previous charging magnitude at each sample, clamps it to the external envelope and emits the negative signed request. Disabling resets the request.",
      "ports": [
        {
          "name": "voltage",
          "direction": "input",
          "unit": "V",
          "description": "Highest cell voltage; scalar.",
          "shape": [],
          "elementType": "real",
          "quantity": "voltage"
        },
        {
          "name": "limit",
          "direction": "input",
          "unit": "A",
          "description": "Charge-current magnitude limit; scalar.",
          "shape": [],
          "elementType": "real",
          "quantity": "current"
        },
        {
          "name": "enable",
          "direction": "input",
          "unit": "true / false",
          "description": "Enable; scalar.",
          "shape": [],
          "elementType": "bool",
          "quantity": "dimensionless"
        },
        {
          "name": "request",
          "direction": "output",
          "unit": "A",
          "description": "Signed current request (charge negative); scalar.",
          "shape": [],
          "elementType": "real",
          "quantity": "current"
        },
        {
          "name": "mode",
          "direction": "output",
          "unit": "1",
          "description": "Mode (0 disabled, 1 CC, 2 CV); scalar.",
          "shape": [],
          "elementType": "real",
          "quantity": "dimensionless"
        }
      ],
      "parameters": [
        {
          "key": "sampleTimeS",
          "label": "Sample interval (s)",
          "unit": "s",
          "default": 0.1,
          "description": "Positive sample interval. Initialization has zero elapsed time; subsequent accepted samples update memory."
        },
        {
          "key": "targetV",
          "label": "Voltage target (V)",
          "unit": "V",
          "default": 4,
          "description": "Voltage target (V). This is an editable model input; the default belongs to the synthetic worked example."
        },
        {
          "key": "kp",
          "label": "Proportional gain (A/V)",
          "unit": "A/V",
          "default": 5,
          "description": "Proportional gain (A/V). This is an editable model input; the default belongs to the synthetic worked example."
        },
        {
          "key": "ki",
          "label": "Integral gain (A/(V·s))",
          "unit": "A/(V·s)",
          "default": 0,
          "description": "Integral gain (A/(V·s)). This is an editable model input; the default belongs to the synthetic worked example."
        }
      ],
      "equations": [
        "magnitude[k] = clamp(magnitude[k-1] + kp * (targetV - voltage[k]), 0, limit[k])",
        "request[k] = -magnitude[k]"
      ],
      "example": {
        "title": "Incremental CC-CV controller worked example",
        "text": "Use the defaults below with Highest cell voltage = 3.9 V, Charge-current magnitude limit = 2 A, Enable = 1 true / false. At 0 s, Signed current request (charge negative) is -0.5 A. Additional checks are listed below.",
        "url": "https://design.lemonergy.com/cosim.html?example=block-battery-incremental-cccv",
        "label": "Open Studio example",
        "checks": [
          {
            "port": "request",
            "atS": 0,
            "value": -0.5,
            "tolerance": 1e-08,
            "label": "Signed current request (charge negative)",
            "unit": "A"
          }
        ],
        "inputs": [
          {
            "port": "voltage",
            "label": "Highest cell voltage",
            "value": 3.9,
            "unit": "V"
          },
          {
            "port": "limit",
            "label": "Charge-current magnitude limit",
            "value": 2,
            "unit": "A"
          },
          {
            "port": "enable",
            "label": "Enable",
            "value": 1,
            "unit": "true / false"
          }
        ]
      },
      "limits": [
        "The gain acts per update. Changing sample interval changes the response; this is an incremental controller, not the PI variant.",
        "The example verifies numerical behavior for synthetic parameters. Cell characterization and validation for an intended use are separate tasks."
      ],
      "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."
      },
      "references": [
        "astrom-murray-feedback",
        "tomaszewska-charging"
      ],
      "evidence": [
        "docs/glossary/native-block-verification.json"
      ],
      "sourceRepository": "Lemonergy Studio public contract",
      "sourceRevision": "verification-2026-10-27",
      "caseIds": [
        "native-battery-incremental-cccv"
      ],
      "exampleTraces": [
        {
          "id": "battery-incremental-cccv",
          "url": "https://lemonergy.com/learn/glossary/api/traces/battery-incremental-cccv.json?v=c88fa0132d9a",
          "title": "Incremental CC-CV controller recorded example",
          "exampleId": "block-battery-incremental-cccv",
          "source": "Executed synthetic Lemonergy Studio example",
          "recordedOn": "2026-10-28",
          "points": 11,
          "channels": 2,
          "omittedChannels": 0,
          "interpolation": "step",
          "solver": {
            "method": "dormand-prince-45",
            "reason": "no-continuous-states"
          }
        }
      ],
      "type": "battery-incremental-cccv",
      "implementationId": "battery-incremental-cccv",
      "url": "https://lemonergy.com/learn/glossary/blocks/battery-incremental-cccv/",
      "documentationUrl": "https://lemonergy.com/learn/glossary/blocks/battery-incremental-cccv/",
      "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-battery-incremental-cccv"
        ]
      }
    }
  },
  "incoming": [
    {
      "id": "edge:usesBlock/native-battery-incremental-cccv/0",
      "type": "usesBlock",
      "source": "workflow:native-battery-incremental-cccv",
      "target": "block:battery-incremental-cccv",
      "properties": {
        "sourceFile": "wiki-blocks.json",
        "position": 0,
        "name": "Incremental CC-CV controller",
        "type": "battery-incremental-cccv",
        "role": "Adds a proportional voltage-error correction to the previous charging magnitude at each sample, clamps it to the external envelope and emits the negative signed request. Disabling resets the request.",
        "settings": [
          "Use the parameter values in the block reference.",
          "Bundled example verified on the production release of 28 October 2026."
        ]
      }
    }
  ],
  "outgoing": [
    {
      "id": "edge:cites/block:battery-incremental-cccv/reference:astrom-murray-feedback",
      "type": "cites",
      "source": "block:battery-incremental-cccv",
      "target": "reference:astrom-murray-feedback",
      "properties": {
        "sourceFile": "block-library.json",
        "scope": "Scientific or mathematical background; implementation scope is stated by the block contract"
      }
    },
    {
      "id": "edge:cites/block:battery-incremental-cccv/reference:tomaszewska-charging",
      "type": "cites",
      "source": "block:battery-incremental-cccv",
      "target": "reference:tomaszewska-charging",
      "properties": {
        "sourceFile": "block-library.json",
        "scope": "Scientific or mathematical background; implementation scope is stated by the block contract"
      }
    }
  ],
  "neighbors": [
    {
      "id": "workflow:native-battery-incremental-cccv",
      "type": "Workflow",
      "label": "Incremental CC-CV controller worked example",
      "properties": {
        "id": "native-battery-incremental-cccv",
        "title": "Incremental CC-CV controller worked example",
        "kind": "studio",
        "summary": "Updates a bounded charge request from voltage error each sample.",
        "steps": [
          "Review the block inputs, units and model limits.",
          "Open the Studio example and run its bundled model.",
          "Compare the output channels with the numerical checks; change one input and run again."
        ],
        "example": "Use the defaults below with Highest cell voltage = 3.9 V, Charge-current magnitude limit = 2 A, Enable = 1 true / false. At 0 s, Signed current request (charge negative) is -0.5 A. Additional checks are listed below.",
        "observe": "Inspect the outputs and numerical checks on the block reference page.",
        "limits": "The gain acts per update. Changing sample interval changes the response; this is an incremental controller, not the PI variant. The example verifies numerical behavior for synthetic parameters. Cell characterization and validation for an intended use are separate tasks.",
        "url": "https://design.lemonergy.com/cosim.html?example=block-battery-incremental-cccv",
        "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"
      }
    },
    {
      "id": "reference:tomaszewska-charging",
      "type": "Reference",
      "label": "Lithium-ion battery fast charging: A review",
      "properties": {
        "title": "Lithium-ion battery fast charging: A review",
        "publisher": "eTransportation",
        "url": "https://doi.org/10.1016/j.etran.2019.100011",
        "type": "Review article",
        "scope": "CC-CV and alternative charging protocols, transport limitations, degradation and thermal implications; results depend on cell and test conditions. Software behavior is documented separately in Lemonergy block references.",
        "year": 2019,
        "authors": [
          "Anna Tomaszewska et al."
        ],
        "accessed": "2026-10-27"
      }
    }
  ]
}
