Skip to content

Latest commit

 

History

History

TraceControl

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Trace Controller Service

Table of contents

Introduction

The PLCnext Runtime provides an RSC service, called ITraceControllerService, that a client application written in C++ can use to manage LTTng trace sessions. This example demonstrates the use of the Trace Controller service using an LTTng trace configuration file that is installed on every PLCnext Control device. This example provides an alternative to the manual setup of the same LTTng configuration, described in the following Knowledge Base article:

How to activate the PLCnext Trace Controller (LTTtng)

When started, the LTTng session described in the configuration file creates a snapshot trace when triggered by specific fault conditions on the device.

As with the knowledge base article, this example is not intended to describe how LTTng works, or how to create LTTng configurations, or how to analyse LTTng trace results.

Guide details

Description Value
Created 4.05.2021
Last modified 4.05.2021
Controller AXC F 2152
FW 2021.0.3 LTS
Arpversion 21.0.3.35554
SVN Revision 35554
SDK 2021.0.3 LTS (21.0.3.35554)
PLCnext CLI 21.0.0 LTS (21.0.0.489)

References

A complete description of the Trace Controller service is available from this source:

General information on LTTng is available from the LTTng website.

Quick-start example

This example demonstrates features of the Trace Controller RSC service.

It is assumed that the user has some experience building C++ Components and Programs for PLCnext Control.

Prerequisites:

  • AXC F x152 controller.

  • PLCnext Command Line Interface (CLI) tool, version 2021.0. This is included in the "PLCnext Technology C++ tool chain", available on the Phoenix Contact website.

  • A Software Development Kit (SDK) for the AXC F 2152 PLCnext Control, version 2021.0.0 or later. This is also included in the "PLCnext Technology C++ tool chain".

  • (optional) Eclipse IDE, with the PLCnext Technology feature installed.

  • (optional) Visual Studio, with the PLCnext Technology add-in installed.

Procedure:

  • Clone this repository, e.g.

    git clone https://github.com/PLCnext/CppExamples.git
  • Create a new ACF project using either the PLCnext CLI tool, or Eclipse, or Visual Studio, with the following settings:

    • Project name: TraceControl
    • Component name: TraceControlComponent
    • Project namespace: TraceControl
  • Copy the contents of the Examples/TraceControl/src directory in this repository, to the src directory of the ACF project. Replace the existing source files with the same name.

  • Build the ACF project.

  • Deploy the ACF project to the PLC.

  • Restart the PLCnext Runtime.

  • Check the contents of the file /opt/plcnext/logs/Output.log. It should contain messages from your ACF component. In the component source code, you can see where these messages are generated in each step of the call sequence.