freeopcua / opcua-modeler Goto Github PK
View Code? Open in Web Editor NEWGUI to create OPC UA models and export them as XML
License: GNU General Public License v3.0
GUI to create OPC UA models and export them as XML
License: GNU General Public License v3.0
Currently, adding nodes with children doesn't export all the nodes.
For example if you instantiate an Object from an Object type which has children, only the instantiated object is exported.
When an object is added, we need to search for children recursively in _after_add
method.
Work in progress, feel free to fix and/or comments
every steps/module here is checked when it is roughly implemented. polishing will come later
0.1
0.2
0.3
0.4
0.5
0.5.5
0.6
later:
Installed from pip version 0.4.0
Tried to run opcua-modeler and got this error:
$ opcua-modeler
Traceback (most recent call last):
File "C:\Python27\Scripts\opcua-modeler-script.py", line 9, in <module>
load_entry_point('opcua-modeler==0.4.0', 'console_scripts', 'opcua-modeler')()
File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 542, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 2569, in load_entry_point
return ep.load()
File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 2229, in load
return self.resolve()
File "c:\python27\lib\site-packages\pkg_resources\__init__.py", line 2235, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
ImportError: No module named uamodeler.uamodeler
uamodeler module is missing the __init__.py
file to allow it to be imported as a module.
This just a notice that we can now delete csvtoxml folder in this repository. This tool was a hack I made because there was no free modeling tool available. It's left over from before we decided to use the server in the background for designing an address space.
opcua-modeler is good enough now that we will never need this.
Hi,
I stumbled upon some odd behaviour while trying to understand how to use XML Schemas. I used the myNS.xml example from open62541 docs.
So the opcua-modeler shows the object definitionas as expected (in Types/Object Types):
In the definition, Pump is a child of FieldDevice. However, if I add a new object (in Objects/a folder) as defined above, then unexpected results happen:
The device object has just two subnodes (ManufacturerName and ModelName), with no pump in it. Then if pump is added, it has all its subnodes plus ManufacturerName and ModelName. The last two variables are actually siblings of the pump and should not get as children in the pump description.
So the question is whether it is desired behaviour, there is something funny in the XML description, or whether there is a bug in the modeler handling objects?
cheers, Nikolay
Is it a bug or a feature?
Copy-paste should be of paste-environment and adjust Browsename accoringly
Also id generation should be consideren
I created my address space, but there is no ModellingRule in the xml. When I implement the new model with open62541(a opc ua sdk), it can't present the correct variant , because that variant has no ModellingRule. So help!
Hi, i got a symmetric reference type without inverseName
<UAReferenceType BrowseName="1:zz" NodeId="ns=1;i=4002" Symmetric="true">
<DisplayName>zz</DisplayName>
<References>
<Reference IsForward="false" ReferenceType="HasSubtype">i=32</Reference>
</References>
</UAReferenceType>
Saving gives an error:
File "C:\freeopcua-modeler\python-opcua\opcua\common\xmlexporter.py", line 299, in add_etree_reference_type
self._add_sub_el(obj_el, 'InverseName', var.Value.Value.Text.decode('utf-8'))
AttributeError: 'NoneType' object has no attribute 'decode'
Love the effort, and would really like to test the tool.
I thought I installed everything needed but when I try running app.py it complains as follows:
C:\Some\opcua-modeler-master>python app.py Traceback (most recent call last): File "app.py", line 3, in <module> main() File "C:\Some\opcua-modeler-master\uamodeler\uamodeler.py", line 434, in main modeler = UaModeler() File "C:\Some\opcua-modeler-master\uamodeler\uamodeler.py", line 58, in __init__ self._restore_state() File "C:\Some\opcua-modeler-master\uamodeler\uamodeler.py", line 182, in _restore_state self.restoreState(self.settings.value("main_window_state", b"")) TypeError: restoreState(self, Union[QByteArray, bytes, bytearray], version: int = 0): argument 1 has unexpected type 'sip.voidptr'
of course, I have limited experience in python (but no one else is creating a free infomodel tool)...
The indicator is showing both type and value as "None" and crashes
showing error: invalid literal for int() with base 10: 'None' 1
Traceback (most recent call last):
File "\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64
\lib\site-packages\uawidgets\attrs_widget.py", line 237, in setModelData
dv.Value = string_to_variant(text, dtype)
File "\Downloads\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64
\lib\site-packages\opcua\common\ua_utils.py", line 113, in string_to_variant
return ua.Variant(string_to_val(string, vtype), vtype)
File "\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64
\lib\site-packages\opcua\common\ua_utils.py", line 84, in string_to_val
val = int(string)
ValueError: invalid literal for int() with base 10: 'None'
I have to add Value Node in XML manually
When I create a variable of any underlying data type, within the saved XML the format is as follows:
<Value>
<uax:Double>0.0</uax:Double>
</Value>
I'd expect something more like the following, so that an interpreter is able to create the correct value object component under a variable type object. See the example of the open62541 XML node-set compiler for reference.
<Value>
<ListOfExtensionObject>
<ExtensionObject>
<TypeId>
<Identifier>i=63</Identifier>
</TypeId>
<Body>
<Argument>
<Name>stopped</Name>
<DataType>
<Identifier>i=11</Identifier>
</DataType>
<ValueRank>-1</ValueRank>
<ArrayDimensions></ArrayDimensions>
<Description/>
</Argument>
</Body>
</ExtensionObject>
</ListOfExtensionObject>
</Value>
This issue in node-red-contrib-iiot-opcua is the underlying use-case problem. Basically a node-set compiler of the node-opcua is not able to interpret the xml file correctly, which leads to the 'value' component not being created thus no read/write operations are possible. I'm not quite sure yet, if this is a problem with the modeler or the node-red or node-opcua projects.
Starting from a new model, when I create a new object type and check the Auto NodeID button, the node ID that is assigned is 20001. Subsequent auto node IDs increment up from there.
20001 is already used by PubSubDiagnosticsDataSetWriterType_Counters_StateOperationalFromError_DiagnosticsLevel according to https://github.com/OPCFoundation/UA-Nodeset/blob/master/Schema/NodeIds.csv
In OPC UA you can use multiple XML files as a basis and on top of them build your own information model.
E.g. I also want to use the "Devices" IM (https://opcfoundation.org/UA/schemas/DI/1.00/Opc.Ua.Di.NodeSet2.xml) for my modelling, and based on this build my own IM, let's say Namespace "urn:somestuff".
After modelling my own IM I only want to export the stuff I defined, not the whole "Devices" IM again, because it will be loaded separately into my OPC UA Server, so I only want to export the "urn:somestuff".
As far as I can see it that's currently not possible?
If I get some free time in the next weeks I was thinking about expanding my knowledge on unit tests. I have never wrote them before.
I read this and it doesn't look that difficult, but I think we should add this to modeler.
http://johnnado.com/pyqt-qtest-example/
I will probably need help because I'm inexperienced.
Should not be hard, I need to make a simple plugin architecture and use our client to access the internal server and optionaly support xml if server does not have xml support. It does require the server to support the node management service though!
@Pro @jpfr Does open62541 has python wrapper? or should I use Cython? I coult not find any ref to python in your repository, but I kind of remember seing something..... I could also simply start the server as an external command but that will make it hard to kill it properly...
Is adding references possible with the current version? Cannot find any menu or button
Trying to instal and run opcua-modeler
:
$ pip3 install opcua-modeler
...
Successfully installed freeopcua lxml-3.5.0 opcua-modeler opcua-widgets python-dateutil pytz six-1.10.0
$ opcua-modeler
opcua-modeler: command not found
Where am I going wrong?
I'm look at fixing methods.
When comparing to UAModeler, I see that the simple method I created requires an extension object.
Is this normal? Do we need to support extension objects to support methods?
Method Argument in UAModeler:
You can see that UAModeler only keeps track of what kind of extension object to make, in this case (296 = Argument)
This is the XML that gets created.
This also breaks Free OPC UA Modeler, because it does not parse out the extension object at this time (see Value attribute):
If I can get some clues on how to approach this I can begin working on it.
we do not have time to read error with the current statusbar error display
I have a problem reading a value from the internal OPC server. I use the QuickOPC toolkit and get the error message:
"The first namespace in the table must be the OPC-UA namespace."
After loading example.xml the namespace array contains:
[0] urn:freeopcua:python:server
[1] urx:mycompany:myproject
The screenshot that comes with the folder opcua-modeler (screenshot.png) shows index 0 with the value http://opcfoundation.org/UA/
.
So, is the index 0 problem a bug or can I configure it somehow?
Since I used git clone
, I assume, I have the most recent version ...
Best regards!
if i have an opc Server,how could i make them connect,maybe this question can be interpreted as where in the code "opcua-modeler" could i change to make it communicate with my local server, i provide local server's address or the code could identified the address of server by its own?
Is this a design decision or expected behaviour? I was expecting to be able to create PropertyType-Variables under other Variables. In the documentation I've only read that PropertyType-Variables cannot be placed under other PropertyType-Variables. So does this apply to all variables?
qt.svg: :/folder.svg:141:6: Could not resolve property: pattern5614
qt.svg: :/folder.svg:141:6: Could not resolve property: pattern5626
qt.svg: :/folder.svg:141:6: Could not resolve property: pattern5614
qt.svg: :/folder.svg:141:6: Could not resolve property: pattern5626
qt.svg: :/folder.svg:141:6: Could not resolve property: pattern5614
qt.svg: :/folder.svg:141:6: Could not resolve property: pattern5626
and how could i connect to local opc-server?
Resume discussions on how to implement a UA model in XML from FreeOpcUa/python-opcua#248 to keep issues between project separated.
Hello,
it would be great if we could generate some UML class diagramm from a UA model.
If you read a companion spec, you might have seen some UML diagramms that visualize the UA model. I think that these diagramms are a good way to get a fast understanding of the given model. Thus, if you have to write some documentation of your model, you would have a "single source of truth". One might even create some special extensions for the opcua-modeler nodes in order to document the model / type / ... nodes and create some sort of auto-documentation from the UA model.
Since I am not familiar if there is some sort of XML specification for UML diagramms, I can not make an suggestion on technical details here.
Menu is only limited to ObjectTypes
I have installed a version with pip3.
I expect that this version should be able to open example.xml.
However I get the following error:
uamodeler.uamodeler - INFO - Starting server on opc.tcp://0.0.0.0:48400/freeopcua/uamodeler/')
opcua.server.address_space - WARNING - AddNodesItem: Requested NodeId NumericNodeId(i=2001) already exists')
uawidgets.utils - ERROR - The requested node id is already used by another node.(BadNodeIdExists)')
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/uawidgets/utils.py", line 21, in wrapper
result = func(self, *args)
File "/usr/local/lib/python3.4/dist-packages/uamodeler/uamodeler.py", line 357, in _open
path = self._import(path)
File "/usr/local/lib/python3.4/dist-packages/uamodeler/uamodeler.py", line 334, in _import
new_nodes = self.server_mgr.import_xml(path)
File "/usr/local/lib/python3.4/dist-packages/uamodeler/server_manager.py", line 72, in import_xml
return self._backend.import_xml(path)
File "/usr/local/lib/python3.4/dist-packages/uamodeler/server_manager.py", line 105, in import_xml
return self._server.import_xml(path)
File "/usr/local/lib/python3.4/dist-packages/opcua/server/server.py", line 422, in import_xml
return importer.import_xml(path)
File "/usr/local/lib/python3.4/dist-packages/opcua/common/xmlimporter.py", line 63, in import_xml
node = self.add_object_type(nodedata)
File "/usr/local/lib/python3.4/dist-packages/opcua/common/xmlimporter.py", line 171, in add_object_type
res[0].StatusCode.check()
File "/usr/local/lib/python3.4/dist-packages/opcua/ua/uatypes.py", line 201, in check
raise UaStatusCodeError(self.value)
opcua.ua.uaerrors._auto.BadNodeIdExists: The requested node id is already used by another node.(BadNodeIdExists)
uamodeler.uamodeler - INFO - Starting server on opc.tcp://0.0.0.0:48400/freeopcua/uamodeler/')
opcua.server.address_space - WARNING - AddNodesItem: Requested NodeId NumericNodeId(i=2001) already exists')
uawidgets.utils - ERROR - The requested node id is already used by another node.(BadNodeIdExists)')
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/uawidgets/utils.py", line 21, in wrapper
result = func(self, *args)
File "/usr/local/lib/python3.4/dist-packages/uamodeler/uamodeler.py", line 357, in _open
path = self._import(path)
File "/usr/local/lib/python3.4/dist-packages/uamodeler/uamodeler.py", line 334, in _import
new_nodes = self.server_mgr.import_xml(path)
File "/usr/local/lib/python3.4/dist-packages/uamodeler/server_manager.py", line 72, in import_xml
return self._backend.import_xml(path)
File "/usr/local/lib/python3.4/dist-packages/uamodeler/server_manager.py", line 105, in import_xml
return self._server.import_xml(path)
File "/usr/local/lib/python3.4/dist-packages/opcua/server/server.py", line 422, in import_xml
return importer.import_xml(path)
File "/usr/local/lib/python3.4/dist-packages/opcua/common/xmlimporter.py", line 63, in import_xml
node = self.add_object_type(nodedata)
File "/usr/local/lib/python3.4/dist-packages/opcua/common/xmlimporter.py", line 171, in add_object_type
res[0].StatusCode.check()
File "/usr/local/lib/python3.4/dist-packages/opcua/ua/uatypes.py", line 201, in check
raise UaStatusCodeError(self.value)
opcua.ua.uaerrors._auto.BadNodeIdExists: The requested node id is already used by another node.(BadNodeIdExists)
uamodeler.uamodeler - INFO - Starting server on opc.tcp://0.0.0.0:48400/freeopcua/uamodeler/')
uamodeler.uamodeler - INFO - Starting server on opc.tcp://0.0.0.0:48400/freeopcua/uamodeler/')
opcua.server.address_space - WARNING - AddNodesItem: Requested NodeId NumericNodeId(i=2001) already exists')
uawidgets.utils - ERROR - The requested node id is already used by another node.(BadNodeIdExists)')
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/uawidgets/utils.py", line 21, in wrapper
result = func(self, *args)
File "/usr/local/lib/python3.4/dist-packages/uamodeler/uamodeler.py", line 357, in _open
path = self._import(path)
File "/usr/local/lib/python3.4/dist-packages/uamodeler/uamodeler.py", line 334, in _import
new_nodes = self.server_mgr.import_xml(path)
File "/usr/local/lib/python3.4/dist-packages/uamodeler/server_manager.py", line 72, in import_xml
return self._backend.import_xml(path)
File "/usr/local/lib/python3.4/dist-packages/uamodeler/server_manager.py", line 105, in import_xml
return self._server.import_xml(path)
File "/usr/local/lib/python3.4/dist-packages/opcua/server/server.py", line 422, in import_xml
return importer.import_xml(path)
File "/usr/local/lib/python3.4/dist-packages/opcua/common/xmlimporter.py", line 63, in import_xml
node = self.add_object_type(nodedata)
File "/usr/local/lib/python3.4/dist-packages/opcua/common/xmlimporter.py", line 171, in add_object_type
res[0].StatusCode.check()
File "/usr/local/lib/python3.4/dist-packages/opcua/ua/uatypes.py", line 201, in check
raise UaStatusCodeError(self.value)
opcua.ua.uaerrors._auto.BadNodeIdExists: The requested node id is already used by another node.(BadNodeIdExists)
uamodeler.uamodeler - INFO - Starting server on opc.tcp://0.0.0.0:48400/freeopcua/uamodeler/')
uamodeler.uamodeler - INFO - Starting server on opc.tcp://0.0.0.0:48400/freeopcua/uamodeler/')
opcua.server.address_space - WARNING - AddNodesItem: Requested NodeId NumericNodeId(i=2001) already exists')
uawidgets.utils - ERROR - The requested node id is already used by another node.(BadNodeIdExists)')
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/uawidgets/utils.py", line 21, in wrapper
result = func(self, *args)
File "/usr/local/lib/python3.4/dist-packages/uamodeler/uamodeler.py", line 357, in _open
path = self._import(path)
File "/usr/local/lib/python3.4/dist-packages/uamodeler/uamodeler.py", line 334, in _import
new_nodes = self.server_mgr.import_xml(path)
File "/usr/local/lib/python3.4/dist-packages/uamodeler/server_manager.py", line 72, in import_xml
return self._backend.import_xml(path)
File "/usr/local/lib/python3.4/dist-packages/uamodeler/server_manager.py", line 105, in import_xml
return self._server.import_xml(path)
File "/usr/local/lib/python3.4/dist-packages/opcua/server/server.py", line 422, in import_xml
return importer.import_xml(path)
File "/usr/local/lib/python3.4/dist-packages/opcua/common/xmlimporter.py", line 63, in import_xml
node = self.add_object_type(nodedata)
File "/usr/local/lib/python3.4/dist-packages/opcua/common/xmlimporter.py", line 171, in add_object_type
res[0].StatusCode.check()
File "/usr/local/lib/python3.4/dist-packages/opcua/ua/uatypes.py", line 201, in check
raise UaStatusCodeError(self.value)
opcua.ua.uaerrors._auto.BadNodeIdExists: The requested node id is already used by another node.(BadNodeIdExists)
I'm normally always running python code directly from an IDE. However today I tried to run modeler after installing via pip.
In windows you cannot do python opcua-modeler
or python uamodeler.py
.
You have to open the python console and type
>>>from uamodeler.uamodeler import main
>>>main()
Am I missing something obvious?
no idea why but nobody uses that yet...
Traceback (most recent call last):
File "\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64
\lib\site-packages\uawidgets\attrs_widget.py", line 204, in createEditor
return BitEditor(parent, attr, dv.Value.Value)
File "\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64
\lib\site-packages\uawidgets\attrs_widget.py", line 30, in init
if ua.test_bit(val, el.value):
AttributeError: module 'opcua.ua' has no attribute 'test_bit'
If a model is open, and you press the open button, it clears the entire address space before allowing a new xml to be selected.
It should only clear the address space if a new xml is actually selected, that way cancel function works as expected (no changes to currently loaded address space).
When I copy an object A with typedefintion T and rename it to object B, the typedefinition ob B is A and not T.
P.S. sorry for flooding, it is okay?
Exporting a GUID results in XML like this:
<Value>
<uax:Guid>00000000-0000-0000-0000-000000000000</uax:Guid>
</Value>
It should be exported as a structure:
<Value>
<uax:Guid>
<uax:String>00000000-0000-0000-0000-000000000000</uax:String>
</uax:Guid>
</Value>
Hi,
XML the export of UAReferenceType is serialized like this
<DisplayName></DisplayName>
<InserseName></InverseName>
<References></References>
however UANodeSet.xsd requires the following order:
<DisplayName></DisplayName>
<References></References>
<InserseName></InverseName>
As I import xml from UaModeler I found all of the child of the datatype are removed
https://www.unified-automation.com/products/development-tools/uamodeler.html
Methods and ObjectTypes are successfully transformed.
I run master. New project -> right-click "Add namespace" -> "test" as value
Traceback (most recent call last):
File "C:\Users\z\Documents\freeopcua-modeler\opcua-widgets\uawidgets\uti
ls.py", line 21, in wrapper
result = func(self, *args)
File "C:\Users\z\Documents\freeopcua-modeler\opcua-modeler\uamodeler\nam
espace_widget.py", line 127, in setModelData
self.logger.info("Writting namespace array: %s", uries)
AttributeError: 'MyDelegate' object has no attribute 'logger'
During handling of the above exception, another exception occurred:
TypeError: NamespaceWidget.error[str].emit(): argument 1 has unexpected type 'At
tributeError'
I loaded the "Devices Information Model" (from https://opcfoundation.org/UA/schemas/DI/1.00/Opc.Ua.Di.NodeSet2.xml) into the modeler and then just hit "Save As" (without any modification).
What I expected was to get the same XML back.
But unfortunately there are some issues here:
Description="b'Defines the basic information components for all configurable elements in a device topology'"
(Note the additional b
and quotation) as an attribute. It should be a child tag.urn:freeopcua:python:server
should not be added automatically. We are using open62541 and thus don't need this namespace in the XMLIsForward="true"
should not be printed if it is the default value true
. Only if false
IsAbstract="false"
should not be printed if it is the default value false
. Only if true
Devlopers I am trying to use this tool for my personal OPC_UA project. I want to create a instance model using nodsets released by Euromap organisation. I am attaching the link for downloading nodeset xml files from the organisations homepage.
http://www.euromap.org/en/euromap83 (Opc_Ua.EUROMAP83.NodeSet2.xml)
http://www.euromap.org/en/euromap77 (Opc_Ua.EUROMAP77.NodeSet2.xml)
using these two nodesets I want to create a new model, but if I try to add these nodesets I get exceptions. Commercial modellers such as UA Modeler can use these Nodesets.
Euromap is European Plastic and Rubber organisation, and Euromap Companion Specs will be used by industries all over world as European standards are taken as norm in most countries, so i think solwing this issue will open a large pool of user and supporters for this project.
Thanks
Here is the exception when I try to add euromap 83 namespace from xml file. Before it I have addede da.di namespace.
I have a dedicated files for instance (i.xml) and type (t.xml) node sets. How can I load t.xml first and i.xml later and work in it? Currently I can add both of them as reference node sets, but then opening a new file reloads the whole server.
Error parsing extension object
In UaModeler you can compile c / c++ code that are compliant with UA SDK.
This could be a great feature in the opcua modeler too. Thus, you can create your information model and generate the necessary python objects that are needed if you want to use the model in the freeopcua-python context.
Example: Structure datatypes (see BuildInfo
of standard spec as example)
Why are Uris over 2 the only ones exported?
uris = self.server.get_namespace_array()[2:]
Shouldn't indexes of 1 or greater be exported?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.