Analyzer of Circuits' Sequences
PLC ST code Generator
Ladder Logic converter
FluidPyPLC is an updated version of the previous FluidPy, it is more light and efficient than before. It has new settings and can handle more sequence's cases. Enjoy the new version.
It's a python script that takes any sequence of pistons e.g. A /B-/B /A-. It solves all the blocks of the inserted sequence, it draws the Phases' Diagram, and converts the solution in Structured Text for PLCs. The GUI mode will show you the data structure of the sequence, the plc ST code and the plot. You can then copy and paste the ST code in any program you want that reads it, e.g. CODESYS. (I tried with CODESYS and works)To use this tool you need to install Python and Pip on your computer. For Windows users you can find it here or by using:
winget install python3 python3-pip
For Linux users you can install it via apt:
sudo apt-get install python3 python3-pip python3-tk
Use pip to install FluidPyPLC:
pip install FluidPyPLC
pip install setuptools
Now you need to set a main folder where to save your data, and you need to create there the Plot and the plc folder. You can do it manually or you can use:
fluidpy --folder path/to/your/folder
And FluidPyPLC will create the two folders for you, and change the config.json file "folder_path" to "your folder path".
[ ] For Windows Users. If you want an icon to execute the GUI faster -> create a new shortcut and assign the Target:
Target: fluidpy.exe --gui
Windows will automatically locate the fluidpy.exe script in your Python/scripts folder and you can launch the app from your icon now.
If fluidpy.exe is not recognize as a command, you have to add the Python/scripts to your PATH, locate then your Python/scripts folder on your computer, copy the path and add it to the PATH ENV Variables.
[Use my favicon if you want]
You can invoke the command from anywhere on your terminal:
fluidpy
To view all the usage's methods use the tags --help
or -h
.
[ ] To test your PLC's sequence code you can use the plc.py and one of the CONFIGURATION pdfs in the Configurations folder.
[ ] If you want to test the code with the CODESYS Visualization, use the plc.bak2.py as plc.py, and the tutorial below.
In CODESYS you have to create a project. In the project you will have your PLC device, your main application with your main PRG file. To test the ST code you must add a Modbus Serial Device to handle the inputs and outputs of your plc. The Modbus will act as an intermediate between your code and a virtual plc device, like you are setting up the inputs and outputs on a plc in real life.
To do that, open your CODESYS project, go to
Tools -> CODESYS installer
then search for "Modbus" and install the modules required. After that you have to
right-click your PLC device -> Add device
and then select
Modbus -> Modbus serial port -> Modbus COM
Now that the Modbus COM is added:
right-click Modbus_COM -> Add device -> Select Modbus -> Modbus serial device -> Modbus Serial Device
If you want to rename it you can (e.g. Modbus I/O handler, etc..).
Now right-click it -> Map I/O and finally you can map your inputs and outputs based on the ST code generated by FluidPyPLC.
Now you only have to design your Machine in the visualization file and assign the switches to the limit switches (To test the code, you have to manually change the limit switches as you don't have physical Pneumatic Pistons with physical limit switches). Enjoy your PLC's simulation.
In the GUI mode you can launch the Ladder Logic Converter and it will create an output.xml file into the main path chosen by you. The .xml file will be in PLCopenXML format ready to be imported into CODESYS.
Things to still add to the code:
- Ladder Logic Converter
- Automatic Import Button
- Automatic PLC configuration between CODESYS and FluidSim
GPLv3
thanks to writeme for the README template