GithubHelp home page GithubHelp logo

How return value in method? about opcua-smart HOT 6 CLOSED

etm avatar etm commented on August 15, 2024
How return value in method?

from opcua-smart.

Comments (6)

fpauker avatar fpauker commented on August 15, 2024 1

In general, to collect data from real world equipment you need some kind of interface to access data from the device and provide it to the opc ua server application.
Typically this are some vendor specific protocols and then are mapped to opc ua servers.

hopefully this helps you.

from opcua-smart.

etm avatar etm commented on August 15, 2024 1

If you want to have a quick gander on some sample servers, e.g. an opcua server for a universal robot 10e, you can join me on discord https://discord.gg/u8Pe49. I will be online until 20:00 Porto Alegre time.

from opcua-smart.

etm avatar etm commented on August 15, 2024

I released (and pushed to git) a version that does it correctly. the return keyword signifies the datatype for the return. Only one return is supported at the moment. As customary in ruby, the last line in the block is the return value, no need to use the return keyword.

##Server
t.add_method :MethodX,
            inputarg1: OPCUA::TYPES::INT32,
            return: OPCUA::TYPES::INT32 do |node, inputarg1|
            p "Argument: #{inputarg1}"
            inputarg1 + 1
end

##Client
p node.call 1

Discussion: i personally am not a friend of using return values in methods, OPCUA is messy enough as it is. I typically create very simple methods with no return value, and write potential return values into variables in the same folder. This forces me to think more about a good structure. Also it never use long running methods, but instead always rely on conveying method state through some variable in the same folder. But you can of course do whatever you want :-) OPCUA is after all a beloved bloody mess of a thing, that tries to be everything for everybody.

from opcua-smart.

darlandieterich avatar darlandieterich commented on August 15, 2024

Well, I'm one dummy/beginner with OPC-UA.
I didn’t understand very well how the server collects data from the given equipment, as we don’t have a PLC yet. I am studying the protocol for future deployment of a server in the company. Would you have an example of how this works? this work with folder? how?

very thnks for the push! very useful dude!

from opcua-smart.

darlandieterich avatar darlandieterich commented on August 15, 2024

@fpauker
Thanks for reply. what are the main protocols?

from opcua-smart.

darlandieterich avatar darlandieterich commented on August 15, 2024

@etm
I will do my best to be able to participate. Thanks.

from opcua-smart.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.