Time Series Data Management System   (TSDMS)

TSDMS Solutions Blog Pricing About Support

 

NI DIAdem Tutorial

NI DIAdem is software for measurement data aggregation, inspection, analysis, and reporting.   The Time Series Data Management System (TSDMS) is built on DIAdem, harnessing DIAdem's powerful features into a seemless application that is easier to use than DIAdem alone.   This tutorial is intended to assist a beginner on how to use DIAdem alone, without the assistance of the TSDMS.  

 

Overview

NI DIAdem is a comprehensive software application designed to import, organize, and both visually and numerically analyze measurement data.   It is a complete solution for the management of Big Data.

DIAdem DataPlugin technology allows you to directly import raw data files from over 200 data acquisition / data logger file formats.   Additionally, it allows you to create a custom DataPlugin to import text/CSV based files via a simple to use Wizard.   An advanced DIAdem user may also create a new DataPlugin to read any binary file format where the structure of the file is known.  

Measurement data sizes can get large, and consist of many individual files.   In some data acquisition scenarios, you may have data recorded by different data acquisition devices and/or data loggers during the same session, or between current and earlier activities.   The best way to manage this Big Data is to import it, convert it to a consistent data model, and then save it to a binary file.  

NI provides an open format binary file that provides superior performance and flexibility for the storage of measurement data.   Converting raw measurement data files to the NI TDM/TDMS file format, and then analyzing data in that format with DIAdem, will significantly reduce the time to read files, analyze them, and then save the results.   (see Excel for Big Data and Database vs. File for more information).  

DIAdem Vs. Excel & Other Apps

It is fairly easy to import CSV and other text based data formats into spreadsheet applications such as Excel.   Each parsed data can be assigned a column in the spreadsheet, and you can then perform calculations on the data in all rows within a column.   This works well for small files, but quickly becomes a burden with more than 100,000 rows, and impossible at more than 1,048,576 rows of data.   Reading 1 million rows in Excel takes minutes, but reading it with a DIAdem DataPlugin will only take 7 seconds.   Saving the data to a binary (TDM/TDMS) file and then reading it again will only take 0.04 seconds with DIAdem.  

Most DIAdem DataPlugins have been optimized to read raw data as fast as possible.   And few other time series data analysis applications support anything near the number of raw data formats DIAdem supports.   If you are truly dealing with Big Data, and you need to be able to analyze data from a wide range of data acquisition systems and data loggers, consider carefully the import capabilities and performance of your data analysis system.  

DIAdem Graphical User Interface

The DIAdem graphical user interface (GUI) is organized by task.   The Navigator panel allows you to import raw data, connect to an indexing service such as DataFinder, and to search for data.   The Data Portal provides a means to interact with imported data that has been loaded into memory.   The View panel has tools to enable you to visually analyze and interact with data loaded into the Data Portal.   The Analysis panel provides hundreds of engineering and scientific analysis functions for the manipulation, calculation, and analysis of data.   The Report panel has a powerful user interface that quickly generates custom visualizations of the analyzed data, and supports exporting report pages to common external document formats.   The Script panel allows you to automate repetitive tasks.  

The DIAem panels are highlighted in red in the image below.   When you select a panel, the user interface area (highlighted in blue) changes, presenting new menu choices, group bars (and their function groups), and toolbars that are relevent to the panel (task) chosen.

DIAdem Settings

The global settings for DIAdem are accessible by accessing the menu option 'Settings', 'DIAdem Settings...' from any panel.   This will launch a dialog 'DIAdem Settings' with the options organized within a 'General' group, and then by 'Panels'.   Any changes to the settings will not persist to the next launch of DIAdem unless you save them.  

DIAdem settings may be saved by accessing the menu 'Settings', 'Save As...'.   A 'Save DIAdem Settings As' dialog will appear and it will be set by default to the folder location where DIAdem expects to find the settings file with the '.DDD' file extension.   The default DIAdem settings file is named 'Desktop.DDD'.   Any alternative settings you wish to save should be saved in this folder, under a different filename.  

Loading a .DDD settings file after DIAdem has been loaded will cause DIAdem to restart.   You may also launch DIAdem with a particular settings (.DDD) file.   By specifying a startup script in the 'DIAdem Settings' dialog under 'General', 'Start script', and saving those settings to a unique settings '.DDD' file, you can cause DIAdem to automatically launch a custom script.   To do this, make a copy of the Windows menu icon, then edit the icon and modify the 'Target:' option to include the custom desktop filename with the lower case letter 'd' as the prefix followed by the desktop settings filename without the filename extension.   For example, to launch a custom desktop file named 'CustomDesktop.DDD', the command line would be modified to add 'dCustomDesktop' as: "C:\Program Files\National Instruments\DIAdem 2021\DIAdem.exe" /dCustomDesktop   Note that the double quotes " are required for the path because it has spaces in it.  

What You Learned

  • DIAdem is a Big Data management software application that excels in the ingestion, analysis, and visualization of 2D and 3D measurement data.  
  • You can import Big Data from nearly any file format, and then store it to an efficient, open file format.
  • The graphical user interface is organized by task (import, search, visualize, analyze, report, automate), and the user interface changes based on the panel selected.  
  • The global settings can be saved and loaded, and also configured to run a custom script when DIAdem is launched.  

 

Navigator

The DIAdem NAVIGATOR is used to import raw data, connect to an indexing service such as DataFinder so the metadata and content imported can be searched, and it facilitates loading data into memory (Data Portal).   DataPlugins are available to support the importing of hundreds of different raw data file formats.   Imported data is saved to the TDM or TDMS file format and then indexed by a DataFinder.   The NAVIGATOR user interface provides the means to search the DataFinder index to identify data of interest by metadata at the file/root, channel group, or channel level.   Search results may then be loaded into memory and viewed with the Data Portal.  

Clicking on the NAVIGATOR panel, configures the DIAdem user interface area for NAVIGATOR tasks.   DIAdem needs to be connected to a file indexing service.   By default, the 'My DataFinder' DataFinder is installed with DIAdem and is automatically configured as the connected DataFinder.   In multi-user environments, you may have options to also connect to a shared DataFinder, or a DataStore.   You can connect to a different DataFinder or DataStore using the 'File' menu, or the Group Bars.   At the top of the application window, the title will indicate what indexing service DIAdem is currently connected to.  

NI DIAdem NAVIGATOR GUI

Configuring Search Areas

Search Areas are the indexed folders that the DataFinder searches for data when a NAVIGATOR search is performed.   When DIAdem is installed, it may configure several folders for search areas.   It is the author's opinion that it is better configure the NAVIGATOR search areas to only index imported data saved to TDMS files, and remove any search areas that index raw data files.   You will achieve the best read/write and analysis performance in DIAdem by only working with indexed TDM/TDMS files.  

To see the current DataFinder search areas, click on the NAVIGATOR panel, and at the bottom of the screen, choose the tab labeled 'File Browser'.   By right clicking on 'Search Areas', you may add a new search area.   IMPORTANT: All imported data saved to TDMS files (.tdms) should be stored on a fast drive that is locally connected to the PC running DIAdem.   This will provide you with the best performance.   To remove a search area, right click on a search area listed below 'Search Areas' and choose the 'Remove Search Area...' option.   After adding and/or removing search areas, you should re-index the DataFinder by selecting the NAVIGATOR menu options 'Settings', 'My DataFinder', 'Configure...'.   In the 'Configure My DataFinder' dialog, click on the 'Indexer' tab and then click the 'Start Now' button.  

Configure NI DIAdem NAVIGATOR indexing source

Importing Raw Data

DIAdem supports reading measurement data from many different file formats, including binary, text/CSV, and bus log data.   DataPlugins are used to read binary and text/CSV files.   The Bus Log Converter is used to read CAN, LIN, and FlexRay bus log data.   You can easily use the Wizard to create a custom DIAdem DataPlugin for reading text or CSV data files.   In addition to the many binary file types built-in to DIAdem, you can also visit DIAdem's website online to download a DataPlugin for hundreds of different data acquisition file types.  

Importing Raw Binary Files

The first thing you should do is try to import a raw binary file using the NAVIGATOR panel 'File', 'Open' dialog.   At the bottom right of that dialog, change the file extension filter drop down box to match the file extension of the file you wish to import (if available).   Then at the top of the dialog, browse to the folder where your file resides.   If your file extension is supported, click the 'Load' button at the bottom of the dialog and it will be loaded into memory and visible via the Data Portal.  

Import raw binary files into DIAdem

If your raw binary file type is not listed in the currently installed DataPlugins, then you need to visit NI's DataPlugin download website (click here) and download the appropriate DataPlugin.   If the downloaded DataPlugin file has a .uri extension, then use Windows file explorer to right-click on the file and choose 'Import'.   If the file extension is .exe, then simply double click on the EXE file and NI's Package Manager will guide you through the installation.  

Importing Raw Text/CSV or Excel Files

The DIAdem Text and Excel DataPlugin Wizards make it easy to import data from text, CSV, and Excel files.   From the Navigator panel, click 'File' and then choose either 'Text DataPlugin Wizard..." or 'Exel DataPlugin Wizard...".   At the end of the process, you can save the import configuration to a new DataPlugin so that it may be used again in the future.  

Import raw text/CSV or Excel data into DIAdem

Before starting this tutorial, use Windows file explorer to locate the file 'C:\Users\Public\Documents\National Instruments\DIAdem ####\Data\Example.xls' DO NOT LOAD THIS FILE WITH EXCEL OR ANY OTHER APPLICATION.  

This tutorial will demonstrate how to import the contents of an Excel file (.xls) using the 'Excel DataPlugin Wizard'.   The process for the 'Text DataPlugin Wizard' and the 'Excel DataPlugin Wizard' are very similar.  

From the NAVIGATOR panel, click on the 'File' menu and choose the option 'Excel DataPlugin Wizard...'.   A file selection dialog will appear.   Find the file 'Example.xls' and click on the 'Open' button.   The DataPlugin Wizard dialog will appear, and Step 1 'File Structure' will appear as shown below.   Notice that in this Excel sheet, the first two rows consist of heading names for the column, the third row is the units, and the data begins in the first row.   The first column is labeled 'Type' and consists of a drop down combo box where you can set the type of row as 'Group Properties', 'Channel Properties', 'Channel Data' or 'Ignore'.  

Import raw text/CSV or Excel data into DIAdem

Set the first two rows as 'Channel Properties', because these values consist of the channel names.   Set the third row as 'Channel Properties' because this is the channel unit (channel units are stored as properties in DIAdem).   The remaining rows from four on should be set to the default of 'Channel Data'.   When configured properly, it will appear as shown in the image below.   Click the 'Next >' button at the bottom of the dialog to continue.  

Import raw text/CSV or Excel data into DIAdem

If the Excel file contained multiple sheets, you could assign the sheet name as a group property, but this is not the case, so click the 'Next >' button at the bottom of the dialog to continue.  

In Step 3 'Channel Properties', DIAdem has correctly assumed that the first row is the channel name, the second row should be the channel property named 'Description', and the third row the channel unit.   Click the 'Next >' button at the bottom of the dialog to continue.  

Import raw text/CSV or Excel data into DIAdem

In Step 4 'Channel Values', you assign the data type for the channel data by column, by changing the value of the drop down combo box in the second unlabeled row from the top.   It is very important to review all columns and insure the correct data type (numeric, text, time or date/time) is selected.   DIAdem will make an assumption on the data type, and the combo box choice will be 'Automatic' followed by the data type in parenthesis (data type).   Note that in the 5th column labeled 'Gear_Idx', row #1 has a value of 1, and the remaining values are NOVALUE.   This is because a blank value is in that cell from row 2 onward.   This is the correct setting.   Similarly, in the 6th column labeled 'Gear', the default data type will be text or 'Automatic (Text)', and the first five values will be the text value 'Gear', followed by NOVALUE for the remaining rows.   Click the 'Next >' button at the bottom of the dialog to continue.  

