2025-12-06 19:16:58 +04:00

2.6 KiB

Splitter Detection Logic in IO.lsp

Overview

The script decides whether to create a single cable or two cables + splitter based on the DESCA values in each pair.

Decision Flow

Step 1: Check if both DESCA values are filled

If val1 = "" OR val2 = ""
  → Go to Case 2 (single value handling)
Else (both val1 and val2 have values)
  → Go to Case 1 (pair handling)

Step 2: Case 1 - Both values filled (Pair handling)

For FIO/FIOH blocks (special handling at lines 318-427):

SPLITTER CREATED if:

  • Both values contain "TPE" AND they're different names (e.g., TPE2 vs TPE3)
  • One contains "RCV" and other contains "SND" (or vice versa)

SINGLE CABLE if:

  • None of the splitter conditions above match → default to single cable

For all other blocks (VFD, SIO, etc. at lines 432-445):

SINGLE CABLE if values match any of these patterns:

  • Both contain "SEL"
  • Both contain "DPM"
  • Both contain "VFD" AND both contain "STO"
  • One contains "_PB" and other contains "_PB_LT" (pushbutton + light)
  • Both contain "BCN" (beacon stack)
  • Both contain "EPC"
  • Both contain "SSP"

TWO CABLES + SPLITTER if:

  • None of the single-cable conditions match → default to splitter

Summary Table

DESCA1 Pattern DESCA2 Pattern Result
*_SEL* *_SEL* Single cable
*_DPM* *_DPM* Single cable
*VFD*STO* *VFD*STO* Single cable
*_PB* *_PB_LT* Single cable
*_PB_LT* *_PB* Single cable
*BCN* *BCN* Single cable
*EPC* *EPC* Single cable
*SSP* *SSP* Single cable
*TPE* (different) *TPE* (different) ⚠️ SPLITTER (FIO only)
*RCV* *SND* ⚠️ SPLITTER (FIO only)
*SND* *RCV* ⚠️ SPLITTER (FIO only)
Anything else Anything else ⚠️ SPLITTER

Key Code Locations

  • Lines 318-332: FIO/FIOH splitter conditions (TPE pairs, RCV/SND pairs)
  • Lines 432-445: All other blocks - single cable conditions
  • Lines 505-519: Default ELSE branch - creates splitter for unmatched pairs

Example Scenarios

  1. Beacon stack (BYDC_6_BCN1_A + BYDC_6_BCN1_H):

    • Both contain "BCN" → Single cable (line 443)
  2. Pushbutton + light (*_PB + *_PB_LT):

    • Pattern match → Single cable (lines 440-441)
  3. TPE pairs (*TPE1 + *TPE2):

    • For FIO blocks → ⚠️ Splitter (lines 322-324)
    • For other blocks → ⚠️ Splitter (default)
  4. Two different devices (e.g., *DEVICE1 + *DEVICE2):

    • No pattern match → ⚠️ Splitter (default)