Difference between revisions of "Using OpcCmd Utility as OPC A&E Client"

From OPC Labs Knowledge Base
Jump to navigation Jump to search
Line 1: Line 1:
 
[[Category:OPC A&E]] [[Category:OpcCmd Utility]] [[Category:Tools and Online Services]]  
 
[[Category:OPC A&E]] [[Category:OpcCmd Utility]] [[Category:Tools and Online Services]]  
 
For general information about the OpcCmd tool, see [[:Category:OpcCmd Utility]].
 
For general information about the OpcCmd tool, see [[:Category:OpcCmd Utility]].
 +
= Tutorial =
 +
If you execute the commands listed in the tutorial below, you will get an overview of basic OPC A&E client operations.
 +
 +
This tutorial works with the OPC Kit Server, which is installed with QuickOPC, or available for download from the [[Tool Downloads]] page. You should be able to use the same tutorial with your own OPC A&E Server, by modifying the server ProgID and in the commands.
 +
 +
 +
# Start the OpcCmd utility in interactive mode. The interactive mode is always in effect e.g. when you use ClickOnce, or when running the utility from QuickOPC Launcher/Start menu. In other cases, you need to use the <code>-i</code> (or <code>--interactive</code>) option on the command line.<br/><br/>
 +
# At the {{Style=label|OpcCmd>}} prompt, enter {{Style=keyboard|aeClient}}, or shortened: {{Style=keyboard|aec}}.<br/>The program responds with a list of technologies supported ("Com").<br/><br/>All following commands are entered at the {{Style=label|aeClient>}} prompt. You can enter <code>-?</code>, <code>-h</code> or <code>--help</code> (possibly preceded by the command name) at any time to obtain help for this prompt (or its commands).<br/><br/>
  
 
= Commands, Arguments and Options =
 
= Commands, Arguments and Options =

Revision as of 14:56, 10 March 2021

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

Tutorial

If you execute the commands listed in the tutorial below, you will get an overview of basic OPC A&E client operations.

This tutorial works with the OPC Kit Server, which is installed with QuickOPC, or available for download from the Tool Downloads page. You should be able to use the same tutorial with your own OPC A&E Server, by modifying the server ProgID and in the commands.


  1. Start the OpcCmd utility in interactive mode. The interactive mode is always in effect e.g. when you use ClickOnce, or when running the utility from QuickOPC Launcher/Start menu. In other cases, you need to use the -i (or --interactive) option on the command line.

  2. At the OpcCmd> prompt, enter aeClient, or shortened: aec.
    The program responds with a list of technologies supported ("Com").

    All following commands are entered at the aeClient> prompt. You can enter -?, -h or --help (possibly preceded by the command name) at any time to obtain help for this prompt (or its commands).

Commands, Arguments and Options

Command: aeClient subscribeEvents

Example:

OpcCmd -i
aeclient
subscribeEvents OPCLabs.KitEventServer.2

Command: aeClient acknowledgeCondition

The acknowledgeCondition command (can be shortened to ac) acknowledges a condition in the events server.

Acknowledging a condition requires an event to be identified by a precise combination of several pieces of information. In order to make the acknowledging easier, the acknowledgeCondition command allows you to pick the event from those collected during previous event subscriptions. Using the --eventIndex option (can be shortened to -ei), you specify the index of the event you want to acknowledge.

When event output is on, the event indexes appear in front of every displayed event in angle brackets, such as "[2]". You can also use the events? command (ev?) to display the events previously collected.

Example:

OpcCmd -i
aeclient
subscribeEvents OPCLabs.KitEventServer.2 -sqn Simulation.ConditionState1
events?
acknowledgeCondition --eventIndex 2

In order to trigger an acknowledgeable event for the previous example, you can start a second instance of the OpcCmd utility and pass it a corresponding command, like this:

OpcCmd daClient writeItem OPCLabs.KitServer.2 SimulateEvents.ConditionState1.Activate [Boolean]True

Using OPC NET API implementation

If you want to use the OPC NET API implementation instead of the native implementation (in OpcCmd for .NET Framework), you can do it interactively as in the following example:

OpcCmd -i
aeclient --property InstanceParameters.EnableNativeClient=[Boolean]false
subscribeEvents subscribeEvents OPCLabs.KitEventServer.2

If you want to use such setting permanently, you can modify one of the OpcCmd Intrinsic Component Configuration files (JSON, INI or XML). For example, with the JSON format, put the following into the appsettings.json or appsettings.production.json file:

{
  "OpcLabs.EasyOpc.AlarmsAndEvents.EasyAEClient": {
    "InstanceParameters": {
      "EnableNativeClient": false
    }
  } 
}