Skip to content

Instantly share code, notes, and snippets.

@danyill
Created February 21, 2025 23:37
Show Gist options
  • Save danyill/8cb3862bf6ce361cc550f5ae43202e18 to your computer and use it in GitHub Desktop.
Save danyill/8cb3862bf6ce361cc550f5ae43202e18 to your computer and use it in GitHub Desktop.
oscd-diff end user help draft

How to use

The compare plugin allows for a complete comparison of two SCL documents and gives a hierarchial list of differences using the SCL structure shown in IEC 61850-6.

Users may compare only particular elements and specify these in considerable detail. Comparisons can occur between one or more documents. Pre-defined filters are available for common use cases and users may create new filters as well as export and import filters to allow them to be shared (the filters are saved as JSON files)

Comparisons on large files may take a considerable time - 10-15 minutes on a high powered machine with 16 Gb RAM and no other browser tabs or applications open. SCL files for even small substations can have many hundreds of thousands of elements. Comparisons between files with only a small number of IEDs should take < 10 seconds.

It is recommended to create filters to ensure performant queries and targeted results.

While the comparison is being done the user interface may become unresponsive, and a message asking whether the user would like to wait may come up. Either the user can click "Wait" or just ignore this message - the comparison will continue to occur in the background.

Once a comparison is complete, click on the print icon on the left to either print or export to PDF. The full-screen button maximises the view to take up the full browser window.

Quick Start

At the top top, a set of predefined filters for common tasks is provided. Click the three dots on the right to duplicate/delete or to import/export the filters.

If using small files with only a few IEDs (e.g. SSD, ICD and CID files or SCD files with just a few IEDs) then choosing the "Complete" filter.

Then select the from and too document.

The colours of the document icons here are used to show where the changes are, if changes are only in the first document colour it indicates removals and if changes are in the second document colour it indicates additions.

Finally the "From elements" and "To elements" can be entered. On a predefined filters these can usually be left blank or at the filter defaults.

Click on "Compare" and wait for the comparison to be presented. Changing to another tab may mean the comparison is effectively paused so leaving the the window in focus is recommended.

The output is shown in the normal SCL file structure:

Header
Substation
Communication
IED (one or more)
DataTypeTemplates

To understand each element it is recommended to look these up in IEC 61850-6 or each manufacturer's documentation.

Creating filters

To create your own filter, choose a similar filter and select the "More" option adjacent to the filter selector (the three dots). Click on "Duplicate". Then click on the "More" option and select "Edit".

Fill out the basic metadata:

  • Filter name - appears in the filter drop-down list.
  • Description (optional) - additional information on the filter settings or intended usage.

From and To Elements

From and To elements define the root of the comparison.

For a complete comparison this may be left empty and if the root is the same in both documents it may be entered in just "From elements".

This filter is a CSS selector (see MDN for more information) and can be used to specify particular elements.

For example between two IEDs:

  • From elements: IED[name="XAT_BusA_P1"]
  • To elements: IED[name="SOM_BusA_P1"]

The "From elements" lines up with the "From document" and the "To elements" line up with the "To document".

This allows other kinds of comparisons to be done. Imagine in the "From document" a SubStation "XAT" exists and in the other file a SubStation "SOM" exists.

By putting Substation[name="XAT"] in the "From document" and Substation[name="SOM"] in the "To document" these may be compared.

Include and Exclude Filters

The five different filters allow fine-grained comparisons. Examples are given for the Substation section but could just as easily be given for IEDs.

SCL elements, attributes and namespaces used in the file can be either "Include" or "Exclude" filters. By default if the user does not select them, then the toggles are set to "Exclude" on the default "Complete" filter.

This appears as:

Exclude Except

To swap them around, click on the toggle. The filters then become:

Include Except

The filters are given as CSS Selector expressions. These are often more simple than equivalent XPath expressions. Learn more about the differences and how to use these on MDN or make a start with the examples below.

It is recommended to study the default filters and to create filters initially with small files in an incremental manner to understand them clearly.

Elements

The following would include everything but exclude a particular VoltageLevel named V33:

Exclude Except
VoltageLevel[name="V33"]

To swap the filter so that it only includes only the VoltageLevel V33 only would click on the "Include Elements" toggle.

Now the meaning of the text boxes have changed to:

Include Except

The "Except" input is especially useful when querying a broad "outer element". For instance, imagine a user wanting to compare all VoltageLevel elements but not one specific one:

Include Except
VoltageLevel VoltageLevel[name="V33]

If your SCL had multiple Substation elements in it, we could specify the particular one to compare using a child combinator. For example:

Substation[name="XAT"] > VoltageLevel[name="V33]

Ensuring Elements are Connected

If complex selectors are used then the user must ensure the there is a hierarchial path between the elements.

For example, the GSE element within the Communication section sits within the SubNetwork and ConnectedAP elements as defined by the standard.

If specifying toggling to "Include" on Elements, then all ancestors of the GSE element need to be included as well for the filter to function correctly.

The filter settings would be:

  • From: Communication
  • Elements: set the toggle to "Include"
  • Under include:
    SubNetwork
    ConnectedAP
    GSE
    GSE *
    

The last selector, GSE * is a combination of all GSE elements, the "descendant combinator" which is a space and means any ancestor matching the first selector and a universal selector, * which matches elements of any type.

Other usages

Many IEDs place information in a Private elements. This may not be human readable in some cases. To exclude these from a comparison, place Private in the "Exclude" elements field.

Attributes

Attributes work much like elements in that filters can be either inclusive or exclusive.

One use case could be to exclude descriptions. In SCL many elements have a desc attribute but this is sometimes overwritten by an IED Configuration Tool (ICT). To ignore these differences, on an exclusive filter, enter desc in the "Exclude" field.

Namespaces

By default all namespaces are included.

This plugin requires namespaces to be entered as their fully qualified URLs.

To exclude other manufacturers, enter their fully qualified namespace:

http://www.ManufacturerA.com/Some/More/Detail

Namespaced Elements

Namespaced elements can be included in the Elements field in the following form:

https://a.com:DO

Where this means a DO element in the https://a.com namespace.

Other Notes

Extension namespace information within Private elements cannot be interpreted by this plugin except by string comparison as their structure is unknown (not defined by IEC 61850-6).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment