Newer
Older
set enviroment variable:
export $PYGEN=/home/<your_account>/pyGen
To test the generator from command line (this allow to create multiple devices components from a single ICD):
To test the generator with the GUI (only single device component generation is supported)
<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 Mysql Connector:
pip install --user mysql-connector-python
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----------
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.