Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value Min/ Max Range or limit #4686

Open
7 tasks
embbo opened this issue Oct 8, 2021 · 14 comments
Open
7 tasks

Value Min/ Max Range or limit #4686

embbo opened this issue Oct 8, 2021 · 14 comments

Comments

@embbo
Copy link

embbo commented Oct 8, 2021

Description

Background Information / Reproduction Steps

Is there anything like 'Range' with a min- or max-value available ?
How can I set from the out-side or cleint ? that each varibale have maximum or minimum value is that ?
e.g
Node : XYZ ; DT Int32
min 10- max 100
other min and max values could be discarded

Used CMake options:

cmake -DUA_NAMESPACE_ZERO=<YOUR_OPTION> <ANY_OTHER_OPTIONS> ..

Checklist

Please provide the following information:

  • open62541 Version (release number or git tag):
  • Other OPC UA SDKs used (client or server):
  • Operating system:
  • Logs (with UA_LOGLEVEL set as low as necessary) attached
  • Wireshark network dump attached
  • Self-contained code example attached
  • Critical issue
@embbo embbo changed the title Value Min Max/ Range like 'Range' Value Min/ Max Range or limit Oct 8, 2021
@mlang-de
Copy link
Contributor

What you are searching for is imho the OPC UA DataType Range, see here:
https://reference.opcfoundation.org/v104/Core/docs/Part8/5.6.2/
To use this in an OPC UA common way you can use the VariableType BaseAnalogType and/or its subtypes.
https://reference.opcfoundation.org/v104/Core/docs/Part8/5.3.2/#5.3.2.2

@embbo
Copy link
Author

embbo commented Oct 11, 2021

@mlang-de
_UA_Server_addVariableNode(mUaServer, myIntegerNodeId, parentNodeId, parentReferenceNodeId, myIntegerName, UA_NODEID_NUMERIC(0, UA_NS0ID_ANALOGITEMTYPE), attr, NULL,NULL);`
this is rigth ? or i am missing something ?

@mlang-de
Copy link
Contributor

  1. _UA_Server_addVariableNode seems not to be the public Server API, but it should work anyway
  2. yes it looks ok, but why you are not testing it? Maybe you must include this VariableType into your server or may use the full Base Nodeset2 file/information model.

@embbo
Copy link
Author

embbo commented Oct 11, 2021

@mlang-de
I tested .but i can't see node in ua expert if I used like that ?
UA_NODEID_NUMERIC(0, UA_NS0ID_ANALOGITEMTYPE)

but can see when using this

UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE), attr, NULL, NULL);

@mlang-de
Copy link
Contributor

Imho you do not check the return value from _UA_Server_addVariableNode.
My look into the crystal ball supposed that the AnalogItemType is not part of your base information model.
May be enable UA_NAMESPACE_ZERO FULL by CMake.

@embbo
Copy link
Author

embbo commented Oct 12, 2021

@mlang-de okay it works fine .. But can i set these values in information model. xml?

@mlang-de
Copy link
Contributor

Yes. For builtin type it could like this:

<Value>
  <uax:String>1.0.0</uax:String>
</Value>

But a Range is a structured DataType so it should like this.

<UAVariable DataType="Range" ParentNodeId="ns=1;i=6022" NodeId="ns=1;i=6023" BrowseName="EURange">
    <DisplayName>EURange</DisplayName>
    <References>
        <Reference ReferenceType="HasProperty" IsForward="false">ns=1;i=6022</Reference>
        <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
    </References>
    <Value>
        <uax:ExtensionObject>
            <uax:TypeId>
                <uax:Identifier>i=885</uax:Identifier>
            </uax:TypeId>
            <uax:Body>
                <uax:Range>
                    <uax:Low>0</uax:Low>
                    <uax:High>100</uax:High>
                </uax:Range>
            </uax:Body>
        </uax:ExtensionObject>
    </Value>
</UAVariable>

I never test this with open62541, but in theory it should work.

@embbo
Copy link
Author

embbo commented Oct 12, 2021

okay great thank you .. 1 last question may be you can answer .
Can I add my own data (int , strings ) in this xml. like
<UAVariable Sensor address ="101010" DataType="Range" ParentNodeId="ns=1;i=6022" NodeId="ns=1;i=6023" BrowseName="EURange">

@mlang-de
Copy link
Contributor

What do you mean with "own data"?
You must respect the xsd schema, so your example

<UAVariable Sensor address ="101010" DataType="Range" ParentNodeId="ns=1;i=6022" NodeId="ns=1;i=6023" BrowseName="EURange">

looks wrong.
Use a suitable XML Modeller and use the related schema from here https://github.com/OPCFoundation/UA-Nodeset/blob/v1.04/Schema/UANodeSet.xsd

For example

<UAVariable DataType="String" ParentNodeId="ns=1;i=5001" NodeId="ns=1;i=6007" BrowseName="2:ManufacturerUri">
    <DisplayName>ManufacturerUri</DisplayName>
    <References>
        <Reference ReferenceType="HasProperty" IsForward="false">ns=1;i=5001</Reference>
        <Reference ReferenceType="HasModellingRule">i=80</Reference>
        <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
    </References>
</UAVariable>

@embbo
Copy link
Author

embbo commented Oct 12, 2021

@mlang-de : I mean e.g, I have 50 nodes each node has node Id but with node Id i have to send somedata e.g. 101010 for heat sensor address 1010102 for temperature sensor. Data of both nodes is in Float but I need to send 101010 or 1010102 . How can I put this data xml.

@mlang-de
Copy link
Contributor

Imho this is not part of an XML. In an XML only default/initial values should be defined.
To connect a variable with real application data see for instance https://github.com/open62541/open62541/blob/master/examples/tutorial_server_datasource.c
and/or
https://github.com/open62541/open62541/blob/master/examples/tutorial_server_variable.c

@embbo
Copy link
Author

embbo commented Nov 2, 2021

@mlang-de
I have another question; if you can answe..
I have data type float but I want to put limits around this float like between 0 to 1 .. other values can discarded .. do you hav any idea , if I can write this in XML

@mlang-de
Copy link
Contributor

mlang-de commented Nov 2, 2021

Imho you have to implement this by your own with the data source callbacks and is not part of the open62541 server and no way to "define" this within the XML. The XML describes the information model no implementation logic.
But maybe I am wrong.

@embbo
Copy link
Author

embbo commented Nov 2, 2021

okay thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants