Reading Variable from simple Server shows timestamp but no value.

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
User avatar
h2k_toy
Sr. Member
Sr. Member
Posts: 14
Joined: 24 Sep 2020, 09:13

Reading Variable from simple Server shows timestamp but no value.

Post by h2k_toy »

Hello,

i'm greenhorn to this topic and i have problems getting started. I downloaded the Demo-SDK and craeated a model using the UAModeler.

Basically i can not find a simple example that uses a model generated with the UaModeler. This would be helpfull.

For evaluation I created a model with a folder and 3 variables of type UInt32, String and Boolean.

I use the generated code and succeeded to view the model with the 3 variables using the UaExpert tool.

I override the NodeManager method like:

Code: Select all

        public override DataValue ReadAttribute(RequestContext context, NodeAttributeHandle nodeHandle)
        {
            if(object.Equals(nodeHandle.NodeId.Identifier, VariableIds.WeldTask_JobNumber.Identifier))
            {
                return new DataValue(new Variant((UInt32)1));
            }
            else
            {
                return base.ReadAttribute(context, nodeHandle);
            }
        }

This is the only change i made to the generated code.


The method is being called as expected, when i click on the node in the UaExpert.
I can identify the requested variable and return a value = 1

The timestamp is showed in the ua expert but the values is always 0.

I tried the same with the boolean and string variable - corresponding results with timestamps successfully transmitted but values shows default.

Question:
- Can somebody explain why i receive a timestamp but no values at all?

User avatar
h2k_toy
Sr. Member
Sr. Member
Posts: 14
Joined: 24 Sep 2020, 09:13

Re: Reading Variable from simple Server shows timestamp but no value.

Post by h2k_toy »

I just checked the model and can find no errors.

The DataType of JobNumber is "UInt32":

Code: Select all

    
    <UAVariable DataType="UInt32" NodeId="ns=1;i=6010" BrowseName="1:JobNumber" AccessLevel="3">
        <DisplayName>JobNumber</DisplayName>
        <References>
            <Reference ReferenceType="HasTypeDefinition">i=63</Reference>
            <Reference ReferenceType="HasComponent" IsForward="false">ns=1;i=5003</Reference>
        </References>
    </UAVariable>
The data type is aliased in the model:

Code: Select all

        <Alias Alias="UInt32">i=7</Alias>
And the nodeids are as intended.

Code: Select all

<UAObject NodeId="ns=1;i=5003" BrowseName="1:WeldTask">
  <!-- ... -->
</UAObject>
I'd like to post the full model but it's too big...

The only thing which appeared strange to me is that the namespace changes from 1 to 2 when i load the model into .NET objects. But a collegue said this is normal. (?) This is why i compare only the nodeid.Identiifer in the ReadAttribute method. However, this seems not to be the problem but maybe somebody can clarify what's going on here.

User avatar
Support Team
Hero Member
Hero Member
Posts: 3068
Joined: 18 Mar 2011, 15:09

Re: Reading Variable from simple Server shows timestamp but no value.

Post by Support Team »

Hello,

Please override the Read-Method as shown in the examples. The method ReadAttribute is not called by the BaseNodeManager implementation.
Best regards
Unified Automation Support Team

User avatar
h2k_toy
Sr. Member
Sr. Member
Posts: 14
Joined: 24 Sep 2020, 09:13

Re: Reading Variable from simple Server shows timestamp but no value.

Post by h2k_toy »

Hi Thank you very much, that helped.

Post Reply