This repository contains supplementary materials for our research on AutoPLC, a flexible framework for structured text (ST) generation.
The folder data/benchmarks
includes 4 datasets used in our experiments:
- oscat: Contains tasks and data relevant to the OSCAT library.
- lgf: Includes tasks related to LGF functions.
- competition: Comprises datasets derived from the industrial code generation competition.
- agents4plc benchmark: The benchmark proposed by the Agents4PLC Team.
This folder contains the code used for our experiments and implementations. It is further organized into the following subdirectories:
- rag_data: Includes resources for RAG, such as the Rq2ST benchmark and the case library.
- autoplc_scl: Represents the implementation of AutoPLC applied to Siemens SCL.
- autoplc_st: Represents the implementation of AutoPLC applied to CODESYS ST.
We recommend to run AutoPLC on Windows 10 Professional, which is compatible with both TIA Portal V19 and CODESYS V3.5 SP20.
- Install the necessary dependencies by running:
pip install -r requirements.txt
-
Bash Environment Setup
Prior to executing the scripts, please prepare the environment for AutoPLC, copy the.env.example
file to.env
and fill in the necessary information. This step is exclusively for testing purposes and does not involve any leakage of personal information. -
Compiler Tools Setup
- For Siemens SCL: we used the openness api provided by Siemens, which requires 1) C# .Net Framework runtime; 2) TIA Portal V19 on Windows 10 or above. See TIACompileService. The repository provides source code, and a tested binary package is provided in Release.
- For CODESYS ST: we used the codesys script engine, which requires 1) CODESYS V3.5 SP20; 2) python on Windows 10 or above. See CODESYSCompileService. A tested CODESYS installer is also provided in Release.
- Knowledge Base Setup
We use the online knowledge base provided by the Zhipu Team and integrated their glm-airx model for reranking. See https://open.bigmodel.cn/dev/howuse/retrieval.
Siemens SCL compilation tool is developed by ourselves. For CODESYS compilation tool, we have referenced the implementation of this repository: codesys-api. Thanks very much for the contribution of the author of this repository.
We encapsulate each tool as a standard http service for AutoPLC's calling. In order to reduce service load, we deploy multiple services based on multiple machines in the LAN, which can be configured in the configuration file. The compilation service address can be modified in the yaml configuration file.
To run AutoPLC, execute the following command:
python src/autoplc/main.py --benchmark [benchmark name] --config [config name, same to config file name]
Replace [benchmark name]
with the name of the benchmark you want to use (e.g., oscat
, lgf
, competition
, agents4plc
) and [config name]
with the name of the configuration you want to use. These configurations need to be created in the src/config
directory.
For ST generation, replace main.py
with main_st.py
in the command.
2025 AutoPLC Team.