[Beremiz-devel] OPC-UA server support: help!

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Beremiz-devel] OPC-UA server support: help!

Mario de Sousa


 Hi Andrey & Edouard,

Context
------------
I am trying to develop a Beremiz plugin for some very basic OPC-UA server
support.
The OPC-UA plugin will work a little differently to other plugins as it will
need to access the PLC variables directly, instead of mapping them to located
variables (%Ixx, %Qxx).


Help needed
-------------------
I need to get a list of the global variables and their datatypes.
I can easily get a reference to the PLCController object (i.e. the Config Tree
Node root).

I haven't found a clean way of getting the {variable, data-type} info from
this object.

I can get a list of the variable names calling
PLCController.GetConfigurationVariableNames()

I can also get a list of the configuration names calling
PLCController.GetProjectConfigNames()
or
PLCController.GetProjectInfos()  (among other stuff)

I can't seem to get the data-type of each of the listed variables using the
PLCController interface.

I am currently considering 3 possibilities:

1)
 Is there a method that I have missed that will give me that info ?

2)
I can probably get the info I need (data-type of each variable) by following
the PLCController.Project object, but I suspect that you wouldn't consider
this the best way of going about it.

3)
Should I add (or change) a method of PLCController to give the data-type of
each variable?


  Mario.
 



_______________________________________________
Beremiz-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beremiz-devel
skv
Reply | Threaded
Open this post in threaded view
|

Re: [Beremiz-devel] OPC-UA server support: help!

skv
Administrator
Hi Mario,

could this function help you? It list of all variables used in all
POUs. It's used by Beremiz debugger.

ProjectController.GetIEC,ProgramsAndVariables(self):
ProjectController.self._ProgramList
ProjectController.self._VariablesList

BTW as you are probably know there is on-going effort to port Beremiz
to python3. It would be nice if you'd write python3-compatible code.

There is script in tests/tools/check_source.sh, that checks code-style, does
some static analysis checks, checks some python3 compatibility checks.

It checks only for problems that are already fixed in Beremiz to
detect regressions and to avoid them.
It's called automatically every-time new code is pushed to automforge/beremiz repository
(called pipeline). If all checks are passed, then green check is shown near the commit.
See https://bitbucket.org/automforge/beremiz/commits/all

I'd recommend you to run check_source.sh script locally before commit and to enable
Pipelines in your Beremiz fork (it should be done explicitly in repo settings).
I've added this script to run automatically before commit, so I can't
commit any code that cause regression detected by check_source.sh.

I use following lines in Beremiz .hg/hgrc to achieve that.

[hooks]
pre-shelve.linter = touch .hg/skiphook
post-shelve.linter = rm .hg/skiphook
pretxncommit.linter =  ./tests/tools/check_source.sh --only-changes



Full check takes pretty long, you can run
'./tests/tools/check_source.sh --only-changes'.
It will check only modified source files.


I really appreciate that you take a lot of effort to document you
code! Excellent! Could you write please function description not in a comment
block before function, but as a python docstring according to PEP-257.
Then it'll be automatically used by all python tools as function
description and used for generating API documentation (when we do this).
https://www.python.org/dev/peps/pep-0257/


On 19-02-20 14:26, Mario de Sousa wrote:

>
>
>  Hi Andrey & Edouard,
>
> Context
> ------------
> I am trying to develop a Beremiz plugin for some very basic OPC-UA server
> support.
> The OPC-UA plugin will work a little differently to other plugins as it will
> need to access the PLC variables directly, instead of mapping them to located
> variables (%Ixx, %Qxx).
>
>
> Help needed
> -------------------
> I need to get a list of the global variables and their datatypes.
> I can easily get a reference to the PLCController object (i.e. the Config Tree
> Node root).
>
> I haven't found a clean way of getting the {variable, data-type} info from
> this object.
>
> I can get a list of the variable names calling
> PLCController.GetConfigurationVariableNames()
>
> I can also get a list of the configuration names calling
> PLCController.GetProjectConfigNames()
> or
> PLCController.GetProjectInfos()  (among other stuff)
>
> I can't seem to get the data-type of each of the listed variables using the
> PLCController interface.
>
> I am currently considering 3 possibilities:
>
> 1)
>  Is there a method that I have missed that will give me that info ?
>
> 2)
> I can probably get the info I need (data-type of each variable) by following
> the PLCController.Project object, but I suspect that you wouldn't consider
> this the best way of going about it.
>
> 3)
> Should I add (or change) a method of PLCController to give the data-type of
> each variable?
>
>
>   Mario.
>  
>
>
>
> _______________________________________________
> Beremiz-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/beremiz-devel
--
Best regards,
Andrey Skvortsov


_______________________________________________
Beremiz-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beremiz-devel

signature.asc (849 bytes) Download Attachment