Awlsim is a free Step 7 compatible AWL/STL Soft-PLC written in Python. Depending on the host machine and the Python interpreter used, it achieves good performance of several thousand to millions of AWL/STL instructions per second. German and English S7 AWL/STL mnemonics are supported.
AWL/STL programs on PLCs are used for automation of industrial processes. However Awlsim is very flexible, so it can be used for other purposes beyond industrial applications, too. Awlsim aims to be compatible with the industry standard S7 software on the AWL/STL level.
Awlsim can emulate CPUs with two and four accumulator registers (S7-3xx and S7-4xx).
Compatibility to S7 hardware is a task taken seriously by the awlsim project. We want to be as close as possible to the real PLC hardware with our AWL/STL code execution. For this reason awlsim ships an extensive selftest suite. Missing features and differences between awlsim and Step 7 are documented in the COMPATIBILITY.md and TODO.md files. If you find any undocumented bugs and incompatibilities to a real PLC CPU, please contact me.
Awlsim is Open Source Free Software licensed under the GNU General Public License v2+. That means it's available in full source code and you are encouraged to improve it and contribute your changes back to the community. Awlsim is free of charge, too.
- Function Block Diagram (FBD) / Funktionsplan (FUP)
- Ladder logic (LAD) / Kontaktplan (KOP)
- Structured Text (ST) / Structured Control Language (SCL)
- Awlsim on MS Windows
- Awlsim on Linux and other platforms
- Connecting hardware (PROFIBUS-DP)
- Connecting hardware (LinuxCNC)
- Development (GIT)
- Bug reports and feature requests
- Frequently Asked Questions (FAQ)
- License / Copyright
Experimental support for FBD/FUP is included in the latest Awlsim release. It is not ready for production use, yet, but your feedback is greatly appreciated. The current editor does only contain very basic functionality.
This screen shot shows a preview of the current experimental FBD/FUP editor.
There is no LAD/KOP editor and compiler available in Awlsim, yet.
There is no ST/SCL editor and compiler available in Awlsim, yet.
The preferred way to run awlsim on MS Windows is to use the standalone package:
awlsim-win-x.y.package.exe (See Download).
Just extract the standalone .exe package by double clicking it and selecting 'extract'.
Double click on the file awlsim.cmd that appears in the extracted directory
to start Awlsim.
There usually is no need to install anything. Windows will probably ask you (twice) to confirm that you trust the program being run.
If Windows complains about missing MSVCR100.dll, you will have to install Microsoft Visual C++ 2010 Redistributable.
If you want to build and run awlsim from source .tar.bz2 package (you most likely don't), you need the Python package and either PyQt5 or PySide:
Please install Python to its default install location.
Afterwards install PyQt5 using the pip3 tool that comes with Python.
PyQt5 is part of PyPi.
Awlsim ships a convenience shell script to install PyQt5. Just go into the maintenance subdirectory of the Awlsim package and double click on the win-install-dependencies.cmd file. This script will download PyQt5 from PyPi and install it.
To run Awlsim just double click on the awlsim-win.cmd file. The graphical user interface of awlsim should appear. If you did not install a dependency correctly, or if there is any other problem, an error message will be printed to the console window that also appears.
Awlsim runs on any platform that supports Python and either PyQt or PySide, which includes Linux and Mac OS X. Just run the main awlsim scripts like awlsim-server or awlsim-client. All scripts include a shebang, so you don't need to specify the Python interpreter explicitly.
The awlsim core and thus the command line interface 'awlsim-cli' and the core server 'awlsim-server' also run on these alternative Python interpreters:
- PyPy 2 or later.
Runs more than ten times faster than awlsim on C-Python interpreter.
- Jython 2.7 or later.
Runs slightly slower than awlsim on C-Python interpreter.
- IronPython 2.7 from
IronPython GIT repository.
Runs a lot slower than awlsim on C-Python interpreter.
It is possible to compile the awlsim core and coreserver with
Cython. Cython is an optimizing static compiler
for the Python language.
If Cython is installed, the ./setup.py build run will also build the optimized awlsim package in addition to the standard Python modules. The package will be called awlsim_cython, so both the optimized build and the original Python-code can be installed simultaneously.
To use the awlsim_cython core, set the AWLSIMCYTHON environment variable to 1 before running awlsim. For example run awlsim-cli like this:
AWLSIMCYTHON=1 awlsim-cli EXAMPLE.awl
This will also work with awlsimgui.
Using the compiled awlsim_cython core will result in a performance gain of about 50 percent, compared to the pure Python core.
Awlsim includes an experimental hardware access layer for connecting the awlsim S7-CPU to real PROFIBUS-DP slave hardware. It does this by providing an interface to the Raspberry Pi PROFIBUS module.
The hardware access layer module is loaded and executed with the
new -H command to awlsim-cli.
For example: awlsim-cli -D -H pyprofibus program.awl
The pyprofibus module has some module options. See the --help and --hardware-info pyprofibus options to awlsim-cli for details.
The pyprofibus module is highly experimental at this time. It lacks a lot of flexibility, but it does work.
Needless to say, the Raspberry Pi PROFIBUS module must be installed before the awlsim pyprofibus hardware access layer can be used. Otherwise to following error will occur:
[PyProfibus hardware module] Failed to import PROFIBUS protocol stack module 'pyprofibus': No module named 'pyprofibus'
A LinuxCNC HAL module is included in awlsim. With this module it is possible to use awlsim as a non-realtime S7-compatible PLC backend.
To use awlsim in LinuxCNC, a HAL configuration file has to be added to your
LinuxCNC configuration. See the
LinuxCNC Integrators Manual
on how to add HAL-files.
An example LinuxCNC project is included in the awlsim package as
See awlsim.hal in this directory for additional information.
Latest bleeding edge awlsim can be downloaded using the Git version control system as follows:
git clone https://git.bues.ch/git/awlsim.git
|or via http:||
git clone http://git.bues.ch/git/awlsim.git
|or via git:||
git clone git://git.bues.ch/awlsim.git
or by downloading the
awlsim snapshot archive.
To browse the Git repository online, go to the git web interface.
A mirror of the repository is available on GitHub, GitLab, Bitbucket and on NotABug.org.
If you want to contribute to awlsim, please read the contribution guidelines first.
If you find any bugs in awlsim or if you have any suggestion for new
features, we would like to hear from you.
Your help is greatly appreciated and will help to create better software and improve the overall experience for everybody. So don't hesitate to report anything that that limits your awlsim usage.
If you have got any code improvements or other improvements that should be merged into the project, please send such enhancements to the awlsim maintainer.
Please read the contribution guidelines first.
Awlsim is a complex piece of software. The following two diagrams show the basic connections and interactions between the basic parts of the software package. (Click to enlarge).
- Q: How is awlsim pronounced?
A: It is pronounced like a combination of the words all and sim (sim as in simulation).
In German you might also pronounce it A.W.L.-sim, though.
- Q: Should a 32 bit or 64 bit Python interpreter be used?
A: If you use the C-Python interpreter and if you have a 64 bit CPU, use the 64 bit Python interpreter. This will be slightly faster (about 2%) due to faster support for 32 bit unsigned integers via native 64 bit signed integers.
Thanks to everybody testing awlsim and reporting bugs and differences between awlsim and the original Step 7 AWL/STL language implementation. Also thanks to everybody providing example AWL/STL code and test cases for the testing suite.
Thanks to the lecturers at Balthasar Neumann Technikum Trier for their fine lectures in PLC automation. Those in particular are Mr. Etringer, Mr. Kronenburg, Mr. Laub et al., in lexicographical order.