After selecting the new hardware products you need to create and/or improve your system and deciding on the best-suited software package, you are ready to build your application. National Instruments software makes this process straightforward by providing a highly integrated product line and intuitive and easy-to-use software. The following sections describe how to build a high-channel count application with the LabVIEW Datalogging and Supervisory Control module. This document does not describe how to configure new Fieldbus or DeviceNet devices. If this is a requirement of your application, refer to your user documentation to get started with the applicable protocol and then start the building process at the Configure Tag Settings section of this document. This guide is an outline only to the software process. For detailed instructions on external signal connection or intricacies of the configuration or development software, refer to the device or software documentation.
Configure DAQ Devices
Use National Instruments Measurement & Automation Explorer to configure the DAQ devices in your system. Most of the equipment will be recognized automatically, but the SCXI chassis will need to be added manually. Refer to the product documentation for specific steps for adding the SCXI chassis.
Measurement & Automation Explorer lets you define virtual channels for your devices -- creative names for data sources as well as the option to scale the channel data to a real world value. The OPC server uses these virtual channels when connecting to the data sources on the DAQ or SCXI hardware. Therefore, the first thing to do when you are building a high-channel count system with SCXI products is to create and configure the virtual channels with Measurement & Automation Explorer.
. Virtual Channels in Measurement & Automation Explorer
Right-click the Data Neighborhood icon in Measurement & Automation Explorer and select Create New from the shortcut menu. Follow the steps of the Channel Wizard to create a new virtual channel. The wizard will ask for the name for the virtual channel, the data source, and the scaling factor.
. Configuring a Virtual Channel in Measurement & Automation Explorer
The following are a number of tips for creating virtual channels with the Channel Wizard:
- Multiple DAQ configurations can be saved using the save configuration feature of Measurement & Automation Explorer. Measurement & Automation Explorer saves files in a somewhat counter-intuitive manner in that you must save a new configuration before you modify it because any changes you make to the configuration are immediately saved to the current file.
- Virtual channels can be duplicated with their channel reference and name incremented with each successive duplicate. Take advantage of this feature of virtual channels to configure channels swiftly.
- Remember to set the scales for a channel before you duplicate it.
- Choose a naming convention for the tags so that you can easily remember and reference them.
- Remember that the more channels are created, the more the drivers must process. If the program does not seem to be responding, be patient.
- Be careful not to reference two virtual channels to the same I/O point. This will cause errors in the OPC server.
- Many of the SCXI modules have software settings and/or hardware jumpers that change the behavior of the module, so be aware of those and change them if you need to in Measurement & Automation Explorer and the physical module.
- Remember that in datalogging and supervisory control applications, the emphasis is on monitoring nearly constant values. The Tag Engine is not intended for high-end waveform analysis, but to supervise relatively slowly changing signals. There is a trade-off between the number of channels and the sampling rate per channel that can be achieved.
After you set your channels, you can proceed to the next steps of the process.
Configure FieldPoint Devices
Configure FieldPoint modules using FieldPoint Explorer. Many of the modules have software configuration options that change the behavior of the module, so make sure they are set correctly.
. FieldPoint Explorer
Add a COM resource to the FieldPoint server and specify the IP address or COM port of the network module you are trying to find.
Figure 8. Configuring a COM resource in FP Explorer
If the Ethernet module does not have an IP address, you have to specify one by browsing the network and configuring unassigned devices. The devices must be on the same subnet for this to work. Then select Find Devices. The devices that are connected to that module are automatically detected, and channel names are generated. Save this configuration and remember that the active configuration file in FieldPoint Explorer is the one that its OPC server uses to connect to the data.
Below are a number of tips for configuring FieldPoint devices in FieldPoint Explorer:
- You can monitor and control items from FieldPoint Explorer for the demo and test of equipment.
- If you want the software configuration settings changes for modules more permanent, make use of the Snapshot feature, which saves the current settings for power-up or reset. This way, if you make a new file, your previous software settings will be maintained. This feature actually changes the settings on the hardware devices, so if a new file is created, the file must be synched to the device in order for that configuration to work properly.
- Because of the hot plug and play feature of these modules, it is easy to switch the locations of the modules around frequently. Beware that after the locations of the hardware are set and programming has begun, if the locations need to change, the configuration files must be redone, and everything from here on must be updated.
- FieldPoint Explorer automatically names channels as you add network modules, so you can keep them the same or rename them.
- You can create special OPC items to control specific attributes or commands of the module programmatically. For example, you can create items for the FP-CTR-500 (Counter module) that can control the terminal count of the counter inputs or reset the counter value dynamically.
. Configuring CTR Channels in FP Explorer
Configure Tag Settings in Tag Configuration Editor
After you configure the hardware properly, launch LabVIEW. Open the Tag Configuration Editor (TCE) and begin to edit the SCF.
. Tag Configuration Editor
Use the Tag Wizard to connect to the available OPC servers on the system or to servers available on remote systems.
. Tag Wizard
After you add the channels you selected, they appear in the list on the panel of the TCE. You can edit each of these tags from their default values, and all of the settings mentioned earlier in this document can be applied. Remember that the engine settings and historical settings are available to edit as well. Larger queue sizes for the engine can help to deal with larger amounts of data or a greater number of system events or alarms.
Below are a number of tips for using the Tag Wizard:
- You can use a separate piece of software called Server Explorer bundled with the LabVIEW Datalogging and Supervisory Control module to browse local and remote OPC servers in order to ensure that the channels are configured correctly.
- In the Tag Wizard, you can add groups of items all at once by clicking the folder icon and selecting Add Items.
- The I/O group settings apply to every item in the group. So, to create multiple update rate settings, create a new group for every set of tags with a certain update rate.
- For large numbers of tags, use the tag export command to export tags to a spreadsheet. Any spreadsheet program will allow you to easily manipulate the tag values that must be configured, including I/O group, update rates, alarms, deadbands, scaling, and so on. You can save variations of the files if you want to test different settings by creating new files in the TCE, importing these back into the editor, and testing the changes.
- The data the engine receives is automatically logged when you toggle it on as long as it is enabled in the SCF. Alarm and event generation is automatic as well and is easy to configure.
- The higher the number of channels, the lower the update rates must be in order to prevent engine overflow. If you are getting queue overflows, try lowering the update rate and/or increasing the queue size.
- There are four deadband settings: I/O Group deadband, Engine deadband, logging deadband, and alarm deadband.
- Be sure to update the scales for each tag according to the scales set in the tag’s hardware configuration program.
- Keep channels configured in Measurement & Automation Explorer and the TCE equal. The greater the number of virtual channels, the slower the performance of the OPC server, no matter how many channels are added to the TCE.
After the SCF is configured and saved, you can start the Tag Engine. Security settings can be applied as needed. If the application is intended for logging only, then you are finished, because all logging is done automatically. However, in many cases, a more customized application is needed, which brings us to dealing with LabVIEW VIs and application code.
Build Application Code
Use the HMI wizard whenever possible to automatically generate the code to monitor and update tag values. This greatly reduces development time and is great for simple monitoring and control applications. However, if you need a specialized application, the VIs provided make tag manipulation easy and fit in easily with the other VIs provided with LabVIEW, including any advanced data analysis, manipulation, or testing that must be performed on the tag values.
The LabVIEW Datalogging and Supervisory Control module VIs enable you to provide applications that can do almost anything programmatically. For example, you can control the starting and stopping of the engine using VIs, you can create security settings and user accounts on-the-fly, you can access historical databases, and you can open and close the Historical Trend Viewer programmatically.
Below are a number of tips for building applications in LabVIEW:
- Accessing the historical database programmatically should be done with caution. The larger the database, the longer it will take to access it.
- Avoid using historical data access VIs if you can. Many times, the same purpose can be achieved by using tag attribute VIs that are much faster. For example, if you need to access the database with the current set of tags, use the Get Tags VI, not the Get Historical Tags VI.
- When using the tag read/write VIs, remember that every time a value is written, it is queued in the engine. Avoid inefficient programming that asserts a value into a write tag every time through a loop if not necessary. If deadbands are not set, this can lead to engine output overflows.
- When starting or stopping the engine programmatically, beware that the calling VI can return before the engine is entirely finished starting or stopping. If data or file operations are engine dependent, use the engine status VI to determine when the engine is in the desired state before continuing the program flow.
- Many tag attributes are dynamic so keep this in mind before creating perhaps unnecessary SCFs, but also remember that programmatic changes to tags are not saved when the program exits.
- Use the timestamp along with the tag value to determine the exact time the value was retrieved. This knowledge can help determine the value’s relative importance in time to other tags.
- Remember, building a large-scale application is an iterative process; all of the steps in this document will most likely have to be done multiple times before the application is complete.
Successful programming in LabVIEW for connectivity and control of SCXI, FieldPoint, and other OPC tags, including third-party vendors, is dependent on installing and configuring the hardware for the specific application, then configuring the devices in software (FieldPoint Explorer, Measurement and Automation Explorer, and the TCE) in collaboration with program development in LabVIEW using the Data logging and Supervisory Control module.