Analyzing and manipulating settings.xml of LIBPF OPC

LIBPF OPC is the LIBPF module that adds plant control system connectivity via the Classic OPC interface (OPC DA). The module is configured using the LIBPF OPC Configurator, but the underlying configuration data are stored in an XML file called settings.xml.

To troubleshoot, sometimes you need to inspect the settings.xml file, and to do that you can use a few good tools.

The first thing you might want to do is looking at which groups are defined. To do that, I use the standard UNIX utilities grep and sed. These are available from any UNIX shell, but also on Windows if you installed Git for Windows (just open the Git bash shell). The command to list the defined groups is:

grep '<group' settings.xml | sed 's/.* id="\([^"]*\)" .*$/\1/g'

If you want to detect duplicates, you can pipe the output of the sed command to sort:

grep '<group' settings.xml | sed 's/.* id="\([^"]*\)" .*$/\1/g' | sort

But for more complex analyses, grep and sed soon hit their limits. The good news is that we can exploit the structure of XML, and use some more XML-specific tool, such as one for running XQuery queries in Nokia Qt SDK, called xmlpatterns.

If you create a XQuery file called groups_id.xq with this code:


then this command will filter your settings.xml and print only the group with id equal to R14AR4:

xmlpatterns -param id="R14AR4" group_id.xq

This other XQuery “program” (save as input_tag.xq) will print all input variables linked to a specific LIBPF variable, defined within groups that are enabled:


One example of use for the input_tag XQuery is finding the input variables linked to the LIBPF variable S01.Tphase.mdot:

xmlpatterns -param tag="S01.Tphase.mdot" input_tag.xq

You can find more hints on XQuery here.