Creating a Lon Xml file

If no lonVendor module contains the Lon Xml file you need, this procedure documents how to use the Lon Xml Tool to create a configuration file for the device.
Prerequisites: The source .xif file and (if necessary) other resource files, are available and ready to use. Workbench is open in a Supervisor station.
 NOTE: Lon Xml supports default (init) values for a device ncis and cps, provided that the source .xif file is version 4.0 or later, and init data values other than all zeros exist. 
  1. Click Tools > Lon Xml Tool.
    The Lon Xml Create view opens.
  2. Browse to select the three source locations and define the complete path including the drive letter for each file or use the Sys Home (!) path.
    • Working Dir identifies where to create the Lon Xml file (the Directory Chooser opens).
    • Xif Filedefines the location of the manufacturer’s .xif file for that device (the File Chooser opens).
    • Resource Dir (if applicable) defines the directory that contains associated resource files (the Directory Chooser opens).
  3. To force the use of zero-based names for the unique name of each element in an arrayed nv, nci and cp for the Lon Xml file, click the Zero Based Arrays check box.
    The tool creates names of arrayed elements by appending the array index to the array name. The default behavior (unchecked) uses one-based indices for arrayed nvs, ncis, and cps.
  4. To create the Lon Xml file, click Compile.
    The tool parses the xif file for the device along with the resource files (if applicable), and creates a *.lnml file for the device in the working directory.

    If you are using resource files, and when compiling, an exact match is not found, a popup Engineering Unit Select window opens before the tool creates the Lon Xml files. This window lets you review unit strings in the language resource file that may need association with engineering units.

    In this window, the Scope/Index property shows the mapping within the language resource file to the unit string, and the Original property shows the found string. The original string is close to an approved unit in the list (possibly the best guess).

  5. Pick a new unit from the approved New Text list and click OK.
    If the tool finds other unit strings that need specifying, the window remains open.
  6. Repeat selections until all unit strings are associated.
    The tool creates the Lon Xml file for the device along with a datatypes Lon Xml file under the datatypes subfolder of the working directory.
     NOTE: In a few cases, selection of a unit based on the Original text string may be difficult (does not suggest a normal engineering unit). In this case, leave the New Text property blank and click OK to go to the next unit. No units will be applied to elements using this string. 

    If you are creating Lon Xml lnml files for multiple devices by the same vendor, after doing this process for the first device, you might not be prompted again with an Engineering Unit Select popup, unless another device (xif) points to a new unit string.

    The tool names each Lon Xml file based on the name of the .xif file, and gives its datatype Lon Xml file(s) names derived from the resource files.

     IMPORTANT: If you copy the directories that contain Lon Xml files, such as to make a backup, make sure you copy the subdirectories as well as the primary directory and preserve the directory names.