Skip to main content

PLCreX

Project description

PLCreX - a modular IEC 61131-3 PLC analysis CLI application

Maintenance made-with-python Tests Coverage GPLv3 license

PLCreX is a modular command-line interface (CLI) application tailored for IEC 61131-3 Programmable Logic Controllers (PLCs). It's designed with a focus on issues such as review, redesign, reuse, and reliability, among others. This project is driven by our ongoing research and we're committed to progressively integrating new features. PLCreX serves as a comprehensive suite of analysis and reuse capabilities for existing IEC 61131-3 Program Organization Units (POUs) implemented in Function Block Diagrams (FBDs) or Structured Text (ST).

diagram-20230726

Quick links


🛠 Getting Started

Prerequisites

  • Python: 3.11
  • Operating System: Windows

Installation via PyPI

Run pip install plcrex to get PLCreX using PyPI

Installation via Github

  1. Download or clone PLCreX repository

  2. Run install.bat to automatically create a virtual environment (venv) and installation of dependencies

  3. [optional] Run coverage run -m pytest ./tests/ --verbose for local tests

  4. [optional] Run coverage report -m to check test results

         Name                                 Stmts   Miss  Cover   Missing
         ------------------------------------------------------------------
         plcrex\__init__.py                       4      0   100%
         plcrex\cli.py                           57      3    95%   33-34, 96
         plcrex\tools\__init__.py                 0      0   100%
         plcrex\tools\ds2ts\__init__.py           0      0   100%
         plcrex\tools\ds2ts\_ds2ts.py             3      1    67%   22
         plcrex\tools\ds2ts\lib\__init__.py       0      0   100%
         plcrex\tools\fbd2ia\__init__.py          0      0   100%
         plcrex\tools\fbd2ia\_fbd2ia.py           4      0   100%
         plcrex\tools\fbd2st\__init__.py          0      0   100%
         plcrex\tools\fbd2st\_fbd2st.py           4      0   100%
         plcrex\tools\st2ast\__init__.py          0      0   100%
         plcrex\tools\st2ast\_st2ast.py          17      0   100%
         plcrex\tools\xmlval\__init__.py          0      0   100%
         plcrex\tools\xmlval\_xmlval.py           7      0   100%
         tests\__init__.py                        0      0   100%
         tests\test_fbd2st.py                    69      0   100%
         tests\test_fbd_io_checker.py             7      0   100%
         tests\test_help.py                       6      0   100%
         tests\test_st2tree.py                   25      0   100%
         tests\test_version.py                   12      0   100%
         tests\test_xml_checker.py               19      0   100%
         ------------------------------------------------------------------
         TOTAL                                  234      4    98%
    

💻 Commands

Usage: python -m plcrex PLCreX [OPTIONS] COMMAND [ARGS]

Usage OPTIONS COMMAND/ARGS
python -m plcrex [OPTIONS] COMMAND -v,--version: show author and version
--help: show details

--fbd2st: call FBD-to-ST-Compiler
--st2ast: call ST-Parser
--ds2ts: call Test-Case-Generator
--xml-val: call XML-Validator
python -m plcrex fbd2st [OPTIONS] SRC EXPORT --bwd: use backward translation
--formal: use formal parameter list
--st2ast: run ST parser with exports
--impact-analysis: check I/O impact analysis
--help: show details

SRC: source path
EXPORT: export directory path
python -m plcrex st2ast [OPTIONS] SRC EXPORT --no-txt: no tree export as *.txt
--no-dot: no tree export as *.dot
--beckhoff: use Beckhoff TwinCAT ST grammar
--help: show details

SRC: source path
EXPORT: export directory path
python -m plcrex ds2ts [OPTIONS] FORMULA --help: show details

FORMULA: formula in ST syntax
python -m plcrex xml-val [OPTIONS] SRC --v201: use tc6_xml_v201.xsd
--help: show details

SRC: source path

📜 Publications

  • M.C. Werner and K. Schneider, "Formal Methods-based Optimization of Dataflow Models with Translation to Synchronous Models", Forum on Specification and Design Languages (FDL), 2023

  • M.C. Werner and K. Schneider, From IEC 61131-3 Function Block Diagrams to Sequentially Constructive Statecharts, Forum on Specification and Design Languages (FDL), 2022

  • M.C. Werner and K. Schneider, Translation of Continuous Function Charts to Imperative Synchronous Quartz Programs, Formal Methods and Models for Codesign (MEMOCODE), 2021

  • M.C. Werner and K. Schneider, Reengineering Programmable Logic Controllers Using Synchronous Programming Languages, Forum on Specification and Design Languages (FDL), 2020

ℹ️ Licenses

Description Version License
PLCreX - GPLv3
STgrammar_Beckhoff.lark (🔗 Blark) 0.5.0 GPLv2
ds2ts_R1_1_0.cp311-win_amd64.pyd 1.1.0 -
fbd2ia_R1_1_0.cp311-win_amd64.pyd 1.1.0 -
fbd2st_R1_1_0.cp311-win_amd64.pyd 1.1.0 -

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plcrex-1.0.0.tar.gz (248.8 kB view hashes)

Uploaded Source

Built Distribution

plcrex-1.0.0-py3-none-any.whl (245.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page