Table of Contents


About the ACE Configuration Management Utility

The ACE Configuration Management (ACM) Utility is a tool for managing XML configurations for the Elecsys RediGate or Director products that are created in the ACE Editor software.

This utility provides the following features:

Because the tool is designed to perform a set of actions on a group of configurations, it is ideal for batch queries or batch modification of configurations to update ACE properties, add new features, etc. The Elecsys ACE Editor is still needed to view and upload configurations, and will still be used for individually setting properties or adding objects to a single configuration.

The master copy of this ACM utility spreadsheet can be opened, configured for individual combinations and varieties of queries, and saved under different names for future reference. It is not required that the ACM spreadsheet retain its originally distributed filename. This will allow a user to keep multiple logs of information obtained from devices or results of a modification action.


Installation

The ACE Configuration Management (ACM) Utility is a Microsoft Excel workbook, which includes Visual Basic macros. This platform was chosen for its wide support on Windows operating system, which is also required for the Elecsys ACE Editor; and because Excel Visual Basic for Applications (VBA) supports XPath and XML methods.

Because the utility uses VBA macros, the default security settings in Microsoft Excel may prevent a user from being able to run the macros.

To set up macro security in Excel, select the menu:

File | Options | Trust Center | Trust Center Settings | Trusted Locations.

Click the Add New Location button, and add the file location where the utility (Excel file) will be stored.

Also, you may wish to disable the "/" key as an Excel menu option. In Options | Advanced | Lotus Compatibility, clear the "Microsoft Excel menu key" property. This will allow you to type XPath queries starting with "/" in a worksheet cell.

Test the ability to run macros by clicking the "Main Menu" button on the About sheet.

Other Utilities

In addition to the ACM Utility and the ACE Configuration Editor software, the following utilities are also recommended for help in designing the XPath queries used in the utility:


Main Menu

On the About page, click the "Main Menu" button. This will open a menu to select the location of ACE XML configurations, the output of modified files, and provides a menu of actions to perform.

Configuration Path: Click the Configuration Path button and browse to the folder containing ACE XML configurations.

For instance, C:\Users\username\Documents\Elecsys\ACE\CFG

FileName Filter: (optional) Enter a filename criteria to select a subset of the XML files.

Examples: *.xml (this is the default filter)

abc*.xml

or the FileName Filter could include a subfolder such as “myfiles\*.xml”

Output XML Path: Click the Output XML Path button and browse to the folder where the (modified) output XML files will be stored. This is only used with Modify actions.
If the Output XML Path is blank, output files will be stored in the same as the Configuration Path.

Output File Suffix: (optional) Enter a suffix to add to the modified output files.

For instance, a suffix of "_MOD" will create files with the output name

OriginalConfigurationName_MOD.XML

NOTE: If you use the same Output XML Path as the source Configuration Path and do not use an Output File Suffix then the output file will overwrite the original configuration! This is not recommended.

After setting up the paths, filter, and file suffix, click the "List Configurations" button. This will generate a list of configuration names based on the above criteria. The configuration names appear on the Configurations sheet. Click the “Go to Configurations“ button to switch to the Configurations sheet.

Program Option: Select either “Query Configurations,” Modify Configurations,” or “L5X Tool” for a list of corresponding options.


Configurations Sheet

The Configurations sheet lists the names and descriptions of XML configuration files that will be queried or modified by this utility. Only ACE XML configurations (with a TemplateProperties/Description XML field) will be included automatically in the list. You can click on the tab for the Configurations sheet at any time, or click the "Go to Configurations" button.

After clicking the "List Configurations" button on the Main Menu page, you will automatically be taken to the Configurations sheet.

On the Configurations sheet, there are three columns:

Include

The configurations are automatically marked with "1".
The Query, Modify, or L5X actions will only act on the configurations with a “1” in this column.
You can exclude configurations by just changing the "1" to something else, or deleting unneeded rows, or by clearing cell contents. Any row with a blank Configuration Name will be treated as the end of the list for all actions.

Configuration Name

The configuration names listed are obtained from the Configuration Path and FileName Filter on the Main Menu dialog. If there are many configurations listed that you don't want to query, you can change the filter and re-run the list.
You can also manually enter configuration names in this column – it is not required to use the "List Configurations" button.

Description

The Description column is obtained from the <TemplateProperties> property in the ACE XML configuration file. This column has no purpose in the ACM utility, other than for information.

The Configurations sheet includes buttons that will take you to the Query, Modify, or L5X Tags sheet in order to set up queries or other actions.


Query Sheet

The Query sheet is used to request information from each XML configuration included on the Configurations sheet.

After setting up the list of configurations on the Configurations sheet, define one or more XML queries on the Query sheet.

Query definitions consist of 4 columns, with one Query definition per row:

Column Header

The Column Header defines one or more columns of data to be stored on the Query Results sheet. The Column Header is just descriptive, but does need to be non-blank.

Any row containing a blank Column Header will be treated as the end of the list, and Run Query definitions following a Column Header will not be run. This can be used (by inserting a blank row) to limit the list Query definitions for testing, then delete the blank row to run subsequent queries.

If the Column Header ends with square brackets enclosing a positive integer number (e.g., “[2]”), it will create multiple columns in the Query Results sheet based on the number in brackets. The columns will contain XML data matching the Select Query (XPath) criteria.

If the Select Query returns fewer XML nodes than the defined columns, the rest of the columns will contain “n/a”. If the Select Query matches more XML nodes than the columns allow, the rest of the data will be omitted from Query Results.

Example:

If Column Header is "Ethernet IP[2]", it will create two columns on the Query Results sheet. The columns will be labeled "Ethernet IP(1)" and "Ethernet IP(2)". If the Select Query yields the IP address of Ethernet port objects, only the first two will be listed in these columns.

