Giter Club home page Giter Club logo

Comments (8)

nauful avatar nauful commented on July 28, 2024

This error corresponds to the enum for BadTypeMismatch. Might need unsigned int, long, a float or a double depending on the type of the node. Check the data type for the node on the server.

Closing, not a library issue.

from libua.

Sanjay-pujari avatar Sanjay-pujari commented on July 28, 2024

I have created another node of type int and just to assigning value 6, but still not writing value to node, where as when tried with OPC UA client then it is writing the value

This is the code snippet

uint[] respStatuses;
//client.SetPublishingMode(true);
client.Write(new WriteValue[]
{
new WriteValue(
new NodeId(2, "SiemensPLCs.PLC1500.HMI.Station_Status[2]"), NodeAttribute.Value,
null, new DataValue(6, StatusCode.GoodClamped, DateTime.Now))
}, out respStatuses);

Now status code is "2155020288"

image

Screenshot of OPC UA client

image

from libua.

Sanjay-pujari avatar Sanjay-pujari commented on July 28, 2024

This error corresponds to the enum for BadTypeMismatch. Might need unsigned int, long, a float or a double depending on the type of the node. Check the data type for the node on the server.

Closing, not a library issue.

Hello Nauful, thank you for the response.
I have double verified the data type and value assigned but still facing issue. please check my comment with more details

from libua.

nauful avatar nauful commented on July 28, 2024

The UA data type is Word, which in C# is ushort. Sending 6 as a constant is an int (Int32 for UA) Try declaring a variable with that type specified:

ushort value = 6u;
... new DataValue(value, ...)

from libua.

Sanjay-pujari avatar Sanjay-pujari commented on July 28, 2024

I have tried with suggested code, still not changing the value, please refer the below screenshot

image

I'm able to change the value through OPC quick client but not with code. I have tried various types and values but "write" method is not working at all

from libua.

nauful avatar nauful commented on July 28, 2024

Try StatusCode.Good instead of StatusCode.GoodClamped. If that doesn't work, I need more info:

With an unencrypted connection (security None or Sign but not SignAndEncrypt), can you take a Wireshark capture of writing the value from your OPC client, then of writing your value from this test app?

from libua.

Sanjay-pujari avatar Sanjay-pujari commented on July 28, 2024

Finally it worked with below code snippet

ushort val = (ushort)6u;
uint[] respStatuses;

client.Write(new WriteValue[]
{
new WriteValue(
new NodeId(2, "SiemensPLCs.PLC1500.HMI.Station_Status[2]"), NodeAttribute.Value,
null, new DataValue(val))
}, out respStatuses);

Declare the variable and then pass that variable to DataValue object.
Note:- Just pass that value only and don't pass other parameters to DataValue object,

from libua.

nauful avatar nauful commented on July 28, 2024

Sounds good. Your server may have been rejecting the additional parameters.

from libua.

Related Issues (20)

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.