# Generowanie kodu sterowników PLC z modelami językowymi

EN: **LLM-based PLC code generation (IEC 61131-3)** · id `plccodegen` · aliases: PLC code generation, LLM4PLC, Agents4PLC, Structured Text generation, IEC 61131-3, generowanie kodu PLC, programowanie sterowników z AI

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [AI w przemyśle](https://aiatlasgraph.com/t/industrialai.md) › [Asystenci językowi dla przemysłu](https://aiatlasgraph.com/t/industrialassistants.md) › Generowanie kodu sterowników PLC z modelami językowymi

## Description

- PL: Generowanie programu sterownika (np. Structured Text wg IEC 61131-3) przez LLM w pętli z kompilatorem i weryfikacją formalną.
- EN: Generating controller programs (e.g. IEC 61131-3 Structured Text) with an LLM in a loop with a compiler and formal verification.

## In one sentence

- PL: Pisanie programów dla sterowników maszyn w fabryce z pomocą AI, która tworzy kod z opisu, a narzędzia sprawdzają go przed uruchomieniem.
- EN: Writing programs for factory machine controllers with AI that drafts code from a description, while tools check it before it runs.

## Problem it solves

- PL: Program sterownika steruje prawdziwymi siłownikami i taśmociągami, więc błąd w kodzie może zniszczyć maszynę, a specjalistów od tego języka brakuje.
- EN: A controller program drives real actuators and conveyors, so a code bug can wreck a machine, and specialists in these languages are scarce.

## What it does

- PL: Jak praktykant, który pisze szkic, a kierownik budowy i inspektor sprawdzają go po kolei i odsyłają z uwagami do poprawki.
- EN: Like an apprentice who drafts the plan while the site manager and an inspector check it in turn and send it back with notes.

## Everyday example

- PL: Inżynier opisuje słowami sekwencję sortowania paczek na taśmie, dostaje gotowy kod sterownika, a kompilator i weryfikator wskazują, co jeszcze poprawić.
- EN: An engineer describes a parcel-sorting sequence on a conveyor in words, gets controller code, and the compiler and verifier point out what still needs fixing.

## This concerns you if you…

- PL: programujesz sterowniki maszyn lub linii produkcyjnych
- PL: chcesz przyspieszyć pisanie powtarzalnej logiki automatyki
- PL: musisz udowodnić, że kod jest bezpieczny
- EN: program controllers for machines or production lines
- EN: want to speed up writing repetitive automation logic
- EN: must prove that code is safe

## Keywords

IEC 61131-3 · Structured Text · LLM4PLC · Agents4PLC · NuSMV · compiler-in-the-loop · LoRA · CODESYS

## How it works

- PL: Model pisze kod w języku sterowników, który następnie przechodzi kontrolę składni, kompilację i weryfikację modelową względem specyfikacji. Każdy błąd wraca do modelu jako wskazówka do poprawki, z człowiekiem w pętli. Otwarte modele doucza się lekkimi adapterami, bo języki sterowników są rzadkie w danych treningowych.
- EN: The model writes code in a controller language, which then goes through syntax checks, compilation and model checking against a specification. Each error is fed back to the model as a repair hint, with a human in the loop. Open models are fine-tuned with light adapters because controller languages are rare in training data.

## Limits

- PL: Ogólne modele często nie tworzą poprawnych programów sterowników bez tej pętli narzędzi. Weryfikacja formalna dowodzi tylko własności, które ktoś zapisał w specyfikacji. Dotychczasowe oceny obejmują głównie laboratoryjne stanowiska testowe.
- EN: General models often fail to produce valid controller programs without this tool loop. Formal verification proves only the properties someone wrote into the specification. Evaluations so far cover mainly lab testbeds.

## Key terms

- PL: **PLC**: Przemysłowy komputer sterujący maszyną lub linią produkcyjną.
- PL: **Structured Text**: Tekstowy język programowania sterowników z normy IEC 61131-3.
- PL: **weryfikacja modelowa**: Automatyczne sprawdzenie wszystkich stanów programu względem zapisanych reguł.
- EN: **PLC**: An industrial computer controlling a machine or production line.
- EN: **Structured Text**: A text-based controller language from the IEC 61131-3 standard.
- EN: **model checking**: Automatically checking all program states against written rules.

## Know first

- [Agenci kodujący (AI-assisted coding)](https://aiatlasgraph.com/t/aicoding.md)

## Related topics

Untyped, symmetric "see also" links.

- [Agenci kodujący (AI-assisted coding)](https://aiatlasgraph.com/t/aicoding.md)

## Sources

- [LLM4PLC: Harnessing Large Language Models for Verifiable Programming of PLCs in Industrial Control Systems](<https://arxiv.org/abs/2401.05443>) `fakih-llm4plc-2024` · by Mohamad Fakih, Rahul Dharmaji, Yasamin Moghaddas, Gustavo Quiros Araya, Oluwatosin Ogundare, Mohammad Abdullah Al Faruque

---

AI Atlas revision 122 (2026-10-30) · HTML: https://aiatlasgraph.com/t/plccodegen · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-10-30
