{
  "version": 2,
  "name": "Parts Buffer and Run-Time Service",
  "exported": "2026-10-13T00:00:00.000Z",
  "notes": "Generic v1.123 example (not tied to one scene). X1 = part in, X2 = part out, X3 = conveyor running feedback, X4 = service reset PB. CT1 counts parts in the buffer (CTUD). Y1 = buffer full (10), Y2 = buffer has parts but is not full. T1 (RTO) totals conveyor running time; Y3 flashes at 1 Hz once 10 s of running has accumulated, until X4 is pressed.",
  "program": [
    {"id": 1, "rn": 0,
     "comment": "FIRST SCAN — empty the buffer count every time the PLC enters RUN",
     "elements": [
       {"id":101,"kind":"contact","type":"XIC","addr":"SB3"},
       {"id":102,"kind":"block","type":"RES","addr":"CT1","pre":0}
     ]},
    {"id": 2, "rn": 1,
     "comment": "BUFFER COUNT — part in (X1) counts up, part out (X2) counts down, never below 0",
     "elements": [
       {"id":103,"kind":"contact","type":"XIC","addr":"X1"},
       {"id":104,"kind":"block","type":"CTUD","addr":"CT1","pre":10,"cd":"X2"}
     ]},
    {"id": 3, "rn": 2,
     "comment": "Y1 BUFFER FULL — count at or above 10",
     "elements": [
       {"id":105,"kind":"contact","type":"XIC","addr":"CT1"},
       {"id":106,"kind":"output","type":"OTE","addr":"Y1"}
     ]},
    {"id": 4, "rn": 3,
     "comment": "Y2 PARTS WAITING — count between 1 and 9",
     "elements": [
       {"id":107,"kind":"compare","type":"LIM","addr":"CT1/ACC","lo":1,"hi":9,"cmp":0},
       {"id":108,"kind":"output","type":"OTE","addr":"Y2"}
     ]},
    {"id": 5, "rn": 4,
     "comment": "RUN-TIME TOTAL — RTO keeps adding up conveyor running time across every stop",
     "elements": [
       {"id":109,"kind":"contact","type":"XIC","addr":"X3"},
       {"id":110,"kind":"block","type":"RTO","addr":"T1","pre":10000}
     ]},
    {"id": 6, "rn": 5,
     "comment": "Y3 SERVICE DUE — flashes at 1 Hz (SB6) once 10 s of running is reached",
     "elements": [
       {"id":111,"kind":"contact","type":"XIC","addr":"T1"},
       {"id":112,"kind":"contact","type":"XIC","addr":"SB6"},
       {"id":113,"kind":"output","type":"OTE","addr":"Y3"}
     ]},
    {"id": 7, "rn": 6,
     "comment": "SERVICE RESET — one press (rising edge of X4) clears the run-time total",
     "elements": [
       {"id":114,"kind":"contact","type":"P","addr":"X4"},
       {"id":115,"kind":"block","type":"RES","addr":"T1","pre":0}
     ]}
  ],
  "comments": {
    "X1": "Part In",
    "X2": "Part Out",
    "X3": "Conveyor Running",
    "X4": "Service Reset PB",
    "Y1": "Buffer Full",
    "Y2": "Parts Waiting",
    "Y3": "Service Due",
    "CT1": "Buffer Count",
    "CT1/ACC": "Buffer Count",
    "T1": "Run-Time Total"
  }
}
