| HENKEL | Alpla | Vetromeccanica | AUTEFA | | | ---------------------- | ------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | | Before Changeover | Sends IDH_BTL_NEXT number to be validated | | | | | _Data_To_EbConvey[38]_ | | | | | | | Validates IDH_BTL_NEXT is valid number and send acknowledge | | | | | | _Data_From_EbConvey[0].2_ | | | | | Step 1 | Operator manually selects "Line Clearance" (?) and send signal "0" on "CalculatedBottlesRemainingToFill". | | | | | | _Data_To_EbConvey[23]_ | | | | | Step 2 | | Stops taking bottles out of trays and sends what is already on the tables and conveyors. | Emptying Merger and Line | Stops taking bottles out of trays and sends what is already on the tables and conveyors. | | | | _N/A_ | _TG10 Send 0 in Bottles for Actual Batch_ | | | Step 3 | Operator verifies line is empty and sends "changeover request" signal after last bottle goes thorugh filler. | | | | | | _Data_To_EbConvey[0].0_ | | | | | Step 4 | | Operator verifies line is empty and sends "line is busy with changeover", confirming on Popup screen | | | | | | _Data_From_EbConvey[0].0_ | | | | Step 5 | | | Starts changeover | Starts changeover | | | | | _Data_From_EbConvey[0].0_ | _Data_From_EbConvey[0].0_ | | Step 6 | | | Ends changeover. Sends signal "Changeover is finished and ready. | Ends changeover. Sends signal "Changeover is finished and ready. | | | | | _Data_From_EbConvey[0].1_ | _Data_From_EbConvey[0].1_ | | | | | | | | | | | | | | Step 7 | Send Reset counters signal | | Reset Counters | | | | _Data_To_EbConvey[0].1_ | | | | | Step 8 | Send new value on "CalculatedBottlesRemainingToFill". | | | | | | _Data_To_EbConvey[23]_ | | | | | Step 9 | Send Changeover Complete. To be considered "Production Ready" | Starts conveying bottles. | Finish Chanover Cycle | | | | _Data_To_EbConvey[0].2_ | | | | # Batch Lifecycle Process Documentation ## Overview This document details the step-by-step process of a batch changeover in the production line, including all interactions between HENKEL, ALPLA, Vetromeccanica, and AUTEFA systems. ## System Roles - **HENKEL**: Controls filling process and initiates batch changes - **ALPLA**: Manages bottle production and validates batch data - **Vetromeccanica**: Coordinates conveyor systems and inter-system communications - **AUTEFA**: Handles empty bottle logistics and tray loading ## Pre-Changeover Phase ### Batch Validation 1. **HENKEL → ALPLA** - Sends next batch bottle ID (IDH_BTL_NEXT) - Location: `Data_To_EbConvey[38]` 2. **ALPLA Response** - Validates IDH_BTL_NEXT number - Sends acknowledgment - Signal: `Data_From_EbConvey[0].2` ## Changeover Process ### Step 1: Line Clearance Initiation - **HENKEL Action**: - Operator selects "Line Clearance" - Sets "CalculatedBottlesRemainingToFill" to 0 - Location: `Data_To_EbConvey[23]` ### Step 2: Production Stop - **Vetromeccanica Actions**: - Stops bottle unloading from trays - Continues processing bottles already on conveyors - **AUTEFA Actions**: - Initiates merger and line emptying - Updates TG10 telegram with 0 in Bottles for Actual Batch ### Step 3: Line Verification - **HENKEL Action**: - Operator verifies empty line - Sends changeover request after last bottle passes filler - Signal: `Data_To_EbConvey[0].0` ### Step 4: Changeover Confirmation - **Vetromeccanica Action**: - Operator verifies empty line - Confirms "line busy with changeover" via popup - Signal: `Data_From_EbConvey[0].0` ### Step 5: Changeover Execution - **AUTEFA & Vetromeccanica**: - Start changeover process - Signal: `Data_From_EbConvey[0].0` ### Step 6: Completion Confirmation - **AUTEFA & Vetromeccanica**: - Send "Changeover finished and ready" signal - Signal: `Data_From_EbConvey[0].1` ## Post-Changeover Phase ### Step 7: Counter Reset - **HENKEL Action**: - Sends reset counters signal - Signal: `Data_To_EbConvey[0].1` - **AUTEFA Action**: - Resets internal counters ### Step 8: Production Parameters - **HENKEL Action**: - Updates "CalculatedBottlesRemainingToFill" with new value - Location: `Data_To_EbConvey[23]` ### Step 9: Production Resume - **HENKEL Action**: - Sends "Changeover Complete" signal - Signal: `Data_To_EbConvey[0].2` - **Vetromeccanica Action**: - Starts conveying bottles - **AUTEFA Action**: - Completes changeover cycle ## Communication Flow Diagram ```mermaid sequenceDiagram participant H as HENKEL participant A as ALPLA participant V as Vetromeccanica participant AU as AUTEFA H->>A: Send IDH_BTL_NEXT A->>H: Validate & Acknowledge H->>V: Set CalculatedBottlesRemainingToFill = 0 V->>AU: Stop Unloading H->>V: Send Changeover Request V->>V: Confirm Empty Line V->>AU: Start Changeover AU->>V: Confirm Changeover Complete H->>V: Reset Counters H->>V: New Bottle Count H->>V: Production Ready ``` ## Signal Reference Table | Step | Signal | Location | Description | |------|---------|-----------|-------------| | Pre-Change | IDH_BTL_NEXT | Data_To_EbConvey[38] | Next batch bottle ID | | Validation | Acknowledge | Data_From_EbConvey[0].2 | Batch validation | | Initiation | Zero Count | Data_To_EbConvey[23] | Remaining bottles count | | Request | Changeover | Data_To_EbConvey[0].0 | Start changeover | | Confirmation | Line Busy | Data_From_EbConvey[0].0 | Line status | | Completion | Ready | Data_From_EbConvey[0].1 | Line ready | | Reset | Counters | Data_To_EbConvey[0].1 | Reset counters | | Resume | Complete | Data_To_EbConvey[0].2 | Production ready | ## Error Handling ### Validation Errors - Invalid batch number detection - Communication timeout handling - Line status verification failures ### Process Safeguards - Multiple operator confirmations required - Line emptiness verification - Status signal validation ### Recovery Procedures 1. Counter synchronization check 2. Line status verification 3. Communication reset if needed 4. Manual intervention protocols *** # Vetromeccanica Software Implementation Guide ## Software Architecture ### PLC Distribution 1. **Q1 PLCs (Client Side)** - Main communication interface with Henkel - Manages line controllers Q2-Q4 - Handles real-time batch data processing 2. **Supervisor PLC (Server Side)** - Central communication hub - Manages AUTEFA telegrams - Provides ALPLA OPC-UA interface - Handles SKU database and searches ## Data Structures ### Client Side Structures ```pascal // FromHenkel Communication Structure TYPE "FromHenkelv2_U" STRUCT di : Array[0..49] of DINT; // Raw data from Henkel STW : "Bool32_U"; // Status word bits LineStatus : Struct di0 : "Bool32_U"; // Line status bits END_STRUCT; SignalExchange : Struct // Line signals Filler : Struct CalculatedBottlesRemainingToFill : DINT; END_STRUCT; END_STRUCT; AB_IDH_BTL : Array[0..11] of CHAR; // Current batch ID NB_IDH_BTL : Array[0..11] of CHAR; // Next batch ID PO_NUMBER : Array[0..11] of CHAR; // Current order PO_NUMBER_NEXT : Array[0..11] of CHAR; // Next order ABBottlesNumber : DINT; // Current batch count NBBottlesNumber : DINT; // Next batch count END_STRUCT; END_TYPE ``` ### Server Side Structures ```pascal // SKU Information Structure TYPE "StSku_U" STRUCT Av : DInt; // Article Variant ID AvDesc : String[36]; // Description ProdFamily : DInt; // Product Family CustomArticleNum : String[12]; // Customer Article Number END_STRUCT; END_TYPE // AUTEFA Message Header TYPE "AUTEFA_message_header" STRUCT message_length : Int; endian_format : Word := 16#4321; telegram_number : Int; task : Int := 1; error_number : DInt; send_client_ID : "Client_ID"; timestamp : "TX_Time"; END_STRUCT; END_TYPE ``` ## Key Functions Implementation ### 1. Byte Processing (Q1) ```pascal // Process incoming Henkel data FOR #i := 0 TO 49 DO #atFromHenkel[#i] := "FromHenkel".di[#i]; CASE #i OF 0, 10, 20, 35..40, 44..49: // Control words and IDs #diAppo.%B3 := #atFromHenkel[#i].%B2; #diAppo.%B2 := #atFromHenkel[#i].%B3; #diAppo.%B1 := #atFromHenkel[#i].%B0; #diAppo.%B0 := #atFromHenkel[#i].%B1; ELSE // Process data #diAppo.%W0 := #atFromHenkel[#i].%W1; #diAppo.%W1 := #atFromHenkel[#i].%W0; END_CASE; #atFromHenkel[#i] := #diAppo; END_FOR; ``` ### 2. SKU Search (Supervisor) ```pascal // Search SKU in ALPLA database IF NOT "LineN[#i].SearchEnd" THEN IF "LineN[#i].i" >= 249 THEN "LineN[#i].SkuActualNotFound" := TRUE; "LineN[#i].SkuActualReq.Av" := 0; "LineN[#i].SkuActualReq.ProdFamily" := 0; "LineN[#i].SearchActualSku" := FALSE; ELSIF "LineN[#i].ReqActualCustomProdNum" = "AlplaSkuList[LineN[#i].i].CustomArticleNum" THEN "LineN[#i].SkuActualReq" := "AlplaSkuList[LineN[#i].i]"; "LineN[#i].SearchActualSku" := FALSE; ELSE "LineN[#i].i" += 1; END_IF; END_IF; ``` ### 3. AUTEFA Telegram Preparation (Supervisor) ```pascal // Prepare TG10 Production Info "TG10_send.DATA.Filling_Line" := #LineNumber; // Actual batch data Strg_TO_Chars( Strg := "BatchActual.BatchNumber", pChars := 0, Cnt => #uiCnt, Chars := "TG10_send.DATA.Batch_ID" ); "TG10_send.DATA.Active_Batch_Target_1000" := DINT_TO_INT("ToAutefa.TG10_ProductionInfo" / 1000); "TG10_send.DATA.Active_Batch_Target_Units" := DINT_TO_INT("ToAutefa.TG10_ProductionInfo" MOD 1000); "TG10_send.DATA.Active_Batch_Article_Variant_ID" := "WriteData_D.ToQ1.FromAlpla.ActualSku.Av"; ``` ## Data Flow Processing ### 1. Q1 Processing Sequence ```mermaid graph TD A[Receive Henkel Data] --> B[Byte Swap Processing] B --> C[Update Local Variables] C --> D[Send to Line PLCs] C --> E[Send to Supervisor] ``` ### 2. Supervisor Processing Sequence ```mermaid graph TD A[Receive Q1 Data] --> B[SKU Search] B --> C[Format Data] C --> D[Prepare AUTEFA Telegram] C --> E[Update OPC-UA Data] ``` ## Error Handling Implementation ### 1. Communication Monitoring ```pascal // Monitor Q1-Henkel communication "T_LostComHenkel".TON( IN := NOT "TR_LostComHenkel".Q AND NOT "ToSV.STW.QE1.LostComQ1", PT := T#60s ); "ToSV.STW.QE1.LostComHenkel" := "T_LostComHenkel".Q; ``` ### 2. SKU Validation ```pascal // Validate SKU data IF "LineN[#i].SearchActualSku" AND "LineN[#i].i" >= 249 THEN // SKU not found handling "LineN[#i].SkuActualNotFound" := TRUE; "LineN[#i].SkuActualReq.Av" := 0; "LineN[#i].SkuActualReq.ProdFamily" := 0; "LineN[#i].SkuActualReq.CustomArticleNum" := ''; "LineN[#i].SkuActualReq.AvDesc" := ''; END_IF; ``` ## Line Index Configuration Each line's data is managed through a consistent index system: ```pascal CASE LineIndex OF 0: // Fill_TL21_L23 #locChar := "TL21_ReadData_D".FromQ1.FromHenkel.AB_IDH_BTL; 1: // Fill_TL22_L25 #locChar := "TL22_ReadData_D".FromQ1.FromHenkel.AB_IDH_BTL; 2: // Fill_TL23_L43 #locChar := "TL23_ReadData_D".FromQ1.FromHenkel.AB_IDH_BTL; 3: // Fill_TL25_L41 #locChar := "TL25_ReadData_D".FromQ1.FromHenkel.AB_IDH_BTL; 4: // Fill_TL26_L42 #locChar := "TL26_ReadData_D".FromQ1.FromHenkel.AB_IDH_BTL; 5: // Fill_TL27_L40 #locChar := "TL27_ReadData_D".FromQ1.FromHenkel.AB_IDH_BTL; END_CASE; ``` ## Important Memory Mappings ### Henkel Data Array Map ``` di[0-49] Layout: - Current Batch Data: - PO_NUMBER: di[44-46] - IDH_BTL: di[35-37] - Next Batch Data: - PO_NUMBER: di[47-49] - IDH_BTL: di[38-40] - Next+1 Batch Data: - PO_NUMBER: di[1-3] - IDH_BTL: di[7-9] - IDH_CON: di[4-6] ``` ### Critical Status Bits ``` STW Bits: - [0]: Changeover Request - [1]: Counter Reset - [2]: Production Ready - [31]: Life Bit Line Status: - [0]: Line Empty - [1]: Changeover Active - [2]: Line Ready ``` ## Debug Tips 1. **Communication Issues** - Check life bit timing (bit 31) - Verify byte swap patterns - Monitor communication counters 2. **SKU Search Problems** - Enable search debugging flags - Log CustomArticleNum comparisons - Verify AlplaSkuList content 3. **Telegram Failures** - Validate header structure - Check message length calculations - Monitor acknowledgment timing ## Common Implementation Pitfalls 4. **Byte Ordering** - Always use correct swap pattern based on data type - Verify endianness in telegram headers - Test with known data patterns 5. **String Handling** - Zero-pad incomplete strings - Handle empty/null characters - Verify string length limits 6. **Counter Management** - Synchronize counters after resets - Handle rollover conditions - Validate counter arithmetic