Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[milo-dev] 回复:Reply: Reply: Write node value error

Hi,

The first parameter of DataValue constructor is Variant type, can't use "(double)3000".
I test the blow source code instead, but same error.
Variant v = new Variant((double)3000);
DataValue dv = new DataValue(v, StatusCode.GOOD, null);

------------------------------------------------------------------
发件人:Ari Suutari <Ari.Suutari@xxxxxxxxxxxxxxx>
发送时间:2017年3月30日(星期四) 14:57
收件人:george.ray <george.ray@xxxxxxxxxx>; milo developer discussions <milo-dev@xxxxxxxxxxx>
主 题:RE: Reply: [milo-dev] Reply: Write node value error

Hi,

 

Looks like kepware presents item having “Word” datatype as double in UA.

I tested with Kepserver 6.0.2107.0:

 

new DataValue((short) 3000, StatusCode.GOOD, null) returns Bad_TypeMismatch

new DataValue((double) 3000, StatusCode.GOOD, null) returns GOOD (and value changes)

 

You can see the OPC UA view of Kepserver with UaExpert (from unified automation).

 

                             Ari S.

 

 

From: george.ray [mailto:george.ray@xxxxxxxxxx]
Sent: 30. maaliskuuta 2017 9:30
To: milo developer discussions <milo-dev@xxxxxxxxxxx>; Ari Suutari <Ari.Suutari@xxxxxxxxxxxxxxx>
Subject: Reply: [milo-dev] Reply: Write node value error

 

I tested "new DataValue(v, StatusCode.GOOD, null)", same error: Bad_TypeMismatch.

 

------------------------------------------------------------------

发件人:Ari Suutari <Ari.Suutari@xxxxxxxxxxxxxxx>

发送时间:2017330(星期四) 13:42

收件人:george.ray <george.ray@xxxxxxxxxx>; milo developer discussions <milo-dev@xxxxxxxxxxx>

主 题:RE: [milo-dev] Reply: Write node value error

 

Hi,

 

Your code looks ok to me, ie. passing 3000 as short to Variant.

But it might be that kepware doesn’t like passing null statuscode,

try “new DataValue(v, StatusCode.GOOD, null)” instead.

 

Ari S.

 

 

From:milo-dev-bounces@xxxxxxxxxxx [mailto:milo-dev-bounces@xxxxxxxxxxx]On Behalf Of george.ray
Sent: 30. maaliskuuta 2017 8:32
To: milo developer discussions <milo-dev@xxxxxxxxxxx>; Kevin Herron <kevinherron@xxxxxxxxx>
Subject: [milo-dev] Reply: Write node value error

 

I modified WriteExample.java, and wrote node value through KEP Server.

In KEP Server the node data type is Word, value is 2500, I want to modify the value to 3000.

This is the souce code :

@Override
public void run(OpcUaClient client, CompletableFuture<OpcUaClient> future) throws Exception {
   
// synchronous connect
   
client.connect().get();
   
List<NodeId> nodeIds = ImmutableList.of(new NodeId(2, "ChannelTest.DeviceTest.Tag190"));
   
Variant v = new Variant((short)3000);
   
DataValue dv = new DataValue(v, null, null);
   
CompletableFuture<StatusCode> f = client.writeValue(nodeIds.get(0), dv);
   
StatusCode status = f.get();

    if
(status.isGood()) {
       
logger.info("Wrote '{}' to nodeId={} success", v, nodeIds.get(0));
   
}
   
else
       
logger.info("Wrote '{}' to nodeId={} failed", v, nodeIds.get(0));

   
future.complete(client);
}

 

How to set values type in Eclipse Milo when writing Node?

 

------------------------------------------------------------------

发件人:Kevin Herron <kevinherron@xxxxxxxxx>

发送时间:2017329(星期三) 23:00

收件人:george.ray <george.ray@xxxxxxxxxx>; milo developer discussions <milo-dev@xxxxxxxxxxx>

主 题:Re: [milo-dev] Write node value error

 

If you post your code I could tell you more, but OPC UA requires that you write values of the correct type for the Node you're writing to.

 

On Wed, Mar 29, 2017 at 3:30 AM, george.ray <george.ray@xxxxxxxxxx> wrote:

Hi

 

I am testing write node value function by WriteExample, but getting “StatusCode{name=Bad_TypeMismatch, value=0x80740000, quality=bad}” error.

What's the reseason of this issue? Maybe the value type is error, but I don't known how to set the type when writing value.

 

Thanks!

 

Best regards,

George Ray


_______________________________________________
milo-dev mailing list
milo-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/milo-dev

 

 

 



Back to the top