Skip to content
README.md 3.24 KiB
Newer Older
Gino Tosti's avatar
Gino Tosti committed
as root:

Gino Tosti's avatar
Gino Tosti committed
yum install libXScrnSaver

as user:
Gino Tosti's avatar
Gino Tosti committed

Gino Tosti's avatar
Gino Tosti committed
python -m pip install --upgrade pip  setuptools wheel
Gino Tosti's avatar
Gino Tosti committed

Gino Tosti's avatar
Gino Tosti committed
python -m  pip install Cheetah3
Gino Tosti's avatar
Gino Tosti committed

Gino Tosti's avatar
Gino Tosti committed
python -m  pip install xlrd==2.0.1
Gino Tosti's avatar
Gino Tosti committed

Gino Tosti's avatar
Gino Tosti committed
python -m  pip install openpyxl
Gino Tosti's avatar
Gino Tosti committed

Gino Tosti's avatar
Gino Tosti committed
python -m pip install pandas (it could be already installed)

Gino Tosti's avatar
Gino Tosti committed
python -m pip install pysimplegui

Install pyGen:
Gino Tosti's avatar
Gino Tosti committed

Gino Tosti's avatar
Gino Tosti committed
git clone git@git.ia2.inaf.it:gino.tosti/pygen.git

Gino Tosti's avatar
Gino Tosti committed
source install.sh
Gino Tosti's avatar
Gino Tosti committed

set enviroment variable:
export $PYGEN=/home/<your_account>/pyGen 

Gino Tosti's avatar
Gino Tosti committed
To test the generator from command line (this allow to create multiple devices components from a single ICD):
Gino Tosti's avatar
Gino Tosti committed

Gino Tosti's avatar
Gino Tosti committed
$>cd $PYGEN/test
Gino Tosti's avatar
Gino Tosti committed

Gino Tosti's avatar
Gino Tosti committed
$>python genDevice.py -f <your ICD file .xls/xlsx> -p astrima -m tcs
Gino Tosti's avatar
Gino Tosti committed

Gino Tosti's avatar
Gino Tosti committed
To test the generator with the GUI (only single device component generation is supported)
Gino Tosti's avatar
Gino Tosti committed

Gino Tosti's avatar
Gino Tosti committed
$>cd $PYGEN/test
Gino Tosti's avatar
Gino Tosti committed

Gino Tosti's avatar
Gino Tosti committed
$>python runGenDeviceGUI.py

Gino Tosti's avatar
Gino Tosti committed
<NEWS - 07/07/21>

It is now possible to generate an ICD in word (using the standard ASTRI document format) starting from open ecxel file format (.xlsx). 
To use this feature you have to install:
pip install --user docx
pip install --user docxtpl

To run the converter

$>cd $PYGEN/test
$>python icd_converter.py -f <your ICD file (xlsx format)>

es. 
$>python icd_converter.py -f $SHAREDIR/ICD/icdExample.xlsx
.....
.....
The generated .Docx file is: ..../ICD/icdExample.docx

<NEWS - 01/07/21>

An experimental simulation OPC-UA server written in python can be also generatedwith this version of pyGen. Arrays are not supported at present, then to play with it use ICD that do not include arrays.

Before to use it you need to install some libraries:

———Python OPCUA support libraries —-
the ACS environment  must be active
library needed by Qt
from root /sudo 
yum install libxcb
yum install xcb-util-wm
yum install xcb-util-image
yum install xcb-util-keysyms
yum install xcb-util-renderutil

from user account:
Install pyQT
 pip3 install --user PyQt5
 pip3 install --user pyqtgraph

Install python opcua https://github.com/FreeOpcUa/python-opcua

 pip3 install --user opcua
 pip3 install --user opcua-client

The documentation on python opcua is here:
https://github.com/FreeOpcUa/python-opcua

--------Simulation server generation----------
$>cd $PYGEN/test
$>python makeTestOPCUAServer.py -f <your ICD file .xls/xlsx> -o <ServerOutputDir> 
the input ICD file  shall be the same used to generate the ACS component.The default output dir is "./SimulationOPCUAserver"
in the output you have someting like:
....
....
Working on: ['MyDevice']
File: /home/astrisw/pyGen/test/SimulationOPCUAserver/MyDeviceServerModel.xml  created
File: /home/astrisw/pyGen/test/SimulationOPCUAserver/MyDevice_opcuaServer.py  created
The Simulation server can be reached at: opc.tcp://127.0.0.1:52523/OPCUA/hwSimulator

$>cd ServerOutputDir
$>python <DeviceName>_upcuaServer.py

you should see something like this output:

Server Started!
Python 3.6.9 (default, Sep  3 2020, 15:28:31) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.8.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]:

Insert exit at the In[1] prompt above.

To check the server open another terminal and insert the command:
$>opcua-client
Insert for example:"opc.tcp://127.0.0.1:52523/OPCUA/hwSimulator" in the input box on top left of the client and click on the "Connect button". You can play with the servers nodes now.