Skip to content

Latest commit

 

History

History

python

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

🐍 Python Driver

alt text

GitHub last commit

💬 Language

  • Python 3.7

📚 Required Libraries

Instalation

The module uses setuptools in order to install and configure all packages.

  1. (Optional) Create a virtual environment and activate it
    • python -m venv env
    • (windows) /env/Scripts/activate.bat
  2. Install everything using setup.py
    • pip install -e .
  3. Use within virtual enviroment

If you choose not to use virtual enviroment, you might need to edit the import statements of the module!

📜 PGVA Arguments

  • string ip - host IP for tcp/ip (ex. 192.168.0.XXX)
  • int port - TCP port number for tcp/ip (ex. 502)
  • int slave_id - unit or slave Modbus identification number for the device (ex. 0)

Example Code

🚀 Start

  • vaemConfig holds the arguments for the new VAEM object
  • Creates a new VAEM driver object (ip, port, slave_id) and attempts to connect
  • Initializes the device and configures the valves using the given array of opening times

image

♾️ Loop

  • While loop that repeatedly opens and closes valve 1
  • Reads the status of the VAEM after opening the valve
  • Waits one second between opening and closing, vice versa
  • Checks if there is an error and clears it if true

image

🚧 Constructor

  • Sets the TcpClient with the given host ip and port from config
  • Attempts three times to connect to the client
  • Throws an error if the code was not able to connect to the device

image

✔️ Initialization

  • Sets the operating mode to OpMode1 using a write operation
  • Clears any errors on the device using a write operation

(constructFrame builds the message to be sent to the device and transfer sends it)

image

🧑‍💻Interface

  • configureValves(valveOpeningTimes: dict);
  • openValve(self);
  • closeValve(self);
  • readStatus();
  • clearError();
  • saveSettings();

Author

Name Email GitHub
Milen Kolev milen.kolev@festo.com @MKollev