Field fix / guidePLC / HMI Code & LogicVendor-agnostic (IEC 61131-3)Access Trafficindustrial-automation

Vehicle Entry Exit Tracking — PLC Control Template

Shared by TSIMEREZIVO Team · 4 Oct 2026 · 39 views

# Vehicle Entry Exit Tracking — Usage Guide ## Overview Dual-loop occupancy tracking template for lots, compounds, or secure yards. Entry is inhibited when configured capacity is reached. ## Commissioning 1. Confirm loop detector edges count one vehicle only 2. Validate occupancy never goes negative on exit events 3. Set `CAPACITY_SP` to the true physical or regulatory capacity --- ## Control Logic — Vendor-Agnostic Pseudocode # Vehicle Entry Exit Tracking — Logic ## Standards: IEC 61131-3 ## Scan Rate: 20ms | Pattern: dual-loop vehicle counting ``` ROUTINE: VehicleEntryExitTracking SCAN_RATE: 20ms // SECTION 1 — EDGE DETECTION ENTRY_EDGE := ENTRY_LOOP AND NOT ENTRY_LOOP_PREV EXIT_EDGE := EXIT_LOOP AND NOT EXIT_LOOP_PREV ENTRY_LOOP_PREV := ENTRY_LOOP EXIT_LOOP_PREV := EXIT_LOOP // SECTION 2 — COUNTING IF ENTRY_EDGE THEN VEHICLE_COUNT := VEHICLE_COUNT + 1; ENTRY_COUNT := ENTRY_COUNT + 1 END_IF IF EXIT_EDGE AND VEHICLE_COUNT > 0 THEN VEHICLE_COUNT := VEHICLE_COUNT - 1; EXIT_COUNT := EXIT_COUNT + 1 END_IF // SECTION 3 — GATE COMMANDS ENTRY_GATE_CMD := ENTRY_REQUEST AND VEHICLE_COUNT < CAPACITY_SP EXIT_GATE_CMD := EXIT_REQUEST IF VEHICLE_COUNT >= CAPACITY_SP THEN SET_ALARM(ALM_FULL, HIGH) END_IF // SECTION 4 — HMI HMI_OCCUPANCY := VEHICLE_COUNT HMI_ENTRY_COUNT := ENTRY_COUNT HMI_EXIT_COUNT := EXIT_COUNT END_ROUTINE ``` --- ## Tag List ```csv Tag Name,Description,Data Type,Direction,Engineering Unit,Range Min,Range Max,Default Value,Address ENTRY_LOOP,Entry Vehicle Loop Detector,BOOL,input,,,,FALSE,DI:0:0.0 EXIT_LOOP,Exit Vehicle Loop Detector,BOOL,input,,,,FALSE,DI:0:0.1 ENTRY_LOOP_PREV,Previous Entry Loop State,BOOL,internal,,,,FALSE, EXIT_LOOP_PREV,Previous Exit Loop State,BOOL,internal,,,,FALSE, ENTRY_EDGE,Entry Loop Rising Edge,BOOL,calculated,,,,FALSE, EXIT_EDGE,Exit Loop Rising Edge,BOOL,calculated,,,,FALSE, ENTRY_REQUEST,Entry Gate Request,BOOL,input,,,,FALSE, EXIT_REQUEST,Exit Gate Request,BOOL,input,,,,FALSE, CAPACITY_SP,Maximum Occupancy,INT,internal,,0,100000,100, VEHICLE_COUNT,Current Occupancy Count,DINT,internal,,0,100000,0, ENTRY_COUNT,Total Entries,DINT,internal,,0,999999,0, EXIT_COUNT,Total Exits,DINT,internal,,0,999999,0, ENTRY_GATE_CMD,Entry Gate Command,BOOL,output,,,,FALSE,DO:1:0.0 EXIT_GATE_CMD,Exit Gate Command,BOOL,output,,,,FALSE,DO:1:0.1 ALM_FULL,Facility Full Alarm,BOOL,calculated,,,,FALSE, HMI_OCCUPANCY,HMI: Occupancy Count,DINT,output,,0,100000,0, HMI_ENTRY_COUNT,HMI: Entry Count,DINT,output,,0,999999,0, HMI_EXIT_COUNT,HMI: Exit Count,DINT,output,,0,999999,0, ``` --- ## Alarm Matrix ```csv Alarm Tag,Condition,Setpoint,Priority,Type,Response,Delay,Auto Acknowledge ALM_FULL,VEHICLE_COUNT >= CAPACITY_SP,capacity,high,process,Facility at full capacity. Entry gate held closed until space is available.,0s,No ```

More like this

Rate, comment, and get full access

Members can download files, rate contributions, and discuss fixes with the engineers who posted them — free.

Join the library