PLC_Generation/PLC Data Generator/README_Hub_Updates.md
2025-08-05 14:38:54 +04:00

1.6 KiB

Hub IO Path Updates

Overview

Updated the PLC Data Generator to support two different Hub IO path configurations:

  • SorterHub: For hubs with "S0" in their tagname (e.g., S01_FIOH1, S02_FIOH2)
  • Hub: For regular hubs without "S0" in their tagname

Changes Made

1. Excel File Structure (IO-To-Path.xlsx)

  • The original "Hub" sheet has been renamed to "SorterHub"
  • A new "Hub" sheet has been created for regular hub configurations
  • Both sheets maintain the same column structure: IO, IPath, OPath

2. Code Updates

io_paths.py

  • Updated load_io_path_mappings() to load both Hub and SorterHub sheets
  • Modified get_io_path() to automatically select the correct sheet based on tagname:
    if device_type == 'Hub':
        # Check if the hub has S0 in its name to determine which sheet to use
        if 'S0' in str(tagname).upper():
            df = sorter_hub_df
        else:
            df = hub_df
    

main.py

  • Updated to handle the additional sorter_hub_df parameter from load_io_path_mappings()
  • Passes sorter_hub_df to process_data()

process.py

  • Updated function signature to accept sorter_hub_df parameter
  • Passes sorter_hub_df to get_io_path() calls

Usage

No changes required from the user perspective. The system automatically:

  1. Detects if a hub tagname contains "S0"
  2. Uses the appropriate IO path mapping sheet
  3. Generates correct IO paths based on the hub type

Testing

Tested successfully with MCM01 data, showing proper loading of both Hub sheets and 100% successful IO path mappings.