Nadeesha Dileen Nawagaththegama
Member
Members
Forum Posts: 4
Member Since:
12/11/2017
12/11/2017
Offline
Hi,
I’m new to opc, opcua and wont to write a new node value to server form opcua client, so i used following way and passed appropriate arguments to that write function. But it gets results as {BadTypeMismatch}, can you please help me to solve this.
ResponseHeader responseHeader = m_session.Write( null, nodesToWrite, out results, out diagnosticInfos); Thank you..
Nadeesha Dileen Nawagaththegama
Member
Members
Forum Posts: 4
Member Since:
12/11/2017
12/11/2017
Offline
Hi Paul,
Thanks for helping.
I ‘m testing my client with Opc Ua Quickstart Data Access Server. Following is the code with parameters and values that I’m used. pls help
WriteValueCollection nodesToWrite = new WriteValueCollection(); WriteValue writeValue = new WriteValue(); NodeId nodeId = "ns=2;s=1:FC1001?SetPoint"; writeValue.AttributeId = Attributes.Value; writeValue.IndexRange = null; object objvalue = 400.5F; DataValue dataValue = new DataValue() { WrappedValue = 400.5F, SourceTimestamp = DateTime.Now, Value = objvalue }; writeValue.Value.Value = dataValue; writeValue.Value.StatusCode = StatusCodes.Good; writeValue.Value.ServerTimestamp = DateTime.MinValue; writeValue.Value.SourceTimestamp = DateTime.MinValue; nodesToWrite.Add(writeValue); foreach (WriteValue nodeToWrite in nodesToWrite)
{ NumericRange indexRange; ServiceResult result = NumericRange.Validate(nodeToWrite.IndexRange, out indexRange); if (ServiceResult.IsGood(result) && indexRange != NumericRange.Empty) { // apply the index range. object valueToWrite = nodeToWrite.Value.Value; result = indexRange.ApplyRange(ref valueToWrite); if (ServiceResult.IsGood(result)) { nodeToWrite.Value.Value = valueToWrite; } } } StatusCodeCollection results = null; DiagnosticInfoCollection diagnosticInfos = null; ResponseHeader responseHeader = m_session.Write( null, nodesToWrite, out results, out diagnosticInfos);
Thank you..
Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online:
Guest(s) 20
Currently Browsing this Page:
1 Guest(s)
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1446
Posts: 4891