The System Management and Information (SMI) Library allows for programmatic retrieval of system configuration information for NI RIO hardware (CompactRIO, Single-Board RIO, myRIO, MXI-ExpressRIO, and EthernetRIO) and Real-Time CompactDAQ, as well as Real-Time PXI controller and chassis information. SMI is currently supported in LabVIEW 2014 and later versions.
Description
The System Management and Information (SMI) library provides functions for the detection of network devices and the management of NI hardware on a network. Device detection and system configuration management is implemented by wrapping System Configuration (SysConfig) API calls, supplemented with NI RIO target-specific module detection code. For example, SMI network detection encapsulates the SysConfig "Find Hardware" to retrieve information about detected devices. By comparison, C series module detection in RIO chassis is done by deploying a target specific FPGA bitfile and performing an EEPROM memory query for stored module information.
C Series Module Detection
C Series module detection for RIO targets (example: cRIO) can be done either remotely over the network, or as part of a Real-Time application, if the target is in FPGA mode. In the case of remote module detection, NI-RIO, NI System Configuration, and NI-RIO IO Scan components must be installed on the RT target. Local module detection on an RT target requires that the components, as well as target specific FPGA bitfiles (for the RT target and expansion IO chassis) are installed on the target. The most convenient way to place necessary SMI dependencies (components and FPGA bitfiles) on an RT target is to install the "C Series Module Detection" user component (CDF file) on the target.
The C Series Module Detection component may be installed by using the "Custom software installation" option in NI MAX, or through programmatic use of the SysConfig API (Functions>>Measurement>>System Configuration>>Software Management>>Install.vi). Installing the C Series Module Detection component installs components (drivers) necessary to use SMI in either remote or local running RT applications.
In order for the C Series Module Detection component to appear in the LabVIEW Real-Time Software Wizard (NI MAX >> Target >> Software [right-click] >> Add/Remove Software) "Custom software installation" features list, the SMI installation will copy a folder containing the component to the User Components directory (C:\Program Files (x86)\National Instruments\RT Images\User Components). If a hardware target is not yet supported by SMI, developers can generate FPGA bitfiles by using an included module detection project, installed alongside SMI (<LabVIEW>\vi.lib\SMI\source\C Series module detection). No matter their source, any FPGA bitfiles or components required by SMI can be copied to the RT target filesystem as an alternative to installing the CDF. If copied manually, FPGA bitfiles should be copied into the following directories on the RT target (by OS):
Possible Additional Installation Steps
The User Components directory is a read-only directory, and some versions of the Windows OS will prevent VI Package Manager from copying files to this location during installation. If a user dialog message is displayed during installation of the SMI package stating that the component could not be copied to the intended system directory, the following (manual) steps will need to be taken to complete installation of SMI:
1. Navigate to the temporary CDF component installation location (<LabVIEW>\vi.lib\NI\SMI\cdf\C Series Module Detection).
2. Copy the C Series Module Detection folder(Ctrl-C).
3. Navigate to the User Components directory (C:\Program Files (x86)\National Instruments\RT Images\User Components)
4. Paste the C Series Module Detection folder inside of the User Components directory.
The NI-RIO device driver version will determine which NI hardware is supported for certain SMI features.
Examples
SMI palette examples demonstrate possible uses of the SMI library. SMI runs on both host PC (remote detection) or NI Linux Real-Time targets (target address = "localhost").
Note: Remote detection of C Series modules on NI RIO hardware will deploy an NI FPGA bitfile to the target, which can potentially interrupt a running system. It is recommended to verify the safe, non-operating state of any remote target before triggering any remote module detection.
SMI system information is retrieved by initializing a System Session for the intended target with valid NI Auth login credentials. Subsequent calls to SMI palette member VIs use the authenticated "controller" reference in order to interact with the device. After initialization, SMI library VIs can be used to retrieve device information, or as in the advanced example, use System Session or Hardware References to modify system parameter settings. Once an SMI library VI is executed, information gathered by that VI updates the "controller" object, and it can be read using property nodes without the need to re-run the library VI. Some SMI classes which include such accessor methods are: Controller, Chassis, Modules, etc. The "controller" object (containing the System Session and Hardware Reference) is closed at such time as the connection is no longer necessary.
Figure 1: system detection.vi (example) - get controller information VI must come before the get chassis information VI.
Figure 2: advanced system information.vi (example)
Requirements
*note - required only for detection of RT application implementation of C series module detection on NI RIO hardware.
Support
SMI is an open source project, and the source code is available in the SMI GitHub project (https://github.com/NISystemsEngineering/SystemManagementAndInformation). We encourage contributions to the SMI library from the LabVIEW user community by branching the code and submitting pull request to the trunk in GitHub.
History
Version | Date | Description/Changes |
---|---|---|
2013.0.0.1 | 9/2/16 | Initial Release |
Download and Installation
The SMI library is available for installation directly from VI Package Manager.
It would be great if there was a way to get module-specific information, such as # of analog and digital input and output channels. From what I can find in SMI so far, we cand dig down and find C-Series Module ID's. But then we would need some sort of up-to-date database to query to pull out information for each module type.
Depending on what features you're using, this could be implemented through an additional scan engine (hybrid mode) bitfile. It wouldn't cover some of the fancier modules, but for analog and digital, scan engine can easily provide the channel count and type under each module.
Sticking with the existing modules, it might be possible to yank code from https://github.com/NIVeriStandAdd-Ons/Scan-Engine-Custom-Device-Classes/tree/master/Source to do this, since I believe they all need to know how many channels they have. May be more trouble than its worth, but having something general which takes a module ID and gives you all the known, static properties would be pretty handy.
The SMI reads C Series module EEPROM addresses for only a limited set of module specific information (vendor, model, serial, product ID) which conform the C Series design standard. I am not aware of channel count/type information being similarly stored in the EEPROM, but will investigate this as it would indeed be a great feature to add to SMI.
It is true that for those C Series modules detectable by NI Scan Engine - not all C Series modules will be detected in this mode, it is not difficult to get a channel type ("AI, AO, DI, and DO" only; TC modules returned as AI I believe) and access ("r" only access = input, "r and w" access = output) on a channel by channel basis. I developed code internally to do this for an NI CompactRIO in Scan Mode, but as I mentioned this does not guarantee that all modules are detected.
SMI uses the FPGA Interface Mode for detection because all modules will be seen, even third party modules, as long as they conform to the C Series standard (MDK). A way to leverage SMI and also derive channel count, based on product ID, would be to create a look-up table (LUT) of channel type/count for each C Series module you intend to support and query that when a module is detected. The drawbacks of this method would be the need to update the LUT for each new module, and multifunction modules (AIO, DIO) will not be possible to support in this way - no way to know the configuration on a channel by channel basis.
Christian,
The code above is great! This is exactly what I want. Except... It runs on the RT. I would like to access this same information, for the RT controller, but from a Windows program. E.g. I want to configure an RT program within a Windows GUI, and would like the current information on what I/O channels are on the RT target. So far, I haven't found a way to get the reference to the RT Variable Engine from Windows. Is that possible?
Thanks,
DaveT
I don't think you can get a reference to the IO variable engine remotely. You can get a reference to the PSP (shared) variable engine, and get information about all published variables. By default all IO variables are published to the network, so they will show up in the PSP engine. If you don't change this configuration, you may be able to use the PSP engine for your purpose.
Thanks, Christian. This looks great. Can't wait to try it.
DaveT
Well, I tried it. I found that I needed to change the Target Class near the bottom from RSI Module to PSP Variable Container, then it worked. Which is great! Except that was yesterday. I've done some other stuff with the cRIO in the meantime, and now today I can't get it to work at all. I'm getting error -1950679035. I haven't been able to figure out why yet. Rebooted the cRIO. Stopped the startup program on the RT. No luck...
Well, it worked again after I closed LV and re-opened it. Not sure why. I'm concerned that there's some dependency on what else has been run, which could make it difficult to use this code in a larger context.
The error means that the Scan Engine is not currently running on the target. Depending on the current configuration/mode of the cRIO target, the Scan Engine may not be deployed/started automatically. For example, if the cRIO is in FPGA mode, it will not run the Scan Engine.
I also noticed that in Scan Engine mode the Scan Engine may require 30+seconds to initialize after restarting the cRIO, before it will respond correctly to the code. Before then it will return the error you report.
If you have a Startup Executable that uses the Scan Engine, the scan engine should be deployed and running. But as you are discovering there are situations where the Scan Engine is not already running.
Thanks for the explanation, Christian. I have the code working now. It's a great addition to my program. Thanks again!
DaveT
These are current limitations of the SMI library:
Limitations
SMI custom error codes have been added to the library, for ease of troubleshooting and application management.
SMI Error Codes (538950-538999)
538950 |
The specified target is unsupported. SMI is only intended for real-time targets. |
538951 |
Warning: One or more System Session properties are not available for the target. |
538952 |
Warning: One or more System Hardware properties are not available for the target. |
538953 |
Warning: One or more System Hardware properties are not available for one or more of the target network adapters. |
538954 |
Warning: One or more System Hardware properties are not available for the target chassis. |
538955 |
Warning: One or more System Hardware properties are not available for the Ethernet RIO remote chassis. |
538956 |
Warning: FPGA bitfile needed for C Series module detection was not found in the expected file location. |
538957 |
Warning: Scan Mode not supported for C Series module detection. |
538958 |
Warning: C Series module detection failed for the chassis slot. |
538959 |
Warning: One or more C Series module properties could not be read from the EEPROM for the module in the chassis slot. |
538960 |
Warning: C Series module detection is not supported for remote chassis connected to a secondary network adapter. |
538961 |
Warning: One or more System Hardware properties are not available for the network target. |
Hello
I am getting an error when trying to install the package for LabVIEW 2018 The SMI folder is not showing up in my vi.lib/NI folder. It is there for a second and then it seems to get deleted. So I can't do the additional steps. The SMI Installation README.txt is also not installed on the desktop.
Please advise