ChatGPT for PLC/DCS Control Logic Generation

Heiko Koziolek,Sten Gruener,Virendra Ashiwal
DOI: https://doi.org/10.48550/arXiv.2305.15809
2023-05-25
Software Engineering
Abstract:Large language models (LLMs) providing generative AI have become popular to support software engineers in creating, summarizing, optimizing, and documenting source code. It is still unknown how LLMs can support control engineers using typical control programming languages in programming tasks. Researchers have explored GitHub CoPilot or DeepMind AlphaCode for source code generation but did not yet tackle control logic programming. The contribution of this paper is an exploratory study, for which we created 100 LLM prompts in 10 representative categories to analyze control logic generation for of PLCs and DCS from natural language. We tested the prompts by generating answers with ChatGPT using the GPT-4 LLM. It generated syntactically correct IEC 61131-3 Structured Text code in many cases and demonstrated useful reasoning skills that could boost control engineer productivity. Our prompt collection is the basis for a more formal LLM benchmark to test and compare such models for control logic generation.
What problem does this paper attempt to address?
The problem this paper attempts to address is the exploration of the potential application of large language models (LLMs) in the generation of industrial automation control logic. Specifically, the researchers created 100 different categories of prompts to test whether LLMs can generate correct IEC 61131-3 structured text code based on natural language descriptions. These prompts cover multiple aspects of control engineering, including standard algorithms, custom mathematical functions, PLC programming tasks, process control, sequential control, interlocking, diagnostics and communication, and advanced process control. By using ChatGPT and GPT-4 models for testing, the researchers found that LLMs can generate syntactically correct and somewhat practical control logic code in many cases. This suggests that such models have the potential to improve the efficiency of control engineers, especially in implementing custom control logic. However, current LLMs still have some limitations and occasionally produce incorrect answers, indicating the need for further research and improvement.