Be aware that if using a fixed number of columns and the Query that you are using returns more XML nodes than are allowed to be displayed by the Column Header, it may give the false impression that there aren't as many nodes as there actually are.


If the Column Header ends with [0], it will create only a single column in Query Results. If the Select Query returns multiple elements, the contents of each element will be included in the single column, separated by braces { }. If the Select Query returns only a single node, it will be shown without braces.

Example:

If Column Header is "Ethernet IP[0]", it will create one column on the Query Results sheet. The column will be labeled "Ethernet IP" and may include contents such as: "{10.95.213.86}{192.168.100.1}".

Description

This column has no purpose and is only descriptive to help document what the Query definition is used for.

Select Query

The Select Query column uses XPath syntax to define selection criteria for one or more XML nodes in each configuration file. The selected element(s) (one or more, depending on the Column Header) will have their text stored in the Query Results page. See the section Understanding XPath Queries for help in understanding XPath query format used in the ACE Configuration Management Utility.

If there is a row with a non-blank Column Header but a blank Select Query, it will create an empty column under its column header on the Query Results sheet.

Condition Query

The Condition Query column is currently unused.


Understanding XPath Queries

XML is a structured document format that uses a nested hierarchy of parent/child elements. The Elecsys ACE Editor (version 3.0 and higher) uses XML for both the template and configuration definitions.
XPath is a very powerful query language that allows a complex set of criteria to search an XML document. See www.w3schools.org for more generic information and tutorials on XML and XPath.

XML Structure

When defining XPath queries, it is important to understand the XML structure of the ACE configurations.

Example:

An EtherPort object in the ACE Editor defines the Ethernet network interface. Below is a picture of the ACE properties for Ethernet object with Type=EtherPort and Instance=0 (DownFile=netethr0).

This object is represented in the XML configuration file using the following XML text (abbreviated here to include only a few properties):

<Node Type="EtherPort" Name="EtherPort0" Enabled="Yes">

<Properties>

<Instance>0</Instance>

<DownFile>netethr0</DownFile>

</Properties>

<Fields>

<Field Name="Network Card IP" Width="2147483647" Type="IPADDRESS">

<Value>10.63.191.26</Value>

</Field>

<Field Name="Subnet Mask" Width="2147483647" Type="IPADDRESS">

<Value>255.255.0.0</Value>

</Field>

<Field Name="Default Gateway" Width="2147483647" Type="IPADDRESS">

<Value>0.0.0.0</Value>

</Field>

</Fields>

</Node>

XML syntax consists of:

All XML elements must have an opening and closing tag (such as <Node> and </Node>) and be properly nested. Note that XML is case-sensitive, so you must ensure that all queries use the proper case.

XPath Example 1 – selection of XML nodes for Ethernet IP Address

On the Query or Modify sheet, you can define a Select Query such as:

//Node[@Type='EtherPort' and Properties[Instance='0' or Instance='1']] /Fields/Field[@Name='Network Card IP']/Value/text()

XPath Example 2 – using chained XPath queries

A special notation used in the ACE Configuration Management Utility (not part of XPath syntax) is the "~~~" notation, which may be used to chain together two XPath queries, if necessary. The above example used a single XPath query to request the IP address of EtherPort object(s) with Instance=0. The same query could be done in the ACM using two separate XPath statements, joined together sequentially with "~~~". The ACM Utility only currently supports up to two joined statements.

//Properties[DownFile='netethr0' or DownFile='netethr1'] ~~~ ../Fields/Field[@Name='Network Card IP']/Value/text()

