Table of Contents
Fetching ...

Converting IEC 61131-3 LD into SFC Using Large Language Model: Dataset and Testing

Yimin Zhang, Mario de Sousa

TL;DR

The paper tackles converting Ladder Diagram (LD) to Sequential Function Chart (SFC) in IEC 61131-3 using Large Language Models (LLMs) by addressing data scarcity with synthetic, text-based SFC-LD datasets. It compares few-shot learning and fine-tuning, finding that a fine-tuned GPT-4o-mini achieves up to 79% joint accuracy (and up to 91% on a subset) across synthetic datasets. The approach demonstrates that representing graphical PLC programs as text enables LLMs to learn the LD→SFC mapping despite simplified assumptions. The work lays a foundation for scalable LD-SFC automation and suggests future directions toward real-world data, richer textual formats, and more advanced prompting and validation strategies.

Abstract

In the domain of Programmable Logic Controller (PLC) programming, converting a Ladder Diagram (LD) into a Sequential Function Chart (SFC) is an inherently challenging problem, primarily due to the lack of domain-specific knowledge and the issue of state explosion in existing algorithms. However, the rapid development of Artificial Intelligence (AI) - especially Large Language Model (LLM) - offers a promising new approach. Despite this potential, data-driven approaches in this field have been hindered by a lack of suitable datasets. To address this gap, we constructed several datasets consisting of paired textual representations of SFC and LD programs that conform to the IEC 61131-3 standard. Based on these datasets, we explored the feasibility of automating the LD-SFC conversion using LLM. Our preliminary experiments show that a fine-tuned LLM model achieves up to 91% accuracy on certain dataset, with the lowest observed accuracy being 79%, suggesting that with proper training and representation, LLMs can effectively support LD-SFC conversion. These early results highlight the viability and future potential of this approach.

Converting IEC 61131-3 LD into SFC Using Large Language Model: Dataset and Testing

TL;DR

The paper tackles converting Ladder Diagram (LD) to Sequential Function Chart (SFC) in IEC 61131-3 using Large Language Models (LLMs) by addressing data scarcity with synthetic, text-based SFC-LD datasets. It compares few-shot learning and fine-tuning, finding that a fine-tuned GPT-4o-mini achieves up to 79% joint accuracy (and up to 91% on a subset) across synthetic datasets. The approach demonstrates that representing graphical PLC programs as text enables LLMs to learn the LD→SFC mapping despite simplified assumptions. The work lays a foundation for scalable LD-SFC automation and suggests future directions toward real-world data, richer textual formats, and more advanced prompting and validation strategies.

Abstract

In the domain of Programmable Logic Controller (PLC) programming, converting a Ladder Diagram (LD) into a Sequential Function Chart (SFC) is an inherently challenging problem, primarily due to the lack of domain-specific knowledge and the issue of state explosion in existing algorithms. However, the rapid development of Artificial Intelligence (AI) - especially Large Language Model (LLM) - offers a promising new approach. Despite this potential, data-driven approaches in this field have been hindered by a lack of suitable datasets. To address this gap, we constructed several datasets consisting of paired textual representations of SFC and LD programs that conform to the IEC 61131-3 standard. Based on these datasets, we explored the feasibility of automating the LD-SFC conversion using LLM. Our preliminary experiments show that a fine-tuned LLM model achieves up to 91% accuracy on certain dataset, with the lowest observed accuracy being 79%, suggesting that with proper training and representation, LLMs can effectively support LD-SFC conversion. These early results highlight the viability and future potential of this approach.

Paper Structure

This paper contains 19 sections, 11 figures, 3 tables.

Figures (11)

  • Figure 1: Three Basic Structures.
  • Figure 2: An Example from Dataset 2 of The Generated Data Structures.
  • Figure 3: Boxplot of the Number of Steps and Transitions
  • Figure 4: Example SFC and Its Equivalent LD.
  • Figure 5: LD to SFC Conversion Experiments Overview.
  • ...and 6 more figures