README.md 3.3 KB
Newer Older
Gino Tosti's avatar
Gino Tosti committed
1
2
as root:

Gino Tosti's avatar
Gino Tosti committed
3
4
5
yum install libXScrnSaver

as user:
Gino Tosti's avatar
Gino Tosti committed
6

Gino Tosti's avatar
Gino Tosti committed
7
pip install --upgrade --user pip  setuptools wheel
Gino Tosti's avatar
Gino Tosti committed
8

Gino Tosti's avatar
Gino Tosti committed
9
pip install --user Cheetah3
Gino Tosti's avatar
Gino Tosti committed
10

Gino Tosti's avatar
Gino Tosti committed
11
pip install --user xlrd==2.0.1
Gino Tosti's avatar
Gino Tosti committed
12

Gino Tosti's avatar
Gino Tosti committed
13
pip install --user openpyxl
Gino Tosti's avatar
Gino Tosti committed
14

Gino Tosti's avatar
Gino Tosti committed
15
pip install --user pandas (it could be already installed)
Gino Tosti's avatar
Gino Tosti committed
16

Gino Tosti's avatar
Gino Tosti committed
17
pip install --user pysimplegui
Gino Tosti's avatar
Gino Tosti committed
18
19

Install pyGen:
Gino Tosti's avatar
Gino Tosti committed
20

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

Gino Tosti's avatar
Gino Tosti committed
23
source install.sh
Gino Tosti's avatar
Gino Tosti committed
24
25
26
27

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

Gino Tosti's avatar
Gino Tosti committed
28
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
29

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

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

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

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

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

Gino Tosti's avatar
Gino Tosti committed
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<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

58
59
60
61
62
63
64
65
66
67
<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 
Gino Tosti's avatar
Gino Tosti committed
68

69
yum install libxcb
Gino Tosti's avatar
Gino Tosti committed
70

71
yum install xcb-util-wm
Gino Tosti's avatar
Gino Tosti committed
72

73
yum install xcb-util-image
Gino Tosti's avatar
Gino Tosti committed
74

75
yum install xcb-util-keysyms
Gino Tosti's avatar
Gino Tosti committed
76

77
78
79
80
yum install xcb-util-renderutil

from user account:
Install pyQT
Gino Tosti's avatar
Gino Tosti committed
81

82
 pip3 install --user PyQt5
Gino Tosti's avatar
Gino Tosti committed
83

84
85
 pip3 install --user pyqtgraph

Gino Tosti's avatar
Gino Tosti committed
86
87
88
89
90
91
Install Mysql Connector:

 pip install --user mysql-connector-python



92
93
94
95
96
97
98
99
100
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----------
Gino Tosti's avatar
Gino Tosti committed
101

102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
$>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.

Gino Tosti's avatar
Gino Tosti committed
131
132