edouard@3635: <!---
andrej@1728: [![docs](https://readthedocs.org/projects/beremiz/badge/?version=latest)](https://beremiz.readthedocs.io)
edouard@3635: -->
edouard@3836: [![CI Automated testing](https://github.com/beremiz/beremiz/actions/workflows/run_tests_in_docker.yml/badge.svg?branch=python3)](https://github.com/beremiz/beremiz/actions/workflows/run_tests_in_docker.yml)
andrej@1727: 
andrej@1679: # Beremiz #
andrej@1679: 
andrej@1679: Beremiz is an integrated development environment for machine automation. It is Free Software, conforming to IEC-61131 among other standards.
andrej@1679: 
andrej@1679: It relies on open standards to be independent of the targeted device, and let you turn any processor into a PLC. Beremiz includes tools to create HMI, and to connect your PLC programs to existing supervisions, databases, or fieldbuses.
andrej@1679: 
andrej@1679: With Beremiz, you conform to standards, avoid vendor lock, and contribute to the better future of Automation. 
andrej@1679: 
andrej@2253: Beremiz consists of two components:
andrej@2253: 
edouard@3450: * Integrated Development Environment (IDE), Beremiz.py. It is running on user's computer and is used to write/compile/debug PLC programs and control PLC runtime.
edouard@3450: * Reference runtime implementation in python, Beremiz_service.py. It's running on target platform, communicates with I/O and executes PLC program.
andrej@2253: 
andrej@1679: See official [Beremiz website](http://www.beremiz.org/) for more information.
andrej@1679: 
edouard@3635: ## Install latest release ##
edouard@3635: 
edouard@3635: Windows installer and Snap package for Linux are available in [Github releases](https://github.com/beremiz/beremiz/releases) and [Snapcraft's store](https://snapcraft.io/beremiz)
edouard@3635: 
edouard@3635: ## Tutorials and examples ##
edouard@3635: 
edouard@3635: In IDE, find menu "File>Tutorials and examples" to quickly open examples that should run as-is.
edouard@3635: 
edouard@3637: There are more examples in `tests/projects` and `exemples` directories.
edouard@3635: 
edouard@3635: Some example and test are shown on [Beremiz youtube channel](https://www.youtube.com/channel/UCcE4KYI0p1f6CmSwtzyg-ZA).
edouard@3635: 
edouard@3635: ## Development with Beremiz ##
edouard@3635: 
edouard@3635: Developers are invited to subscribe to [mailing list](https://sourceforge.net/p/beremiz/mailman/beremiz-devel/) (beremiz-devel@lists.sourceforge.net).
edouard@3635: 
edouard@3635: The list is moderated and requires subscription before posting.
edouard@3635: 
edouard@3635: To subscribe to the mailing list go [here](https://sourceforge.net/p/beremiz/mailman/beremiz-devel/).
edouard@3635: 
edouard@3635: Searchable archive using search engine of your choice is available [here](http://beremiz-devel.2374573.n4.nabble.com/).
edouard@3635: 
edouard@3635: ## Build on Linux (developer setup) ##
edouard@3635: 
edouard@3835: ### System prerequisites (Ubuntu 22.04) :
edouard@3835: ```
edouard@3835: # install required system packages as root
edouard@3835: sudo apt-get install \
edouard@3835:   build-essential automake flex bison mercurial \
edouard@3835:   libgtk-3-dev libgl1-mesa-dev libglu1-mesa-dev \
edouard@3835:   libpython3.10-dev libssl-dev \
edouard@3835:   python3.10 virtualenv cmake git mercurial
edouard@3835: ```
edouard@3835: 
edouard@3635: 
edouard@3635: ### Prepare build directory
edouard@3635: 
edouard@3637: All commands hereafter assume that selected directory to contain all downloaded source code and build results is `~/Beremiz`
edouard@3635: 
edouard@3635: ```
edouard@3635: mkdir ~/Beremiz
edouard@3635: cd ~/Beremiz
edouard@3635: ```
edouard@3635: 
edouard@3635: ### Get Source Code (Mercurial)
edouard@3635: 
edouard@3635: ```
edouard@3635: cd ~/Beremiz
edouard@3635: hg clone https://hg.beremiz.org/beremiz
edouard@3635: hg clone https://hg.beremiz.org/matiec
edouard@3635: ```
edouard@3635: 
edouard@3635: ### Get Source Code (Git)
edouard@3635: 
edouard@3635: ```
edouard@3635: cd ~/Beremiz
edouard@3635: git clone https://github.com/beremiz/beremiz
edouard@3635: git clone https://github.com/beremiz/matiec
edouard@3635: ```
edouard@3635: 
edouard@3835: ### Python prerequisites (virtualenv) :
edouard@3835: ```
edouard@3835: # setup isolated python environment
edouard@3835: virtualenv ~/Beremiz/venv
edouard@3835: 
edouard@3835: # install required python packages
edouard@3835: ~/Beremiz/venv/bin/pip install -r ~/Beremiz/beremiz/requirements.txt
edouard@3835: 
edouard@3835: ```
edouard@3835: 
edouard@3635: ### Build MatIEC compiler
edouard@3635: 
edouard@3635: ```
edouard@3635: cd ~/Beremiz/matiec
edouard@3635: autoreconf -i
edouard@3635: ./configure
edouard@3635: make
edouard@3635: ```
edouard@3635: 
edouard@3635: ### Build CanFestival (optional)
edouard@3635: 
edouard@3637: Only needed for CANopen support. Please read CanFestival manual to choose CAN interface other than `virtual`.
edouard@3635: 
edouard@3635: ```
edouard@3635: cd ~/Beremiz
edouard@3835: 
edouard@3835: hg clone http://hg.beremiz.org/canfestival
edouard@3835: #  -- or --
edouard@3872: git clone https://github.com/beremiz/canfestival
edouard@3835: 
edouard@3835: cd ~/Beremiz/canfestival
edouard@3635: ./configure --can=virtual
edouard@3635: make
edouard@3635: ```
edouard@3635: 
edouard@3635: ### Build Modbus library (optional)
edouard@3635: 
edouard@3635: Only needed for Modbus support.
edouard@3635: 
edouard@3635: ```
edouard@3635: cd ~/Beremiz
edouard@3835: 
edouard@3835: hg clone http://hg.beremiz.org/Modbus
edouard@3835: #  -- or --
edouard@3835: git clone https://github.com/beremiz/Modbus
edouard@3835: 
edouard@3635: cd ~/Beremiz/Modbus
edouard@3635: make
edouard@3635: ```
edouard@3635: 
edouard@3635: ### Build BACnet (optional)
edouard@3635: 
edouard@3635: Only needed for BACnet support.
edouard@3635: 
edouard@3635: ```
edouard@3635: cd ~/Beremiz
edouard@3635: svn checkout https://svn.code.sf.net/p/bacnet/code/trunk/bacnet-stack/ BACnet
edouard@3635: cd BACnet
edouard@3635: make MAKE_DEFINE='-fPIC' MY_BACNET_DEFINES='-DPRINT_ENABLED=1 -DBACAPP_ALL -DBACFILE -DINTRINSIC_REPORTING -DBACNET_TIME_MASTER -DBACNET_PROPERTY_LISTS=1 -DBACNET_PROTOCOL_REVISION=16' library
edouard@3635: ```
edouard@3635: 
edouard@3635: ### Launch Beremiz IDE
edouard@3635: 
edouard@3635: ```
edouard@3951: ~/Beremiz/venv/bin/python ~/Beremiz/beremiz/Beremiz.py
edouard@3635: ```
edouard@3635: 
edouard@3635: ## Run standalone Beremiz runtime ##
edouard@3635: 
edouard@3635: * Start standalone Beremiz service
edouard@3635: 
edouard@3635: ```
edouard@3635: mkdir ~/beremiz_runtime_workdir
edouard@3951: ~/Beremiz/venv/bin/python ~/Beremiz/beremiz/Beremiz_service.py -p 61194 -i localhost -x 0 -a 1 ~/beremiz_runtime_workdir
edouard@3635: ```
edouard@3635: 
edouard@3635: To connect IDE with runtime, enter target location URI in project's settings (project->Config->BeremizRoot/URI_location) pointed to your running Beremiz service in this case :
edouard@3635: 
edouard@3635: ```
edouard@3635: PYRO://127.0.0.1:61194
edouard@3635: ```
edouard@3635: 
edouard@3635: If project's URL is 'LOCAL://', then IDE launches on demand a local instance of Beremiz python runtime working on a temporary directory.
andrej@1679: 
edouard@3450: ## Build documentation
edouard@3450: 
edouard@3637: Source code for documentation is stored in `doc` directory in project's source tree.
edouard@3635: It's written in reStructuredText (ReST) and uses Sphinx to generate documentation in different formats.
edouard@3450: 
edouard@3450: To build documentation you need following packages on Ubuntu/Debian:
edouard@3450: 
edouard@3450: ```
edouard@3450: sudo apt-get install build-essential python-sphynx
edouard@3450: ```
edouard@3450: 
edouard@3450: ### Documentation in HTML
edouard@3450: 
edouard@3450: Build documentation
edouard@3450: 
edouard@3450: ```
edouard@3450: cd ~/Beremiz/doc
edouard@3450: make all
edouard@3450: ```
edouard@3450: 
edouard@3637: Result documentation is stored in directories `doc/_build/dirhtml*`.
edouard@3450: 
edouard@3450: ### Documentation in PDF
edouard@3450: 
edouard@3450: To build pdf documentation you have to install additional packages on Ubuntu/Debian:
edouard@3450: 
edouard@3450: ```
edouard@3450: sudo apt-get install textlive-latex-base texlive-latex-recommended \
edouard@3450:      texlive-fonts-recommended texlive-latex-extra
edouard@3450: ```
edouard@3450: 
edouard@3450: Build documentation
edouard@3450: 
edouard@3450: ```
edouard@3450: cd ~/Beremiz/doc
edouard@3450: make latexpdf
edouard@3450: ```
edouard@3450: 
edouard@3637: Result documentation is stored in `doc/_build/latex/Beremiz.pdf`.
edouard@3450: 
andrej@2253: ## Documentation ##
andrej@1679: 
andrej@1679:  * See [Beremiz youtube channel](https://www.youtube.com/channel/UCcE4KYI0p1f6CmSwtzyg-ZA) to get quick information how to use Beremiz IDE.
v@3605: 
edouard@3635:  * [Official documentation](http://beremiz.readthedocs.io/) is built from sources in doc directory.
andrej@1729:    Documentation does not cover all aspects of Beremiz use yet.
andrej@1729:    Contribution are very welcome!
andrej@1727:    
andrej@1679:  * [User manual](http://www.sm1820.ru/files/beremiz/beremiz_manual.pdf) from INEUM (Russian).
andrej@1679:    Be aware that it contains some information about functions available only in INEUM's fork of Beremiz.
andrej@1679: 
andrej@1679:  * [User manual](http://www.beremiz.org/LpcManager_UserManual.pdf) from Smarteh (English).
andrej@1679:    Be aware that it contains some information about functions available only in Smarteh's fork of Beremiz.
andrej@1679: 
andrej@1679:  * Outdated short [user manual](https://www.scribd.com/document/76101511/Manual-Beremiz#scribd) from LOLI Tech (English).
andrej@1679: 
andrej@1679:  * See official [Beremiz website](http://www.beremiz.org/) for more information.
andrej@1679: