Company
Wipro PARI
Title
AI-Powered PLC Code Generation for Industrial Automation
Industry
Automotive
Year
2025
Summary (short)
Wipro PARI, a global automation company, partnered with AWS and ShellKode to develop an AI-powered solution that transforms the manual process of generating Programmable Logic Controller (PLC) ladder text code from complex process requirements. Using Amazon Bedrock with Anthropic's Claude models, advanced prompt engineering techniques, and custom validation logic, the system reduces PLC code generation time from 3-4 days to approximately 10 minutes per requirement while achieving up to 85% code accuracy. The solution automates validation against IEC 61131-3 industry standards, handles complex state management and transition logic, and provides a user-friendly interface for industrial engineers, resulting in 5,000 work-hours saved across projects and enabling Wipro PARI to win key automotive clients.
## Overview Wipro PARI, one of the largest global automation companies with over 1,300 employees and facilities worldwide, implemented a comprehensive LLMOps solution to address a critical bottleneck in industrial automation: the time-intensive process of converting complex process requirements into Programmable Logic Controller (PLC) ladder text code. The traditional manual process required industrial automation engineers 3-4 days per query to translate high-level requirements into precise machine instructions while managing multiple states and transitions, ensuring compliance with the IEC 61131-3 international standard, handling complex variable declarations, maintaining detailed documentation, and conducting thorough testing of safety protocols. The solution leverages Amazon Bedrock as its foundation, primarily using Anthropic's Claude 3.5 Sonnet for complex code generation tasks and Claude 3.7 Sonnet for enhanced reasoning capabilities in code rectification. The choice of Amazon Bedrock was driven by several enterprise-grade requirements: broad model selection flexibility allowing model switching without infrastructure changes, fully managed service reducing operational overhead, strict data privacy ensuring customer data remains within AWS and is not used for training underlying foundation models, and compliance certifications required for manufacturing environments handling sensitive operational data. ## Architecture and Infrastructure The production system implements a microservices architecture with over 30 specialized APIs deployed on load-balanced Amazon EC2 instances within a secure VPC environment, with plans to migrate to Amazon ECS in future iterations. The architecture is organized into four main layers that work together to deliver the end-to-end solution. The frontend consists of a React-based responsive web application that enables industrial engineers to upload control logic spreadsheets, configure generation settings, and verify generated ladder code with full traceability. The backend implements React and FastAPI microservices with distinct components including controllers for request handling, core services for business logic, authentication modules for user management, file processing engines for spreadsheet handling, and specialized spreadsheet parsers for extracting control logic specifications from industrial automation documentation. The AI/ML processing layer integrates with Amazon Bedrock and uses multiple Anthropic Claude models depending on task complexity. LLM integration services transform control logic requirements into intermediate structured pseudo queries, which are then converted into standardized PLC ladder text code through multi-iteration processing. The system handles complex industrial automation scenarios including parallel execution paths, fork/defork logic, and Boolean expressions commonly found in manufacturing control systems. The data and storage layer uses Amazon S3 buckets to store generated code artifacts, templates, and version history for industrial project management, while Amazon RDS for PostgreSQL maintains persistent state management, project tracking, and relationships between control logic specifications and generated code. Security is implemented through Amazon Cognito for user authentication and role-based access controls, IAM-based access controls for service-to-service authentication, Amazon GuardDuty for continuous threat detection, and AWS CloudTrail for comprehensive audit logging of code generation activities. ## Data Processing Pipeline The solution implements a sophisticated multi-stage pipeline that begins with the data formatter module. Users upload control logic spreadsheets through the UI, and the formatter intelligently extracts state definitions, transition numbers, associated actions, and forking/de-forking path relationships. This extracted information is crucial for downstream validation of the PLC code and is stored in S3 buckets for persistence and future reference. The data formatter constructs a comprehensive prompt containing the original spreadsheet data and specific processing instructions, which is sent to Claude 3.5 Sonnet to convert the control logic into a structured pseudo query format. An important aspect of this transformation is that lengthy descriptions are abbreviated to 20 characters to conform to PLC variable naming conventions. The pseudo query serves as an intermediate structured representation that translates human-readable control logic requirements into a standardized format that can be processed by AI models to generate PLC code. For example, a specification like "When temperature > 80°C AND pressure < 5 bar, turn on cooling pump" is converted to a pseudo query such as `IF (TEMP_SENSOR > 80) AND (PRESSURE_SENSOR < 5) THEN SET COOLING_PUMP = TRUE`. ## Advanced Prompt Engineering Techniques The PLC code generator module employs sophisticated prompt engineering to maximize the accuracy of ladder text generation. The prompt builder constructs detailed task prompts that include PLC programming domain knowledge such as state/transition variable naming conventions, network creation patterns for forking/de-forking, and condition network structures. The system implements few-shot learning by including examples demonstrating pseudo query to ladder text conversion, along with explicit instructions for handling state transitions, variable declarations, and complex Boolean expressions. A particularly innovative aspect of the prompt engineering approach is the dynamic few-shot sampling strategy. Pseudo queries and related metadata including structural characteristics such as state transitions, actions, and control flow patterns are indexed in a vector store. At inference time, a hybrid retrieval strategy combines semantic similarity and lexical matching with the metadata to fetch the most relevant structurally aligned examples and their corresponding PLC code, which are then dynamically injected into the prompt. This approach ensures that the model receives contextually relevant examples that match the structural complexity of the current task. ## Iterative Code Generation Because PLC ladder text typically exceeds the 4,096 token maximum output limit of the foundation model, the solution implements an iterative generation approach with specialized continuation prompting. The task prompt is first passed to Claude 3.5 Sonnet, which generates the initial ladder text code containing up to 4,096 tokens. The system then checks if generation is complete and, if not, constructs a continuation prompt that instructs the model to continue generating PLC code from where it left off in the previous iteration. This continuation method is critical for maintaining context between sequential generations, ensuring consistency throughout the entire code base. The process continues iteratively until the PLC ladder code is fully generated, with completed code segments being consolidated before passing to the code rectifier module. This approach demonstrates a practical solution to handling long-form code generation tasks where output exceeds model token limits while maintaining logical coherence across segments. ## Code Rectification and Quality Assurance The code rectifier module addresses a fundamental challenge in LLM-based code generation: even with sophisticated prompting, LLMs may miss critical functionalities during initial code generation due to the inherent complexity of PLC ladder logic. The solution incorporates a hybrid approach combining custom logic containing business guidelines with FM-based rectification to ensure high-quality output. The rectifier performs several critical functions. First, it ensures proper handling of parallel execution paths where sequences split into multiple branches and later re-converge, maintaining proper logic flow throughout the PLC program. This is accomplished by invoking Claude 3.7 Sonnet, which provides enhanced reasoning capabilities required for complex parallel execution path corrections, using a specialized prompt and the generated PLC code along with node/network mapping scripts to track state transitions and sequence tracking. The module uses data extracted by the formatter, including transition variables' source and destination states stored in Amazon S3, through a three-phase process. The identification phase uses specialized Python algorithms to analyze the PLC code structure and cross-references transition variables against their declared source and destination states, flagging incorrect connections. The remediation phase employs targeted Python routines to systematically remove incorrect connections while preserving overall logic structure integrity. The reconstruction phase implements custom Python logic to establish proper connections between states following correct sequential execution patterns. Additionally, the generated code may contain syntax errors, undeclared variables, or non-compliant naming. Using Claude 3.5 Sonnet and custom logic, the rectifier identifies missing variables that are used within the code but not declared, adds missing variables to the declaration section, and standardizes variable names to ensure compliance with Siemens S7-1517 PLC naming conventions. The rectified PLC code and associated metadata are stored in Amazon S3 for version control and traceability. ## Validation Framework After rectification, the code undergoes a comprehensive validation process through the code evaluator module. The validator analyzes the rectified ladder text against critical guidelines including verification that each state has a unique identifier with no duplicates, confirmation that transition identifiers are unique throughout the code, validation that each transition connects to the correct destination state, ensuring every state has at least one input transition condition to trigger state changes, and checking that transition variables within the same state are mutually exclusive to prevent logic conflicts. For each validation check, the system generates a detailed pass/fail result with specific information about issues detected. A comprehensive validation report is compiled, highlighting remaining issues that might require manual attention from engineers with clear indicators of their location and nature in the code. This multi-layered rectification and validation approach significantly improves the quality of generated ladder text, reducing the need for manual intervention and accelerating the overall code development process. ## User Workflow and Experience The complete user workflow demonstrates the end-to-end LLMOps implementation in production. Industrial engineers log in to the React web application and authenticate through role-based access controls managed by Amazon Cognito. They upload Excel spreadsheets containing control logic specifications, which are processed through Excel parsers that extract control logic data, validate input specifications against industrial standards, and transform raw data into structured format suitable for AI processing. The LLM integration services send structured requirements to Amazon Bedrock, which generates intermediate pseudo queries, converts them into standardized PLC ladder text code, and handles complex industrial automation scenarios. The generated code undergoes automated quality validation against IEC 61131-3 standards, intelligent rectification to fix syntax and logical errors, and storage of validated code artifacts in S3 with version control and traceability. Engineers review the generated ladder code through the web interface, verify code quality and safety compliance, download validated PLC code for deployment, and maintain project history with full audit trails for industrial compliance requirements. The UI provides an intuitive interface where users can access the web-based system to upload control logic spreadsheets or structured text inputs, select different models and adjust parameters to optimize generation, and for advanced users, edit prompts directly to customize the generation process. The system displays the generated ladder text, pseudo query, and validation report, allowing engineers to quickly assess output quality. The entire process from upload to validated code typically completes in 3-7 minutes depending on input query complexity. ## Performance and Business Impact The solution demonstrates consistent performance across various test cases with measurable business impact. The average validation completion percentage across test cases was 85%, with processing time reduced from 3-4 days to approximately 10 minutes per query. Cost per query generation is approximately $0.40-$0.60, making it economically viable at scale. Perfect 100% validation scores were achieved on less complex queries such as "Conveyor controls," while even complex queries with multiple state transitions achieved validation scores of 70-90%. While these results are impressive, it's important to note that the 85% average accuracy means that generated code still requires engineer review and potential manual correction for the remaining 15%. The solution is best characterized as an intelligent code generation assistant that dramatically accelerates the development process rather than a fully autonomous code generation system. The validation framework and comprehensive reporting help engineers quickly identify and address any issues, making the manual review process much more efficient than writing code from scratch. The automation approach has delivered measurable business impact including 5,000 work-hours saved across projects while minimizing manual coding errors. The solution helped 200 engineers focus on high-value tasks like code design and application development while accelerating the code generation process. It also helped Wipro PARI win key automotive clients and created a competitive advantage for complex automation projects. ## Future Roadmap and Scaling Plans Building on the current implementation, Wipro PARI is planning significant expansions using additional Amazon Bedrock features. The team will implement Amazon Bedrock Guardrails to enforce content filtering policies that prevent generation of unsafe control logic and ensure compliance with IEC 61131-3 standards at the model output level. This represents an important evolution in the safety and compliance aspects of the LLMOps implementation. The roadmap includes building multi-agent workflows using AWS Strands Agents, an open source SDK designed for autonomous AI agents, where specialized agents will handle distinct tasks: one agent for requirements analysis, another for code generation, and a third for automated documentation generation. To scale these agents in production, Wipro PARI will use Amazon Bedrock AgentCore, which provides serverless infrastructure for deploying and scaling agents with enterprise-grade security, session isolation, and built-in identity management. Amazon Bedrock AgentCore Memory will enable the system to maintain context across engineering sessions, allowing agents to remember previous interactions and build upon prior work. An Amazon Bedrock AgentCore gateway will securely connect agents to existing PLC validation tools and internal automation systems. Additional planned agents include automated testing, security scanning, and automated document generation capabilities. Beyond agent-based expansion, Wipro PARI plans to incorporate additional validation rules, enhance the UI, add support for complex sequence types, and integrate with SIEMENS software for direct code deployment. The company also intends to expand the solution to other major PLC systems including Rockwell Automation, Schneider Electric, and ABB, helping Wipro PARI scale their automotive industry expertise to broader manufacturing sectors. ## LLMOps Best Practices Demonstrated This case study demonstrates several LLMOps best practices for production systems. The use of intermediate representations (pseudo queries) creates a structured bridge between human-readable requirements and code generation, improving model performance and enabling better validation. The iterative generation approach with continuation prompting addresses token limit constraints while maintaining context consistency across long-form outputs. The hybrid retrieval strategy for few-shot learning demonstrates sophisticated prompt engineering that dynamically adapts examples based on structural similarity rather than using static examples. The multi-stage validation and rectification pipeline shows how to combine FM capabilities with custom business logic and domain-specific rules to ensure output quality. The comprehensive storage and versioning strategy using S3 and RDS enables traceability, audit trails, and project management capabilities essential for enterprise deployments. The security implementation through Amazon Cognito, IAM, GuardDuty, and CloudTrail demonstrates how to build enterprise-grade security and compliance into LLMOps systems. The microservices architecture with plans to migrate from EC2 to ECS shows a thoughtful approach to infrastructure evolution and scalability. Overall, this case study provides a comprehensive example of how to build, deploy, and scale LLM-based code generation systems in production manufacturing environments with strict quality, safety, and compliance requirements.

Start deploying reproducible AI workflows today

Enterprise-grade MLOps platform trusted by thousands of companies in production.