server client implementation in lua throught C-api (or cli) for embedded device

305 views
Skip to first unread message

christof....@gmail.com

unread,
Jun 9, 2016, 5:37:13 AM6/9/16
to open62541
Hello Guys,

I've been looking through several OPC dev's, and finally have a preference for your effort for several reasons (pure C, ARM-raspberry demonstrated).
I've been looking into the code and examples, to get a feeling how much abstration is already there, and how much is needed at application level. But being no C-guru it's difficult to get a good feeling of it.

Our situation:

We have an embedded ARM based device 
This device is a multiprotocol gateway with an internal DB(sql-server) from which several (~15) worlds/protocols are (partly) synchronised

We would like to extend the protocol list with OPC-UA and have been investigating what codebasis exisists to have this running on our ARM device.

Obviously, we know there are resource limitations, so if we implement a server it will be lightweight with limited nodes, etc. Afterall, the device is not meant to be the 'real' OPC server of a complete installation, but is targetted to allow to connect parts only speaking modbus/KNX/BACnet/EnOcean/DMX/Dali/...  to the 'real' OPC server of the project.

We have 2 use cases / options: 
- act as OPC server, and have some code to sychronise (part) of the internal DB with the server (bidirectionally) (maybe to implement as server + internal client seperately)
- act as client only, exposing functions to sychronise (part) of the internal DB with an (external) OPC server

Ideally we have both, but if server resources are too much a concern, we could live with option 2 alone, although not ideal.

We do all app-level coding in Lua so we would need to wrap your C library functions (or part thereof) into a lua library with the right level of abstraction. Lua has a mechanism for that with a C wrapper library allowing to define/create  a lua library from pure C-code.

My questions are:
- is the 0.2 (once released  in a few weeks) good enough, feature wise, to use the 62541 library for what we need (see below)?
- would it be feasible to run a (lightweight) server on such embedded device?
- what kind of resource/time would it take (I know this is difficult, but just a ball park figure)?
- since we are/have no c-programmers, is there someone listening here who has sufficient time to take this kind of assignement?

The functions we'de need in the Lua lib are:
- init/start/stop server with some default 'settings' (for option 1 only),
- connect or get handle to running server (local or remote)
- check/get connection state
- disconnect from server
- check if namespace exsist on server
- add a namespace
- check if node exsist in a namespace of a server
- add a node (to a namespace on the local/remote server)
- delete a node (on the local/remote server)
- update a node value (of the local/remote server)
- provide a callback mechanism (eg through a listener) that informs back when a node value in a certain namespace changed (and preferably who(client IP or so) changed it).  

Note: if too difficult (or too much work) to turn into lua lib, a cli aproach would also be workable (since we can wrap that in lua). In that case the callback mechanism could be through a spool directory

Cheers,
Christof

Julius Pfrommer

unread,
Jun 9, 2016, 10:30:26 AM6/9/16
to open62541
Hey Christof,


- is the 0.2 (once released  in a few weeks) good enough, feature wise, to use the 62541 library for what we need (see below)?
Yes. We don't over encryption in v0.2. But those "standard" use cases you describe are covered.

- would it be feasible to run a (lightweight) server on such embedded device?
- what kind of resource/time would it take (I know this is difficult, but just a ball park figure)?
Yes. open62541 runs on devices starting at ~100kb ROM + ~100kb RAM.
Everything else depends on the complexity of the information model.
 
- since we are/have no c-programmers, is there someone listening here who has sufficient time to take this kind of assignement?
We are all super-busy. For user-specific work, we'd have to have a project within our respective research organizations.

Since you want to use Lua as a scripting layer. We have an inofficial mapping of open62541 to Lua.
I will get back to you off-list.

Best regards,
Julius

Christof De Backere

unread,
Jun 9, 2016, 11:44:05 AM6/9/16
to open62541
Hi Julius,

You made my day.
Talk to you off-list,

Cheers,
Christof

Op donderdag 9 juni 2016 16:30:26 UTC+2 schreef Julius Pfrommer:

justu...@gmail.com

unread,
May 5, 2017, 10:11:34 AM5/5/17
to open62541
Hi Julius, Christof,

I'm curious if you were able to create the Lua scripting layer for open62541, can you maybe post an update?

Thanks,

Justus

Op donderdag 9 juni 2016 17:44:05 UTC+2 schreef Christof De Backere:

Julius Pfrommer

unread,
May 8, 2017, 3:56:42 AM5/8/17
to open62541, justu...@gmail.com
Hey Justus,

we have an implementation running. It works just fine.
We can give you a demo if you are interested.

Best regards,
Julius

Justus Rijke

unread,
May 8, 2017, 6:37:29 AM5/8/17
to Julius Pfrommer, open62541
Hi Julius,
Good to hear that & thanks for your quick reply! Is this something you are willing to share with the community, or is it a closed source project?
Regards Justus

Op 8 mei 2017 9:56 a.m. schreef "Julius Pfrommer" <julius....@gmail.com>:

oruku...@gmail.com

unread,
May 16, 2017, 12:00:59 PM5/16/17
to open62541
Hi Julius,

Today I found this discussion when reviewing Open62541 materials and searching for a Lua implementation.  It wasn't clear if the reference is only for bindings...
Does this library exist?

Best Regards,

Shima  

Julius Pfrommer

unread,
May 16, 2017, 12:12:53 PM5/16/17
to open62541, oruku...@gmail.com
Hey Shima,

the library implements a full OPC UA SDK for Lua.
We currently use it internally and give away demo binaries.

We might eventual have a commercial offering for the Lua SDK, but that is not yet a done deal.
If you are interested, fell free to contact me off list.

Best regards,
Julius
Reply all
Reply to author
Forward
0 new messages