{
  "version": 2,
  "name": "Analog Tank Level with SCL",
  "exported": "2026-11-21T00:00:00.000Z",
  "notes": "Tank Fill scene, linked as the only scene at offset 0. Simulator v1.133+: the tank's 4-20 mA level transmitter is wired to AX1 through a simulated 4-20 mA analog input card (4 mA = 0 counts, 20 mA = 4095). SCL scales AX1 to percent (D1, REAL) and litres for a 2000 L tank (D3, INT). Auto cycle on analog setpoints: fill until 75.0 %, then drain back to 25.0 % (drain latch = dead band), repeat. Mixer only above 30.0 % (blades covered). High-level alarm at 90.0 % or the overflow float. Start needs Stop X4 and E-Stop X5 released and the selector X6 in AUTO.",
  "program": [
    {"id": 1, "rn": 0,
     "comment": "LEVEL % — SCL scales AX1 counts 0–4095 to 0.0–100.0 % in D1 (REAL)",
     "elements": [
       {"id":101,"kind":"contact","type":"XIC","addr":"SB1"},
       {"id":102,"kind":"block","type":"SCL","addr":"D1","src":"AX1","inMin":0,"inMax":4095,"outMin":0,"outMax":100,"dt":"REAL","pre":0}
     ]},
    {"id": 2, "rn": 1,
     "comment": "LEVEL LITRES — same counts scaled to a 2000 L tank in D3 (INT, rounded)",
     "elements": [
       {"id":103,"kind":"contact","type":"XIC","addr":"SB1"},
       {"id":104,"kind":"block","type":"SCL","addr":"D3","src":"AX1","inMin":0,"inMax":4095,"outMin":0,"outMax":2000,"dt":"INT","pre":0}
     ]},
    {"id": 3, "rn": 2,
     "comment": "AUTO RUN — (Start X3 OR seal-in C1) · Stop X4 N.C. · E-Stop X5 N.C. · Auto X6",
     "elements": [
       {"id":107,"kind":"parallel","type":"XIC","addr":"","branches":[
         [
           {"id":105,"kind":"contact","type":"XIC","addr":"X3"}
         ],
         [
           {"id":106,"kind":"contact","type":"XIC","addr":"C1"}
         ]
       ]},
       {"id":108,"kind":"contact","type":"XIC","addr":"X4"},
       {"id":109,"kind":"contact","type":"XIC","addr":"X5"},
       {"id":110,"kind":"contact","type":"XIC","addr":"X6"},
       {"id":111,"kind":"output","type":"OTE","addr":"C1"}
     ]},
    {"id": 4, "rn": 3,
     "comment": "C2 FILLING — running, not draining, level below 75.0 %",
     "elements": [
       {"id":112,"kind":"contact","type":"XIC","addr":"C1"},
       {"id":113,"kind":"contact","type":"XIO","addr":"C3"},
       {"id":114,"kind":"compare","type":"LES","addr":"D1","cmp":75,"dt":"REAL"},
       {"id":115,"kind":"output","type":"OTE","addr":"C2"}
     ]},
    {"id": 5, "rn": 4,
     "comment": "START DRAIN — running and level at or above 75.0 % (latch C3)",
     "elements": [
       {"id":120,"kind":"contact","type":"XIC","addr":"C1"},
       {"id":122,"kind":"compare","type":"GEQ","addr":"D1","cmp":75,"dt":"REAL"},
       {"id":123,"kind":"output","type":"OTL","addr":"C3"}
     ]},
    {"id": 6, "rn": 5,
     "comment": "END DRAIN — level at or below 25.0 % OR not running (unlatch C3)",
     "elements": [
       {"id":126,"kind":"parallel","type":"XIC","addr":"","branches":[
         [
           {"id":124,"kind":"compare","type":"LEQ","addr":"D1","cmp":25,"dt":"REAL"}
         ],
         [
           {"id":125,"kind":"contact","type":"XIO","addr":"C1"}
         ]
       ]},
       {"id":127,"kind":"output","type":"OTU","addr":"C3"}
     ]},
    {"id": 7, "rn": 6,
     "comment": "Y1 INLET VALVE — filling, blocked by the overflow float X10",
     "elements": [
       {"id":128,"kind":"contact","type":"XIC","addr":"C2"},
       {"id":129,"kind":"contact","type":"XIO","addr":"X10"},
       {"id":130,"kind":"output","type":"OTE","addr":"Y1"}
     ]},
    {"id": 8, "rn": 7,
     "comment": "Y2 DRAIN PUMP — draining",
     "elements": [
       {"id":131,"kind":"contact","type":"XIC","addr":"C3"},
       {"id":132,"kind":"output","type":"OTE","addr":"Y2"}
     ]},
    {"id": 9, "rn": 8,
     "comment": "Y4 MIXER — running and level above 30.0 % (blades covered)",
     "elements": [
       {"id":133,"kind":"contact","type":"XIC","addr":"C1"},
       {"id":134,"kind":"compare","type":"GRT","addr":"D1","cmp":30,"dt":"REAL"},
       {"id":135,"kind":"output","type":"OTE","addr":"Y4"}
     ]},
    {"id": 10, "rn": 9,
     "comment": "Y3 HIGH LEVEL ALARM — level at or above 90.0 % OR overflow float X10",
     "elements": [
       {"id":138,"kind":"parallel","type":"XIC","addr":"","branches":[
         [
           {"id":136,"kind":"compare","type":"GEQ","addr":"D1","cmp":90,"dt":"REAL"}
         ],
         [
           {"id":137,"kind":"contact","type":"XIC","addr":"X10"}
         ]
       ]},
       {"id":139,"kind":"output","type":"OTE","addr":"Y3"}
     ]}
  ],
  "comments": {
    "SB1": "Always ON",
    "AX1": "Level counts",
    "D1": "Level %",
    "D3": "Level litres",
    "X3": "Start PB",
    "X4": "Stop N.C.",
    "X5": "E-Stop N.C.",
    "X6": "Auto Mode",
    "X10": "Overflow Float",
    "C1": "Auto Running",
    "C2": "Filling",
    "C3": "Draining",
    "Y1": "Inlet Valve",
    "Y2": "Drain Pump",
    "Y3": "High Alarm",
    "Y4": "Mixer"
  }
}