(For the more technically minded, the “~~~” notation was implemented because an earlier version of Microsoft Excel/Visual Basic's XPath handling didn’t support using "/../" notation in the middle of an XPath query, to back up a level from a selected node. Now, this appears to be supported. There is still a use for the chained ~~~ queries, at least when getting an array of “counts.” See example further down.)

What is the result?

Let's put together all the above and see what data may be obtained in the Query Results sheet for Example 1 or Example 2.

Using a single row in the Query (or Modify) sheet with the XPath query in Example 1, we will have the following Query definition:

Column Header

Description

Select Query

Condition Query

IP Address[3]

Get up to three IP addresses

//Node[@Type='EtherPort' and Properties[Instance='0' or Instance='1']] /Fields/Field[@Name='Network Card IP']/Value/text()

(blank)

After running the query, assuming the configuration(s) listed on the Configurations sheet have zero or more Ethernet objects configured, the resulting data on the Query Results sheet might look something like this:

Configuration Name

IP Address(1)

IP Address(2)

IP Address(3)

configuration1.xml

10.63.191.26

192.168.1.1

n/a

configuration2.xml

10.1.2.3

n/a

n/a

configuration3.xml

n/a

n/a

n/a


Note that in this example, we purposely defined the Column Header to include three columns, but the query will only return (at most) two Ethernet elements, and the second configuration only has one. The remaining columns will be included in Query Results, but will be populated with "n/a" to indicate there are no XML nodes matching the XPath criteria defined in Select Query.

If, instead, the Column Header had been set as "IP Address" (no square brackets), the data would have included only a single column of “IP Address,” containing the first Ethernet port’s IP address from each configuration, or “n/a”. The additional matching IP addresses (such as “192.168.1.1”) will not appear in the results.

If the Column Header had been set as “IP Address[0]” (with '0' in square brackets), the resulting data in Query Results would have included only a single column of “IP Address,” containing all matching Ethernet port IP addresses.

Configuration Name

IP Address

configuration1.xml

{10.63.191.26}{192.168.1.1}

configuration2.xml

10.1.2.3

configuration3.xml

n/a

Retrieving an attribute

If you wish to return the value of an attribute, as opposed to the text content inside a set of an XML “<tag></tag>” structure, use the "@" symbol plus the attribute name. For instance, to select the visible name of the ACE object representing the eth0 Ethernet configuration, you might use a Select Query like:

//Node[@Type='EtherPort' and Properties[Instance=0]]/@Name

or

//Node[Properties/DownFile='netethr0']/@Name

or

//Properties[DownFile='netethr0'] /../@Name

Each of the above three XPath examples does the exact same thing. In the first two cases, the parent EtherPort <Node> is selected with qualifiers, then the “Name” attribute of <Node> is returned. In the third case, the EtherPort <Properties> element is selected, then the next part of the query moves up to the parent <Node> and selects its “Name” attribute.

The "/text()" suffix after the “@Name” attribute is NOT allowed for retrieving attribute values. It is only allowed (and required) when returning plain text content inside of XML tags.

Getting a count of nodes

If you wish to retrieve the number of matching nodes for an XPath query, rather than the text data for them, add "/count()" at the end of a Select Query (total of 8 characters, with no spaces). Note, this is a unique notation of the ACM Utility (not part of XPath syntax).

As an example, define a Column Header titled "# of IP addresses" and a Select Query listed below:

//Node[@Type='EtherPort'] /Fields/Field[ @Name='Network Card IP'] /Value/count()

or just

//Node[@Type='EtherPort']/count()

Note that we haven't limited the <Instance> numbers to specific Ethernet objects, as in the previous examples. The Query Results might be:

Configuration Name

# of IP Addresses

configuration1.xml

2

configuration2.xml

1

configuration3.xml

0

Getting an array of node counts (and count in qualifier)

Using the “/count()” notation, above, will return a total of all the matching nodes for the entire XPath query.

If you wish to retrieve a collection of elements, and then get a count of a subset of matching nodes under each element from the first set, a different notation must be used. In this case, use a chained query (with “~~~”), and then add "/count[]" at the end of the second part of the Select Query (total of 8 characters, with no spaces, using square brackets instead of parentheses). Note, this is also a unique notation of the ACM Utility (not part of XPath syntax).

One example where this is useful would be to count how the number of TABLE rows that exist under each of a collection of parent objects. The example shown below returns an array of counts for the Poll Table rows in each of a set of Field Unit exist under one or more Master Channels.

There is another way to use “count” as a qualifier, where a certain set of matching XPath elements can be limited by how many are found in a query. This notation is standard XPath syntax and is explained below.

In the following example, three queries are defined.

Column Header

Description

Select Query

Condition Query

ChanNames[0]

Return array of Master Channel names

//Node[(@Type='Master Channel' or @Type='MastChan') and Properties/Instance <4 ] /@Name

(blank)

ChanNumbers[0]

Return array of Master Channel numbers

//Node[(@Type='Master Channel' or @Type='MastChan') and Properties/Instance <4 ] /Properties/Instance/text()

(blank)

UnitNumbers[0]

Return array of Modbus Field Unit addresses

//Node[(@Type='Master Channel' or @Type='MastChan') and Properties/Instance <4 ] /Node/Node [(@Type='FieldUnitModbus32' and count(Fields/Field[@Name='Poll Table'] /TABLE/TR) >0 )] /Properties/Instance/text()

CountPollTable[0]

Return array of number of Poll Table records in each Modbus unit under the selected Master Channels

//Node[(@Type='Master Channel' or @Type='MastChan') and Properties/Instance <4 ] /Node /Node[(@Type='FieldUnitModbus32' and count(Fields/Field[@Name='Poll Table'] /TABLE/TR) >0 )] ~~~ ./Fields/Field [@Name='Poll Table']/TABLE/TR/count[]

(blank)

Explanation:

Possible results of these queries might be:

Configuration Name

ChanNames

ChanNumbers

UnitNumbers

CountPollTable

configuration1.xml

{Master Channel 0}{Master Channel 1}{Master Channel 2}

{0}{1}{2}

{1}{1}{2}{20}

{4}{2}{1}{2}

configuration2.xml

MyChannel2

2

{1}{2}{3}

{5}{5}{3}

configuration3.xml

MyChannel2

2

n/a

0

Explanation of the above results:

Querying a section of XML

If you wish the query to return a selection of XML text, rather than just an individual property value, just broaden the scope of the XPath query; that is, don't go as deep into the nested XML hierarchy of tags down to the last “/text()” element.

Selecting one or more XML text nodes will often be useful or necessary, such as:

For instance, to return the XML text that represents the entire eth0 Ethernet configuration, you could use:

//Node[@Type='EtherPort' && Properties[Instance='0']]

or

//Node[DownFile='netethr0']

This would return all the XML text between <Node> and </Node>, such as:

<Node Type="EtherPort" Name="EtherPort0" Enabled="Yes">

(content omitted here for brevity)

</Node>

Using last() and position()

Within qualifiers (predicates) of an XPath query, the “last()” identifier indicates the last item selected in the set of elements returned by an XPath statement. The “position()” identifier can be used to reference items within the returned set of elements.

Examples:

Select the first Ethernet node in a set:
//Node[@Type='Networks'] /Node [@Type='EtherPort'][1]

Select the last Ethernet node in a set:
//Node[@Type='Networks'] /Node [@Type='EtherPort'][last()]

Select the next to last Ethernet node in a set:
//Node[@Type='Networks'] /Node [@Type='EtherPort'][last()-1]

Select the first two Ethernet nodes in a set:
//Node[@Type='Networks'] /Node[@Type='EtherPort'] [position() <= 2]

Select the last two Ethernet nodes in a set:
//Node[@Type='Networks'] /Node[@Type='EtherPort'] [position() >= last()-1]

Rules for dealing with ACE configurations

Unlike the ACE Editor, which imposes a number of programmatic constraints on instance numbers, adding, deleting and naming of objects, the ACE Configuration Management Utility is kind of like holding a loaded gun – you have a lot of power and can do a lot of damage if you don’t know what you are doing with it.

To be more specific, the XPath Modify queries currently allow you make many changes to the XML file which are not allowed in either XML or the ACE Editor, which could corrupt a perfectly good ACE configuration. Be warned.

Some rules on ACE objects which are required by ACE Editor but not enforced by the management utility:

Using Variable Values

On the Modify sheet only (not the Query sheet), you can use variables to store data for reuse in later query definitions. The 'SaveToVAR' and 'ConstToVAR' actions will store data to a numbered variable. Any of the functional columns on the Modify sheet (Select Query, Mod Type, Source Data/File, or Source Query) can use the variables that have been previously saved in an earlier row in the table.

Variables that are used in these columns must have the form:

${VARxx}

where "xx" is a non-negative integer. The form is important - they must start with "${VAR", end with "}", and contain a number in between.

Leading zeros are not required (i.e., "${VAR00}" is identical to "${VAR0}"). More than one variable may be included in a query after defining its content. Variables may contain any text, whether a number (count of items) or a queried section of XML text that could be used in a later Modify action.

Values saved to variables are NOT saved between separate runs of the "Modify Configurations" macro. They only apply to the queries on the Modify sheet when


Modify Sheet

The Modify sheet is used to both request and modify information in each XML configuration included on the Configurations sheet.

After setting up the list of configurations on the Configurations sheet, define one or more XML queries on the Modify sheet.

Modify Query definitions consist of 7 columns, with one Query definition per row.

The Column Header, Description, Select Query, and Condition Query columns serve the same purpose on the Modify sheet as they do on the Query sheet when used as a simple query. When a “Mod Type” action is selected, the Select Query chooses one or more nodes (or parents of nodes) in the XML document, at which point the action will be performed, such as modifying a value, adding a child node, removing a node, etc.

Column Header

The Column Header defines one or more columns of data to be stored on the Modify Results sheet. The Column Header is just descriptive, but does need to be non-blank.

Any row containing a blank Column Header will be treated as the end of the list, and Run Modify Query definitions following a Column Header will not be run. This can be used (by inserting a blank row) to limit the list Modify definitions for testing, then delete the blank row to run subsequent queries.

If the Column Header ends with square brackets enclosing a positive integer number (e.g. “[2]”), it will create multiple columns in Modify Results sheet based on the number in brackets. If the Select Query returns fewer XML nodes than the defined columns, the rest of the columns will contain “n/a”. If the Select Query matches more XML nodes than the columns allow, the rest of the data will be omitted from Modify Results.

The Modify Results columns will contain XML data matching the Select Query (XPath) criteria (if using a simple query), or an indication of how many modifications have been done (such as “removed 12x” or “added 4x”). The number of results columns indicates the maximum number of nodes that will be modified.

Example:

If Column Header is "Ethernet IP[2]", it will create two columns on the Modify Results sheet.
The columns will be labeled "Ethernet IP(1)" and "Ethernet IP(2)". If the Select Query yields the IP address of Ethernet port objects, only the first two will be listed in these columns.

Be aware that if using a fixed number of columns and the query that you are using returns more XML nodes than are allowed to be displayed by the Column Header, it may give the false impression that there aren't as many nodes as there actually are. Only the nodes selected will be modified.

If the Column Header ends with [0], it will create only a single column in Modify Results, but if the Select Query returns multiple nodes, every node will be modified. (Or if no Modify action is selected, the contents of each node is displayed, separated by braces { }.) If the Select Query returns only a single node with no Modify action, it will be shown without braces.

Description

This column has no purpose and is only descriptive to help remember what the Query definition is used for.

Select Query

The Select Query column uses XPath syntax to define selection criteria for one or more XML nodes in each configuration file. The selected element(s) (one or more, depending on the Column Header) will be acted on by the Modify action. See the section Understanding XPath Queries for help in understanding XPath query format used in the ACE Configuration Management Utility.

If there is a row with a non-blank Column Header but a blank Select Query, it will create an empty column under its column header on the Modify Results sheet.

Condition Query

The Condition Query column is currently unused.

Mod Type

The following Modify actions are supported. See below under Examples of Modify Query actions for additional description of the types of actions that can be performed.

(blank)

Leave the Mod Type column blank to just run an informational query. The result is exactly the same as obtained with the Query and Query Results sheets, described above, but the output is stored on the Modify Results sheet. Source Data/File and Source Query are UNUSED.

AddFromFile

Add contents of a file, typically containing a chunk of XML text, as child node(s) underneath each XML element selected by the Select Query.

The Source Data/File column may contain the filename (using a partial pathname, relative to the Configuration Path configured in the Main Menu), or a fully qualified directory and filename (such as C:\Data\mydata.XML). The Source Query is optional.

The source XML file may contain a small section of XML text, or it may be a complete ACE XML configuration or template file (with an additional qualifying Source Query to select within the source XML for the content to be added).

self – The source XML data may also come from a different location within the same ACE configuration file being modified, using the word "self" for Source Data/File and a query defined under Source Query.

Note that the AddFromFile action will add the ENTIRE contents of the file (or elements specified by the Source Query) under ALL of the XML elements selected by the Select Query (up to the limit specified in the Column Header). Note, this is different from the behavior of the ModifyFromFile action.

The Modify Results sheet will return a value such as “added #x” if successful, where the # is the number of source elements to which the XML data was added; or it may be “n/a” if the Source or Select Query returns no XML elements.

AddFromFile[##]

Add contents of a file (same as AddFromFile) as a child node underneath each XML element selected by the Select Query. The ENTIRE contents of the file (or part of the file specified by Source Query) is added ## number of times under each parent element in the Select Query. This is typically used to add multiple lines to a table, or multiple objects of the same kind at one or more Select Query insertion points.

The Modify Results sheet will return a value such as “added #x” if successful, where the # is the number of source elements which were added (up to total number of Select Query elements * the number ## in the “AddFromFile[##]” Mod Type); or it may be “n/a” if the Source or Select Query returns no XML elements.

Example:

Select Query: points to the <TABLE> property of an ACE table, which may select one or more ACE objects in each configuration.

Column Header: “AddRows[0]” - using “[0]” will modify all of the tables in the Select Query. Using “[2]” will only modify the first two selected tables. Omitting the square brackets will only modify the first selected <TABLE>.

The “Mod Type” is defined as: AddFromFile[4]. The Source Data/File identifies a source containing one or more <TR> elements to be added (using optional Source Query to select one or more <TR> rows in the source).

Running this Modify query will take data from the source file containing one or more <TR> elements and add all of those selected <TR> elements to every selected <TABLE>.

In place of the number inside the [ ] brackets of “AddFromFile[]”, you can use a variable such as ${VAR02} that has previously been set to a certain value. See Using Variable Values for more explanation of the variable feature.

Add

Add contents of the Source Data/File column, typically containing a chunk of XML text, as child node(s) underneath each XML element selected by the Select Query (Source Query column is UNUSED).

This option differs from the AddFromFile options above, by allowing new text to be included directly in the ACM utility spreadsheet, thus not requiring an external file or Source Query to specify the data to be added. This is nice for relatively short sections of XML – however, Microsoft Excel is limited to 32767 characters in a cell.

It is recommended to copy the intended XML content directly from an XML configuration file and include one blank line

The Modify Results sheet will return a value such as “added #x” if successful, where the # is the number of selected elements to which the XML data was added; or it may be “n/a” if the Select Query returns no XML elements.

Add[##]

Same as ‘Add’, but add contents of the Source Data/File column, typically containing a chunk of XML text, as child node(s) underneath each XML element selected by the Select Query. The ENTIRE contents of the Source Data column is added ## number of times under each parent element in the Select Query. This is typically used to add multiple lines to a table, or multiple objects of the same kind at one or more Select Query insertion points.

The Modify Results sheet will return a value such as “added #x” if successful, where the # is the number of source elements which were added (up to total number of Select Query elements * the number ## in the “AddFromFile[##]” Mod Type); or it may be “n/a” if the Source or Select Query returns no XML elements.

Modify

Change the selected XML node(s) to the text included under the Source Data/File column in the Modify sheet. The Source Data may be a simple text value, such as "10.63.191.26", or a section of XML text, such as "<Value>10.63.191.26</Value>". Source Query is UNUSED.

If the Source Data contains XML text, it should include only one parent element, which may include multiple children elements. If the XML text includes multiple top-level parent nodes (siblings), only the first will be used.

The Modify Results sheet will return a value such as “modified #x” if successful, where the # is the number of source elements which were modified; or it may be “n/a” if the Select Query returns no XML elements.

ModifyFromFile

Change the selected XML node(s) to the contents of a file.

The Source Data/File column may contain the filename (using a partial pathname, relative to the Configuration Path configured in the Main Menu), or a fully qualified directory and filename (such as C:\Data\mydata.XML). The Source Query is optional.

The source file may contain plain text, a small section of XML text, or it may be a complete ACE XML configuration or template file (with an additional qualifying Source Query to select within the source XML for the content to be added).

self – The source XML data may also come from a different location within the same ACE configuration file being modified, using the word "self" for Source Data/File and a query defined under Source Query.

Note that if the source data used with the ModifyFromFile actions contains plain text or a single top-level XML node, then the entire source data will be used to modify ALL Select Query nodes.

But if the source data contains multiple top-level XML sibling nodes, EACH sibling node will be used to modify EACH Select Query node, one for one, until either the Select Query nodes or the Source nodes have been exhausted. After that, no more nodes will be modified. Note, this is different behavior from the AddFromFile actions.

Examples:

If the source data contains "<Parent><Sibling1></Sibling1><Sibling2></Sibling2></Parent>", the data is considered a single XML element called "<Parent>". This single element will substitute for (modify) ALL Select Query nodes (up to the limit specified by the Column Header).

But if the source data contains "<Sibling1></Sibling1><Sibling2></Sibling2>", then a MAXIMUM of two Select Query nodes will be modified – the first selected node will be changed to <Sibling1>, and the second will be changed to <Sibling2>.

Remove

Remove the selected XML node(s) specified by Select Query.

Or, it may remove children of those nodes, by adding an additional XPath query under the Source Query column. If the Source Query column is non-blank, it will be added to the Select Query to choose child elements of Select Query.

If the Source Data/File column contains a number (or variable such as ${VAR02} containing a number), up to that many nodes will be removed at EACH Select Query location.

Examples:

1. Select Query points to a set of <TABLE><TR> nodes. A Remove action (with no Source Data or Source Query) will delete all selected <TR> nodes, up to the number of nodes included in the Column Header brackets [ ] (or all selected <TR> nodes, if Column Header ends with [0]).

2. Select Query points to <TABLE> node, the parent of <TR>. A Remove action with "5" in Source Data and "./TR" in Source Query will remove ONLY the first five <TABLE><TR> elements under each <TABLE> node selected by the Select Query.

The Modify Results sheet will return a value such as “removed #x” if successful, where the # is the total number of selected elements that were removed; or it may be “n/a” if the Source or Select Query returns no XML elements.

Reorder

Move the selected XML node(s) specified by Select Query in relation to their sibling XML nodes.

The Source Data/File column should contains a number (or variable such as ${VAR02} containing a number) that specifies the new location of the selected node among its siblings.

If multiple siblings under each parent are selected, they will be moved together but retain their order among themselves.

Examples:

  1. Select Query selects one or more Field Unit <Node> elements. With

  2. Select Query points to <TABLE> node, the parent of <TR>. A Remove action with "5" in Source Data and "./TR" in Source Query will remove ONLY the first five <TABLE><TR> elements under each <TABLE> node selected by the Select Query.

The Modify Results sheet will return a value such as “reordered #x” if successful, where the # is the number of elements that were moved under each parent node; or it may be “n/a” if the Select Query returns no XML elements; or it may be “NOT reordered” if there was a problem such as a wrong sibling number.

SaveToVAR

Save a value or block of XML text retrieved by Select Query into a numbered variable. The value of the variable can be used in later query or modify actions as a substitutable parameter. Source Data/File column contains an integer number, specifying the variable to use. Source Query is UNUSED.

The Modify Results sheet will include the content of the variable that was saved.

Example:

Select Query retrieves a "/count()" of objects or a value (such as "10.63.191.26"). Source Data column is "2". The value returned by the Select Query is stored into variable #2, which can be retrieved later with "${VAR02}".
See Using Variable Values for more explanation of the variable feature.

ConstToVAR

Save the contents of the Select Query column into a numbered variable. The Select Query, in this unique case only, is NOT an XPath query, but a fixed value or text string. The value of the variable can be used in later query or modify actions as a substitutable parameter. Source Data/File column contains an integer number, specifying the variable to use. Source Query is UNUSED.

The Modify Results sheet will include the content of the variable that was saved.

Example:

The Select Query column contains a value of “10”. Source Data column is "2". The value of 10 is stored into variable #2, which can be retrieved later with "${VAR02}".
See Using Variable Values for more explanation of the variable feature.

Source Data/File

The use of the Select Data/File column depends on the Mod Type action and query definition used on each row.

Source Query

The use of the Source Query column depends on the Mod Type action and query definition on each row.


Examples of Modify Query actions

Below are several examples describing how the various Mod Type actions work.

1. List all Master Channel names that have Modbus Field Units as children.

This example queries for an object of a certain "Enabled=Yes" attribute and gets its grandchildren that have a certain "Name" attribute. This is the same as used on the the Query sheet.

Column Header: ModChans[0]

This lists them all in one column. Use [##] for a set number, or omit [0] for only the first Master Channel.

Select Query: //Node[ @Enabled='Yes' and Node/Node[ (@Type='FieldUnitModbus32' or @Type='FieldUnitModbusTCP32')] ] /@Name

Select all enabled nodes whose grandchild has a Modbus FieldUnit type, and list the parent node's name(s).

Mod Type, Source Data/File, Source Query: (blank)

Modify Results (single column): {Channel 01}{PLC Channel 05}

Output is in braces { } because the Column Header ends with [0] and more than one node was queried.

2. Disable all but the first Modbus Field Unit under channel 1.

This uses the position() qualifier and assumes that all Field Units are under the same circuit.

Column Header: Disable[0]

Select Query: //Node[ Properties/Instance = 1] /Node/Node[ (@Type='FieldUnitModbus32' or @Type='FieldUnitModbusTCP32') and position() > 1] /@Enabled
This query selects the Enabled property of all Modbus grandchild nodes under the Master Channel with Instance=1, where the position() of the nodes under its parent (Circuit) is greater than 1.

Mod Type: “Modify”

Source Data/File: “No”

All ACE objects have an "Enabled" attribute that contains text, either "Yes" or "No".

Modify Results (one column): “modified 5x”

This tells the number of source nodes that were modified.

3. Add Automated Processing section under Clients, using a dedicated XML text file.

This example will add the entire contents of a file, which has been copied out of an existing configuration and includes only the Automated Processing section of XML text.

Column Header: ADD_AutoProc

Select Query: //Node[@Type='Clients']

Select the Networks parent where Automated Processing will be added.

Mod Type: AddFromFile

Source Data/File: autoProcSource.XML

autoProcSource.XML contains the entire XML of just the <Automated_Processing> node (not a full ACE configuration), with all its child objects needed in a configuration.

Source Query: (blank)

Modify Results (one column): added 1x

Note that in this example, we could obtain the source data from an existing configuration using a Source Query, such as:

Source Data/File: GoldenACEConfiguration.XML

GoldenACEConfiguration.XML contains a fully configured Automated Processing, to be copied into one or more other configurations.

Source Query: //Node [@Type="Automated_Processing"]

4. Remove existing table rows in the Automated Processing table that was imported above.

This clears the table and allows it to be set up specifically for the ACE objects configured in each configuration.

Column Header: REM_Omni[0]

Select Query: //Node[ @Type='Omni-Modbus-Archives'] /Fields//TR

This removes all TR grandchildren (table rows) of the Omni-Modbus-Archives table, because the Column Header uses [0].

Mod Type: Remove

Source Data/File and Source Query: (blank in this example)

Modify Results: removed 4x

5. Count number of Modbus Field Units in the current configuration.

(For purpose of this example, these are assumed to be Omni flow computers.) This example illustrates the use of the SaveToVAR action. The saved value will be used in the next two examples.

Column Header: VAR00 (#Mod)

Select Query: //Node[ @Enabled='Yes' and (@Type='MastChanFlexScan' or @Type='Master Channel' or @Type='MastChan') ] /Node[(@Type='AsyncCircuit' or @Type='NetCircuit') and @Enabled='Yes'] /Node[(@Type='FieldUnitModbus32' or @Type='FieldUnitModbusTCP32') and @Enabled='Yes'] /count()

or a simpler version:

//Node[@Enabled='Yes'] /Node[@Enabled='Yes'] /Node[(@Type='FieldUnitModbus32' or @Type='FieldUnitModbusTCP32') and @Enabled='Yes'] /count()

This selects nodes of Modbus type that are enabled, which must have both a parent Circuit and Master Channel that are also enabled. The "count()" at the end yields the number of such nodes with the above characteristics.

Mod Type: SaveToVAR

Source Data/File: 0

This setting will store the count of nodes into variable ${VAR00}.

Modify Results: The results page will display the value that was stored in the variable, such as "2".

6. Add two table rows to a table for every Modbus Field Unit, obtained in the previous example.

This example uses a separate file containing a single <TR> section with all its <TD> child rows rows which are the new Poll Table entries.

Column Header: ADD_OmniTimeSync

Select Query: //Node[ @Type='Time-Syncs'] /Fields/Field[@Name='Data Process Table']/TABLE

Select the intended object type, then select the <TABLE> grandchild which is the *parent* where new XML will be inserted.

Mod Type: AddFromFile[${VAR0}]

In the previous example, we used a SaveToVAR action to count the number of enabled Modbus field units. Now we are using the phrase "${VAR0}" in the Mod Type to substitute for the number of iterations that we wish to insert the file contents. The Mod Type is thus converted (for example) to "AddFromFile[2]" before being acted upon.

Source Data/File: TimeSyncTable-ModbusRow.XML

Source Query: blank

(But note that we could have pointed to an XML configuration file with the <TR> table rows we needed, and used a Source Query to request those rows as the items to be inserted.)

Modify Results: added 2x

7. Modify channel number in table, in the previous example, based on Master Channel of every Modbus Field Unit.

This example queries all the Modbus units (assumed for this example to be Omni flow computers), gets the Master Channel number, and modifies the first column of the table rows inserted in the previous example.

Column Header: OmniTSChan[0]

Select Query: //Node[ @Type='Omni-Modbus-Archives'] /Fields/Field[@Name='Data Process Table'] /TABLE/TR [TD[5] = '8'] /TD[1]

This selects the first <TD> column in the table (Channel number), where the 5th <TD> column is a value of "8" (Omni Batch report). (Note, this query only modifies half of the newly inserted rows in the table in this example. Another query row would be needed to modify the rows where the 5th column is "9", Omni Hourly report.)

In this example, there are two matching <TD> elements returned by the Select Query. Both will be modified with the Modify query.

Mod Type: ModifyFromFile

Source Data/File: self

This option queries this configuration for data to use for modification.

Source Query: //Node[ @Enabled='Yes' and Node[ @Enabled='Yes'] and Node/Node[ @Enabled='Yes' and (@Type='FieldUnitModbus32' or @Type='FieldUnitModbusTCP32')] ] /Properties/Instance/text()

This query selects all enabled Master Channels (which also have an enabled Circuit, and enabled child Modbus unit), and gets the Instance number (Master Channel number).

Modify Results: modified 2x

Note that the Select Query selects two rows in the table to be modified, and the Source Query selects potentially all of the Master Channel numbers, if they are different – if there had been more than one Channel, then the nodes would have been modified one for one. In reality, however, in this example all the Modbus field units are under the same channel, so the query actually only returns one node: the Master Channel <Instance> that is the parent of all the Modbus units. Therefore, the Modify query has a single node that is the source, so ALL of the Select Query nodes are modified to match this single value (Channel instance number), no matter how many <TD> rows are matched (one to many).


Using TestXPath Sheet

The TestXPath sheet can be used for testing XPath query definitions (either Select Query, or any document used in a Source Query).

The first seven columns in this sheet are the same as in the Modify (or Query) sheets, except the second column is a filename of an XML document (full path, or relative to the Configuration Path).

Enter data for Column Header, Mod Type, Source Data/File, and/or Source Query, and click the "Test XPATH" button. The basic rules for these columns are followed, as described in the section Modify Sheet. The main differences are:

  1. When clicking the "Test XPATH" button, the query and action are performed ONLY on the same row as the currently-selected cell.

  2. The Number of Child Nodes column (H) gives the count of nodes requested by the Select Query, regardless of whether or not the query ends with "/count()".

  3. The Select Query XML column (I) contains all queried nodes, separated by braces { }, as if the Column Header ended with [0].

  4. The Modify Results column (J) contains the results of any Modify action, separated by braces { }, as they would appear in multiple columns of the Modify Results sheet.


Using L5X Tags Import Utility

The L5X Tags sheet is used to query tags from an Allen Bradley PLC program file, to aid in more quickly configuring the polling of an EtherNet/IP device in the ACE Configuration editor. The Allen Bradley tags are queried from its L5X (XML) configuration file and displayed in the L5X Tags sheet of the ACE Configuration Management Utility. The user can then select which tags to poll, and the ACM Utility will automatically add the following information into an ACE configuration:

Initial Setup of ACE Configuration

The ACE Configuration Management Utility doesn’t automatically create all the ACE Editor objects necessary to configuring an EtherNet/IP. It only fills in the existing tables of an already-configured EtherNet/IP Field Unit.

Thus, the first step is to create an ACE configuration file that will serve as the basic configuration for a RediGate or Director. All the required elements, such as AsyncPorts, Ethernet ports, Firewall, SerialMMI, etc., must be configured within the ACE Editor. The configuration must also include at least one (or more) set of the 5 required components for polling an Allen Bradley EtherNet/IP device:

Master Channel - Scan Table may begin with a blank table and will be filled in by the ACM Utility, but all other settings should be configured in the ACE Editor.

NetCircuit - Circuit should use Master Network Port of 44818, and the IP address of the PLC in the Connect Table.

FieldUnitEthernetIP - the Field Unit definition requires a unique Unit Address under each Master Channel. This Unit Address doesn’t correspond to an actual address of the PLC, but it is needed by the Master Channel to uniquely identify each PLC for scanning purposes. The Poll Table can begin blank and will be filled in by the ACM Utility. Other settings (Controller Type, etc.), should be set up based on Elecsys documentation for EtherNet/IP devices (see https://elecsysdocs.atlassian.net/wiki/spaces/IDG/pages/296343/Protocol+EtherNetIP-Master ).

RTDB - Database Definition may begin with a blank table and will be filled in by the ACM Utility.

TagNames - may begin with a blank table and will be filled in by the ACM Utility.

L5X Import Menu

The L5X Import sheet is used to manage the selection of Allen Bradley tags to be polled, and to configure one of the XML configurations included on the Configurations sheet.

NOTE: When using the Modify feature of the ACM Utility, it is normally recommended in the Main Menu to use either a different Output XML Path and/or Output File Suffix from the source configurations, so the modified XML configurations will not overwrite the original files. The same thing can be done for the L5X Import utility as well. However, it is permissible to use the same Output XML Path and a blank Output File Suffix, so the changes to an EtherNet/IP field unit will be made in place in the same configuration.

Be aware that if you make changes to the L5X configuration and save them into a different XML file, then subsequently make further changes in the ACE Editor, you will need to select the latest (modified) ACE XML file to begin with, so that all changes are retained.

Use the List Configurations button to create a list of configurations on the Configurations sheet. Then click on the L5X Import button in the Main Menu or the L5X Tags sheet to set up the PLC tag information.

The L5X Import Setup dialog will configure the following items:

After clicking the OK button, a dialog will summarize what is being done before listing the L5X tags. Click the Cancel button to return to the L5X Import Setup dialog or OK to continue.

L5X Tags Sheet

After the L5X program file has been read, the tags will be listed on the L5X Tags sheet. An example is shown below. All known AOI and UDT nested structures will be automatically expanded to show their inner tags.

Most of the information in the L5X Tags sheet is informational only and does not need to be modified. The first column (Include=1) is typically the only one that needs to be modified, and perhaps the Scan Period. Occasionally, the Data Type and Bit Position columns may need to be modified to read an integer and store individual bits, instead of storing the whole value into an integer register.

Below is shown an example of the L5X Tags sheet with the following tags selected:
two inner tags of customTimer, DINTARY[1], DINTARY[3], and four bits of DINTARY[5] (0,1,16, and 31) stored into Boolean registers. The default Scan Period is 5 seconds, but has been changed to 1 second for DINTARY[3] and DINTARY[5].

Note that because the top-level “customTimer” structure (newTimerUDT data type) is polled, as well as the individual elements of the structure, it leads to a difference in the Poll Table, as will be explained in the next section.

In summary, the process of configuration is to 1) view the L5X Import Setup dialog and enter information specifying configuration, channel, unit, and L5X program file; 2) click the OK button to read tags from the L5X file; 3) select tags to include in the polling by entering data under the Include column. Optionally, enter comma-separated list of bits under Bit Position to identify bits within integers. 4) Then click the Save to XML button to set up the PLC tag polling in the RediGate or Director configuration (see below).

Save to XML

After setting up the L5X Tags sheet to select tags for polling, click the Save to XML button. Make sure the configuration is not open in the ACE Editor. After changes are made, the configuration will need to be re-opened in the ACE Editor to view the changes or to load to a RediGate or Director.

Click the OK button to confirm saving to XML. The output file will be saved according to the settings in the Main Menu (Output XML Path and Output File Suffix).

After saving the data to the XML configuration file, it will need to be re-opened in the ACE Editor to see the changes. Below is shown an example of several tags imported into an ACE configuration.

Poll Table: DINT values are polled into registers 47001-47003, Booleans are polled into registers 1-33.

Because the top-level customTimer structure was selected for polling in addition to the inner elements, the Poll Table lists “customTimer” as a “Struct” data type. Only this poll is scanned in the Scan Table (below). The following 6 lines in the Poll Table are “continuation polls” which define how the RediGate or Director will parse the integer or Boolean data elements from the single polled structure.
If the top-level customTimer row had not been polled, it would have appeared as two separate (scanned) polls for only the customTimer.ACC and customTimer.DN.

Scan Table: Only rows 1, 8, 9, and 10 in the Poll Table need to be scanned. Note the Scan Period column matches the Scan Period column for each scanned poll, as defined in the ACM Utility.

RTDB Table: Registers defined at 1-33 and 47001-47003.

TagName Table: Only the names for the polled tags appear in the TagNames object. Note that the Poll Table reads the DINTARY[5] and extracts all 32 bits into RTDB registers 2-33. But only registers 2, 3, 18, and 33 have tag names associated with them. If this data is sent via Report By Exception to a protocol (such as Sparkplug-B) that can report only registers with tag names, then only the named tags will be sent, even though there may be data stored in the non-tagged Boolean registers.

The L5X Import Setup dialog (above) set up a configuration for the L5X Tag Setup File (.L5Xtags extension). When the ACM Utility saves data into the XML configuration file, it also records a list of the included tags into the .L5Xtags file, to be used later when re-reading the L5X program file and modifying the tag list for ACE. The name of the .L5Xtags file (including full path) is stored within the ACE configuration as the Description of the TagNames object:

Note: the ACE configuration (any of the 5 tables) can be changed manually in the ACE Editor after saving data using the “Save to XML” option of the ACM Utility. However, any changes made to these tables manually within the ACE Editor will be overwritten the next time the ACM Utility is used to import data from the L5X file.

The above process of selecting the Master Channel, Field Unit, L5X program, and .L5Xtags file should be repeated for every PLC (Field Unit) polled within a given ACE configuration. It is not necessary to save the ACM Utility Excel spreadsheet file for each L5X Tags import action, because the .L5Xtags file (for every Channel/Unit) retains the information needed to repeat or modify the L5X Import in the future.

After the XML configuration file has been fully set up, use the ACE Editor to load the configuration into a RediGate or Director for testing.