Skip to main content
Loading navigation

Build an OPC UA Work-in-Progress Buffer Starvation Dispatcher — implementation

Prompt source

implementation92 lines11 sectionsNo variables1 code block
## Build
Analyze workstation cycle times and buffer levels from simulated OPC UA nodes. Synthesize dynamic lot dispatch proposals to prevent line starvation without direct PLC actuation.

## User
Plant Production Dispatcher

## Workflow
1. Query simulated open62541 OPC UA server node values for station cycle times and queue sizes.
2. Evaluate upstream buffer depletion rates against scheduled station takt times.
3. Generate lot dispatch reassignment proposals to balance workstation loading.
4. Export the recommended dispatch schedule to manufacturing operations for sign-off.

## Interface
Station throughput dashboard with buffer depletion sparklines and proposal approval actions.

## Data
Create synthetic normalized OPC UA data fixtures mimicking open62541 node tables with cycle metrics. Serve from a local mock JSON endpoint.
Starter examples below are synthetic. They are not downloaded records.

## Source
[open62541 OPC UA](https://raw.githubusercontent.com/open62541/open62541/master/README.md)
OPC UA information model variable nodes representing production machine states and telemetry from open62541.

## Tools
pydantic-ai, fastapi, pandas.
Pydantic AI ensures rigid type validation when transforming raw OPC UA telemetry into scheduling proposals.
Fast reasoning LLM capable of tabular arithmetic and queue constraint evaluation.

## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.

## Acceptance
- Calculates starvation lead times for all monitored buffer queues.
- Produces valid lot transfer recommendations without exceeding downstream capacities.
- Flags capacity discrepancies when input station cycles are zero or missing.

## Starter Examples
```json
[
  {
    "input": {
      "stations": [
        {
          "station_id": "ST_10",
          "buffer_count": 2,
          "cycle_time_sec": 45,
          "takt_sec": 50
        },
        {
          "station_id": "ST_20",
          "buffer_count": 12,
          "cycle_time_sec": 70,
          "takt_sec": 50
        }
      ],
      "wip_lots": [
        {
          "lot_id": "LOT_901",
          "current_location": "ST_20_QUEUE",
          "eligible_targets": [
            "ST_10",
            "ST_20"
          ]
        }
      ]
    },
    "expected_output": {
      "bottleneck_station": "ST_10",
      "dispatch_proposals": [
        {
          "lot_id": "LOT_901",
          "recommended_station": "ST_10",
          "rationale": "ST_10 buffer below safety stock with fast cycle rate."
        }
      ],
      "starvation_warning": true
    }
  },
  {
    "input": {
      "stations": [
        {
          "station_id": "ST_30",
          "buffer_count": 0,
          "cycle_time_sec": 0,
          "takt_sec": 60
        }
      ],
      "wip_lots": []
    },
    "expected_output": {
      "bottleneck_station": "ST_30",
      "dispatch_proposals": [],
      "starvation_warning": true
    }
  }
]
```

## Safety
Read-only evaluation of production queue records. Dispatch proposals require manual dispatcher approval before MES entry.
Use mock external writes. Require human review before any real deployment.