Using OpcCmd Utility as OPC UA Client: Difference between revisions

From OPC Labs Knowledge Base
Line 13: Line 13:


Obtaining server condition statistics:
Obtaining server condition statistics:
# Enter <code>uaClient -ServerConditionChanged</code>.
# Enter <code>uaClient -ServerConditionChanged</code>.
# Enter <code>subscribe opc.tcp://opcua.demo-this.com:51210/UA/SampleServer nsu=http://test.org/UA/Data/;i=10849</code>.
# Enter <code>subscribe opc.tcp://opcua.demo-this.com:51210/UA/SampleServer nsu=http://test.org/UA/Data/;i=10849</code>.
Line 20: Line 19:
# Enter <code>events?</code>, or shortened: <code>ev?</code>. Note the index of the last event (in the "[]" column).
# Enter <code>events?</code>, or shortened: <code>ev?</code>. Note the index of the last event (in the "[]" column).
# Enter <code>events? -!extractElement <nn> -!extractMember EventArgs.Statistics.StateDictionary</code>, or shortened: <code>ev? -!xe <nn> -!xm EventArgs.Statistics.StateDictionary</code> where <nn> is the index of the last event, taken in previous step.
# Enter <code>events? -!extractElement <nn> -!extractMember EventArgs.Statistics.StateDictionary</code>, or shortened: <code>ev? -!xe <nn> -!xm EventArgs.Statistics.StateDictionary</code> where <nn> is the index of the last event, taken in previous step.
Sample output:
<pre>
Events (extracting: element 77, member 'eventargs.statistics.statedictionary') (sequence): 5 element(s)
╒═════════════╤═════╤════════════╤════════════╤════════════╤══════════════════╤════════════╤═══════════════════╤══════════════════╤══════════════════╤══════════════════╤══════════════════╕
│[]          │Enter│First Enter │Last Cycle  │Last Cycle  │Last Cycle Time  │Last Enter  │Current Active Time│Accumulated Time  │Minimum Time Span │Average Time Span │Maximum Time Span │
│            │Count│Time Local  │Enter Time  │Leave Time  │Span              │Time Local  │Span              │Span              │                  │                  │                  │
│            │    │            │Local      │Local      │                  │            │                  │                  │                  │                  │                  │
╞═════════════╪═════╪════════════╪════════════╪════════════╪══════════════════╪════════════╪═══════════════════╪══════════════════╪══════════════════╪══════════════════╪══════════════════╡
│Connected    │    1│18:21:30.691│18:21:30.691│18:22:52.225│0:00:01:21.5320000│18:21:30.691│0:00:00:00.0000000 │0:00:01:21.5320000│0:00:01:21.5320000│0:00:01:21.5320000│0:00:01:21.5320000│
│Connecting  │    1│18:21:29.928│18:21:29.928│18:21:30.691│0:00:00:00.7650000│18:21:29.928│0:00:00:00.0000000 │0:00:00:00.7650000│0:00:00:00.7650000│0:00:00:00.7650000│0:00:00:00.7650000│
│Disconnected │    2│18:21:29.841│18:21:29.841│18:21:29.928│0:00:00:00.0780000│18:22:52.400│0:00:00:00.0000000 │0:00:00:00.0780000│0:00:00:00.0780000│0:00:00:00.0780000│0:00:00:00.0780000│
│Disconnecting│    1│18:22:52.225│18:22:52.225│18:22:52.400│0:00:00:00.1870000│18:22:52.225│0:00:00:00.0000000 │0:00:00:00.1870000│0:00:00:00.1870000│0:00:00:00.1870000│0:00:00:00.1870000│
│Unconnected  │    2│18:21:29.841│18:21:29.841│18:21:30.691│0:00:00:00.8430000│18:22:52.225│0:00:00:00.1870000 │0:00:00:00.8430000│0:00:00:00.8430000│0:00:00:00.8430000│0:00:00:00.8430000│
╘═════════════╧═════╧════════════╧════════════╧════════════╧══════════════════╧════════════╧═══════════════════╧══════════════════╧══════════════════╧══════════════════╧══════════════════╛
</pre>