Import raw text/CSV or Excel data into DIAdem

In the final Step 5 'DataPlugin', you may create a unique name for the DataPlugin you are creating.   It is strongly suggested you include the text 'Excel' in the name, and anything else that will help you know when this DataPlugin should be applied to any future files you wish to import.  

In the section labeled 'X/Y Channel Relations', the checkbox labeled 'First channel of group is x-channel' is checked.   All other columns in the spreadsheet will become Y Channels.   The first column is the X Channel with the label 'Time' and the units of 's' for seconds.   This is the correct setting.   Click the 'Finish' button at the bottom of the dialog to continue.  

Import raw text/CSV or Excel data into DIAdem

The data will be imported with the DataPlugin you created, and it will be visible in the Data Portal.   Use the keys 'Alt-F6' to show the Data Portal if it is not visible.   Note that at the top of the Data Portal, the name of the file or root property 'name' is the Excel file name.   The channel group name of 'DIAdem' corresponds to the Excel sheet name.   The channels within the channel group named 'DIAdem' match the first row from each column in the Excel file.   The file is in DIAdem's memory only at this point.   To save the file, click on the NAVIGATOR panel 'File' menu and choose 'Save As'.   Change the file type to 'National Instruments TDM Streaming (*.tdms') and then click the 'Save' button.  

Import raw text/CSV or Excel data into DIAdem

DIAdemNavImportBusLogFiles

Importing Raw Bus Log Data

When importing Bus Log Data, it is critical to have the CAN/LIN/FlexRay bus log database files associated with the bus log data, as well as the associated bus numbers that were employed during the recording.   The physical bus lines are assigned a logical bus number between 0 and 255.   A unit under test may have several buses per type (CAN/LIN/FlexRay), all recorded simultaneously by a datalogger.   (NOTE: The TSDMS Bulk Import application can automatically discover combinations of bus numbers and other settings).   The most efficient way to perform bus log conversion is to collect the raw bus log files to be converted into a single folder, along with the related bus log databases files.   Include a Rich Text File (.RTF) in the folder with information about the relationship between the bus log database files, and the bus numbers associated with them.  

From the NAVIGATOR panel, click on the 'File' menu and select 'Open Bus Log Converter...".   Choose the file type (1) from the drop down box.   Identify the bus log file (2) to be converted.   Specify the output TDM filename and location at (3).  

Import CAN/LIN/FlexRay bus log data into DIAdem using the Bus Log Converter

Next click on the 'Edit...' button (1) in the 'Bus database configuration' area.   Click on the '+' (2) button in the Edit Bus Database Configuration dialog.   Click on the '+' (3) button in the 'Add Bus to Configuration' dialog and select a bus log database file.   Then configure the 'Bus type' from the drop down box, and then the 'Bus number'.  

DIAdem Bus Log Converter

If more than one bus log database file is associated with the same 'Bus type' and 'Bus number', then click the '+' (3) button again and select any additional bus log database files.   When finished, click the 'Add Bus to Configuration' 'OK' button.  

DIAdem Bus Log Converter

If another bus number exists, click on the '+' button in the 'Edit Bus Database Configuration' dialog and repeat the prior process for the additional bus number.   In the image below, you can see one additional CAN bus log file was configured for bus #2 (Bus Name = CAN2) as the second item in the 'Edit Bus Database Configuration' dialog list.   When done, click on the 'Edit Bus Database Configuration' 'OK' button in the dialog.  

DIAdem Bus Log Converter

You can perform many advanced options with the Bus Log Converter.   What is presented here is what most users will need.   At the bottom of the 'Bus Log Converter' dialog, click the 'Convert' button to begin bus log conversion.   A new file will be created, and the data will be loaded into the Data Portal.   Inspect the conversion results, and if good, then consider saving the conversion settings by clicking the button 'Save As...' in the 'Settings' section.  

If the Bus Log Conversion result is good, then it would be beneficial to add metadata to the file loaded in the Data Portal (see the next section), and then save the file as file extension .TDMS to a NAVIGATOR search folder that is indexed by the DataFinder.  

Browsing Imported Data

DIAdem works most efficently when raw data is imported, converted to the TDM Model, and then saved to a TDMS (.tdms) binary file in a DataFinder indexed search area.   You can browse files in a search area by clicking on the NAVIGATOR panel, and then at the bottom of the custom NAVIGATOR user interface, clicking on the 'File Browser' tab.  

NI DIAdem File Browser

Expanding the 'Search Areas' icon, you will see a list of the indexed Search Areas (the exact number and names of Search Areas will vary by each installation).   Expanding a Search Area will list any sub folders and imported TDMS files.   Selecting a file and then right clicking on it will cause a pop menu to appear, with a choice 'Load Data' at the top that will read the file into DIAdem's memory and then appear in the Data Portal (Alt-F6 to show the Data Portal).  

Loading Data Into Memory

DIAdem has a graphical user interface (GUI) called the 'Data Portal' designed to make it easy to view and interact with data loaded into memory.   From the prior tutorial 'Browsing Imported Data', you loaded a previously imported TDMS file.   However, for this tutorial, and nearly every other in the series, the example files that come with the DIAdem installation will be used and referenced.   The instructions below should be used to load the primary tutorial example file 'Example_data.tdm'.  

This tutorial is based on using the DIAdem example file 'Example_data.tdm' located in the folder: 'C:\Program Files\National Instruments\DIAdem ####\Examples\Data\' (replace #### with your DIAdem version).   From the NAVIGATOR panel, choose 'File', 'New' to clear the Data Portal.   Then choose 'File', 'Open...' and the 'Open' dialog will appear.   Navigate to the folder 'C:\Program Files\National Instruments\DIAdem ####\Examples\Data\'.   Change the file filter at the bottom to 'National Instruments TDM Files'.   In the list of files, select the file 'Example_data.tdm'. At the bottom right of the dialog, click on the 'Load' button.   If the Data Portal is not visible at the right of the screen, make it visible by choosing the menu options 'Window', 'Data Portal', or by using the keys 'Alt-F6'.  

The Data Portal

The Data Portal enables you to visualize and interact with the content of a TDMS/TDM data file.   If the Data Portal is not shown, the keys 'Alt-Ft' or choosing the menu 'Window' 'Data Portal' from any panel will show the Data Portal.  

The Data Portal has two tabs named 'Structure' and 'List'.   The 'Structure' tab should be selected, as it is the more intuitive way of viewing the contents of Data Portal.   Below the 'Structure' and 'List' tabs, is a section that shows the file/root, channel group, or channel properties.   Clicking on the file at the top will show the file/root properites.   Clicking on a channel group will show the channel group properties.   Clicking on a channel will show the channel properties.  

NI DIAdem Data Portal

Adding Metadata To Imported Data

Adding metadata to imported data saved to TDMS files allows you to categorize the files by key/value pairs of your choice, and then later identify sets of data files based on these categories and values.   Metadata must be assigned to files, one property at a time, and then the file must be saved.   DIAdem calls metadata 'properties'.   You can add properties to the root of a file, the channel group, or a channel.  

To add a property to the file/root, select the filename shown at the top of the Data Portal to display the file/root properties in lower part of the Data Portal.   Then in the open area of the lower property section, right click and from the pop up menu, select 'New'.  

NI DIAdem Data Portal - add/edit properties

The 'Create Root Properties' dialog will appear.   Assign "Latitude" to the 'Name:', select 'Numeric' for the 'Data type', and assign the value of "30.4065" to the 'Value:' field.   Click the 'OK' button when finished.  

NI DIAdem Data Portal - add/edit properties

Repeat the process, assigning a "Longitude" property with the numeric value of "-97.7273".   When finished the Data Portal should appear as shown below.  

NI DIAdem Data Portal - add/edit properties

In order for the two properties added to persist and become included in the index, it would be necessary to save the file just edited, and re-index the search area.   Since this is an example file, don't save the file, but rather clear the Data Portal by accessing the NAVIGATOR panel 'File' menu and selecting 'New'.  

Searching For Data

Searching for data involves using the NAVIGATOR, connected to a DataFinder or DataStore, with Search Areas configured and indexed. The DataFinder feeds back index information to the NAVIGATOR, allowing you to interactively configure and perform searches.  

This tutorial assumes you have Search Areas configured and TDM/TDMS files in those Search Areas.   If not, then import a few data files, or configure a new Search Area to point to the example TDM/TDMS files that come with the DIAdem installation (folder located at 'C:\PROGRAM FILES\NATIONAL INSTRUMENTS\DIADEM 2021\Libr\Data\').   If the Data Portal is visible, hide it by toggeling it off with the 'Alt-F6' key combination.  

From the NAVIGATOR panel, click on the 'File Browser' tab at the bottom of the screen.   Configure DIAdem to perform an advanced search by choosing the menu option 'Find', 'Advanced Search'.   Clear out any existing search by choosing the menu option 'Find', 'Delete Query'.   Your DIAdem application should appear approximately like what is shown below.  

NI DIAdem NAVIGATOR advanced search

The Advanced Search Window is where you configure the search conditions to find metadata consisting of file/root, channel group, or channel properties.   Additionally, you can search by file, channel group, and channel name.  

At the top of the Advanced Search Window are three tabular columns labeled 'Level', 'Property', and 'Value'.   The 'Level' column is where you specify the source of the property to search for, such as the 'File', 'Channel Group' or 'Channel'.   In the first row (not the header), select 'File' under the 'Level' column for a file/root property.   Under the 'Property' column, in the first rwo click in the '' combo box, and available file/root properties by name will appear in the list.   Choose the 'Filname' property.   NOTE: Filename, channel group name, channel name and other DIAdem standard properties such as 'folder' and channel 'units' are presented and treated just like custom properties are in the user interface.  

NI DIAdem NAVIGATOR advanced search

To the right of the 'Property' column, is an unlabeled column where you specifiy the conditions such as <, >, =, etc.   The available options vary depending on the data type of the value.   Choose the equal sign (=).  

In the 'Value' column, you may enter a value directly, or depending on the data type of the value, you can click on the button to the right labeled '...' and a list or range of values will appear as shown below.   Enter into the 'Value' field the asterisk * symbol to search for all files.  

NI DIAdem NAVIGATOR advanced search

In the upper right of the Advanced Search Window, click the 'Search' button.   This will cause the 'Search Results' tab at the bottom to be activated, and then any search results will be displayed.   When searching by files (DIAdem calls this 'Results as Elements'), the 'Filename' will always appear, and then other properties from the files may appear in additional columns.   You can configure what additional properties from the files are shown by right clicking on the bar above the column titles and choosing 'Configure Results List...' from the pop up menu.   This will cause the 'Configure Search Results List' dialog to appear.   The use of this dialog is self explanatory.  

NI DIAdem NAVIGATOR advanced search

What You Learned
  • The DIAdem NAVIGATOR panel allows you to import raw data, connect to an indexing service such as DataFinder, configure Search Areas (to be indexed), load data into the Data Portal, and perform a search to find file by metadata
  • Hundreds of raw binary data file types can be imported by downloading a DataPlugins from NI's website and installing the DataPlugin into DIAdem.   DIAdem has a Wizard for easily importing text/CSV and Excel data, and saving that import configuration as a custom DataPlugin.   CAN/LIN/FlexRay bus data is imported using the Bus Log Converter.  
  • Saving imported raw data to a TDMS file structures the data according to the NI TDM Data Model.   The binary file is extremely efficient for subsequent read/write operations, making file loading/saving, and analysis activities execute quickly.  
  • The Data Portal provides an interface where you can visually interact with the contents of a data file loaded into memory.   Properties (metadata) can be viewed, and custom properties may be added at the file/root, channel group, and channel level.  

 

Data Portal

The NAVIGATOR is used to find data of interest and load it into memory.   The Data Portal provides a GUI that allows you to visualize and interact with the file data loaded into memory.  

Loading Data Into The Data Portal

The basics of loading data into memory / the Data Portal were covered in the NAVIGATOR section under Loading Data Into Memory.   In addition to loading a complete data file into memory, the DIAdem NAVIGATOR can also load only portions of the data such as specific channel groups, channels, or a range of values, values based on a number of intervals or inteval width (Data Reduction).   The loaded data can also be appended to data currently loaded in the Data Portal.   These capabilities are powerful tools that can solve difficult data management issues.  

The best practice is to load data from the NAVIGATOR search results, after you have performed a search.   Right click on a search result, and choose the 'Load Data' option from the pop up menu.  

The NI TDM Data Model

The TDM data model consists of three levels of hierarchy for the organization of measurement data.   The top level is the file / root level, and below that is the channel group(s), and a channel group can contain one or more channels.   The highly efficient binary TDM/TDMS file format is based on the NI TDM Model.   Details on the NI TDM Data Model can be found here.  

The Data Portal GUI

At the top of the Data Portal is a toolbar shown in the image below.   From this toolbar, you may clear out the Data Portal (memory), save the contents in memory to a file, filter what is shown in the Data Portal, sort the Data Portal contents, and refresh the Data Portal.  

NI DIAdem Data Portal

Data Structures & Channel Types

A 2D data structure consists of an x-channel and y-channel(s) with the same number of values in the X and Y channels.   The most common configuration is one x-channel, and one or more y-channels within the same channel group.   It is also possible to have pairs of X and Y channels within the same channel group.   Y channels are frequently 'numeric' with floating point values.   X channels may be numeric with floating point values (representing seconds, ms, etc.), or they contain date/time values.   Waveform channels contain both the X and Y parts within the same channel. (waveform to numeric channel conversion example)  

Several other channel type exist to handle unique data management needs.   Assignment Channel are numeric or waveform channels that connect specific values or values ranges with text values.   Text Channel holds unicode text values.   Implicit Channel values are generated through a linear specification (rather than individual values).   Calculation Channel values are derived from a formula that typically reference one or more channels and constants.  p Complex Channel consist of real and imaginary values are alternatively stored in a channel.   Video Channel contains reference information to an external video file.  

DIAdem supports both triplet and matrix 3D (x-y-z) data structures.   Tools are included in DIAdem to convert between the two 3D data structure types.   Matrix structures are more commonly accepted for the Report panel 3D charting.   A matrix consists of one numeric x-channel, one numeric y-channel, and multiple numeric z-channels.   One z-channel for each value in the y channel, and the number of values in each z-channel corresponds to the length of the x-channel.   A triplet consists of three data channels of the same length (number of rows/samples), one each x-channel, y-channel, and z-channel.  

Channel Table of Matrix Data Structure
X Y Z1 Z2 Z3
0.1 10.0 100.0 110.0 120.0
0.2 20.0 105.0 115.0 125.0
  30.0      
Channel Table of Triplet Data Structure
X Y Z1 Z2 Z3
0.1 10.0 100.0 110.0 89.2
0.2 15.0 115.0 105.0 99.6
0.3 20.0 125.8 103.5 101.2
What You Learned
  • The NAVIGATOR is used to locate files of interest, and then load the data file into memory.  
  • The Data Portal allows you to visualize and interact with the contents of the data loaded into memory.
  • TDM/TDMS files are organized according to the NI TDM Data Model hierachy, where channels are grouped under channel groups, and channel groups fall under the file/root level.  
  • DIAdem supports both 2D and 3D data structures, as well as a wide scope of channel types.  

 

View

The DIAdem VIEW panel allows you to visually inspect and graphically analyze data loaded into the Data Portal.   Channel Tables allow you to see the contents of channel individual values in tabular format.   The 2D Axis System enables inspection of plotted channel data.   The layout in VIEW is flexable, allowing you to view a channel table in one section, and one or more 2D Axis System plots in an other.   Other types of interactive visualization tools are available, including Bode, Polar, Orbit, Shaft Centerline, Birds Eye View, Contour, Cascade, Map, Graphic, Video, and Textbox, depending on the type of channel you have.  

If video was recorded simultaneously with data, you can use VIEW to interactively inspect the data and visually see the video content at that point in time.   Videos and data are synchronized using the data time channel, and the time reference data in the video.  

To get a quick visual overview of the capabilities of the DIAdem VIEW panel, load the VIEW layout file 'View_Example.tdv' from the folder: 'C:\PROGRAM FILES\NATIONAL INSTRUMENTS\DIADEM ####\Examples\Documents\'.  

NI DIAdem VIEW

NI DIAdem VIEW

NI DIAdem VIEW

NI DIAdem VIEW

NI DIAdem VIEW

NI DIAdem VIEW

For the tutorials that follow, find the example file that comes with the DIAdem installation named 'Example.tdm' located in 'C:\PROGRAM FILES\NATIONAL INSTRUMENTS\DIADEM ####\Libr\Data\Example.tdm'   and load that file into memory (the Data Portal).  

The VIEW Panel GUI

The VIEW toolbar is always visible when the VIEW panel is selected, along with the Group Bar where you can select worksheet partitions.   The Axis Toolbar is only visible when a '2D Axis System' (or other axis system) is assigned to a worksheet area.  

NI DIAdem Data Portal

Graphical Analysis

Click on the VIEW panel button to activate it.   Make sure the Data Portal is visible, using the keys 'Alt-F6' to show it if not.   From the VIEW panel 'File' menu, choose 'New'.   Hover your mouse over the Group Bar option 'Regular Worksheet Partitions' and select the 'Two Areas' option.  

NI DIAdem Data Portal

In the Data Portal, under the channel group 'Example', select the channel 'Time' and then while pressing the 'Ctrl' key, select the channels 'Speed' and 'RPM'.   With the mouse still over the selected channels, drag and drop them to the upper VIEW sheet.   A pop up menu will appear, select the '2D Axis System' option.  

NI DIAdem Data Portal

Note that whenver dragging and dropping anything but waveform channels to the VIEW sheet to create a 2D Chart, you should always select the X Channel, followed by one or more Y channels.  

The 'Speed' channel is the red curve, and it cannot be seen because it's amplitude is far less than the 'RPM' green curve.   To make them both visible, go to the 2D Axis System toolbar 'Y-Axis' and select the option 'n Systems [linear]'.  

NI DIAdem Data Portal

Choose the VIEW toolbar options 'Crosshair Cursor' and 'Curve Cursor'.   Then click on the Speed curve and notice as you follow from left to right along the curve, the X and Y channel values are shown.  

NI DIAdem Data Portal

Click on the VIEW 'Maximum Values Cursor' toolbar, and then click on the RPM curve and drag from left to right, observing how the cursor jumps from one discovered peak to the next, displaying the X and Y channels values in a small windows.  

NI DIAdem Data Portal

Let's inspect the data more closely between 0 and 10 seconds.   Select the VIEW toolbar Band Cursor and choose the 'Band Zoom' option.   The cursor changes to a magnifying glass with two vertical lines.   Align the left line with the X axis at Time = 0 sec, click and drag to the right and release at approximately 10 sec.   If you don't get it right, click on the VIEW toolbar 'Zoom Off' and start over.  

NI DIAdem Data Portal

NI DIAdem Data Portal

Click on the VIEW toolbar 'Minimum Values Cursor'.   Then click on the RPM channel curve, identifying the first minimum after the first peak of 3800 RPM at 3.19 sec.  

NI DIAdem Data Portal

Channel Table

In the Data Portal, select the channels 'Time', 'Speed', and 'RPM' from within the channel group 'Example' and then drag and drop into the VIEW sheet lower area.   Choose the 'Channel Table' option from the pop up menu.  

NI DIAdem Data Portal

NI DIAdem Data Portal

Removing Spikes/Outliers

Sometimes your data may contain spikes / outliers caused by noise or interference.   This can adversely affect your ability to perform a peak analysis or other statistical analysis.   You can remove channel values directly from a 2D Axis System, or using the Channel Table.  

Continuing from the prior example, right click on the active VIEW worksheet and choose the option 'Add New Sheet to End' from the pop up menu.  

NI DIAdem Data Portal

A new blank sheet will appear.   From the Data Portal, collapse the 'Example' channel group and expand 'the 'Noise data' channel group by first selecting it, and then right click and choose the pop up menu option 'Collapse Groups' and 'Expand Groups'.   Note that the channel data in the channel group 'Noise data' has a sine wave looking icon to the left of the channel names.   These are waveform channels.   Click on the 'Noise_2' channel and drag and drop it to the empty VIEW worksheet you created, choosing the '2D Axis System' pop up menu option.   In the image below, a blue circle shows the spike we are going to remove.  

NI DIAdem Data Portal

Use the Band Cursor 'Band Zoom' option to zoom into the area of interest, roughly between 3.8 and 4.2 seconds.   Repeat the process until roughly 3.908 to 3.909 seconds is shown like in the image below.   Use the VIEW toolbar 'Minimum Values Cursor' to show details about the first spike (a valley).  

NI DIAdem Data Portal

The 'Minimum Values Cursor' states that the minimum value occurs at X = 3.90846 sec, and at the position in the channel of 'P1: 195424'.   That position is what DIAdem calls a 'row'.   Let's look at that row for all channels in that group in a Channel Table.   Right click in the 2D Axis System background and choose 'New Area' and then 'Bottom'.  

NI DIAdem Data Portal

Click on the channel group 'Noise data' and then drag and drop it to the new bottom blank area, and choose 'Channel Table' when the pop up menu appears.  

NI DIAdem Data Portal

We want to delete row 'P1: 195424' at X = 3.90846 sec for all channels, so that they are the same length and will be accepted by any other analysis we may wish to perform.   Click anywhere in the Channel Table to make sure it is selected and active.   From the VIEW 'View' menu, choose 'Go To', 'Row...'.  

NI DIAdem Data Portal

In the dialog that appears, enter the value '195242' to the right of the label 'Row:' and then click the 'OK' button.  

NI DIAdem Data Portal

The table will scroll down, putting row 195242 within view.   Select the row 195242 by clicking on it.  

NI DIAdem Data Portal

While row 195242 is selected, right click and choose 'Cut' from the pop up menu.   A dialog will appear, asking to confirm that data should be cut.   Click 'Yes'.   The row will be removed for all channels.  

NI DIAdem Data Portal

Another way to remove a spike is to do it completely from the 2D Axis System.   Click the 2D Axis System 'Zoom off' option to show the entire time history for channel 'Noise_2'.   We are going to graphically remove the spike highlighted with a blue circle in the image below.  

NI DIAdem Data Portal

Before using flags, it is important to configure the DIAdem settings for the VIEW panel flags.   From any panel, select the menu options 'Settings', 'DIAdem Settings...', select the 'Panels' section, and then under 'Flag settings' review the options.   It is recommended to set 'Remove selected points:' option to 'Set values to NoValue'.   The choice of 'Linear' or 'Spline' for the option 'Interpolate selected points:' is an engineering choice dependent upon each situation (this tutorial will use the 'Linear' option).  

DIAdem VIEW global settings for flags

Use the Band Cursor to zoom into that spike until you can easily use the VIEW toolbar 'Maximum Values Cursor' to select the spike.  

NI DIAdem Data Portal

While the spike is still selected, click on the 2D Axis System toolbar 'Set Flags' button.  

NI DIAdem Data Portal

Drag the cursor away from the spike, and you will see a red dot marking the flag you set.  

NI DIAdem Data Portal

Then click on the 2D Axis System toolbar 'Flags' and choose the option 'Flags: Delete Data Points'.   This will actually set the value for channel 'Noise_2' to NOVALUE (no rows will be deleted).  

NI DIAdem Data Portal

NI DIAdem Data Portal

As you can see from the image above, the spike is gone, leaving a gap between the remaining points.   That gap is because the value for channel 'Noise_2' at row 221175 is NOVALUE.   Use the VIEW toolbar 'Curve Cursor' to see the value at the gap and confirm it is NOVALUE.   If you look at the data with a Channel Table, you will see that in row 221175, channel 'Noise_2' has a value of NOVALUE.   If you plan to do further analysis, a NOVALUE will cause problems, forcing you to do something with it.   Now is the best time to resolve that NOVALUE.  

NI DIAdem Data Portal

Set a flag at that NOVALUE (a red dot will not appear), and then click on the 2D Axis System toolbar 'Flags' and choose 'Flags: Interpolate NoValues'.   The curve gap will now close because the NOVALUE has been replaced with an interpolated value based on the points prior to and after the NOVALUE.   The flag (red dot) is now visible because the row for that channel now has a value.  

NI DIAdem Data Portal

You now know two methods for resolving a spike/outlier in the channel data.   The best method depends on the situation, and what further analysis you intend to perform on the data, and the decisions that may be made from the data.   It is good engineering practice to keep careful notes when you modify data in any way like what was demonstrated by the last two examples.  

Descriptive Statistics Within Band Cursor

Descriptive statistics may be calculated for the channel values specified between the VIEW band cursor situated on a curve by using an example script provided with the DIAdem installation.   This script can be found by searching DIAdem help for 'Dynamic Display of Statistical Characteristic Values in DIAdem VIEW.   (Click here for online link to help document)   Find, load, and run the script named 'VIEW_Statistic_Init.vbs'.   The script will add the custom icon shown below, and it will have the expanded options shown in the second image below.  

Calculate descriptive statistics within DIAdem VIEW panel band cursor   Calculate descriptive statistics within DIAdem VIEW panel band cursor

The script will create a new VIEW sheet and area, configure it for a 2D Axis System, and assign the channel 'Noise data/Noise_2' to the curve.   Click on the band cursor icon on the VIEW toolbar and set it so that it falls on the 2D Axis System curve between 'P1: 100985' and 'P2: 251310' as shown below.  

Calculate descriptive statistics within DIAdem VIEW panel band cursor

Click on the 'View Statistics' icon in the VIEW toolbar, and choose the option 'Enable VIEW Statistics'.   A dialog titled 'Example for Calculating Statistical Characteristic Values in VIEW' will appear.   Click the 'All Off' button to remove checks from all check boxes.   Then check the options 'Root mean square' under 'Mean values', '0.50 quantile from 'Quantiles', and finally 'Standard deviation' from the section titled 'Dispersion'.   Click the 'OK' button when finished.  

Calculate descriptive statistics within DIAdem VIEW panel band cursor

Another dialog will appear named 'Statistical Characteristic Values'.   The three statistical metrics you selected will appear in the dialog, along with information about the band cursor position in terms of the X values.  

Calculate descriptive statistics within DIAdem VIEW panel band cursor

Click on the 'Save Values' button in the dialog.   In the Data Portal, you will find a new channel group named 'StatisticResultGroup' with channels created containing the values from the dialog.   Note that when descriptive statistics are calculated for all values in a channel, DIAdem by default adds those values as properties to the channel analyzed.   But in this case only a portion of the channel was added, and therefore it was necessary to create channels that identify the range of values analyzed, and the results.  

Calculate descriptive statistics within DIAdem VIEW panel band cursor

Note that the 'Statistical Characteristic Values' dialog is non-modal, meaning that you can move your mouser cursor in the VIEW sheet area, click between the band cursor, move the band cursor, and the values in the dialog will be updated.  

Calculate descriptive statistics within DIAdem VIEW panel band cursor

Close the dialog by clicking on the 'x' in the upper right of the dialog.   You may optionally remove the added toolbar by clicking the option 'Enable VIEW statistics and Delete Command Symbol'.  

Calculate descriptive statistics within DIAdem VIEW panel band cursor

 

Exporting VIEW

You can export the VIEW panel display for the active sheet to REPORT, or a PDF (.pdf) file.   To export to a PDF file, from the VIEW panel, access the 'File' menu and choose 'Print...'.   Click on the 'Printer...' button and in the 'Name:' combo box, change it to 'DIAdem PDF Export'.   Set the 'Orientation' to Portrait or Landscape, and then click the 'OK' button.   Click the 'OK' button in the 'Print' dialog, and then you be prompted to choose where to save the file.   Click on the image below to see the PDF file from this example.  

NI DIAdem Data Portal

To export the VIEW active sheet to REPORT, access the VIEW 'File' menu and choose the menu option 'Transfer to REPORT'.   Typically you will need to perform some formatting in REPORT, but the advantage is that you have many formatting options in REPORT, and this method creates the chart and table objects for you from what you had in VIEW.  

NI DIAdem Data Portal

What You Learned
  • The VIEW panel allows you to easily visually inspect and graphically analyze data loaded into memory / Data Portal.  
  • You can plot multiple Y channel data to curves in VIEW, and then quickly identify maximum and minimum values on a curve.  
  • The band cursor allows you to zoom into a particular section of the curve.  
  • A channel table shows you the channel data in a tabular format.  
  • Spikes / outliers can be managed by either using the channel table to delete the data for all channels, or by interpolating the data on either side of the spike for only the channel with the outlier.  
  • Descriptive statistics within the bounds of the band cursor can be calculated by using a script example included with the DIAdem installation.  
  • The active VIEW sheet can be exported to a PDF file, or a new REPORT panel layout.  

 

More VIEW Tutorials

Scroll Cursor Range   |   Axis Scaling   |  Curve Formatting   |  Flags   |  Descriptive Statistics Within Band Cursor   |  Map, Video, & Textbox   | 

 

Analysis

The ANALYSIS panel allows you to perform analysis on the data loaded into the Data Portal (memory).   Dialogs assist you in setting up and performing an extensive scope of standard mathemtical functions for data analysis.   These mathemtical functions are organized into groups that you can browse via the menus, or the group bars.   The DIAdem Calculator allows you to define your own custom formula based functions.   The Calculation Manager will allow you to define a set of calculations to execute where the output from one calculation may be passed as input to the next calculation.  

ANALYSIS Panel GUI

When you activate the ANALYSIS panel by clicking on it, the graphical user interface (GUI) changes, displaying a blank output area in the middle of the application.   The menu structure at the top of the DIAdem application window, and the group bars along the inside left organize the mathematical functions available for data analysis.   The function group names are: Basic Mathematical, Channel Calculations, Curve Fitting, Signal Analysis, Statistical and Classification, 3D Analysis, and Crash Analysis.   Make sure the Data Portal is visible by using the keystrokes 'Alt-F6' if it is not.  

The Calculation Manager is accessed by either clicking on the ANALYSIS 'File' menu and then choosing 'Calculation Manager...', or by clicking on the toolbar icon labeled 'Calculation Manager'.   The calculator is activated by clicking on the ANALYSIS toolbar icon labeled 'Calculator', or from the menu 'Basic', 'Calculator...'.  

Choosing a mathematical function from the menu or the group bar launches a dialog that will typically accept one or more channels for input.  

NI DIAdem Data Portal

Find the example file that comes with the DIAdem installation named 'Example.tdm' located in 'C:\PROGRAM FILES\NATIONAL INSTRUMENTS\DIADEM 2021\Libr\Data\Example.tdm'   and load that file into memory (the Data Portal).  

Calculating Descriptive Statistics on a Channel

From the ANALYSIS menu 'Statistics', choose the option 'Descriptive Statistics...'.   In the 'Descriptive Statistics' dialog, under 'Object to be analyzed', click on the button labeled '...' to the right of the 'Channels:' label and input field.   Another dialog will appear named 'Select Channels'.   Use the button labeled 'X' to delete any channels already in the list.   Then expand the channel group named 'Noise data', and then drag and drop the channel 'Noise_2' to the channel list area in the 'Select Channels' dialog.   When done, click 'OK'.  

NI DIAdem Data Portal

On the 'Characteristic Values 1' tab, click the 'All Off' button, and then in the 'Mean values' section, enable the checkbox labeled 'Root mean square'.   The calculation will appear immediately in the 'Result data' section.  

NI DIAdem Data Portal

Click on the tab labeled 'Result Storage' and make sure the checkbox labeled 'Store results in channels' is not checked.   Calculation of the RMS, as well as all other calculations available from this dialog result in a single numeric value.   The default is to add that result to the channel(s) being analyzed as a new property.   Click the 'Calculate' button, and then the 'Close' button.  

NI DIAdem Data Portal

Examine the properties for the channel 'Noise_2' in the Data Portal.   Under 'Custom Properties', you will see the RMS result saved under the property named 'Result~Statistics~MeanValues~SquareMean'.   Note that the tilde '~' character is used here to indicate the property hierarchy.   The results of all ANALYSIS functions in DIAdem are either stored as properties or new channels.  

NI DIAdem Data Portal

Note also that in the ANALYSIS window, a sort of log was written, indicating what calculation was performed, on what channel, the DIAdem script function used to perform the calculation ('ChnStatisticsCalc()'), and the numerical result for the root mean square.  

NI DIAdem Data Portal

Smoothing A Channel

DIAdem has three smoothing filters to assist with managing signal noise.   From the 'Curve Fitting' menu, you can see them at the top with the labels 'Smooth...', 'Smooth with 4353H filter...', and 'Smooth with Savtizky-Golay Filter...'.   Unfortunately, DIAdem has not intergrated these three filter options that have evolved over time into a single interactive dialog.   You need to try each one manually to find the best result for your needs.   We will explore using each of these filters on the channel 'Noise_2' in the channel group 'Noise data'.  

NI DIAdem Data Portal

From the ANALYSIS panel menu 'Curve Fitting', choose the filter option 'Smooth...'.   Drag and drop the 'Noise_2' channel into the channel input area.   Make sure the 'Calculation parameters' are set to the default values of: 'Max smoothing width on one side (no of points):' to 12, 'Select points:' to 'Maximum number', 'Smoothing procedure' is 'Smooth over mean value', and 'Result channel' does not have the checkbox 'Store result in original channel checked.   A plot will be shown in the dialog to give you an idea what impact the filter will have on the data.   Unfortunately, you cannot zoom in and see specific sections of the data, but in this case you can see that the filter is too aggressive.   Try changing the 'Max smoothing width on one side' option, and the other parameters as well.   When finished, click the 'Cancel' button so that no changes are saved.  

NI DIAdem Data Portal

From the ANALYSIS menu 'Curve Fitting', choose the filter 'Smooth with 4253H Filter'.   Drag and drop the 'Noise_2' channel to the channel input control.   Notice that this filter is much less aggressive than the 'Smooth' filter.   The spikes in the signal are filtered to some degree, but it is not clear from the preview if the outcome will be acceptable.   Choose the 'Smooth with 4253H-twice-filter' option, make sure the checkbox 'Store result in original channel' is not checked, and then click the 'Calculate' button, observing what happens in the Data Portal, and then click the 'Cancel' button to close the 'Smooth with 4253H Filter' dialog.  

NI DIAdem Data Portal

A new channel will be added to the default channel group in the Data Portal.   Move that channel back under the channel group 'Noise data' by selecting the channel 'Smoothed4253H', right click and choose 'Cut' from the pop up window.   Then navigate back up to the 'Noise data' channel group, click on the channel group, and then right click and choose 'Paste'.  

NI DIAdem Data Portal

Lets examine the filtered results more closely by using the VIEW panel.   Activate the VIEW panel, and choose the 'File', 'New' option to clear out the worksheet area (don't save anything that was left behind).   Click on the channel 'Noise_2' and then the channel 'Smoothed4253H' and then drag and drop in to the empty VIEW worksheet.   Choose the '2D Axis System' option.   Use the Band Cursor to zoom in to the section between 3.908 and 3.91 seconds.   Note by toggling the checkbox for the green curve (Smoothed4253H), you can see the effect of the filter on the signal.   You would need to decide if this filtering is good.   Note that if you calculate RMS on the filtered channel, you will see that it has changed from 0.128 to 0.120.  

NI DIAdem Data Portal

Try the final filter named 'Smooth with Savitzky-Golay Filter'.   Drag and drop the 'Noise_2' filter to the channel input control.   Notice that in the preview area, the a message states the preview has been aborted because the channel has many values (325000 in fact).   Therefore, the only way to see the result is to plot it in the VIEW panel.   Make sure the defaults are set to: 'Smoothing width on one side:' to 12, 'Order of the polynomial:' to 1, and 'Weighting channel' checkbox is unchecked.  ' After confirming that the 'Store result in original channel' is unchecked, click the 'Calculate' button to execute the filtering, and then the 'Close' button to close the dialog. Drag the channel created 'FilteredSignal' back to the channel group 'Noise data'.  

NI DIAdem Data Portal

Activate the VIEW panel and then drag and drop the channel 'FilteredSignal' to the 2D chart.   Note that the effect of the 'Savitzky-Golay' filter is significantly different than the '4253H' filter.  

NI DIAdem Data Portal

NI DIAdem Data Portal

Try the 'Savitzky-Golay' filter again, but this time change the 'Smoothing width on one side:' to 3.   Plot that result in the VIEW panel as done before. You can see that the 'Savitzky-Golay' filter with a value of 3 (channel 'FilteredSignal1') produces a result that is somewhere between the 'Smoothed4253H' result, and the 'Savitzky-Golay' filter value 12 (channel 'FilteredSignal').

NI DIAdem Data Portal

Clear out the VIEW sheet by clicking on the VIEW menu options 'File' and 'New' (don't save).   Clear out the Data Portal by clicking on the NAVIGATOR panel and then the menu options 'File' and 'New' (don't save).   Load the 'Example.tdm' file again by choosing 'File' and 'Recent Files'.  

Finding A Channel Event

This tutorial will demonstrate how DIAdem can identify a channel event based on criteria for two channel conditions.   DIAdem has two dialogs to assist with an event search task.   From the ANALYSIS panel, browse the menu option 'Channel Functions', and select either 'Event Search' or 'Event Search (Free Formula)'.   It is the author's opinion that 'Event Search (Free Formula)' is easier to use.  

From the ANALYSIS panel, browse the menu option 'Channel Functions', and select 'Event Search (Free Formula)'.   The dialog 'Event Search (Free Formula) will appear.   Clear out the dialog inputs so they appear as shown below.  

NI DIAdem Data Portal

We want to look for the condition where the channel 'Speed' has a value greater than 40 m/s, and the channel torque is greater than 200 Nm.   Under the section 'Channels to be analyzed', click on the first row in the table to the right of the label '1' under the column 'Identifier' and assign the value of 'A'.   To the right of that, drag and drop the channel 'Example/Speed' from the Data Portal into the field labeled 'Channel'.   Click on the '+' icon to add another condition and then repeat the process for the channel 'Torque', but assigning the 'Identifier' of value 'B'.   At the bottom of the dialog, the tab 'Result Storage' and options 'Condition fulfilled' and 'Condition not fulfilled' establish what the result channel output will be.   You want the value to be '1' when fulfilled (true), and '0' when not fulfilled (false).   At the top of the dialog, enter the 'Formula' value of '(A>40) AND (B>200)'.   The dialog should appear as shown below.  

NI DIAdem Data Portal

The 'Result data' plot on the bottom right will show graphically when the data will meet the conditions for the 'Selected channel' plotted above.   Click the 'Calculate' button at the bottom of the screen, and then click the 'Close' button.  

DIAdem will create a new channel named 'EventStatus' in the last channel group in the Data Porta.   Drag this channel up to the channel group 'Example' where it belongs.  

NI DIAdem Data Portal

Visualizing Event Search Results

This tutorial will use the 'EventStatus' channel created from the prior tutorial event search to visually identify where in the 'Speed' and 'Torque' channels the events occurred.   The visualization will be performed in a VIEW 2D Axis System using 'Background Segments'.  

Click on the VIEW panel to activate it.   Clear out the worksheet by choosing the menu option 'File', 'New'.   Select the 'Time', 'Speed', and 'Torque' channels in the 'Example' channel group and then drag and drop them to the empty VIEW worksheet.   When the pop up menu appears, choose '2D Axis System'.   Access the 2D Axis System toolbar 'Y-Axis' and select the option 'n Systems [linear]'.  

NI DIAdem Data Portal

From the VIEW panel menu, choose 'View' and 'Settings' (or double click inside the 2D Axis System area, but not the legend area).   Click on the button 'Background Segments...'.  

NI DIAdem Data Portal

Delete any existing segment definitions if they exist.   Click on the '+' button labeled 'New Entry' when you hover your mouse over it.   The 'Add Segment' dialog will appear.   Drag and drop the 'Time' channel from the Data Portal to the 'Add Segment' dialog 'X-channel' channel input control.   Drag and drop the 'EventStatus' channel from the Data Portal to the 'Add Segment' dialog 'Y-channel' channel input control.   Make sure the 'Type:' is set to 'X', the 'Color' is set to grey, and the 'Transparency' is set to '0'.   Click the 'OK' button to close the 'Add Segment' dialog.   Click the 'OK' button to close the 'Color Background Segments' dialog.   Click the 'OK' button to close the '2D Axis System' dialog.  

NI DIAdem Data Portal

NI DIAdem Data Portal

The 2D chart now displays the 'EventStatus' channel in the background, allowing you to visualize when the where the channel 'Speed' has a value greater than 40 m/s, and the channel torque is greater than 200 Nm.  

NI DIAdem Data Portal

Clear the VIEW worksheet by accessing the menu 'File', 'New'.   Clear out the Data Portal by clicking on the NAVIGATOR panel and then the menu options 'File' and 'New' (don't save).   Load the 'Example_data.tdm' file again by choosing 'File' and 'Recent Files'.  

Calculator & Calculation Manager

You can perform custom channel calculations using the 'Calculator' and the 'Calculation Manager'.   The Calculation Manager is recommended over the Calculator several reasons, as will be demonstrated by the examples that follow.  

The tutorial that follows will calculate power from the RPM and Torque channels from the 'Example.tdm' DIAdem sample file.   Find the example file that comes with the DIAdem installation named 'Example.tdm' located in 'C:\PROGRAM FILES\NATIONAL INSTRUMENTS\DIADEM 2021\Libr\Data\Example.tdm'   and load that file into memory (the Data Portal).  

Channel References for Calculator & Calculation Manager

DIAdem uses the format of Ch("group name / channel name") to reference a channel within formulas for both the Calculator and the Calculation Manager.   For example, if you wanted to reference a channel named 'Noise_1' in the channel group named 'Noise data', then the reference would be: Ch("Noise data/Noise_1") .   If the channel "Noise_2" is a unique name to all channels currently in the Data Portal, then you can simplify the reference to just the channel name, e.g. Ch("Noise_1") .   When you are creating a new channel to receive the results of the calculation, make sure to always include the channel group name.  

Both the Calculator and the Calculation manager will create a new channel in an existing default channel group, or a new channel group.   Using 'Ch("NewChnGrp/NewChn") = PI' for example as the formula (exclude the outer single quotes) will result in a new channel group named 'NewChnGrp' and a new channel named 'NewChn' to be created in the Data Portal (assuming neither already exist).   If the channel already exists, it will be overwritten.  

Calculating Power Using Calculator

The general formula to calculate power in kW from Torque in N-m and speed in RPM is:

Power [kW] = 2 * Pi() * (1 min / 60 sec) * (1 kW / 1000 W) * (Speed [rpm]) * (Torque [N-m])

Access the Calculator by clicking on the ANALYSIS panel toolbar labeled 'Calculator', or from the menu 'Basic', 'Calculator...'.   Click in the 'Formula' window, and enter the following formula (excluding the leading and trailing single quotes): 'Ch("Example/Power_kW") = Ch("RPM") * Ch("Torque") * 2 * PI * (1/60) * (1/1000)'  

NI DIAdem Data Portal

If you press the enter key on your keyboard after entering / pasting the formula, then the formula will execute.   Otherwise, you can perform the calculation by click the 'Calculate' button.  

NI DIAdem Data Portal

After the calculation executes, a new channel named 'Power_kW' will be created in the Data Portal with the result.   Note that no units are assigned to this channel, and it is necessary to enter constants in order to convert the speed from RPM to rotations per second, and the power from watts to kilowatts.   As a convenience, the 'Description' property for the channel is updated with the formula from the Calculator.  

NI DIAdem Data Portal

Calculating Power Using Calculation Manager

Click on the channel 'Power_kW' created by the prior exercise and then right click and choose 'Delete' to remove the channel.   Launch the Calculation Manager by either using the menu option 'File', 'Calculation Manager...', or clicking on the calculation manager icon.  

NI DIAdem Data Portal

Create a new Calculation Group by clicking on the 'Add Calculation Group' toolbar button.   Name the calculation group 'Power' and click the 'OK' button.  

NI DIAdem Data Portal

NI DIAdem Data Portal

NI DIAdem Data Portal

Click on the dialog toolbar 'Add Calculation'.   The dialog 'Calculation Manager - Add Calculation' will appear.   Two buttons are at the top, 'Calculation' and 'Script'.   Click the 'Calculation' button at the top.   Assign a name to the calculation.   Set the 'Formula:' to : 'Ch("Example/Power_kW") = Ch("RPM") * Ch("Torque")'   Make sure the 'Quantity-based' checkbox is checked, and then to the right of that at 'Result unit:', click on the '...' button and find the 'Quantity' of 'Power' and assign the value of 'kW'.   Click on the 'Script' button at the top of the dialog and observe the VBScript code that is shown to replicate the calculation.   Click the 'OK' button when finished.  

Note that the formula 'Ch("Example/Power_kW") = Ch("RPM") * Ch("Torque")' does not contain any constants for unit conversion.   This is because the 'Quantity-based' checkbox is selected, and a target final unit of 'kW' was assigned.   The conversions required to convert torque in N-m and speed in rotations per minute (rpm) to kilowatts is automatically figured out by DIAdem.   HOWEVER, if the 'Torque' or 'RPM' channel didn't have units, then this option would generate an error, and it would be necessary to input the unit conversions as was done with the Calculator.  

NI DIAdem Data Portal

The dialog should be configured as shown in the image below.   Click on the toolbar 'Run' button to execute the calculation.   Observe that the 'Power_kW' channel is created in the Data Portal.  

NI DIAdem Data Portal

In order to demonstrate a sequence of calculations, we will add one more calculation that will convert power and speed (rpm) back to torque.   Click the 'Add Calculation' button.   Assign a 'Name:' of 'Torque_Nm'.   Enter the formula: 'Ch("Example/Torque_Nm") = Ch("Power_kW") / Ch("RPM")'   Check the checkbox 'Quantity-based' and set the 'Result unit' to 'N-m' by looking under 'Quantity' = 'Torque' and selecting '[Nm] newton meter'.   Click the 'Run' button at the top right toolbar to see the result.   Click the 'OK' button to close the 'Calculation Manager - Add Calculation' dialog.  

NI DIAdem Data Portal

With the 'Calculation Manger' dialog still visible, click the save button on the toolbar and give it the name 'Power_Torque.tca', taking note where the file was saved.   Click the 'OK' button to close the dialog.   In the Data Portal, select the 'Power_kW' and 'Torque_Nm' channels and then click the keyboard key 'Del' to delete those two channels (or right click and choose 'Delete').   Click on the ANALYSIS toolbar button 'Execute Calculations' button.   Select the first row labeled 'Power' (in the 'Calculation' column it shows '--- 2 Calculation(s) ---').   Click on the toolbar button 'Run'.   Observe that both calculations run.   First the 'Power_kW' channel is created, and then it is followed by the 'Torque_Nm' calculation.  

NI DIAdem Data Portal

NI DIAdem Data Portal

As demonstrated, you can sequence a series of calculations, where one depends on the result of a prior calculation to generate a new output.   This is a powerful no script method of automating calculations.  

What You Learned
  • DIAdem has a wide scope of powerful analysis functions.   Dialogs guide you through the use of each of the functions.  
  • You can use event search to identify when one or more channels both meet a particular condition, and then visualize the result in the VIEW panel using Background Segments.  
  • The Calculation Manger is a tool that allows you to easily chain a sequence of calculations where one calculation result becomes another calculation's input   (script / code writing not required).  

 

More ANALYSIS Tutorials

Offset Correction   |   Differentiate & Integrate   |  Convert To Unit Set   |  Resampling   |  FFT   |  Digital Filters   |  Time-At-Level Histogram   |  Signal Generation   |  Detrend a Signal   |  Create a Signal Mask   | 

 

Report

Generate a custom report that documents data and results using the DIAdem REPORT panel.   You can use any combination of 2D/3D chart axis system, tables, text, and graphic objects in a report.   You may generate multiple pages (worksheets) in a report, but each page must connect to data currently in the Data Portal.   A report with multiple pages from different files can be accomplished by exporting the report to a PDF file, and then appending REPORT worksheets connected to other data files to the same PDF file.   Report templates may be created with custom layouts, logos, and formats to support easier generation of routine reports.  

Find the example file that comes with the DIAdem installation named 'Example.tdm' located in 'C:\PROGRAM FILES\NATIONAL INSTRUMENTS\DIADEM 2021\Libr\Data\Example.tdm'   and load that file into memory (the Data Portal).  

REPORT GUI

Similar to the other DIAdem panels, the REPORT panel when activated has a custom set of menus, group bars, and toolbars.   One or more REPORT worksheets are supported.   If you save a worksheet, you may use it as a layout to create a new report with different data / channels, but the same initial formatting.   Reoccuring parts of a layout that are common to multiple layouts may be assigned to a 'master layout' that is liked to one or more subordinate layouts.  

NI DIAdem Data Portal

REPORT Objects

The REPORT group bar provides access to the various REPORT objects, spaning from tables, 2D, polar, spider, and 3D axis systems, pie charts, graphics, and text.   Each group bar has many sub group bars, providing easy access to the many object options.  

NI DIAdem Data Portal

REPORT Chart Wizard

The easiest way to explore what chart you want to use for your data is to use the Chart Wizard.   Click on the REPORT group bar chart wizard and a special cursor appears.   Click on the upper left of an empty REPORT worksheet (10% away from the left and top) and then drag the cursor to about 10% of the distance from the bottom right and release the mouse button.   A 2D Axis System object will be added to the REPORT worksheet, and the 'Chart Wizard' dialog will appear.  

NI DIAdem Data Portal

Begin by choosing a 'Diagram type' of 'Line', and then hover the mouse over the 'Subtype' graphical options on the right.   Choose the subtype option 'Lines with several Y-Axes' and then click the 'Next >' button.  

NI DIAdem Data Portal

The sequence that follows for assigning channels will yield the most direct result and the minimum of steps.   If any channels are already assigned under the 'Curves' list, then use the 'X' button to delete them.   Click the '+' New Entry button.   Select the 'RPM', 'Torque', and 'Power' channels from the channel group 'Example' and then drag and drop them into the 'Add Curves' dialog 'Y-Channels' channel input control.  

NI DIAdem Data Portal

Select the 'Time' channel from the channel group 'Example' and then drag and drop it into the 'Add Curves' dialog 'X-channel' channel input control.   Click the 'Add Curves' dialog 'OK' button when finished.   Click the 'Chart Wizard' 'Next >' button to continue to the next step.  

NI DIAdem Data Portal

NI DIAdem Data Portal

Select the 'Curves' tab if it isn't shown.   The last column on the right of the curves list is labeled 'Y-Axis'.   This allows you to assign each curve to a particular Y-Axis location (Left, Right, Second left, or Second right).   Set each one to 'Left'.   Explore the other tabs by clicking on them and observing the options.   You can for example change the axis scaling from linear to logarithmic, assign custom axis labels, and format the axis colors.   When finished browsing, click the 'Finish' button.  

NI DIAdem Data Portal

NI DIAdem Data Portal

The Chart Wizard doesn't cover all of the REPORT chart options, but it does a great job of allowing you to visually explore chart types.   We want the Y axis setup as 'n Systems [linear]'.   Double click in the center of the report page.   The 'Curve and Axis Definition' dialog will appear.   Click on the 'Axis Postion' tab and then under 'Axis system' click on 'N systems'.   Click the 'Preview' button to see the REPORT worksheet update with your selectiong.   Browse the other tabs to see the other possible changes you can make.   When done browsing, click the 'OK' button.  

NI DIAdem Data Portal

NI DIAdem Data Portal

Reports are normally generated and then exported to a PDF file, image file, html document, or even a PowerPoint file.   It is important to have the page layout configured properly prior to export.   Access the REPORT 'Settings' menu and choose 'Layout Setup', 'Layout Parameters'.   Click on the 'Worksheet' tab.   Set the Orientation to 'Landscape'.   Set the 'Page size' to 'Letter'.   Click the 'OK' button when finished.

NI DIAdem Data Portal

Next we will customize the report, adding a logo, and a title.   Resize the 2D Axis object by clicking on the object, and then grabbing the upper corner and dragging down until sufficient room is left for a logo at the upper left, and a title in the top middle.   Resize anything else that may be required for your layout.  

NI DIAdem Data Portal

Click on the REPORT 'Graphics' group bar and select the option 'Load Graphic'.   Browse to the folder 'C:\Users\Public\Documents\National Instruments\DIAdem 2021\Documents\' and select the 'Dummy.jpg' image file.   You could choose your own logo at this point.   Drag the graphic to the upper left corner of the worksheet.   Re-size it if necessary.   Double click on the image, and in the 'Graphic' dialog, check the checkbox labeled 'Embed graphic in layout when saving'.   This option is important, because you may want to be able to tranfer your report layout to someone, or you don't want the graphic link to get lost because the source image is moved or deleted.  

NI DIAdem Data Portal

NI DIAdem Data Portal

NI DIAdem Data Portal

Next we will add a custom title to the report.   Click on the REPORT group bar 'Text' and choose the 'Comment' option.   Position the cursor over the top left of the report and drag and drop to the lower left to create a box area to hold the title.   Try to align the left and right corners of the comment object with the chart left and right axis.  

NI DIAdem Data Portal

Double click in the center of the comment object, and the 'Comment dialog will appear.   In the 'Text' input area, enter the text 'Engine Text'.   Click the 'Preview' button and observe the change to the report.   Under 'Alignment', change the 'Horizontal' to 'Center', and the 'Vertical' to 'Center'.   Change the 'Font size:' to '8'.   Click on the 'Frame' tab and set the 'Line color' to 'No Color'.   Click the 'Preview' button again, then the 'OK' button to accept the changes.  

NI DIAdem Data Portal

You may now export this report to several different file formats including the PDF, image, XPS, HTML, PowerPoint, and even the Windows clipboard.   From the REPORT menu, choose 'File', 'Export'.  

Generating Reports With Data From Multiple Files

When exporting a report worksheet, if you choose a PDF or PowerPoint file and it already exists, you will be given the choice to overwrite or append the report.   Generating reports from multiple data files and appending them as either a PDF or PowerPoint file enables you to generate a report with data from multiple files.  

Creating a Layout

Continuing from the prior tutorial, double click on the 2D axis chart, activate the 'Curve List' tab, and then use the 'X' button in the top right of the dialog to delete all of the curves.   Click the 'OK' button when finished.   The 2D axis line chart remains, but no curves are shown because no channels are assigned to them.   Save the worksheet as a layout by accessing the REPORT menu and choose 'File', 'Save', pick a folder to store the layout, and name it something like '2D chart - landscape.tdr'.   In the Data Portal, expand the channel group 'Noise data'

Clear the REPORT worksheet by clicking on the REPORT menu 'File', 'New'.   Open the REPORT layout you just saved.   Click on the NAVIGATOR panel and open the file named '2D_UserFormat.tdm' from the folder C:\Users\Public\Documents\National Instruments\DIAdem 2021\Data\ (make sure the file filter is set to 'National Instruments TDM Files (*.tdm)').   Click on the REPORT panel to make it active.   In the Data Portal, select the channels 'Date', 'ReallDiffTemp', and 'MeanDiffTemp' (in that sequence, always the X channel first), and then drag and drop them to the 2D axis chart.   Click the REPORT toolbar 'Refresh' button to insure the report is refreshed.   Edit the report title by double clicking on it and then assigning the text 'Temperature Study'.   Click the 'OK' button to close the 'Comment' button.   You have used a report layout to quickly generate a new report from a different set of data.  

NI DIAdem Data Portal

NI DIAdem Data Portal

What You Learned
  • The REPORT panel allows you to generate reports with a broad choice of chart types, as well including tables, graphics, and text, all formatted the way you want.  
  • The Chart Wizard helps you to visualize the different chart types available.  
  • A report layout may be saved and used again later as the basis for a new report.  

 

SCRIPT

The DIAdem SCRIPT panel allows you to automate repetitive tasks by writing code in either VBScript or Python   All of the functionality you see in each of the DIAdem panels is accessible to a script (and more).   You may also create custom dialogs with the Dialog Editor that contain powerful controls including channel inputs and data visualization.  

SCRIPT GUI

The primary SCRIPT tools are the script editor, the enable/disabl, the recording mode, and the Logfile.   You can write to the Logfile by using the 'LogFileWrite()' subroutine in a script. For example: 'Call LogFileWrite("writing to the Logfile")'.  

NI DIAdem Data Portal

Copying Code & Settings From A Dialog

In any dialog other than those from the SCRIPT panel, you can cause DIAdem to write the dialog settings and any function / subroutine calls used by the dialog to the Windows clipboard.   In most cases, the information written will be more detailed than what is recorded using the recording mode.   The key combination is 'Ctrl-Shift-C'.  

Identifying Menu / Group Bar / Toolbar Elements

You can get the identity of any DIAdem menu, group bar, or toolbar by holding the 'Shift-Ctrl' keys while hovering the mouse over the menu/group bar/toolbar.   Use the Bar Manager object to access these items.  

NI DIAdem Data Portal

VBScript Language

Use the single quote ' character to insert a comment.   To comment out a block of code, select the code and use 'Ctrl-D'.   To un-comment a block of code, select the code and use 'Shift-Ctrl-D'.  

All variables should be declared using the 'Dim' statement.   Use the keys 'Ctrl-F5' or the SCRIPT toolbar button 'Run Script' to run a script.  

Referencing a channel in DIAdem can be done in several ways.   Most DIAdem functions / subroutines accept a channel reference in the form of a variable object reference e.g. 'Set oChnX = Data.GetChannel("Example/Time")', or a text reference in the form of '"[1]/Time"' or '"Example/Time"' or '"[1]/[1]'" (without the single quotes).   The best method is to configure the object reference, or if using text then use the text '"channel group name/channel name"' format ('"Example/Time"').  


Dim oChnX, oChnY, oChnResult

'Assign the X & Y channels to a channel objects oChnX and oChnY
Set oChnX = Data.GetChannel("Example/Time")
Set oChnY = Data.GetChannel("Example/Speed")

'Define the channel where the result of the analysis will go
'by creating a new channel in the same channel group as oChnY
'with the channel name "Result"
Set oChnResult = oChnY.ChannelGroup.Channels.Add("RMS_of_" & oChnY.Name, DataTypeChnFloat64)

'Calculate the RMS of oChnY
'ChnRMS(XW, Y, ResultChannel, RMSWidth) 
Call ChnRMS(oChnX, oChnY, oChnResult, 10)

Or using text based channel references:


'Calculate the RMS of oChnY
'ChnRMS(XW, Y, ResultChannel, RMSWidth) 
Call ChnRMS("Example/Time", "Example/Speed", "Example/Speed_RMS", 10)

The text based channel references may seem more simple (and they are for a single calculation), BUT they are specific to a particular channels by name.   If you want to use your script on data in the Data Portal with different channel group and channel names, it will be necessary to change every channel group and channel name reference.   It is better and easier in longer scripts to assign those references once as channel objects, and then use those channel objects throughout the remainder of the script.  

Recording Mode

DIAdem's SCRIPT recording mode will record all commands and most variables as you perform a task with any of the non-SCRIPT panels.   Access the recording mode by clicking on it from the SCRIPT toolbar.   You will need to make a choice on how to handle file references.   The 'File reference' option in the dialog of 'Absolute path' is the easiest option for a beginner to understand.   The 'Path variable' option will configure an array for the filenames used throughout the script, but you need to be comfortable with VBScript arrays if you want to use that option.  

NI DIAdem Data Portal

When recording DIAdem's dialogs, you can get more information from the dialog settings than just the final function/subroutine call by using the key combination 'Ctrl-Shift-C' before the dialog is closed.   For example, if you turn on recording mode and perform descriptive statistics on a channel, the script window will contain the following code:


Call ChnStatisticsChannelCalc("[1]/Speed", 56, 0, 0, False, False, False, "NameName")

But if you use the key combination Ctrl-Shift-C before closing the dialog, you will get the following code snippet:


'StatsSelection = eStatsMinimum + eStatsMaximum + eStatsArithmeticMean
StatsSelection   = 56
StatsUsePopulationFormula = False
'------------ Result Storage ------------
StatsResultChn   = False
StatsResultChnNames = False
StatsResultChnNameFormat = "NameName"
'------------ Command -------------------
'Set ChnResult = ChnStatisticsChannelCalc("'[1]/Speed'", 56, NOVALUE, NOVALUE, False, False, False, "NameName")
Call ChnStatisticsChannelCalc("[1]/Speed", 56, 0, 0, False, False, False, "NameName")

Everything above the call to ChnStatisticsChannelCalc() in the script shown above is either comments, or assignments to global variable associated with the ChnStatisticsChannelCalc() function (although they are not actually called).   They provide supplemental information.   In particular, the first line of 'StatsSelection = eStatsMinimum + eStatsMaximum + eStatsArithmeticMean' is very useful because you can look at the help for this function, and then easily add additional statistical functions to be calculated.

This tutorial will teach you how to use the SCRIPT Recording Mode to record a series of actions in DIAdem.   Then you will use the 'VBScript Template' provided and adapt that script with the contents from the recording mode script.   For this tutorial, be prepared to find the example file that comes with the DIAdem installation named 'Example.tdm' located in 'C:\PROGRAM FILES\NATIONAL INSTRUMENTS\DIADEM 2021\Libr\Data\Example.tdm'   and load only the 'Time', 'RPM', and 'Torque' channels using the SCRIPT commands:

Call Data.Root.Clear()
Call DataFileLoadSel("C:\PROGRAM FILES\NATIONAL INSTRUMENTS\DIADEM 2021\Libr\Data\Example.tdm","TDM","[1]/[1]|[1]/[3]|[1]/[4]","Load|ChnXYRelation")

Tutorial Using Recording Mode

This tutorial will use the SCRIPT recording mode to calculate the power as a channel from the channels 'RMS' and 'Speed' from the file 'Example.tdm'.   Descriptive statistics will then be calculated on the channel 'Power'.  

Activate the SCRIPT panel.   Load the channels 'Time', 'RPM' and 'Torque' from the DIAdem example file 'Example.tdm' using the script shown below.  


Call Data.Root.Clear()
Call DataFileLoadSel("C:\PROGRAM FILES\NATIONAL INSTRUMENTS\DIADEM 2021\Libr\Data\Example.tdm","TDM","[1]/[1]|[1]/[3]|[1]/[4]","Load|ChnXYRelation")

Clear the SCRIPT workspace by using the menu 'File', 'New Workspace' (don't save anything).   In the SCRIPT panel, click in the recording mode toolbar and set the 'File reference' option to 'Absolute path'.   Click the 'Configure Recording Mode' dialog 'OK' button.  

NI DIAdem Data Portal

The recording mode non-modal dialog will appear.

NI DIAdem Data Portal

Recall that to calculate power using the Calculation Manger, it was the product of the channels 'RPM' and 'Torque'.   The general formula is: Power [kW] = 2 * Pi() * (1 min / 60 sec) * (1 kW / 1000 W) * (Speed [rpm]) * (Torque [N-m])   Activate the ANALYSIS panel by clicking on it.   From the 'Basic' menu, choose '* Multiply...'.   In the Data Portal, drag and drop the 'RPM' channel into the dialog 'Multiply' channel control labeled '1st channel:'.   Drag and drop the 'Torque' channel from the Data Portal to 'the dialog 'Multiply' channel control labeled 'Other channels:'.   Click the 'Calculate' button, and then the 'Close' button.   Activate the SCRIPT panel, and you will see the following line added to the script by the recording mode:

NI DIAdem Data Portal


Set ChnResult = ChnMul("[1]/RPM", "[1]/Torque", "/Multiplied")

Cleaning that up, a better command would be:


Call ChnMul("Example/RPM", "Example/Torque", "Example/Power")

Edit the script as shown above and try running the script (Ctrl-F5).   The revised script will create a channel named 'Power'.   Note that the unit for power is '(1/min)*(Nm)', and we want kW.   The units need to be converted, and the ChMul() function doesn't support quantity-based calculations like other commands such as Calculate() do.   We will fix that by using another ANALYSIS function named 'Scale'.   The recording mode should still be on.   Click on the ANALYSIS panel and then select the menu 'Basic' and 'Scale...'.   In the Data Portal, select the new channel 'Power' and drag and drop it into the 'Scale' dialog channel control labeled 'Channel:'.   The 'Factor' in the dialog multiples the channel values by a constant, and the 'Offset' adds or subtracts and offset from the channel values.   (sort of like Y = mX + b).   We need to multiple all of the values in Power by '3.142 * 2 * (1/60) * (1/1000) = 0.0001047' in order to express the power channel in units of kW.   Enter the constant of '0.37704' into the 'Factor' text box, check the checkbox labeled 'Store result in original channel'.   Click the 'Calculate' button, and then the 'Close' button.  

NI DIAdem Data Portal

Activate the SCRIPT panel.   The recording mode has added a new line to the script as shown below.  


Set ChnResult = ChnLinScale("[1]/Power", "/Power", 0.0001047, 0)

A cleaner version of this line of code would be:


'Convert power in (1/min)*(Nm) to kW
Call ChnLinScale("Example/Power", "Example/Power", 0.0001047, 0)

The unit for the channel 'Power' in incorrect.   In the Data Portal, click on the channel 'Power', and then in the channel properties window, find 'Unit', click on the unit value, and a '...' button will appear.   Click on the '...' button to edit the unit for power.  

NI DIAdem Data Portal

The warning message shown below should appear.   Click the 'No' button.  

NI DIAdem Data Portal

The 'Channel Unit: Symbol Input Tool' dialog will appear.   Click on the drop down box to the right of 'Quantity:' and select 'Power'.   Under the list box 'Units', select '[kW]kilowatt'.   Click the 'Replace' button, and the dialog will close, and the units for the channel 'Power' will be updated to kW.  

NI DIAdem Data Portal

Activate the SCRIPT panel and review the script commands added.   No additional commands were added to the script for the unit conversion.   If you had said 'Yes' to the earlier dialog, then you would have had to first define what the unit '(1/min)*(Nm)' means in terms of the unit catalog's base value of watts.   The only way to fix the units for the channel 'Power' using a script is to use the following script:


'Change the channel Power units to kW
Dim oChnY
Set oChnY = Data.GetChannel("Example/Power")
oChnY.UnitSymbol = "kW"

Add the above commands to your recorded script.  

The final step will be to calculate descriptive statistics on the channel 'Power'.   With the recording mode still on, active the 'ANALYSIS' panel.   Choose the ANALYSIS menu 'Statistics', 'Descriptive statistics...'.   In the Data Portal, select the channel 'Power' and then drag and drop it to the 'Descriptive Statistics' dialog, into the channel control to the right of the label 'Channels:'.   Configure the 'Characteristic Values 1' tab to have only the following check boxes checked: 'Root mean square'.   Click on the 'Result Storage' tab and insure the checkbox 'Store results in channels' is not checked.   Now use the key sequence 'Ctrl-Shift-C' to copy the dialog settings to the Windows clipboard.   Click the 'Calculate' button, and then the 'Close' button.  

NI DIAdem Data Portal

Activate the SCRIPT panel.   The additional code added to recording mode script should be what is shown below.  


'StatsSelection = eStatsSquareMean
StatsSelection   = 64
StatsUsePopulationFormula = False
'------------ Result Storage ------------
StatsResultChn   = False
StatsResultChnNames = False
StatsResultChnNameFormat = "NameName"
'------------ Command -------------------
'Set ChnResult = ChnStatisticsChannelCalc("'[1]/Power'", 64, NOVALUE, NOVALUE, False, False, False, "NameName")
Call ChnStatisticsChannelCalc("[1]/Power", 64, 0, 0, False, False, False, "NameName")

A clean version of the above code would be what is shown below.   Additionally, the RMS value for channel 'Power' is written to the Logfile, just to show you how you could access that value in a script.  


'Calculate the RMS of the channel Power
Call ChnStatisticsChannelCalc("Example/Power", eStatsSquareMean, 0, 0, False, False, False, "NameName")
Call LogFileWrite("RMS of Power = " & oChnY.Properties("Result~Statistics~MeanValues~SquareMean").Value & " " & oChnY.UnitSymbol)

Your recorded script with the clean changes proposed, should now look what is shown below.   Run this script and observe that a channel 'Power' with the units of 'kW' is created, and it has a maximum value of 128.4 kW.  


Call Data.Root.Clear()
Call DataFileLoadSel("C:\PROGRAM FILES\NATIONAL INSTRUMENTS\DIADEM 2021\Libr\Data\Example.tdm","TDM","[1]/[1]|[1]/[3]|[1]/[4]","Load|ChnXYRelation")

Call ChnMul("[1]/RPM", "[1]/Torque", "/Power")

'Convert power in (1/min)*(Nm) to kW
Call ChnLinScale("Example/Power", "Example/Power", 0.0001047, 0)

'Change the channel Power units to kW
Dim oChnY
Set oChnY = Data.GetChannel("Example/Power")
oChnY.UnitSymbol = "kW"

'Calculate the RMS of the channel Power
Call ChnStatisticsChannelCalc("Example/Power", eStatsSquareMean, 0, 0, False, False, False, "NameName")
Call LogFileWrite("RMS of Power = " & oChnY.Properties("Result~Statistics~MeanValues~SquareMean").Value & " " & oChnY.UnitSymbol)

VBScript Template

The VBScript below may be used as a template for processing a file loaded in the Data Portal, or each file specified by the NAVIGATOR search results.   In either case, the function bProcessDataPortal() is called, input channels are identified, and a DIAdem ANALYSIS function is performed. If the NAVIGATOR search results are being processed, then the file will be saved before the next file from the search results is processed.  

Activate the SCRIPT panel.   From the SCRIPT panel menu, choose 'File', 'New VBS'.   Delete the default script contents by using the keys 'Ctrl-A' to select everything and then clicking the 'Del' key to delete the selection.   Copy the code below to the Windows clipboard (Ctrl-C).   Return to the SCRIPT editor, click in the empty sheet, and either use 'Ctrl-V' to paste the Windows clipboard contents, or the SCRIPT menu 'Edit', 'Paste'.   Access the SCRIPT menu 'File' and 'Save' and save it to the filename 'VBScriptTemplate.VBS'.  


'-------------------------------------------------------------------------------
'-- VBS script file VBScriptTemplate.VBS
'-- Author: Mechatronic Solutions LLC
'-- Comment:  Function bProcessDataPortal() demonstrates how to configure input and output
'             channel assignments, and then execute a DIAdem ANALYSIS function. 
'             If data is loaded into the Data Portal, then bProcessDataPortal() is executed
'             immediately.  If NAVIGATOR search results are found, then each file specified
'             by the search results is loaded, function bProcessDataPortal() is executed,
'             and then the file is saved. 
'
'             YOU MUST EDIT CHANNEL ASSIGNMENTS IN FUNCTION bProcessDataPortal()
'-------------------------------------------------------------------------------
Option Explicit  
Call LogFileDel()

''Uncomment the lines below to load a DIAdem sample file (for demo).
'Call Data.Root.Clear()
'Call Navigator.Display.CurrDataFinder.Browser.Activate()
'Call DataFileLoad("C:\Program Files\National Instruments\DIAdem 2021\Examples\Data\ADOExample.tdm","TDM","Load|ChnXYRelation")


If Not bProcessNavSearchResults() Then Call Err.Raise(65535,,"ERROR:  bProcessNavSearchResults()")


Function bProcessNavSearchResults()
  'Iterate over the NAVIGATOR search results, loading one file at a time, executing
  'bProcessDataPortal(), and then saving the file. 
  'If no NAVIGATOR search results and data exists in the Data Portal, then simply
  'execute bProcessDataPortal(). 
  
  bProcessNavSearchResults = False
  Call LogFileWrite("bProcessNavSearchResults()...")
  
  Dim oSearchResult, oSearchResults, sFilePath
  Dim bCmdNoWarningDisp, bCmdNoMsgDisp

  'The two boolean global variables below supress pop up warnings.  
  'Save the current state to a temporary variable so it may be restored upon exit.
  bCmdNoWarningDisp = CmdNoWarningDisp: bCmdNoMsgDisp = CmdNoMsgDisp
  
  If Data.Root.ChannelGroups.Count > 0 AND Navigator.Display.CurrDataFinder.ResultsList.IsActive = False Then
    If Data.Root.ChannelGroups(1).Channels.Count > 0 Then
      'No NAVIGATOR search results, but the Data Portal has data
      Call LogFileWrite(String(1,vbTab) & "Processing data in the Data Portal ...")
      If Not bProcessDataPortal() Then  
        Call LogFileWrite(String(1,vbTab) & "ERROR processing the Data Portal")
        Exit Function
      End If
      bProcessNavSearchResults = True
      Exit Function
    End If
  End If

  If Navigator.Display.CurrDataProvider.IsKindOf(eDataStore) Then Call Err.Raise(65535,,"ERROR: You are connected to a DataStore, not a DataFinder")
  If Not Navigator.Display.CurrDataFinder.QueryForm.ResultsMode = eResultsModeElements Then Call Err.Raise(65535,,"ERROR: The DataFinder search results are not elements (files), but rather properties")
  If Navigator.Display.CurrDataFinder.ResultsList.ResultsElements.IsIncomplete Then Call Err.Raise(65535,,"WARNING:  Not all of the NAVIGATOR search results are displayed.")
  
  If Navigator.Display.CurrDataFinder.ResultsList.ResultsElements.Count < 1 AND Data.Root.ChannelGroups.Count = 0 Then
    Call Err.Raise(65535,,"ERROR: No NAVIGATOR search results to process, and no data loaded into the Data Portal.")
  Else  'Search results exist
    Call LogFileWrite(String(1,vbTab) & "Processing " & Str(Navigator.Display.CurrDataFinder.ResultsList.ResultsElements.Count) & " search results (files) from the NAVIGATOR search results...")
    Set oSearchResults = Navigator.Display.CurrDataFinder.ResultsList.ResultsElements
    
    For Each oSearchResult In oSearchResults
      
      'Get the path to the file from oSearchResult
      sFilePath = oSearchResult.Properties("folder").Value & "\" & oSearchResult.Properties("filename").Value
      Call LogFileWrite(String(1,vbTab) & "Analyzing file '" & NameSplit(sFilePath,"N") & "." & NameSplit(sFilePath,"E") & "'...")
      
      'Clear the contents of the Data Portal
      Call Data.Root.Clear()
      
      'Load the data file sFilePath into the Data Portal
      Call DataFileLoad(sFilePath, uCase(NameSplit(sFilePath,"E")), "Load|ChnXYRelation")
      
      If Not bProcessDataPortal() Then  
        Call LogFileWrite(String(1,vbTab) & "ERROR processing file '" & NameSplit(sFilePath,"N") & "." & NameSplit(sFilePath,"E") & "'...")
        Exit Function
      End If
      
      'Save the file with any changes from bProcessDataPortal()
      CmdNoWarningDisp = True: CmdNoMsgDisp = True
      Call DataFileSave(sFilePath, uCase(NameSplit(sFilePath,"E")), True)
      'Restore the global variable state
      CmdNoWarningDisp = bCmdNoWarningDisp: CmdNoMsgDisp = bCmdNoMsgDisp
    
    Next  'oSearchResult
    
    'Clean up..
    Call Data.Root.Clear()
    Set oSearchResult = Nothing: Set oSearchResults = Nothing
  End If
  
  bProcessNavSearchResults = True
End Function  'bProcessNavSearchResults()


Function bProcessDataPortal()
  bProcessDataPortal = False
  Call LogFileWrite("bProcessDataPortal()...")
  
  Dim oChnX, oChnY, oChnResult
  
  'Edit the X and Y channel assignments below:
  Set oChnX = Data.GetChannel("Measurement_A/Time")
  Set oChnY = Data.GetChannel("Measurement_A/MeasurementChannel_1")
  
  'Define the channel where the result of the analysis will go
  'by creating a new channel in the same channel group as oChnY
  'with the channel name "Result"
  Set oChnResult = oChnY.ChannelGroup.Channels.Add("Result", DataTypeChnFloat64)
  
  'ChnOffset(Y, ResultChannel, ChnOffsetValue, ChnOffsetMode) 
  Call ChnOffset(oChnY, oChnResult, 0, "min. value offset")
  
  'Update the description property for oChnResult
  Call oChnResult.Properties.Add("description", "ChnOffsetVal() min value offset.  Source: " & oChnY.GetReference(eReferenceNameName))
  
  'Clean up
  Set oChnX = Nothing: Set oChnY = Nothing: Set oChnResult = Nothing
  bProcessDataPortal = True
End Function  'bProcessDataPortal()

To run the demo, un-comment the lines shown below.   Run the script with the keys 'Ctrl-F5' or the SCRIPT toolbar button 'Run Script'.   The script will load a DIAdem example file and then execute the ANALYSIS function 'Offset Corrrection' or 'ChnOffset()' on the channel 'Measurement_A/MeasurementChannel_1'.  


''Uncomment the lines below to load a DIAdem sample file (for demo).
Call Data.Root.Clear()
Call Navigator.Display.CurrDataFinder.Browser.Activate()
Call DataFileLoad("C:\Program Files\National Instruments\DIAdem 2021\Examples\Data\ADOExample.tdm","TDM","Load|ChnXYRelation")

Example Using The Script

In this tutoral, the prior recording mode script generated will be integrated into a copy of the script 'VBScriptTemplate.VBS'.   Save the script 'VBScriptTemplate.VBS' to a new file named 'Power from RPM & Torque.VBS' by choosing the SCRIPT menu 'File', and 'Save As...'   Uncomment the three lines in the beginning that clear the data portal, activate the NAVIGATOR browser, and load a data file.   Replace the DataFileLoad() command with a reference to the 'Example.tdm' file as used in the recording mode tutorial.  


''Uncomment the lines below to load a DIAdem sample file (for demo).
Call Data.Root.Clear()
Call Navigator.Display.CurrDataFinder.Browser.Activate()
Call DataFileLoadSel("C:\PROGRAM FILES\NATIONAL INSTRUMENTS\DIADEM 2021\Libr\Data\Example.tdm","TDM","[1]/[1]|[1]/[3]|[1]/[4]","Load|ChnXYRelation")

If you adjust the script with the additional script content from the recording mode tutoral, and make the other changes as shown below, the script will calculate power from RPM and Torque.  


Function bProcessDataPortal()
  bProcessDataPortal = False
  Call LogFileWrite("bProcessDataPortal()...")
  
  Call ChnMul("Example/RPM", "Example/Torque", "Example/Power")
  
  'Convert power in (1/min)*(Nm) to kW
  Call ChnLinScale("Example/Power", "Example/Power", 0.0001047, 0)
  
  'Change the channel Power units to kW
  Dim oChnY
  Set oChnY = Data.GetChannel("Example/Power")
  oChnY.UnitSymbol = "kW"
  
  'Calculate the RMS of the channel Power
  Call ChnStatisticsChannelCalc("Example/Power", eStatsSquareMean, 0, 0, False, False, False, "NameName")
  Call LogFileWrite("RMS of Power = " & oChnY.Properties("Result~Statistics~MeanValues~SquareMean").Value & " " & oChnY.UnitSymbol)

  'Clean up
  Set oChnY = Nothing
  
	bProcessDataPortal = True
End Function  'bProcessDataPortal()

The function bProcessDataPortal() may also be re-written to use channel object references, as shown below:


Function bProcessDataPortal()
  bProcessDataPortal = False
  Call LogFileWrite("bProcessDataPortal()...")
  
  Dim oChnRpm, oChnTrq, oChnPwr
  
  Set oChnRpm = Data.GetChannel("Example/RPM")
  Set oChnTrq = Data.GetChannel("Example/Torque")
  
  'Create a new channel Power
  Set oChnPwr = oChnRpm.ChannelGroup.Channels.Add("Power", DataTypeChnFloat64)
  
  Call ChnMul(oChnRpm, oChnTrq, oChnPwr)
  
  'Convert power in (1/min)*(Nm) to kW
  Call ChnLinScale(oChnPwr, oChnPwr, 0.0001047, 0)
  
  'Change the channel Power units to kW
  oChnPwr.UnitSymbol = "kW"
  
  'Calculate the RMS of the channel Power
  Call ChnStatisticsChannelCalc(oChnPwr, eStatsSquareMean, 0, 0, False, False, False, "NameName")
  Call LogFileWrite("RMS of Power = " & oChnPwr.Properties("Result~Statistics~MeanValues~SquareMean").Value & " " & oChnPwr.UnitSymbol)

  'Clean up
  Set oChnRpm = Nothing: Set oChnTrq = Nothing: Set oChnPwr = Nothing
  
	bProcessDataPortal = True
End Function  'bProcessDataPortal()
What You Learned
  • Nearly all of the DIAdem functionality may be access by a script.
  • By using the SCRIPT recording mode, while performing a task in DIAdem, you can acquire what you need to assemble a script that can process other files with different channel content, and with minimal modifications.  
  • The script VBScriptTemplate.VBS provided by this tutorial can be used as the base for creating a script that will either process what is in the Data Portal, or the NAVIGATOR search results.  

 


 

Copyright © 2021,2022 Mechatronic Solutions LLC, All Rights Reserved