Reading a tool offset value | OPC UA Implementation: Stacks, Tools, and Samples | Forum

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
Reading a tool offset value
Avatar
Davy T
New Member
Members
Forum Posts: 1
Member Since:
02/14/2019
sp_UserOfflineSmall Offline
1
08/25/2020 - 08:01
sp_Permalink sp_Print

Hi,

After a successful connection to a machine Siemens Sinumerik 840-d, we are trying to read a tool offset value. Here is the minimal code:

// Connection to the machine
Session session = Session.Create(...);

// List of nodes to read
ReadValueIdCollection nodesToRead = new ReadValueIdCollection ();
string nodeId = "ns=2;s=/ToolCompensation/edgeData[u1,c2,1]"
var readValueId = new ReadValueId () { NodeId = nodeId, AttributeId = Attributes.Value, IndexRange = "" };
nodesToRead.Add (readValueId);

// Get the answer
session.Read (null, int.MaxValue, TimestampsToReturn.Both, nodesToRead, out DataValueCollection results, out DiagnosticInfoCollection diagnostics);
object answer = results[0].Value;

The variable "diagnostics" is null so it is good. But the problem we are facing is that the variable "answer" is also null. We are however sure that the node "/ToolCompensation/edgeData" exists and that the format to use is "/ToolCompensation/edgeData[u1,c {column number},{tool number}]", according to the Siemens specifications. We also tried different configurations like:

  • /ToolCompensation/edgeData
  • /ToolCompensation/edgeData[u1,1]
  • /ToolCompensation/edgeData[1,1,1]

Does anyone know why we are receiving null values? Is it possible that while the address "/ToolCompensation/edgeData" is valid, values are really null?

Best regards,
Davy

Avatar
zbynekz
Member
Members
Forum Posts: 38
Member Since:
02/24/2014
sp_UserOfflineSmall Offline
2
08/25/2020 - 20:55
sp_Permalink sp_Print

First thing to do is to look at the whole results[0], not just results[0] Value. Specifically, check results[0].StatusCode, to see if there isn't a Bad status - and if so, with some useful code bits to tell you why it is Bad.

Best regards

Forum Timezone: America/Phoenix
Most Users Ever Online: 202
Currently Online:
Guest(s) 5
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 9
Topics: 750
Posts: 2204