Revision as of 16:23, 30 June 2021

For general information about the OpcCmd tool, see Category:OpcCmd Utility.

Commands, Arguments and Options

Command: uaClient subscribe

OpcCmd -i
uaClient
subscribe opc.tcp://opcua.demo-this.com:51210/UA/SampleServer nsu=http://test.org/UA/Data/;i=10849

Obtaining server condition statistics:

  1. Enter uaClient -ServerConditionChanged.
  2. Enter subscribe opc.tcp://opcua.demo-this.com:51210/UA/SampleServer nsu=http://test.org/UA/Data/;i=10849.
  3. Optionally terminate the command prematurely by pressing X.
  4. Wait for approx. 10 seconds.
  5. Enter events?, or shortened: ev?. Note the index of the last event (in the "[]" column).
  6. Enter events? -!extractElement <nn> -!extractMember EventArgs.Statistics.StateDictionary, or shortened: ev? -!xe <nn> -!xm EventArgs.Statistics.StateDictionary where <nn> is the index of the last event, taken in previous step.

Sample output:

Events (extracting: element 77, member 'eventargs.statistics.statedictionary') (sequence): 5 element(s)
╒═════════════╤═════╤════════════╤════════════╤════════════╤══════════════════╤════════════╤═══════════════════╤══════════════════╤══════════════════╤══════════════════╤══════════════════╕
│[]           │Enter│First Enter │Last Cycle  │Last Cycle  │Last Cycle Time   │Last Enter  │Current Active Time│Accumulated Time  │Minimum Time Span │Average Time Span │Maximum Time Span │
│             │Count│Time Local  │Enter Time  │Leave Time  │Span              │Time Local  │Span               │Span              │                  │                  │                  │
│             │     │            │Local       │Local       │                  │            │                   │                  │                  │                  │                  │
╞═════════════╪═════╪════════════╪════════════╪════════════╪══════════════════╪════════════╪═══════════════════╪══════════════════╪══════════════════╪══════════════════╪══════════════════╡
│Connected    │    1│18:21:30.691│18:21:30.691│18:22:52.225│0:00:01:21.5320000│18:21:30.691│0:00:00:00.0000000 │0:00:01:21.5320000│0:00:01:21.5320000│0:00:01:21.5320000│0:00:01:21.5320000│
│Connecting   │    1│18:21:29.928│18:21:29.928│18:21:30.691│0:00:00:00.7650000│18:21:29.928│0:00:00:00.0000000 │0:00:00:00.7650000│0:00:00:00.7650000│0:00:00:00.7650000│0:00:00:00.7650000│
│Disconnected │    2│18:21:29.841│18:21:29.841│18:21:29.928│0:00:00:00.0780000│18:22:52.400│0:00:00:00.0000000 │0:00:00:00.0780000│0:00:00:00.0780000│0:00:00:00.0780000│0:00:00:00.0780000│
│Disconnecting│    1│18:22:52.225│18:22:52.225│18:22:52.400│0:00:00:00.1870000│18:22:52.225│0:00:00:00.0000000 │0:00:00:00.1870000│0:00:00:00.1870000│0:00:00:00.1870000│0:00:00:00.1870000│
│Unconnected  │    2│18:21:29.841│18:21:29.841│18:21:30.691│0:00:00:00.8430000│18:22:52.225│0:00:00:00.1870000 │0:00:00:00.8430000│0:00:00:00.8430000│0:00:00:00.8430000│0:00:00:00.8430000│
╘═════════════╧═════╧════════════╧════════════╧════════════╧══════════════════╧════════════╧═══════════════════╧══════════════════╧══════════════════╧══════════════════╧══════════════════╛