LabVIEW DSC 7.1 Course Manual PDF
LabVIEW DSC 7.1 Course Manual PDF
LabVIEW DSC 7.1 Course Manual PDF
TM
Course Software Version 7.1 July 2004 Edition Part Number 321367G-01 LabVIEW DSC Module Course Manual
Copyright 19992004 National Instruments Corporation. All rights reserved. Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical, including photocopying, recording, storing in an information retrieval system, or translating, in whole or in part, without the prior written consent of National Instruments Corporation. In regards to components used in USI (Xerces C++, ICU, and HDF5), the following copyrights apply. For a listing of the conditions and disclaimers, refer to the USICopyrights.chm. Trademarks Citadel, CVI, DataSocket, FieldPoint, LabVIEW, Lookout, National Instruments, National Instruments Alliance Program, NI, ni.com, NI-DAQ, NI Developer Zone, and TestStand are trademarks of National Instruments Corporation. Product and company names mentioned herein are trademarks or trade names of their respective companies. Patents For patents covering National Instruments products, refer to the appropriate location: HelpPatents in your software, the patents.txt file on your CD, or ni.com/legal/patents.
Worldwide Technical Support and Product Information ni.com National Instruments Corporate Headquarters 11500 North Mopac Expressway Austin, Texas 78759-3504
Worldwide Offices Australia 1800 300 800, Austria 43 0 662 45 79 90 0, Belgium 32 0 2 757 00 20, Brazil 55 11 3262 3599, Canada (Calgary) 403 274 9391, Canada (Ottawa) 613 233 5949, Canada (Qubec) 450 510 3055, Canada (Toronto) 905 785 0085, Canada (Vancouver) 604 685 7530, China 86 21 6555 7838, Czech Republic 420 224 235 774, Denmark 45 45 76 26 00, Finland 385 0 9 725 725 11, France 33 0 1 48 14 24 24, Germany 49 0 89 741 31 30, India 91 80 51190000, Israel 972 0 3 6393737, Italy 39 02 413091, Japan 81 3 5472 2970, Korea 82 02 3451 3400, Malaysia 603 9131 0918, Mexico 01 800 010 0793, Netherlands 31 0 348 433 466, New Zealand 0800 553 322, Norway 47 0 66 90 76 60, Poland 48 22 3390150, Portugal 351 210 311 210, Russia 7 095 783 68 51, Singapore 65 6226 5886, Slovenia 386 3 425 4200, South Africa 27 0 11 805 8197, Spain 34 91 640 0085, Sweden 46 0 8 587 895 00, Switzerland 41 56 200 51 51, Taiwan 886 2 2528 7227, Thailand 662 992 7519, United Kingdom 44 0 1635 523545 For further support information, refer to the Additional Information and Resources appendix. To comment on the documentation, send email to [email protected].
Contents
Student Guide................................................................................................................................................ 5 A. NI Certification.................................................................................................................................. 6 B. Course Description ............................................................................................................................ 7 C. What You Need to Get Started .......................................................................................................... 7 D. Installing Course Software ................................................................................................................ 8 E. Course Goals...................................................................................................................................... 8 F. Course Conventions ........................................................................................................................... 9 Lesson 1: Datalogging and Supervisory Control (DSC) Module Overview..............................................1-1 A. Introduction to the DSC Module ....................................................................................................1-2 B. How the DSC Module Improves Your Applications ......................................................................1-4 C. Rapid Development ......................................................................................................................1-11 D. Understanding the Data Transfer Process.....................................................................................1-15 E. Setting Up FieldPoint....................................................................................................................1-16 Exercise 1-1.......................................................................................................................................1-22 Lesson 2: Getting Started with the LabVIEW DSC Module .....................................................................2-1 A. The Basic Steps of DSC Development...........................................................................................2-2 B. Adding Hardware............................................................................................................................2-3 C. Tags and Your Hardware................................................................................................................2-7 D. What Is the Tag Engine? ..............................................................................................................2-17 Exercise 2-1.......................................................................................................................................2-20 Lesson 3: Designing Your LabVIEW DSC Application ...........................................................................3-1 A. Understanding the Client/Server Relationship ...............................................................................3-2 B. How Do I Use HMI Wizard to Speed Development?.....................................................................3-5 C. Viewing Connections....................................................................................................................3-11 D. Elements of an Effective User Interface.......................................................................................3-13 E. Panel Wizard .................................................................................................................................3-14 Exercise 3-1.......................................................................................................................................3-20 Exercise 3-2.......................................................................................................................................3-25 Exercise 3-3A ....................................................................................................................................3-29 Exercise 3-3B ....................................................................................................................................3-33 Lesson 4: Handling and Logging Your Data .............................................................................................4-1 A. Logging Data Using the LabVIEW DSC Module..........................................................................4-2 B. Alarms in LabVIEW DSC ............................................................................................................4-13 Exercise 4-1A ....................................................................................................................................4-23 Exercise 4-1B ....................................................................................................................................4-24 Exercise 4-1C ....................................................................................................................................4-25
iii
Exercise 4-1D ....................................................................................................................................4-27 Exercise 4-1E ....................................................................................................................................4-29 Exercise 4-2.......................................................................................................................................4-30 Lesson 5: Advanced Database Management .............................................................................................5-1 A. What Is a Data Set? ........................................................................................................................5-3 B. Keeping Your Database Slim .......................................................................................................5-10 C. Importance of Archiving and Backing Up Data ...........................................................................5-13 D. Merging and Restoring Databases ................................................................................................5-17 Exercise 5-1.......................................................................................................................................5-20 Lesson 6: Maximizing Tag Effectiveness..................................................................................................6-1 A. The Importance of Tag Management .............................................................................................6-2 B. Setting Default Parameters for Tags ...............................................................................................6-8 C. Using the Tag Monitor..................................................................................................................6-13 D. Changing Tag Attributes Programmatically.................................................................................6-22 Exercise 6-1.......................................................................................................................................6-25 Exercise 6-2.......................................................................................................................................6-28 Exercise 6-3.......................................................................................................................................6-32 Lesson 7: Networking with DSC ...............................................................................................................7-1 A. Client/Server Architecture..............................................................................................................7-2 B. Server PhilosophyReview...........................................................................................................7-4 C. Client PhilosophyReview ...........................................................................................................7-9 D. DSC Module Clients.....................................................................................................................7-11 E. Client/Server Architecture Network System..............................................................................7-12 Exercise 7-1.......................................................................................................................................7-28 Exercise 7-2A ....................................................................................................................................7-32 Exercise 7-2B ....................................................................................................................................7-38 Exercise 7-3.......................................................................................................................................7-41 Lesson 8: Advanced Topics .......................................................................................................................8-1 A. LabVIEW DSC Security ................................................................................................................8-2 B. Programmatically Controlling Security ........................................................................................8-16 C. VI-Based Servers ..........................................................................................................................8-18 Exercise 8-1.......................................................................................................................................8-22 Exercise 8-2.......................................................................................................................................8-27 Exercise 8-3.......................................................................................................................................8-28 Exercise 8-4.......................................................................................................................................8-30 Appendix A: Additional Information and Resources................................................................................ A-1 Course Evaluation
iv
ni.com
Student Guide
Thank you for purchasing the LabVIEW Datalogging and Supervisory Control course kit. This course manual and the accompanying software are used in the 2-day, hands-on LabVIEW Datalogging and Supervisory Control course. You can apply the full purchase price of this course kit toward the corresponding course registration fee if you register within 90 days of purchasing the kit. Visit ni.com/training to register for a course and to access course schedules, syllabi, and training center location information.
Student Guide
A. NI Certification
The LabVIEW Datalogging and Supervisory Control Module course is part of a series of courses designed to build your proficiency with LabVIEW and help you prepare for exams to become an NI Certified LabVIEW Developer and NI Certified LabVIEW Architect. The following illustration shows the courses that are part of the LabVIEW training series. Refer to ni.com/training for more information about NI Certification.
LabVIEW Series
LabVIEW Intermediate I: LabVIEW Intermediate II: Successful Performance and Development Practices Connectivity
vi
ni.com
Student Guide
B. Course Description
The LabVIEW Datalogging and Supervisory Control Module course teaches you to use the LabVIEW Datalogging and Supervisory Control Module to develop datalogging and supervisory control applications. This course assumes you have a level of experience with LabVIEW equivalent to completing the material in the LabVIEW Basics I: Introduction course. In addition, you should be familiar with the Windows operating system and computer components such as the mouse, keyboard, connection ports, and plug-in slots, and have experience writing algorithms in the form of flowcharts or block diagrams. The course is divided into lessons, each covering a topic or a set of topics. Each lesson consists of the following parts: An introduction that describes what you will learn. A discussion of the topics. A set of exercises that reinforces the topics presented in the discussion. A summary that outlines important concepts and skills taught in the lesson.
vii
Student Guide
LabVIEW Datalogging and Supervisory Control Course CD, which contains the following files: Filename
Exercises
Description a folder containing all files needs to complete the exercises a folder containing the solutions to each exercise
Solutions
E. Course Goals
This course presents the following topics: Using LabVIEW to build high-channel count applications Developing network applications for distributed control Implementing security within LabVIEW applications Developing applications with automatic datalogging, full alarm management, and event logging Developing a human machine interface (HMI) for your application Logging and extracting historical data
This course does not present any of the following topics: Information and concepts covered in LabVIEW Basics I: Introduction course Control, PID, and/or Fuzzy Logic theory Analog-to-digital (A/D) theory Operation of GPIB, RS-232, Motion, CAN, or VISA Every built-in LabVIEW object, function, or library VI; refer to the LabVIEW Help for more information about LabVIEW features not described in this course Development of a complete application for any student in the class; refer to the NI Example Finder, available by selecting HelpFind Examples for example VIs you can use and incorporate into VIs you create
viii
ni.com
Student Guide
F. Course Conventions
The following conventions are used in this course manual: The symbol leads you through nested menu items and dialog box options to a final action. The sequence FilePage SetupOptions directs you to pull down the File menu, select the Page Setup item, and select Options from the last dialog box. This icon denotes a tip, which alerts you to advisory information. This icon denotes a note, which alerts you to important information. This icon denotes a caution, which advises you of precautions to take to avoid injury, data loss, or a system crash. bold Bold text denotes items that you must select or click in the software, such as menu items and dialog box options. Bold text also denotes parameter names, controls and buttons on the front panel, dialog boxes, sections of dialog boxes, menu names, and palette names. Italic text denotes variables, emphasis, a cross reference, or an introduction to a key concept. This font also denotes text that is a placeholder for a word or value that you must supply. Text in this font denotes text or characters that you enter from the keyboard, sections of code, programming examples, and syntax examples. This font also is used for the proper names of disk drives, paths, directories, programs, subprograms, subroutines, device names, functions, operations, variables, filenames, and extensions. Italic text in this font denotes text that is a placeholder for a word or value that you must supply.
italic
monospace
monospace italic
ix
TOPICS A. Introduction to the DSC Module B. How the DSC Module Improves Your Applications C. Rapid Development D. Understanding the Data Transfer Process E. Setting Up FieldPoint
By the end of this lesson, you will be able to answer the following questions: What can the DSC Module help me accomplish? How can the DSC Module simplify my development? How can I design a simple application with the DSC Module? How does data go from my hardware to my VI with the DSC Module? Why is it important to keep my source of data abstract?
1-1
1-2
ni.com
Security
Networking
Alarms
DSC Module
Trends
Data Logging
1-3
1-4
ni.com
FieldPoint Modules
Third-Party PLCs
1-5
DSC Module Log Data DSC Module and Alarms Tag Engine Citadel
OPC
NI-DAQ Driver
DAQ Board
FieldPoint Driver
FieldPoint Modules
NI or ThirdParty Drivers
Third-Party PLCs
1-6
ni.com
High-Speed Solutions
Use the DSC Module with high-speed acquisitions Use one environment for DAQ, FieldPoint, and OPC
High-Speed Solutions
For applications that require high-speed, efficient data transfers, DAQ and FieldPoint VIs provide a powerful solution. With the DSC Module, you can maintain your DAQ, FieldPoint, and DSC Module code within one environment. Use the DSC Module to easily communicate with any hardware using OPC in the same application containing your high-speed FieldPoint and DAQ programming.
1-7
1-8
ni.com
Exercise 1-1
Exploring the DSC Module Documentation and Help
Approximate time to complete: 10 min. Page 1-22
OBJECTIVE
Become familiar with the documentation available for the LabVIEW DSC module and locate the example programs that ship with LabVIEW DSC.
1-9
1-10
ni.com
Rapid Development
The DSC Module includes wizards that streamline and simplify development. While the wizards are designed to be easy to use, they also allow access to advanced characteristics.
1-11
HMI Wizard
HMI Human Machine Interface Gives instant access to values you need to read or write Generates code on the block diagram to allow you to customize the behavior of the control/indicator Good for simple applications or for a starting point for advanced applications
HMI Wizard
Included in the HMI Wizard are features for both the novice and advanced user. The wizard is designed to help you make clear, effective controls and indicators for your program. The HMI wizard will create fully functional code. However, the generated code is editable so that you can add functionality to your VI. The HMI wizard connects a control or indicator on the front panel to a tag. For instance, assume you have a tag labeled Tank Level that you want to monitor in LabVIEW. After you place a Tank Numeric Indicator on the front panel, the HMI Wizard quickly can create a VI that displays the value of Tank Level.
1-12
ni.com
1-13
Panel Wizard
Multiple panels organize and simplify the user interface for large applications Wizard attaches the appearance of a new panel to a button no programming required Same behavior achieved by programming with subVIs in LabVIEW
Panel Wizard
Many large applications require the use of many windows for the operator to navigate. For example, a large SCADA system for a water treatment facility might monitor many unique water control systems around the city. Rather than squeeze all of the system monitoring onto one panel, you can create a separate panel to view each unique system, making the user interface less confusing. With traditional LabVIEW programming, you must program the appearance of new panels by manually creating subVIs and manipulating the visual properties of the panel to achieve the desired panel appearance. With the Panel Wizard, the DSC Module generates the code to achieve the desired panel navigation.
1-14
ni.com
1-15
NI FieldPoint Overview
Modular Distributed I/O System
Modular Industrial Easy-to-Use Network, Wireless, Stand-Alone Environmentally Rugged
NI FieldPoint is a modular distributed I/O system with industrial-grade performance and unmatched software integration. The system gives you the ability to quickly and easily place I/O and measurement nodes near sensors and signal sources. FieldPoint also gives you the flexibility to choose a standard networking technology such as Ethernet, serial, wireless, or Foundation Fieldbus, that best suits your application. The [c]FP-20xx Ethernet control modules can store and run embedded LabVIEW Real-Time programs. This allows intelligent NI FieldPoint systems to communicate with other network nodes to publish and share data, or act as a reliable stand-alone node.
1-16
ni.com
FieldPoint Architecture
I/O Modules
Terminal Bases
Network Modules
FieldPoint features a modularized architecture consisting of the following components: network modules, connector blocks in CompactFieldPoint, terminal bases, and I/O modules. Network modules provide connectivity between the FieldPoint system and your computer or network. The terminal bases, and connector blocks provide field wiring connections for your signals, power to the I/O modules, and the FieldPoint backplane bus for communications. You can hotswap an I/O module with an identical I/O module and acquire signals without having to reconfigure the module. You can hotswap FieldPoint I/O modules, but not terminal bases. Therefore, do not try to hotswap the terminal bases. The I/O modules are available in two standard types: eight- and 16-channel modules and dual-channel modules for regular FieldPoint. I/O modules provide isolated analog and discrete inputs and outputs for a wide variety of signal types. The I/O modules are installed on terminal bases, which allow you to plug and unplug your modules without disconnecting your field wiring.
1-17
Compact FieldPoint
Terminal Connector Blocks Smart I/O Modules
Controller
Compact FieldPoint modules offer the most rugged platform for embedded control and network distributed measurements. All compact FieldPoint modules are built to last including a solid metal back plate, steel screw fasteners, and flexible wiring and cabling options. Because of these rugged features, Compact FieldPoint modules are rated to 50 g shock and 5 g vibration as well as an operating range of 25 to 60 C. Furthermore, they are expandable with removable CompactFlash storage and contain multiple RS-232/RS-485 serial ports.
1-18
ni.com
FieldPoint Communication
ETHERNET
LabVIEW Real-Time
10BaseT 100BaseT
FOUNDATION FIELDBUS
SERIAL
RS-232 RS-485
H1
RS-232
WIRELESS
FieldPoint communication options include the following: SerialFP-1000 RS-232/485 and FP-1001 RS-485 WirelessSRM6000 Spread-Spectrum Radio Modem connected to FP-1000 RS-232 Network Module EthernetFP-20xx (for use with LabVIEW RT) and FP-16xx 10BaseT or 100BaseTX H1 FieldbusFP-3000 Wireless Ethernet
1-19
Demo
PID Temperature Controller
Preview of Exercise 7-2 Develop an understanding of what can be done with the DSC Module.
Open the PID Server.vi located in the Solutions folder on your computer. This VI monitors and controls the temperature in the temperature chamber using FieldPoint modules. The temperature inside the chamber is monitored with a thermocouple. The light on the chamber has variable intensity to add heat to the chamber as needed, while the speed of the fan can be used to cool off the chamber as needed. Click the run arrow to start the VI. Experiment with different values for the Setpoint control. Click the PID Output tab and notice that the light intensity and the fan speed will change according to the value of the temperature setpoint. Notice the graphics on the front panel also simulate the speed of the fan and the intensity of the light.
OBJECTIVE
1-20
ni.com
Lesson Summary
What is the DSC Module?
Designed to be quick, powerful, flexible
The DSC Module handles hardware and software separately Using Wizards
HMI Wizard Tag Configuration Wizard Panel Wizard
FieldPoint Introduction
Lesson Summary
This lesson introduced you to the DSC Module. You designed a basic application and can start learning how to build more applications. Because you used wizards to build VIs, you can extend the VIs in the following lessons to build upon the code generated by the wizards. You also have learned how to set up FieldPoint devices, and know where you can find more information on that topic.
1-21
1-22
ni.com
3. Use the Context Help as you explore the DSC Module VIs on the Functions palette.
4. Close the VI when you are finished. Do not save changes. End of Exercise 1-1
1-23
Notes
1-24
ni.com
TOPICS A. The Basic Steps of DSC Development B. Choosing the Proper Hardware C. Tags and Your Hardware D. What Is the Tag Engine?
By the end of this lesson, you will be able to answer the following questions: What hardware is best for my applications? What is a tag? Why are tags important? How do I adjust the attributes of my tags to my liking? How can I organize tags for differing uses? What is the Tag Engine? What does the Tag Engine do for my programs?
2-1
2-2
ni.com
2-3
OPC Drivers
2-4
ni.com
2-5
OPC
FieldPoint
OPC
IA OPC Drivers or ThirdParty Server
PCI/PXI/PCMCIA
DAQ Board
Serial/Ethernet
FieldPoint I/O Modules
Serial/Ethernet
Third-Party PLCs
2-6
ni.com
You can launch both these utilities and others using the Tag Utilities Toolbar by selecting ToolsDSC ModuleShow Toolbar
2-7
2-8
ni.com
2-9
Tag Properties
Tags are identified by a descriptive name Five Important Tag Attributes
Type (Analog, Discrete, Bit Array, String) Access (Input, Output, I/O, Memory) Value (The data you want) Status (Is the data good?) Timestamp (When was this data acquired?)
Tag Properties
Because tags are the way to receive data that is both simplified and enhanced, it makes sense that a variety of properties exist for your data. These allow you to better understand and evaluate your data. The most obvious and important property of a tag is its name. Whether you have one source of data or several thousand, a descriptive name is very important. Frequently, your hardware refers to available data as a number, an I/O point, or another vague name. However, a tag does not need to retain that same name. Therefore, a tag called Temperature can read from a data source with a less descriptive name. In addition, the tag contains five important properties. Much like a variable, each tag has a specific data type. You can access each tag in different ways. Some tags can be both read and written to, but others you can only read or write to, not both. Each tag also has the desired data on it. Depending on that value, several different status values can be generated to indicate the condition of your data. Finally, each data point has an associated timestamp, indicating when a measurement was acquired.
2-10
ni.com
Tag Types
The LabVIEW DSC module supports the following tag types:
Analog: double-precision numeric floating point Discrete: Boolean value Bit Array: up to 32 discrete values String: ASCII string
Tag Types
AnalogRepresent continuous values within a range. Numerical controls or indicators should connect to analog tags. DiscreteRepresent two state values, that is, true/false or on/off or 0/1. Boolean controls and indicators can represent discrete tags. Bit ArrayMulti-bit values up to 32 discrete values, represented by an array of Booleans. StringASCII or binary character representations of values. A tag not fitting the previous tag types could be processed as a string tag, for example, bar codes.
2-11
Tag Access
There are four different ways to access a tag: Input You may only read values from the tag Output You may only write values to the tag Input/Output You may both read and write values to the tag Memory An Input/Output tag that is not connected to any hardware device
2-12
ni.com
Organizing Tags
Especially useful in situations with extremely large tag counts or with many pieces of hardware connected
Tag Groups help keep tags logically grouped and can save time in applying some common features Separate SCF files keep unneeded tags from being loaded and used
Organizing Tags
As you continue to grow more familiar with DSC and develop VIs, you will inevitably encounter a situation with many tags. If you just kept all the tags for all of your VIs in a single file, it would be very difficult to keep track the purpose for each tag. Tag Groups and SCF files help combat this problem and assist in making logical sense of your information in addition to implementing some time-saving features. Tag Groups are set up in the TCE, and allow you to place active tags in logical groups. You can then control certain group attributes and fine-tune the behavior of many tags simultaneously. Placing tags in separate SCF files will help preserve system resources and only enable particular tags. As you have more VIs that use the DSC Module, the VIs use different tags and pairing a VI with an SCF file can be a very powerful organizational tool.
2-13
Discover how you can add and manipulate tags in your VIs.
2-14
ni.com
2-15
2-16
ni.com
2-17
You can change the SCF loaded at the Default SCF at ToolsDSC ModuleOptions
2-18
ni.com
Summary
DSC developing basics Understanding hardware Tags
What are they? How do you use them?
Lesson Summary
With this lesson, you have gained a better understanding the DSC Module. You now know how to configure tags, both for testing and for your own hardware. You also have the knowledge to begin designing your VI and use tags to improve interoperability. You know how to use Tag Groups and SCF files to keep tags separate and how to manipulate the two.
2-19
5. Click the FP-PWM-520 module in the configuration tree to select it. 6. Click the Channel Configuration tab at the bottom of the right side of the window. 7. Make sure there is a checkmark in the Channel 0 checkbox. Set Range to 0 to 100 Percent. Set Watchdog Value to 0. Set Power-Up Output Value to 0. Click the Apply button.
2-20
ni.com
8. Place a checkmark in the Channel 1 checkbox and duplicate the settings in step 7 for this channel. 9. Click the + symbol to expand the Data Neighborhood group in the configuration tree. Click the + symbol to expand the FieldPoint Items group. Click the + symbol to expand the FP @ YOUR_IP_ADDRESS group. 10. Click the TC-120 to select it. Click the Start button at the top of the window. Notice the value for Channel 0. It should be in the range of normal room temperature (6080 F). If it is not, notify your instructor. 11. Click the PWM-520 and then click Channel 0. Click the Write button at the top of the window. On the pop-up menu, enter a value of 20 and click the Update button. The light should turn on inside your temperature chamber. Enter 100 and click the Update button. The light should get brighter. After you verify that the light responds, enter a value of 0 and click the Update button to turn the light off. If your light does not behave correctly, notify your instructor. 12. Click Channel 1. Click the Write button at the top of the window. On the pop-up menu, enter a value of 20 and click the Update button. The fan should turn on inside your temperature chamber. Enter 100 and click the Update button. The fan should start spinning faster. Changes in fan speed can be difficult to see. You can listen to the fan to verify the behavior. After you verify that the fan responds, enter a value of 0 and click the Update button to stop the fan. If your fan does not behave correctly, notify your instructor. 13. Select ToolsFieldPointSave As from the MAX menu. Name the file Fieldpoint Temperature Chamber.iak and save it.
2-21
14. Close MAX. 15. Open LabVIEW. 16. Click the New Button, select Blank VI from the menu, and click the OK button. 17. Select ToolsDSC ModuleConfigure Tags to open the Tag Configuration Editor. 18. Select FileNew and click the OK button to create a new file in the Tag Configuration Editor. 19. Select EditConfiguration Wizard, or click the Configuration Wizard button on the toolbar to open the Configuration Wizard. 20. Click the + symbol to expand the National Instruments. OPCFieldPoint group. Click the + symbol to expand the FP @ YOUR_IP_ADDRESS group. Click the + symbol to expand the FP-TC-120 group. Select Channel 0 and click the Add Item(s) button to add the channel.
21. Click the + symbol to expand the FP-PWM-520 group. Repeat the steps 420 to add Channel 0 and Channel 1. 22. Click the OK button in the Wizard. The names of your FieldPoint channels should appear in the Tag Configuration Editor. 23. Highlight the FP-TC-120 Channel 0 in the Tag Configuration Editor and select EditEdit Tag or click the Edit Tag button on the toolbar.
2-22
ni.com
24. Delete the current Tag Name and enter Chamber Temperature in its place. Click the OK button.
25. Repeat steps 21 and 22 for the other two tags, using the following names: FP-PWM-520 Channel 0 Heat Lamp Control FP-PWM-520 Channel 1 Cooling Fan Control
26. Select FileSave As, name the file Temp Chamber.scf, and click the OK button. If prompted to restart the Tag Engine, select Yes to restart the Engine. The black diamonds preceding your tags should disappear, indicating that the tags are saved in memory. 27. Close the Tag Configuration Editor. End of Exercise 2-1
2-23
Notes
2-24
ni.com
TOPICS A. Understanding the Client/Server Relationship B. How Do I Use the HMI Wizard to Speed Development? C. Viewing Connections D. Elements of an Effective User Interface E. Panel Wizard
By the end of this lesson, you will be able to answer the following questions: Why does DSC use a server/client architecture? How does a server/client architecture speed up development of a LabVIEW DSC program? When must you expand the functionality of the Tag Engine and create your own server?
3-1
3-2
ni.com
3-3
3-4
ni.com
2A
2B
3-5
3-6
ni.com
3-7
Image Navigator
Image navigator provides a set of graphics for LabVIEW DSC Import pictures onto the front panel to represent the real-world environment
Select ToolsDSC ModuleImage Navigator to open the image navigator. Inside the Image Navigator, you can select individual pictures and import those to the front panel of your VI. You also can paste images from the Image Navigator onto Boolean controls to customize the look and feel of the application.
3-8
ni.com
OBJECTIVE
To use LabVIEW and the Image navigator to create an advanced application that simulates the real-world application of the Temperature Chamber.
3-9
OBJECTIVE
To use the Tag Wizard to connect to FieldPoint Tags, and then with the HMI wizard, to generate code that acquires data.
3-10
ni.com
Viewing Connections
Select ToolsControl Connections Shows all Front Panel DataSocket connections Only available in LabVIEW DSC
Viewing Connections
In addition to creating owned labels that either have descriptive names or actually reflect the Tag that a DSC Module control is connected to, the Control Connections tool allows users to monitor connections. The Control Connections tool allows users to view the front panel DataSocket connections for all loaded VIs. The information displayed is the URL that the controls are linked with, their current status, and their DataSocket Mode. You can modify the view fields displayed and save the results to a text file for debugging or documentation.
3-11
3-12
ni.com
3-13
Panel Wizard
Allows you to design VIs that call other VIs, switch users, or examine the values of the tags directly Simplifies the process of switching from one VI front panel to another VI front panel during run-time Creates layouts that more intuitive to use
3-14
ni.com
3-15
3-16
ni.com
3-17
OBJECTIVE
To use the Panel Wizard to generate panels to view historical traces and also generate code that launches a subVI from LabVIEW DSC.
3-18
ni.com
Summary
Client/Server relationships
Design a Server to supplement Tag Engine Client retrieves Data from Server
HMI Wizard Automatic Code Generation Front panel DataSockets Used to connect Tags Elements of effective user interface Image Navigator Using the Panel Wizard Programmatically open VIs
Lesson Summary
You now have the knowledge necessary to maximize the effectiveness of many applications. You have gained an understanding of when you need to design a Server and when you can allow the Tag Engine alone act as a server. You also can use various wizards to make powerful applications. The HMI Wizard can connect with your data, and the Panel Wizard can organize and streamline the analysis of that data.
3-19
Front Panel
1. Create the following front panel.
a. Place two raised box decorations located on the ControlsAll ControlsDecorations palette on the front panel and resize appropriately. b. Place a pointer slider control located on the ControlsNumeric Controls palette on each raised box decoration and label one Light Intensity % and one Fan Speed %. c. Place a tab control located on the ControlsAll ControlsContainers palette on the front panel and resize the tab control. d. Place a Stop button located on the ControlsButtons and Switches palette on the front panel and resize the button.
3-20
ni.com
2. Create the tank using the Image Navigator. a. Select ToolsDSC ModuleImage Navigator to open the Image Navigator.
b. Select NI TanksTank #1 from the Image Navigator. c. Drag the tank from the Image Navigator to the front panel to place the tank on the front panel. d. Use the Positioning tool to resize the tank to an appropriate size. 3. Modify a round LED to fit on top of the tank. You will modify the color later to simulate light intensity. a. Place a round LED located on the ControlsLEDs palette on the front panel. b. Resize the LED to appropriate size and place it over the top of the tank. 4. Create the spinning fan custom control. a. Place a square LED located on the ControlsLEDs palette on the front pane and resize it appropriately. b. Right-click the square LED and select AdvancedCustomize from the shortcut menu to open the Control Editor.
3-21
c. From the Image Navigator, select Blowers Etc. from Categories. Then right-click Cool Fan (animation Frame #1) and select Copy from the shortcut menu.
d. In the Control Editor, right-click the square LED and select Import PictureFalse from the shortcut menu to customize the false picture of the LED. e. From the Image Navigator, select Cool fan (animation frame #2), right-click, and select Copy from the shortcut menu. f. In the Control Editor, right-click the square LED and select Import PictureTrue from the shortcut menu to customize the true picture of the LED.
5. Save the custom control as Spinning Fan.ctl in the C:\Exercises\LabVIEW DSC directory. 6. Select FileApply Changes and then arrange the Tank, Spinning Fan, and Light Intensity Boolean controls on the front panel.
3-22
ni.com
Block Diagram
1. Create the following block diagram.
2. Place two While Loops located on the FunctionsExecution Controls palette on the block diagram. 3. In the top While Loop, create the code to adjust the brightness of the Light Intensity indicator. a. Right-click the Light Intensity indicator and select CreateProperty Node from the shortcut menu. b. Click the Light Intensity Property Node and select the Colors [4] property. c. Right-click the input to the Property Node and select CreateConstant from the shortcut menu. Replace the numbers in the cluster with a color box constant located on the FunctionsAll FunctionsNumericAdditional Numeric Constants palette. d. Place an Index Array function and a Build Array function located on the FunctionsAll FunctionsArray palette on the block diagram. e. Place an Unbundle function and a Bundle function located on the FunctionsAll Functions Cluster palette on the block diagram. f. Place a Subtract function located on the FunctionsArithmetic and CompareNumeric palette on the block diagram.
g. Add a local variable to the block diagram. Right-click the Light Intensity % control and select CreateLocal Variable from the shortcut menu. This will reserve the control for use with the HMI Wizard in the next exercise.
3-23
4. Arrange the functions and complete the wiring necessary to complete the top While Loop. Add a Wait Function located on the FunctionsAll FunctionsTime and Dialog palette to the While Loop. 5. In the bottom While Loop, create code necessary to adjust the speed of the Spinning Fan indicator. a. Right-click the Spinning Fan % indicator and select CreateLocal Variable from the shortcut menu to create a local variable. b. Place a Subtract function located on the FunctionsArithmetic & ComparisonNumeric palette on the block diagram. c. Place an Equal to 0? function located on the FunctionsArithmetic & Comparison Comparison palette on the block diagram. d. Place a Wait function located on the FunctionsAll FunctionsTime & Dialog palette on the block diagram. e. Place a Select function located on the FunctionsArithmetic & ComparisonComparison palette on the block diagram. f. Right-click the While Loop and select Add Shift Register from the shortcut menu. g. Right-click the Stop button in the top While Loop and select CreateLocal Variable from the shortcut menu. Delete the Stop button from the bottom While Loop and replace it with the Stop local variable. This allows one Stop button to control both While Loops. 6. Select the Stop local variable, then press and hold down the <Ctrl> key and drag the Stop local variable to create a copy of it. 7. Place a Sequence Structure and wire a Boolean constant to the Stop local variable. a. Place a Sequence Structure located on the FunctionsExecution Control palette on the block diagram. b. Place a false Boolean constant located on the FunctionsArithmetic & ComparisonExpress Boolean palette on the block diagram and wire it to the Stop local variable. 8. Complete the wiring and save the VI as Temp Chamber Ex. 3-1.vi in the C:\Exercises\ LabVIEW DSC directory. End of Exercise 3-1
3-24
ni.com
Front Panel
1. Open the Temp Chamber Template VI in the C:\Solutions\LabVIEW DSC directory. If you completed Exercise 3-1, open the Temp Chamber Ex. 3-1 VI in the C:\Exercises\LabVIEW DSC directory. 2. Open and examine the block diagram.
a. The top While Loop controls the color of the Light Intensity indicator. As the value of the Light Intensity % control changes, the color of the Light Intensity indicator changes from white to dark yellow. This simulates the real world environment of the Temperature Chamber. b. The bottom While Loop controls the Spinning Fan control created in the optional Exercise 3-1. If you are using the Temperature Chamber Template VI, the Spinning Fan indicator corresponds to the fan on the front panel. As the Fan Speed % slider increases, the time sent to the Wait function decreases and the While Loop updates faster, causing the Spinning Fan control to alternate between true and false at a faster rate. This simulates the speed of the actual spinning fan.
3-25
3. Create the HMI Wizard Code for Light Intensity. a. Open the front panel. Right-click the Light Intensity % slider and select HMI Wizard from the shortcut menu to open the HMI Wizard. b. Select the appropriate tag from Tag Value pull-down menu. For Light Intensity %, select Channel 0 of PWM. If the wire connections on the Temperature Chamber are reversed, you can select a different channel or change the connections.
c. Remove the checkmark from the Match control label to tag name checkbox and click the OK button to generate code with the HMI Wizard.
d. Repeat steps a through c For Fan Speed % control. Select Channel 1 of the FieldPoint PWM. 4. Open the block diagram and notice the code created by the HMI Wizard. Each control created a Sequence Structure that includes a DataSocket URL to the tag selected in the HMI Wizard. In addition to the two Sequence Structures for two input tags, a While Loop is created that monitors the Tag Engine.
3-26
ni.com
5. Use the HMI Wizard to add necessary code for temperature in chamber. a. Add a waveform chart to the front panel. b. On the front panel, right-click the waveform chart and select HMI Wizard from the shortcut menu. c. Select Channel 0 on the TC-120 module and click the Add button.
d. Click the OK button. The HMI Wizard generates the necessary code. 6. Review the code the HMI Wizard generates. a. Open the block diagram. The HMI Wizard created code for each Tag Connection and a While Loop that monitors the Tag Engine Status. b. The conditional terminal is connected to the Tag Engine Status of the Get Engine Status VI. c. Code generated by HMI Wizard is locked. To edit the code, right-click and select Release Wizard Lock from the shortcut menu.
3-27
8. Modify the code generated by the HMI Wizard that monitors Tag Engine. This will give the user control to stop the program, independent of the Tag Engine. a. Copy the Stop Button local variable from the top While Loop. b. Insert an Or function located on the FunctionsAll FunctionsBoolean palette. Connect the Stop local variable and the Engine Status to the Or function. This will allow either the Stop button or a true returned from Engine status to stop the While Loop. 9. Modify the code generated by the HMI Wizard for temperature output on Waveform Chart. a. Right-click Wizard Lock on the Sequence Structure created by the HMI Wizard and select Release Wizard Lock from the shortcut menu. b. Add an Or function and another copy of Stop local variable to the While Loop that is located inside this Sequence Structure. c. Remove the Not from the While Loop. Connect Shutdown from the Trend Tags VI to the bottom of the Or function. d. Right-click the While Loop conditional terminal and select Stop if True from the shortcut menu. e. Wire both loop terminals to the edge of the Sequence Structure that reinitializes the value of the Stop Boolean. 10. Save the VI as Temp Chamber Ex. 3-2 in the C:\Exercises\LabVIEW DSC directory. End of Exercise 3-2
3-28
ni.com
2. Create the Historical Data Viewer button shown above by placing an OK button located on the ControlsButtons & Switches palette on the front panel. 3. Right-click the button, select Visible ItemsLabel from the shortcut menu, and click Label to turn off the label. The Panel Wizard names the button Historical Data Viewer by default.
3-29
4. Use the Panel Wizard to generate code. a. Right-click the Historical Data Viewer button and select Panel Wizard from the shortcut menu to open the Panel Wizard. The following screen appears.
b. Select Historical Data Viewer. c. Click the Polling tab and select Always.
3-30
ni.com
5. Open the block diagram and view the code generated by the Panel Wizard. 6. Modify the code to allow the user to stop the While Loop
a. Right-click the While Loop and select Release Wizard Lock from the shortcut menu. b. Copy the Stop local variable from another While Loop and replace the True/False constant with this local variable. c. Right-click the conditional terminal and select Stop if True from the shortcut menu. 7. Save the VI as Temp Chamber Ex 3-3.vi in the C:\Exercises\LabVIEW DSC directory.
Run the VI
8. Display the front panel and run the VI. 9. Change the Light Intensity % and Fan Speed %. 10. After a few data points are collected, click the Historical Data Viewer button. This will use the code generated by Panel Wizard to open the Historical Data Viewer in MAX.
a. Expand Historical Data and select Citadel 5 Universe. b. In the Databases tab, expand My Computer. In the computer name folder, select the trace that you want to view.
3-31
c. Click the View Data button on the toolbar. d. Click the Start/Stop Logging control circled in the following figure to make sure the Green Light for Logging is selected. e. Make changes to the Fan Speed % or Light Intensity % on the Temp Chamber Ex 3-3 VI and view the data in MAX.
3-32
ni.com
a. Place an OK button located on the ControlsButtons & Switches palette on the front panel. Change the text of the button to Historical Trend, and change the owned label to Historical Trend. b. Right-click the Historical Trend button, select Visible ItemsLabel from the shortcut menu, and deselect Label.
3-33
3. Use the Panel Wizard to generate code. a. Right-click the Historical Trend button and select Panel Wizard from the shortcut menu to open the Panel Wizard.
b. Select the Panel tab and select VI. c. Click the Browse button and navigate to the Historical Trend (Simulation) VI located in the C:\Exercises\LabVIEW DSC directory. d. In the Polling tab, select Always.
3-34
ni.com
e. Click the OK button. The Panel Wizard generates the following code.
4. Open the block diagram and modify the code. a. Delete the True constant. Replace it with a copy of the Stop local variable. b. Change the conditional terminal to Stop if True. 5. Save the VI. End of Exercise 3-3
3-35
Notes
3-36
ni.com
By the end of this lesson, you will be able to answer the following questions: Why is it important to log my data? What is Citadel? How does Citadel help me manage my data? How can I view and analyze previous values of my data? What is an Alarm? How can I configure Alarms to automatically perform basic analysis of data? How can I incorporate Historical Data and Alarms directly into my program?
4-1
Logging to a Database
1. 2. 3. 4. Tag Engine acquires data from OPC Server. Tag Engine sends data to Citadel database. Citadel determines location and stores the data. Citadel then makes this database available to various LabVIEW tools (Historical Data Viewer and MAX).
Note: Steps 1, 2 and 3 are transparent to the user. They are handled by the DSC module.
Logging to a Database
DSC logs data in the following manner: First, the Tag Engine acquires the value of a tag and updates it. This values appears in the VI and is also sent to the Citadel database. Citadel then determines the appropriate location in the database to store the data. Citadel can accumulate and store this data. These stored data points, often referred to as Historical Data, are available for use by other programs at any time. This includes the Historical Data Viewer and MAX.
4-2
ni.com
DSC
Trends Data Logging
4-3
DSC Citadel
NI-DAQ Driver
DAQ Board
FieldPoint Driver
FieldPoint Modules
NI or ThirdParty Drivers
Third-Party PLCs
4-4
ni.com
4-5
4-6
ni.com
4-7
4-8
ni.com
4-9
4-10
ni.com
4-11
OBJECTIVE
4-12
ni.com
DSC
Trends Logs Alarms
Allows you to generate events based on particular values of data Useful for having DSC perform basic analysis for you
4-13
4-14
ni.com
Creating Alarms
In the TCE, select Edit Tag under the Alarms Tab:
Check this box to enable alarms Check which of the Alarms you would like enabled, the limit, and the priority (015) Check here and enter a priority if you want an alarm generated if the tag read from the server has a bad status
Creating Alarms
If the Enable Alarms box is unchecked, then this tag will not generate any alarms, and all other fields will be grayed out. Alarms can automatically acknowledge themselves when the values return to the normal range, or the alarm can persist until a user acknowledges the alarm. Which is appropriate? That depends on your application, although a serious alarm should generally require user acknowledgement so that you can be sure someone has been warned that an alarm has occurred. The alarm deadband is used to prevent an alarm from cycling on and off if the tag value is oscillating about an alarm limit. The actual alarms available vary depending on the tag type. The dialog box in this slide shows the alarm for an analog tag. String tags do not support alarms. Discrete tags can generate an alarm if the tag is high or if the tag is low. Bit arrays allow you to generate an alarm based on the status of multiple bits in the array. For analog tags, there are four possible alarms: HI, HI_HI, LO, and LO_LO. It is assumed that LO_LO < LO < HI < HI_HI. The Priority is used only to document how important the alarm is. 15 is considered high priority and 1 is considered low priority.
4-15
4-16
ni.com
4-17
OBJECTIVE
4-18
ni.com
4-19
4-20
ni.com
4-21
Summary
How do I make sure that tag data and events are logged? When is a tag logged? How is Deadband calculated? What are some methods of viewing historical data, alarms and events from the database?
Summary
How do I make sure that tag data and events are logged? Log Events must be checked in the Engine Manager Tags must be configured to log data in TCE When is a tag logged? When its value changes more than the deadband How is deadband calculated? As a percentage of the scale in the tags Scale tab What are some methods of viewing historical data, alarms and events from the database? HMI Wizard, HyperTrend, MAX, Historical Data VIs, Alarms & Events VIs, and Alarm & Event Display front panel control
4-22
ni.com
3. Repeat step 2 if you also want to log the Fan and Light tags. 4. Open the Engine Manager. If it is not already running in the taskbar, select ToolsLaunch Engine in the Tag Configuration Editor to start the Engine Manager. If it is running in the taskbar, double-click the icon in the taskbar to open the Engine Manager.
4-23
5. Make sure there is a checkmark in the Log Data checkbox in the Engine Manager. Minimize the Engine Manager. 6. In the Tag Configuration Editor, select ConfigureHistorical. Notice the name and path of the database. By default, the database is stored in the data folder in the same directory as the SCF file. You can change this to any other location or database name. Notice that the default name is derived from the database path. 7. In Tag Configuration Editor, select FileSave to save the SCF file. If prompted, shutdown and restart the Tag Engine. 8. Close the Tag Configuration Editor.
5. Return to the front panel and examine the LabVIEW code that has been generated in the block diagram.
4-24
ni.com
6. Modify the block diagram as shown in Figure 4-1a. Notice that you are not able to edit the block diagram because it is locked. Right-click the lock icon in the top right corner of the While Loop and select Release Wizard Lock from the shortcut menu to disable the lock from the HMI Wizard. Add a Stop button to the While Loop to enable you to stop the VI without aborting it.
7. Right-click the y-axis of the trend and enable the autoscale option. Save the VI as Ex 4-1 - Historical Trend.vi in the C:\Exercises\LabVIEW DSC directory. 8. Open and run the Exercise 3-7 VI in the C:\Exercises\LabVIEW DSC directory for a minute. Change the heat lamp and fan settings to induce a noticeable pattern in the thermocouple readings. 9. Stop the Exercise 3-7 VI and run the Ex 4-1 - Historical Trend VI. Notice that the historical data for the tags you specified is displayed. You can add or remove any tags from the historical trend view in the HMI Wizard. 10. (Optional) Run the Exercise 3-7 VI again. Notice that the Historical Trend updates every 10 seconds with new data that is logged.
4-25
3. Right-click the Boolean control and select Panel Wizard from the shortcut menu. Configure the Panel Wizard as shown in Figure 4-1b. Click the Browse button and navigate to C:\Exercises\LabVIEW DSC\Ex 4-1 - Historical Trend.vi. Click the OK button.
4. Open the block diagram and examine the code generated by the Panel Wizard. Modify the block diagram as shown in Figure 4-1c so you can stop this loop with the same stop button that stops the other loops.
Figure 4-1c. Edit Block Diagram to Stop VI with One Stop Button
4-26
ni.com
5. On the front panel of the Exercise 4-1 VI, notice that the buttons name and label are same as the VI that you specified earlier. Move the text button to a corner of the tab page. 6. Run the Exercise 4-1 VI and modify the Light Intensity and Fan Speed to obtain varying results for Temperature in Chamber. After approximately one minute, switch to the Historical Data tab page and click the text button. 7. The Ex 4-1 - Historical Trend VI opens and displays the historical data of the configured tags. Change the Light Intensity and the Fan Speed in the Exercise 4-1 VI to see the temperature change accordingly in the Historical Trend indicator. 8. Stop and close the Ex 4-1 - Historical Trend VI. Stop the Exercise 4-1 VI.
3. Right-click the NI HyperTrend indicator and select NI HyperTrendProperties from the shortcut menu. 4. Click Add in the Channels/Traces section. Make sure Citadel 5 is selected. Next, click the Browse button on the top of the Trace Properties page. Navigate under My Computer to the name and location of your database. Select the Chamber Temperature tag and click the OK button.
4-27
5. In the Trace Properties page, change the trace name to Chamber Temperature and the min and max to 0 and 100, respectively, as shown in the following figure. Click the OK button.
6. Add other tags by following the previous steps and rename them accordingly. On the NI HyperTrend Properties page, click the Apply button then click the OK button. 7. Click the Start/Stop Plotting switch on the top right corner of the NI HyperTrend indicator. The hypertrend is enabled when the switch is green. The plot(s) should now appear in the hypertrend. 8. Run the VI to see more recent historical data as it is logged. Vary the light intensity and the fan speed and notice the temperature change. Also notice that a trace is not logged if the value does not change. This is the due to the deadband. Tag values are logged only when they change by at least the amount of the deadband. 9. Stop the Exercise 4-1 VI. Notice that the hypertrend continues logging. Click the Start/Stop Plotting switch on the top right corner to stop logging. Also notice that no block diagram code is generated for this object. 10. Save the VI.
4-28
ni.com
3. Under My Computer, navigate to the database name where you are storing logged data from the temperature chamber. Select the Chamber Temperature tag and click Add. Add other tags if you want to see their historical data. You also can select the database name and click Add to view all the data stored in it. Click the OK button. 4. Notice the tags are listed in the Trace Properties tab. Click the Display tab to display historical data for all the tags. Click the Start/Stop Plotting switch on the top right corner to view the data. 5. To view more recent data, run the Exercise 4-1 VI and change the fan and light settings. Notice that this display behaves and looks similar to the NI HyperTrend indicator in LabVIEW. 6. Stop the Exercise 4-1 VI. Notice that MAX continues logging. Click the Start/Stop Plotting switch on the top right corner to stop logging.
4-29
4. Save the SCF file and click Yes when prompted to update the Tag Engine. 5. Minimize the Tag Configuration Editor to return to Exercise 4-2 VI. Click the Alarms tab on the tab control. 6. Place an Alarm & Event Display located on the Controls PaletteAll ControlsDSC Module Alarms and Events palette on the front panel. Resize the display to fit in the tab page. 7. Place a Text Button on the same tab page to control the Alarm & Event Display. Label the button Stop Display.
4-30
ni.com
8. Open the block diagram and notice the code that is generated. Modify the code as shown in Figure 4-2b so you can control the start and stop the Alarm & Event Display.
Figure 4-2b. Modify Block Diagram to Allow More Control over Alarm & Events Display
9. Run the Exercise 4-2 VI and modify the light intensity and fan speed to vary the chamber temperature. Switch to the Alarms tab to view the alarms. Notice that the alarms display in red, based on the level specified in the Tag Configuration Editor. Right-click the alarms to Acknowledge them from the shortcut menu. You also can right-click the display to set the Filter Options from the shortcut menu. This allows you to limit which alarms are displayed. 10. The Stop Alarm & Event Display button stops and clears the alarm display. To stop this VI completely, click the main STOP button and the Stop Alarm & Event Display button.
4-31
Notes
4-32
ni.com
TOPICS
A. What Is a Data Set? B. Keeping Your Database Slim C. Importance of Archiving and Backing Up Data D. Merging and Restoring Databases
By the end of this lesson, you will be able to answer the following questions: What are data sets? How do you create them and view them? What are some ways to minimize disk space used by databases? How do you compact and archive data in databases? How do you merge databases together?
5-1
5-2
ni.com
Data Set
Group of tag values that are logged together for a finite period of time Useful for organizing historical data
5-3
5-4
ni.com
4. Writes OFF to the control tag. This will end the run.
5-5
5-6
ni.com
5-7
The Display tab displays particular data set runs. Use the Zoom feature to view the entire data set and other runs. To view other runs individually, click View Data Set Run. Right-click the graph legend to disable certain plots, and so on. You can access graph and plot properties by right-clicking the plot area.
5-8
ni.com
OBJECTIVE
5-9
5-10
ni.com
5-11
5-12
ni.com
5-13
5-14
ni.com
5-15
When you use the Path Control to browse to the directory, you receive the computer name and the directory name.
The backup database must already exist in the remote computer to be able to backup to it. You can use MAX to navigate to the shared folder on the remote computer on the network and create the database, before archiving to it.
5-16
ni.com
TRUE if source database is to be deleted after the merge/restore/archive task has completed
5-17
Deleting Data
Delete individual tag values, data sets or entire databases Use LabVIEW DSC VIs or use MAX
Deleting Data
Delete Traces VIUse this VI to delete a set of traces from a given Citadel database. You cannot recover data deleted with this VI cannot be recovered. In MAX, right-click the tag, data set run, data set, or database you want to delete. Select Detach/Delete, and in the next dialog box, select Delete and click OK.
5-18
ni.com
Summary
What is a data set? What is a run? What are some methods to read a data set? What are some methods to reduce the amount of disk space used by a database? What are some methods for backing up data?
Summary
A data set is a group of tag values that are logged together for some finite amount of time. You can log data sets by simply logging to any one of the tags that is contained in a data set. Because a data set logs all the tags in it for a fixed amount of time, each time that data is logged for a certain period of time to the data set, it is called a Run. Each run has its own ID Tag that can be used to retrieve data from that run directly. Data logged in a data set can be displayed and read using the DSC Module VIs or using Historical Data in MAX. You can reduce the database size by making sure that the Logging Deadband is not too small. If it is too small, then data is logged more often, thus taking up more space. Also, ensure that Log Resolution is set to something reasonable and not 0.0. Compacting the database often gets rid of any empty spaces that may have been created from deleting, archiving, and so on. Based on your application, a smaller value may be used for the Historical data lifespan. Back up data when logging to a database. You can do this by archiving using DSC Module VIs or using MAX. You can use the same tools to merge databases and also restore them. It also is a good idea to compact data before archiving it. The Archive Traces VI in LabVIEW DSC has an option to compact the database before archiving it. You can archive entire databases, individual tags, and data sets, not only locally, but also on a remote computer on the network. The same method merges or restores databases.
5-19
Note: You will use the OPCDemo to simulate the device. The OPCDemo reads the value of the setpoint and tries to adjust the sensor value to it, with some time delay. The delay creates an impression of a real device.
5-20
ni.com
4. Create two additional tags (the Chamber Temperature, Heat Lamp Control, and Cooling Fan Control tags should already exist): a. Create a string memory tag and name it RPM Data Set ID Tag. In this example you will identify each run by a string with the following format: 'Test HH24:MM:SS' (for example, 'Test 14:58:33'). The timestamp is taken when the test starts. The ID can be anything, but in this case you add the timestamp to the field to make it unique and identifiable. You could have simply set the ID for each run to be 'Test 1', 'Test 2', and so on. An ID tag is a string or analog tag in your active SCF file. When you start logging a data set, the value of the ID tag at that time becomes the identifier of that data set run.
b. Similarly, create a discrete memory tag and name it RPM Data Set Run Tag. This control tag determines the start and end timestamps of a run. When a condition is met, the Data Set Logger logs the start or end marker. When the start condition is met, a new run starts, provided that the previous run has ended. When the end condition is met, the run ends. The complete list of tags is shown in Figure 5-1b.
5-21
5. Save your SCF file as dataset.scf in the C:\Exercises\LabVIEW DSC directory If prompted, stop and restart the Tag Engine. If you do not save the SCF file, you will not see the changes in the Data Set Logger configuration window. 6. Select ServersData Set Logger Configuration. Select the Definition tab and modify it as shown in Figure 5-1c. The Data Set Name identifies the data set. The ID Tag in this case is RPM Data Set ID Tag. Your control tag is RPM Data Set Run Tag. When its value is ON, the Data Set Logger logs the start marker. When its value is OFF, the Data Set Logger logs the end marker, thus marking off one run.
7. Click the Tags tab and click the Add button to select the tags you want to include in your data set. All tags/traces to which a data set refers must be logged in the same database. For this exercise, add the MotorRPMSetPoint and MotorRPMSensor tags to the set. 8. Click the OK button and save changes when prompted. Read the following caution regarding the dialog that appears next. Click the OK button. Caution: At this point the configuration itself is done. However, you must make sure the Data Set Logger gets launched when you start the Tag Engine. The most efficient way to ensure the Tag Engine will start the Data Set Logger is to include at least one Data Set Logger item in the SCF file, as in Figure 5-1d. 9. Select EditConfiguration Wizard to launch the Configuration Wizard.
5-22
ni.com
10. Navigate to Data Set LoggerRPM Data Set, select the active tag, and click the Add Item(s) button to add it. Click the OK button.
Figure 5-1d. Adding a Tag From the Data Set Logger to the SCF file.
11. Save the SCF file and restart the tag engine if it is already running so that your changes take effect. 12. To make sure that the Tag Engine will load this SCF file, select ToolsOptions in the Tag Configuration Editor and make sure that the file is specified as the Default SCF.
5-23
The complete test runs for about 10 seconds. After the test completes, you can start the next one.
The core part of the VI is a Sequence Structure. The Sequence Structure executes when the user clicks the Start Test button. Frame 0, shown in Figure 5-1f, generates a unique string with the following format: 'Test HH24:MM:SS' (for example, 'Test 14:58:33'). The string becomes a run ID when it is written to the ID tag (RPM Data Set ID Tag).
Frame 1, shown in Figure 5-1g, starts a new run by writing ON to the control tag (RPM Data Set Run Tag). At this time, the Data Set Logger creates the start marker in the database. The Run ID is whatever the current ID tag value is, which is why it is important to initialize the ID tag before the run starts.
Figure 5-1g. Frame 1 - Write ON to the Control Tag to Start the Run
5-24
ni.com
Frame 2, shown in Figure 5-1h, generates an array of values (waveform) and drives the setpoint tag. In response, the OPCDemo sets the value of the MotorRPMSensor. Both values are displayed on the trend.
Frame 3, shown in Figure 5-1i, contains a Wait function to allow some settling time.
Frame 4, shown in Figure 5-1j, ends the run by writing OFF to the control tag.
Figure 5-1j. Frame 4 - Write OFF to the Control Tag to Signify the End of the Run
Notice that no special VIs were used to manipulate the data set. All manipulation is done through the ID tag and the control tag.
5-25
(Optional)
To view a more complex and sophisticated data set viewer, open the NI Example Finder and navigate to the Data Sets Viewer VI located in the Toolsets and ModulesDatalogging and Supervisory ControlRetrieving Historical Data.
5-26
ni.com
Notes
5-27
Notes
5-28
ni.com
TOPICS A. The Importance of Tag Management B. Setting Default Parameters for Tags C. Using the Tag Monitor D. Changing Tag Attributes Programmatically
6-1
6-2
ni.com
What is a Deadband?
Region where value changes DO NOT update value on the engine
Reduces processor usage and network traffic Ignores signal noise
Deadband
Deadband Example Input Range = 050 Volts Initial Value = 10.0 Volts Deadband = 1.0 (1.0% = 0.5 Volts) Actual Values = 10,10.2, 9.7, 9.6, 9.3 Recorded Values = 10, 9.3
What is a Deadband
A deadband is a region where values can change, but it does not update the output value. In the example in the slide, the input range is 050 V and the deadband value is 1.0%. Therefore, the value does not update until value changes by at least 1.0% of the total input range (0.5 V in this example). In this case, the initial value is 10.0 V, so the value must rise above 10.5 V or fall below 9.5 V before the value will update. The values between 9.5 and 10.5 are a band of numbers that are essentially dead. Keep in mind that the deadband moves with each new updated point. For example, in this slide, after the 9.3 is recorded, the new deadband is between 9.8 and 8.8.
6-3
There are four separate deadband settings in the DSC Module. Each is important in eliminating unnecessary data processing and data logging. I/O Group Deadband (% of range)This deadband is applied to the OPC Server itself. I/O group deadband is a percentage of the total range defined by the OPC Server. When set, the OPC Server does not send an interrupt to the Tag Engine to update a value unless the value change is greater than the deadband. The I/O Group Deadband is a part of the OPC Server subscription that is defined in the I/O Group. Like other settings in the I/O Group, the I/O group deadband is a request that is sent to the OPC Server. The OPC Server can ignore the I/O group deadband. For example, it is ignored by the FieldPoint OPC Server. Update Deadband (% of range)This deadband is similar to the I/O Group Deadband, but it is applied to the Tag Engine. The update deadband is a percentage of the Engineering Scale. When this is set, the Tag Engine ignores updates from the OPC Server if the value change is not greater than the deadband. Alarm Deadband (% of range)This deadband is also a percentage of the engineering scale. The alarm deadband acts like a hysteresis in that the tag does not return to a normal state until it has left the alarm condition by at least Alarm Deadband. For example, if the range is 0100 and the Alarm Deadband is 1% and you have a HI Alarm set at 75, if the tag value goes above 75, the tag is in alarm. After the tag is in alarm, the value must drop below 74 to go out of alarm. This eliminates the problem of causing multiple alarms, while a noisy signal hovers about the alarm value. Log Deadband (% of range)This deadband allows you to limit the data that is being logged to the database. To get the most efficient use of hard drive space, the Citadel database only logs data on change. If a log deadband is set, then Citadel only logs data if it changes by more than the deadband.
6-4 ni.com
6-5
Non-analog tags
Discrete tags can only be inverted String tags do not have scaling
The raw scale is the range of values read from the server. If the server already performs scaling, then additional scaling might not be necessary. The engineering scale determines the range of values used by the Tag Engine and your application. When no engineering scales are defined, the DSC module does not perform scaling. Discrete tags support only inverting the value. Bit array tags allow you to select which bits are inverted and which bits are always 0. String tags have no scaling available.
6-6
ni.com
OBJECTIVE
6-7
6-8
ni.com
Using Ranges of Values in Tag Configuration Wizard Allows multiple, related tags to be created at one time Speeds development
Adding as Range
Some items in the Tag Configuration Wizard have channel lists that include a range of addresses. The Add as Range button allows you to select a starting address and a number of items to create. The wizard then automatically generates all of the addresses and increments the tag names. For example, if you chose the First Item Name as Example Tag and chose to create three Items, you create tags named Example Tag0, Example Tag1, and Example Tag2. For drivers with long lists of channels, this reduces the time it takes to create all the tags that you need. Using this tag with properly chosen default parameters allows for quick tag creation.
6-9
I/O Groups
In the DSC Module, I/O Groups define how fast items are read from the server and when a value is considered to be changed by the OPC server, if the server supports deadbanding. By default, the DSC Module creates one group for each server. You may have multiple groups for a single server, but you should not have one group include two different servers. The typical use for multiple groups would be to have one group of tags read at a slow rate and one group of tags that is read at a faster rate.
6-10
ni.com
Importing Tags
After you have edited your tags in a spreadsheet, you can import them back into the TCE. You can combine two SCF files by exporting the contents of both SCF files and combining their data in a spreadsheet. If you have a large SCF file that you are working with, keep a backup file, because debugging errors in a large spreadsheet file can be difficult. Note: The import option does not work if the tag name and data type fields are missing from the spreadsheet file.
6-11
OBJECTIVE
To demonstrate how to export a large file of tags, to edit the file in a spreadsheet editor, and to import it back into the Tag Configuration Editor.
6-12
ni.com
Tag Monitor
Use the Tag Monitor to debug your application. The Tag Monitor allows you to view all the tag values without having to do any programming. You can start the Tag Monitor from the TCE by clicking the Start Tag Monitor button in the toolbar. After the Monitor is running, you can drag and drop tags from the left-hand window pane into the right-hand window pane. After tags appear in the right-hand window pane, the values of those tags update automatically. You also can write values to tags (write tags only) in the Tag Monitor by right-clicking and choosing Write from the shortcut menu.
6-13
Can access and change tag attributes while the program is running
6-14
ni.com
Outputs:
Value, timestamp, status, error, shutdown
Example
Read from thermocouple tag Wait no more than 30 seconds Stop when engine shuts down
6-15
Outputs:
Value status, error
Example
Write to analog output tag Write a value of 2.5 volts Write value only when changed
6-16
ni.com
Timeout = 1
Tag is only read on value change
Timeout = X
Tag is read on value change or after XX seconds
Timeout = 0
With the timeout set to zero, the tag is read immediately. Regardless of what has happened to this value, the value is read. This increases network traffic because it requires the value to be read frequently, even if the value has not changed at all.
Timeout = -1
With the timeout set to 1, the tag is read only when the value changes more than the deadband. This drastically reduces network traffic because the value is only updated when there is a different value to record. This choice is referred to as event-based.
Timeout = X
With the timeout set to an integer value X (integer value X = 30, in this slide), the tag read occurs every time the value changes more than the deadband or every X seconds, whichever occurs first. It is a combination of the previous two methods.
6-17
Read the value of the thermocouple when it changes or every 30 seconds Check if the value is above 80 F If Not, Output a Value of 2.5 V to the FP Analog Output Tag
6-18
ni.com
Polling Example
Checks all values at consistent intervals
Advantage: Allows proper calculations between multiple tags Disadvantage: Increases network traffic
Polling Example
This VI reads a value from three different temperature sensor tags every 0.5 seconds (500 milliseconds) and averages their values. If the average value for the three sensors is less than 80, then a heat lamp is turned on. If the average value read from the temperature sensors is greater than 80, then the heat lamp is turned off. There is a Tag Write VI in the True case of the case structure that cannot be seen in the illustration in this slide. The loop stops running if the Tag Engine stops running. This example is similar to other examples in this lesson, except the example is purely a polling driven example. Nothing about the previous example is event-driven. The values are read from the tags every time the loop iterates, regardless of whether they have changed. In this slide, the tags get read every 0.5 seconds (500 milliseconds) due to the wait time in the loop. In this example, three measurements are being averaged, if they were event driven tag reads, then the average would only change when one of the tags changed by more than its deadband. However, you could average one new value with two stale values. Those stale values could have changed, just not by more than their deadbands. This results in an average that could differ significantly from the actual average temperature. If you poll the tags, you avoid this problem, because you read the current tag value on every iteration. There are no stale values to worry about. The drawback is that polling increases the amount of network traffic, even when the tag values are not changing. Use polling only when it is truly necessary.
6-19
Event-Based Example
Reads the value of the thermocouple only when the value changes Drastically reduces the amount of processing and network traffic Accomplishes the same task as a timeout-based loop Recommended method for this type of operation
Event-Based Example
The example in this slide is nearly identical to the Tag Read and Write example, with one small change. The timeout value has been changed from 30 to -1. This turns the example into a purely event-based example. This means that the loop iterates only when the thermocouple value changes more than the deadband. If the deadband is selected appropriately, this allows for a reduction of network traffic, while still accomplishing the same task as the polling example.
6-20
ni.com
OBJECTIVE
6-21
Change any attribute of an existing tag while the program is running Retrieve the current configuration details of any tag programmatically
6-22
ni.com
6-23
Summary
Proper tag management reduces development time Deadbanding can improve program execution Tag Configuration Wizard, I/O groups, and default parameters help with large tag counts Reading and writing from the block diagram is necessary to create feedback loops Tag attributes can be changed programmatically
6-24
ni.com
7. Select FileSave As and save the file as Temp Chamber61.scf in the C:\Exercises\LabVIEW DSC directory. 8. Close the Tag Configuration Editor.
6-25
10. On the front panel, idle the mouse over the Numeric control and right-click it. Select HMI Wizard from the shortcut menu. In the dialog box that displays, select Deadband 0 from the Tag pull-down menu and click the OK button.
6-26
ni.com
11. Repeat step 10 for the three remaining front panel controls, and select the appropriate tags from the Tag pull-down menu according to the following list: Numeric 2: Numeric 3: Slide:
Deadband 1 Deadband 5 Cooling Fan Control
12. Select FileSave As and save the file as Deadband.vi in the C:\Exercises\LabVIEW DSC directory. 13. Run the VI. Adjust the cooling fan speed with the slider, and watch the values update on the front panel. Notice that Deadband 0 updates every second or two, Deadband 1 updates a couple of times a minute and Deadband 5 rarely updates. This VI demonstrates the importance of selecting a proper deadband. If you use the 0% deadband, you generate network traffic of 3060 updates per minute and generate traffic even when the value has only changed by only a fraction of a degree, which is wasteful. Whereas if you use too large a deadband, such as 5%, you can miss large changes in temperature, which makes for an ineffective control system. Deadband 1 is a better choice in this case, because it updates on small temperature movements, but not on insignificant changes in temperature. 14. In the bottom right corner of the screen, right-click the Engine Manager and select Stop from the shortcut menu as shown in the following figure.
15. Stopping the Engine stops the VI. 16. Close the VI. Do not save changes. End of Exercise 6-1
6-27
6-28
ni.com
10. Select StartProgramsMicrosoft Excel to launch Excel. 11. In Excel, select FileOpen, change the Files of type field to Text, and navigate to large.txt and click the OK button to open the file.
6-29
12. The file is tab delimited by default, so click the Finish button to load the file. 13. For tags 4050041000, change the Raw Full Scale to 20 and the Raw Zero Scale to 4, the Eng Full Scale to 100 and the Eng Zero Scale to 100, and change the Scaling field to Linear. Edit the first tag and then use copy and paste. Notice that WindowSplit can be useful when working with such a large spreadsheet. 14. For tags 50100, invert the logical scaling by changing the scaling from none to Invert. The resulting spreadsheet should be similar to the following figure.
15. Select FileSave As and save the file as Modified_large.txt in the C:\Exerices\LabVIEW DSC directory. Select Yes when prompted with the following dialog box. The LabVIEW DSC Module requires the text format for imported files.
6-30
ni.com
16. Select FileExit to close Excel. 17. In the Tag Configuration Editor, select FileNew, then FileImport. Navigate to Modified_large.txt in the C:\Exercises\LabVIEW DSC directory and click the OK button to import the file. 18. Double-click one of the tags in the range 4050041000, then click the Scaling tab. Check that linear scaling occurs from 420 to 0100. Click the OK button when you are finished. 19. Double-click one of the tags in the range 50100, then click the Scaling tab to confirm that these lines are inverted. Click the OK button when you are finished. 20. Close the Tag Configuration Editor. End of Exercise 6-2
6-31
Front Panel
1. Launch LabVIEW and open a blank VI. 2. Select ToolsDSC ModuleConfigure Tags to open the Tag Configuration Editor. 3. Make sure that the Temp Chamber.scf file you created in Exercise 2-1 is loaded. If it is not loaded, select FileOpen in the Tag Configuration Editor, navigate to the Temp Chamber.scf file in the C:\Exercises\LabVIEW DSC directory and click the OK button to open the file. 4. Close the Tag Configuration Editor. 5. Build the following front panel.
6-32
ni.com
6. Open the block diagram and build the following block diagram.
Place a While Loop located on the FunctionsStructures palette on the block diagram. Place a Read Tag VI located on the FunctionsDSC Module VIsTags palette on the block diagram. Right-click the tag name input and select CreateConstant from the shortcut menu to create the input constant. Repeat these steps for the timeout input. Place a Greater? function located on the FunctionsComparison palette on the block diagram. Wire it as shown in the previous figure. Place a Select function located on the FunctionsComparison palette on the block diagram. Right-click the t and f inputs and select CreateConstant from the shortcut menu. Set the values of the constants to 0 and 50 for the t and f respectively. Place a Write Tag VI located on the FunctionsDSC Module VIsTags palette on the block diagram. Create constants for the tag name and write value on change? inputs as shown in the previous figure.
7. Select FileSave and save the VI as Simple Loop.vi in the C:\Exercises\LabVIEW DSC directory. 8. Run the VI and adjust the desired temperature. Watch as the temperature moves to the desired temperature and then hovers there. 9. Stop and close the VI. Do not save changes. End of Exercise 6-3
6-33
Notes
6-34
ni.com
7-1
Client/Server Architecture
Tag Engine accesses I/O hardware using tags
For example, FieldPoint, PLCs, NI-DAQ
Server VIs, client VIs, and the database can access the Tag Engine for data Local system client and server VIs access local Tag Engine
The client/server architecture allows you to create programs that can access tags (hardware) to collect data from all different types of local and remote devices. NI provides a full range of hardware solutions that integrate with the DSC Module to allow you to collect data. With the NI Compact FieldPoint product line, you can quickly use the DSC Module to configure I/O tags to connect directly to analog or digital lines on the hardware. With the DSC Module, server VIs, client VIs, or the historical database can access the Tag Engine for data. With a DSC architecture deployed on a local system the client and server VIs both access the same local DSC Module Tag Engine.
7-2
ni.com
Citadel
Server VIs
Read/Write Tags
The Tag Engine provided by DSC serves data to each component of the DSC Module architecture. The Tag Engine acquires data from multiple I/O sources both local and remote. The Tag Engine is a built-in server for the DSC Module. For more advanced applications, a server you create can add control and management capabilities to a DSC Module application. The HMI Wizard is a tool that increases a developers efficiency by quickly creating code used to communicate with the LabVIEW DSC Tag Engine. In this lesson, you will expand on the exercises from Lesson 3, Designing your LabVIEW DSC Application, and create a server for PID control for the temperature chamber. This PID Server accesses the Server Engine through the DSC Module to read and write to tags that control the inputs and acquire responses from FieldPoint hardware. Then, you create a client that can read and write to the same tags that the server accesses. The HMI Wizard increases development efficiency considerably.
7-3
In Lesson 3, Designing Your LabVIEW DSC Application, you learned the qualities of a good server for the DSC Module. Remember that creating a server VI is adding additional advanced features to the basic services provided by the Tag Engine in Lookout. The main component of a DSC Module server application is the Tag Engine. By adding a server VI to a DSC Module application, you can add advanced control or analysis to the DSC application. The main role of a server is to pass data back and forth between clients and hardware. The Server VI should be stand-alone, and perform analysis and control for the system. Something often overlooked when designing a server is that there is often limited need to view the values of the data in the server VI. This is more in-line with the role of a client VI. The server VI can transparently provide data to several clients. The clients are then used by the operators to view results and update set points on the server VI.
7-4
ni.com
This slide lists some common features that might appear in a Server VI. The first advanced feature might be code necessary for implementing certain control algorithms or logic. Also, you might add additional code that can analyze program results and then generate an output response. Additional features might include a Tag that all clients can monitor to see if the server is running, or the addition of memory tags to the server so a client can modify setpoints, as well as settings for the control response and outputs that display relevant information for the operators.
7-5
systems Fuzzy logic control designer P, PI, PD, and PID control algorithms Graphical development of control algorithms
The proportional, integral, derivative (PID) Toolkit is an add-on toolkit for LabVIEW that adds PID and fuzzy logic control VIs. The PID Toolkit integrates easily with the DSC Module to allow users to add advanced control features to a DSC Module server application. The PID Toolkit offers a set of PID Toolkit VIs that include the control algorithms for the classic PID control setup. The toolkit also offers Fuzzy Logic control tools. The PID Control Toolkit is used in Exercise 7-1, Creating a Server for Control, to implement a control algorithm with the DSC Module. A PID loop controls the temperature in the chamber based on a setpoint.
7-6
ni.com
Now review the PID Control Toolkit that will be used in the next exercise. On the Functions palette, open and view the palettes available in the PID Control Toolkit. The specific VI that is used in this example is the PID.vi. This VI employs a PID algorithm for simple PID applications or high-speed control applications.
7-7
OBJECTIVE
To use the DSC Module and PID Toolkit to control the response of the temperature chamber with a setpoint.
7-8
ni.com
Intuitive descriptions of what data means, not necessarily where it comes from
Use descriptive and consistent tag names Image Navigator
7-9
For a normal client application you might want to include features such as the ability to modify a setpoint that controls the algorithms on the Server VI. You also might want to display relevant information about the system being controlled by the DSC Module. The key piece to remember is that analysis and control is still performed on the server.
7-10
ni.com
In Exercise 7-2, you create a DSC Module client that can access tags and serve as a remote client in your DSC Module application.
OBJECTIVE
To create a client that can write to the setpoint for the PID Server and read values from the DSC Module Tag Engine.
7-11
Client VIs
Read/Write Tags (HMI Wizard) Transparent Access to Server Tags
Citadel
Server VIs
Read/Write Tags
7-12
ni.com
The DSC Module simplifies deploying server and client VIs. With the DSC Module, you can use the same VIs on the local machine and the networked machine. The Tag Engine on the local machine communicates transparently with the Tag Engine on the networked machine. Also, client VIs on the network machine can access the database, when folders are shared, on the local machine and read data. One of the most important features is that Remote Tags are transparent to the HMI Wizard and allow client VIs to simply communicate to networked tags over the network.
7-13
There are three major steps for configuring client VIs. The details are outlined in the following slides. The LabVIEW DSC Module Run-Time Engine is required. After installing the Run-Time engine, synchronize the clocks on the two computers, and then share the Windows folders used for database access. Finally, import network tags from the local machine.
7-14
ni.com
The first step when deploying DSC Module clients to networked machines is to install the DSC Module Run-Time Engine on the client machine. This is not a free Run-Time license. Visit ni.com and for more information. You can build an executable with the Application Builder, but you must place it in the LabVIEW DSC Module Run-Time folder with DSCengine.exe on the client PC.
7-15
7-16
ni.com
7-17
3. Click Add 4. Find server name from network 5. Click OK for all dialog boxes
7-18
ni.com
1. Double-click My Computer
2
2. Right-click folder to share and select Sharing and Security 3. Click Share this Folder
4
7-19
7-20
ni.com
OBJECTIVE
To distribute the client created in Exercise 7-2 to another computer and control the setpoint on the server machine.
7-21
The following slides cover the application specifics of integrating the DSC Module with regular LabVIEW applications or with Lookout applications. In the setup discussed, the DSC Module functions as the server and either a LabVIEW or Lookout client accesses data from the DSC Module server. The LabVIEW client without the DSC Module installed uses the functionality of front panel DataSocket, but the advanced features of the DSC Module are not available in this setup.
7-22
ni.com
LabVIEW
LOGOS
Client Process
Can be a LabVIEW executable!
VI connects to Engine using Front Panel DataSocket. No LabVIEW interface to Citadel.
7-23
Lookout
Server VIs
LOGOS Read/Write Tags
Client Process
LV DSC Server looks just like a Lookout server process. Lookout Client can easily access read/write tags.
Citadel
I/O Hardware
7-24
ni.com
7-25
7-26
ni.com
Summary
What changes do you need to make to your server? None; just share the database and SCF directories. How can you test network connections? The ping command What changes do you need to make to a DSC Module client? New SCF file with network tags and edit wizard code for historical trends How can you ensure your client and server machines have the same time? Use the time synchronization server
7-27
Front Panel
1. Open the Temp Chamber Ex 3-3 VI located in the C:\Exercises\LabVIEW DSC directory. 2. Rename the second and third tabs on the tab control to PID Settings, and PID Output, respectively. Modify the front panel as shown in the following figure.
7-28
ni.com
3. Right-click the Light Intensity % control and select ReplaceFunctionsNumeric IndicatorsGauge from the shortcut menu to replace the existing control with a gauge control. Repeat this step to replace the Fan Speed % control with a gauge control. a. Right-click the Light Intensity % gauge and select Change to Indicator from the shortcut menu. b. When prompted, click the OK button to allow the modification of the wizard connection.
c. Repeat step b for the Fan Speed % gauge. 4. Add a waveform chart to the PID Control tab. a. Right-click the waveform chart and select Visible ItemsDigital Display from shortcut menu. b. Expand the Plot Legend to display two plots. 5. Create a control for the Setpoint. a. Place a vertical pointer slide located on the ControlsNumeric Controls palette on the front panel. b. Name the slide Setpoint. c. Resize the Setpoint control and change the range from 60 to 200.
Block Diagram
1. Open the block diagram and notice the code generated to read the Setpoint tag. 2. Modify the block diagram as shown in the following figure.
7-29
a. Place a While Loop located on the FunctionsExecution Control palette on the block diagram. b. Place a DSC Read Tag VI located on the FunctionsAll FunctionsDSC Module VIsTags palette on the block diagram. Right-click the Tag Name input and select CreateConstant from shortcut menu to create a tag constant. c. Click the Tag Constant and select Chamber Temperature Tag. d. Place a PID VI located on the FunctionsAll FunctionsControlPID palette on the block diagram. Right-click the VI and select CreateControl from the shortcut menu to create controls for the PID Gains and Output Range inputs. e. Place a Wait Until Next ms Multiple function located on the FunctionsAll FunctionsTime and Dialog palette on the block diagram. Right-click the input to Wait until Next ms Multiple and select CreateConstant from the shortcut menu. Change the value to 1000 to set a wait of 1,000 ms. f. Press and hold down the <Ctrl> key, then click and drag the Numeric Constant to create a copy of it.
g. Place a Divide function located on the FunctionsArithmetic and NumericExpress Numeric palette on the block diagram. h. Place a Greater? Function located on the FunctionsArithmetic and CompareComparison palette on the block diagram. i. Right-click the output of the PID VI and select CreateIndicator from the shortcut menu. 3. Place a Case structure located on the FunctionsExecution Control palette on the block diagram. a. Create a DSC Write tag for Heat Lamp Control Tag and Cooling Fan Control Tag. (1) Place two Write Tag VIs located on the FunctionsAll FunctionsDSC Module VIsTags palette on the block diagram. (2) Right-click the Tag Name input of each Write Tag VI and select CreateConstant from the shortcut menu to create a constant for each tag. (3) Select Heat Lamp Control for the first tag and Cooling Fan Control for the second tag. b. Place a Merge Signals Express VI located on the FunctionSignal Manipulation palette on the block diagram. c. In the True case of the Case structure, connect the PID Output from the PID VI to the value for the Tag Write VI that goes to the Heat Lamp Control Tag. Create a constant with a value of 0 and wire it to the value for the Cooling Fan Control Tag. d. In the False case of the Case structure, connect a constant with a value of 0 to the Write Tag VI for the Heat Lamp Control. Use an Absolute Value function located on the FunctionsAll FunctionsNumeric palette to send the absolute value of the PID VI output to the value for the Cooling Fan Control Tag Write Tag VI. e. Create a local variable from the Light Intensity Control While Loop, and replace the Stop Button in the PID control While Loop. f. Connect the value from the Stop local variable to the Sequence Structure that reinitializes the Stop Boolean to false.
7-30
ni.com
4. On the front panel, set the default values for PID Control. a. Place the PID Gains control and the Output Range control on the PID Settings tab. b. Trial and error will generate acceptable values for the Proportional, Integral, and Derivative values for the PID control. Start with the following values and see if you can improve performance.
Run the VI
1. Save the VI as PID Server Ex 7-1 VI in the C:\Exercises\LabVIEW DSC directory. 2. Display the front panel and run the VI. Change the PID gains settings on the PID Settings tab. 3. Change the Setpoint and watch the system respond. End of Exercise 7-1
7-31
Front Panel
1. Open the PID Server Ex. 7.1 VI located in the C:\Exercises\LabVIEW DSC directory. 2. Use the HMI Wizard to create a memory Tag for Setpoint. a. On the front panel, right-click the Setpoint control and select HMI Wizard from the shortcut menu. b. Click the Create New Tag button.
7-32
ni.com
d. Select Analog for Tag Data Type and click the OK button.
7-33
e. On the Scaling Tab in the Scaling section, set Full Scale to 200 and Zero Scale to 60.
3. Repeat the process for a second memory tag using instead the Tag Configuration Editor to create the Server Running tag. a. Select ToolsDSC ModuleConfigure Tags to open the Tag Configuration Editor.
7-34
ni.com
b. Click the Create Tag icon and create a discrete memory tag named Server Running.
7-35
d. Save the SCF. e. When prompted, click the Yes button to restart the Tag Engine.
Block Diagram
1. Open the block diagram for the PID Server Ex. 7.1 VI and modify the code. 2. Place the Setpoint control inside the PID While Loop to control the setpoint. a. Place the control inside the While Loop. b. Connect broken wires so the Setpoint control is wired to the Setpoint input for the PID VI and to the Merge Signals Express VI. 3. Add a Write Tag VI to the PID While Loop to update when the server is running. a. Place a Write Tag VI located on the FunctionsAll FunctionsDSC Module VIsTags palette on the block diagram. b. Right-click the Tag Name input and select CreateConstant from the shortcut menu. Select the Server Running tag. c. Right-click the value input of the Write Tag VI and select CreateConstant from the shortcut menu.
7-36
ni.com
4. Add a VI to the sequence structure to update that the server is not running. a. Place a Write Tag VI located on the FunctionsAll FunctionsDSC Module VIsTags palette on the block diagram. b. Right-click the Tag Name input and select CreateConstant from the shortcut menu. Select the tag Server Running. c. Right-click the value input of the Write Tag VI and select CreateConstant from the shortcut menu.
5. Select FileSave As and save the VI as PID Server Ex 7.2. VI in the C:\Exercises\LabVIEW DSC directory. 6. Open the Tag Monitor, ToolsDSC ModuleMonitor Tags. 7. Add each Tag to the Tag Window by double-clicking the Tag.
7-37
2. Create the necessary controls and indicators. a. Place a vertical pointer slide located on the ControlsNumeric Controls palette on the front panel. b. Place a square LED located on the ControlsLED palette on the front panel. c. Place three numeric indicators located on the ControlsNumeric Indicators palette on the front panel. d. Place a STOP button located on the ControlsButtons & Switches palette on the front panel. You will use this button later in the exercise. 3. Use the HMI Wizard to make appropriate connections. a. Connect the vertical slider to the Setpoint tag. (1) Right-click the vertical slider and select HMI Wizard from the shortcut menu. (2) Select Setpoint tag and click the OK button.
7-38
ni.com
b. Repeat step a for the other indicators. (1) Connect the square LED to Server Running. (2) Connect each of the three numeric indicators to Heat Lamp Control, Cooling Fan Control, and Chamber Temperature.
4. Connect the STOP button on the block diagram. a. Place a Not function located on the FunctionsArithmetic & ComparisonExpress Boolean palette on the block diagram. b. Place an Or function located on the FunctionsArithmetic & ComparisonExpress Boolean palette on the block diagram. 5. Connect the Stop button to the top input for the Or function.
7-39
6. Connect the Running output from the Engine Status VI to the Not function and then to the bottom input for the Or function.
7. Save the VI as PID Client Ex 7-2.vi in the C:\Exercises\LabVIEW DSC directory. 8. Run the Client VI and change Setpoint value. Watch it also update the server. 9. Notice the operation of Server Running when you start and stop the PID Server.VI. End of Exercise 7-2
7-40
ni.com
Test IP Address
1. To determine the IP address of your computer, click StartRun and type cmd. At the command prompt type ipconfig. IP Address ______________ 2. Exchange IP Addresses with your neighbor. 3. On your computer type ping <ip address of neighbors computer>.
7-41
6. Expand LabVIEW and double-click each Network Tag to add it to the Full Name field in the Tag Monitor.
7. Now you can monitor the value of Tags on the server machine.
b. Enter Administrator for Username, and select Administrator from the Accounts pull-down menu. Leave the Password textbox blank. c. Select User and then Exit to leave the Account Manager.
7-42
ni.com
9. Select ToolsDSC ModuleOptions to open the Options dialog box. 10. Select the Advanced tab.
11. Click the Time Synchronization button to open the Time Synchronization Settings dialog box.
7-43
12. Click the Add button. 13. Find the Server machine from the list of computers. Hint: Expand the tree for My Network Places.
15. The server computer name will appear in the Time Server Search Order section. 16. Click the OK button to close each open dialog box.
7-44
ni.com
7-45
19. Select Share this Folder in the Sharing tab. 20. Click the Permissions button and verify that Everyone is present. For a secured system you can add selected users.
21. Select Full Control and click the OK button. 22. Click the Apply button in the Permissions dialog box and then click the Apply button for the Exercise Properties dialog box.
7-46
ni.com
23. On the Client computer (your machine) access the shared folder of your neighbor. 24. Right-click My Computer and select Map Network Drive from the shortcut menu.
25. Select the computer for the Server (your partners) and then add the folder that is shared.
7-47
28. The tags from the SCF file on the Server machine will appear in the Selected Tags section. 29. Click the Import button. 30. On the Tag Configuration Editor, select FileSave to save the SCF file in the LabVIEW directory. The SCF file on the Client is different from the SCF file on the Server. Make sure to not replace the Server SCF file with the one for the Client.
Deploy Client
31. Run the PID Client VI located in the C:\Exercises\LabVIEW DSC directory. 32. Make sure the PID Server VI is running on the server (partners machine). Notice which Temperature Chamber you are controlling with the PID Client VI on the client machine. End of Exercise 7-3
7-48
ni.com
Notes
7-49
Notes
7-50
ni.com
8-1
Security components:
1. 2. 3. 4. 5. 6. User Account Manager Security Wizard Login Settings Tools Access Control TCE Settings Programmatic Control User Account Manager
Security Wizard Login settings & tools access TCE Settings
Programmatic Control
8-2
ni.com
The User Account Manager is where new user accounts are created and added to groups, and their security privileges managed. Groups make it easy to apply security settings to a whole set of users simultaneously.
8-3
8-4
ni.com
Startup Options
You can configure LabVIEW DSC to automatically log in or prompt a specific user to log in at startup
Startup Options
Often, you would like to control which user gets logged in when LabVIEW initially starts up. For example, if you are developing a system, you may want to have the system automatically log you back in the next time you restart. You can implement this using the Security Preferences settings. Here you can configure the DSC module to automatically log in or prompt a specific user to log in at startup.
8-5
Tools Access
You can restrict access to any of the DSC tools to certain users or groups
Tools Access
The LabVIEW DSC module allows you to control who can use the development tools like the Tag Configuration Editor, the Tag Monitor, and so on. By default, all users have full access to all tools.
8-6
ni.com
Exercise 8-1
The following are the objectives of this exercise: To familiarize yourself with the applying security to the tools of the DSC Module. Add a password to the Administrator account. Make an additional group, Engineers, which has access to level 8. Add two users to your system: an operator named Guy and an engineer named Rick. Prevent operators from accessing the Tag Monitor. Start the system with the login window when LabVIEW is launched.
OBJECTIVE
8-7
Control which users can read or write tags Determine which machines on the network can read/write tags
8-8
ni.com
8-9
The Security Wizard makes it easy to implement security at any time during your development You do not need to change anything on the diagram
8-10
ni.com
Exercise 8-2
The following are the objectives of this exercise: To familiarize yourself with the addition of security to a pre-existing VI To load a client VI To prevent operators from changing a switch, but allow them to see the switch To allow all engineers or administrators full control over the switch
OBJECTIVE
8-11
8-12
ni.com
Using the DSC Module security VIs, you can programmatically login or logout of LabVIEW or can check various security settings and privileges. This allows the developer to implement customized security settings and policies for the application. The Login/Logout example uses NI SEC Programmatic Login.vi and NI SEC Programmatic Logout.vi to log a user in and then out following some operation. The Checking for privileges example programmatically checks to see if the currently logged in user has access to start or stop the tag engine.
8-13
Exercise 8-3
The objective of this exercise is to modify Temp Chamber.vi to programmatically log a user in and logout when the VI finishes.
OBJECTIVE
8-14
ni.com
8-15
8-16
ni.com
Launch the Engine with one SCF file, wait, shutdown Engine, switch SCF files, and re-launch
8-17
VI-Based Servers
For example:
These are VI-Based servers These are OPC servers The tag engine can connect to different types of servers, such as OPC servers or VI-Based servers
A VI-based server is a data server that is written in LabVIEW, unlike an OPC server, which is typically written in Visual Basic or C++. Like any server, a VI-based server can be a real I/O server for a device, a simulation server, or a computational server doing complex computation for your application and serving the results as items. The Tag Engine can interface with any server that uses the Tag Engine Server interface.
8-18
ni.com
VI-Based Servers
DSC Tag Engine CCDB LabVIEW VI-Based Server VI VI-Based Server Registration VI
All FunctionsDSC ModuleDSC Module Server development
Server VIs
Registration VIs
A VI-Based server consists of two parts: a server VI and a registration VI. The Registration VI only needs to run once. Its purpose is to create an entry in a CCDB (Common Configuration Database file) that is accessible to the tag engine and inserts information such as the data items and the path to the server VI. When the Tag Engine starts, it launches the Server VI, which then communicates between the engine and the I/O points (real-world I/O or other I/O points). For more information on using VI-Based servers refer to the following: zone.ni.com (search for VI-Based server) Shipping examples in LabVIEWselect Example FinderToolkits and Modules Datalogging and Supervisory ControlServers. VI-Based Server Development Toolkit Reference ManualNational Instruments\ LabVIEW 7.0\manuals.
8-19
OBJECTIVE
To modify and run a VI-based server example to create a new I/O tag. Create a VI that writes and reads from this tag.
8-20
ni.com
Summary
LabVIEW DSC provides the capability to easily incorporate security into your application, such as creating and managing user accounts, controlling tools access, and SCF file access. Security for the user interface is implemented using the Security Wizard. You can programmatically control the Tag Engine using the system VIs. You can create your own servers using the VI-based server development VIs.
8-21
8-22
ni.com
9. Add two users to your system: an operator named Guy and an engineer named Rick. Select UserNew User Account to create a new user in the User Account Manager. Do not fill in the password; just define the user name. 10. To make Guy a member of the Operators group, click the Groups button. Highlight Operators in the Not Member of box and click the Add button.
8-23
11. Repeat step 10 to create user Rick and make him part of the Engineers group. 12. Exit the User Account Manager. At this point everyone has full access to the Tag Monitor. In the next few steps you will prevent members of the Operators group from starting the Tag Monitor. 13. Make sure you are logged on as Administrator (only Administrators can edit securities). Select ToolsDSC ModuleOptions and click Tools Access in the Advanced tab.
8-24
ni.com
14. Select the Tag Monitor tab in the new dialog box. Notice that Everyone has access to the Tag Monitor. You will allow Everyone to have access, but you will exclude the Operators group. 15. Click the Edit button. 16. In the Access Rights dialog box, click the Add button. 17. The Add Users and Groups dialog box lists all available user and group accounts in the Names section. Highlight Operators and click the Add button. Make sure the Access Rights listbox shows No Access. Click the OK button four times to close the open dialog boxes and return to LabVIEW.
18. Select ToolsDSC ModuleMonitor Tags to launch the Tag Monitor. Because you are logged on as Administrator, you should be able to launch the Tag Monitor successfully. Close the Tag Monitor and log on as Guy. Because Guy is a member of the Operators group, the access should be denied.
8-25
When you restarted LabVIEW, you were automatically logged on as an Administrator. In this section, you will configure LabVIEW to always launch with a login window. 19. Select ToolsDSC ModuleOptions and click Security Preferences on the Advanced tab to open the Security System Settings dialog box. 20. Make sure Show the login prompt at LabVIEW startup time is selected. Click the OK button twice to close the dialog boxes and return to LabVIEW.
21. Restart LabVIEW and notice that after a short delay, it automatically displays the login dialog box when you try to open a VI. End of Exercise 8-1
8-26
ni.com
5. Repeat steps 2 through 4 for the Fan Speed % slider. 6. Right-click the Historical Data Viewer button and select Security from the shortcut menu. 7. Select the User or Group Everyone and select Disabled (View Only) from the Access pull-down menu. 8. Click the Add button to add a new user group. Change the access rights to Full Access and then double-click the Administrators group and click the OK button. Click the OK button to accept these security settings. 9. Repeat steps 5 through 7 for the Historical Trend button. 10. Save the VI as Temp Chamber with Security VI in the C:\Exercises\LabVIEW DSC directory. 11. Try logging in as Guy using ToolsUser Name from any VI. Can you change the Light Intensity or Fan Speed sliders? 12. Try logging in as Rick using ToolsUser Name from any VI. Can you launch the Historical Data Viewer or the Historical Trend? End of Exercise 8-2
8-27
8-28
ni.com
4. Place an NI SEC Programmatic Logout VI on the block diagram and wire the error out cluster to the left hand side of the top While Loop. 5. Place another NI SEC Programmatic Logout VI in the Sequence Structure on the right side of the block diagram. 6. Add a Case structure inside the top While Loop and connect the Log in button to the case selector input. 7. Place an NI SEC Invoke Login Dialog VI inside the true case of the Case structure. 8. Run the VI. Notice that the controls are disabled and grayed out when the program begins running. Try logging in by clicking the Log in button. Log in as Administrator. End of Exercise 8-3
8-29
8-30
ni.com
5. Run the VI and close it when it is finished. 6. Select ToolsDSC ModuleConfigure Tags to open the Tag Configuration Editor. 7. Select FileNew to create a new SCF file. Accept the default values on the next window. 8. Save the SCF file as VI_Based Server.scf and accept the default settings. 9. Click the Configuration Wizard, select the item called My Temp from the Dummy Server, and click the Add Items(s) button to add a tag.
10. Click the OK button to finish the Configuration Wizard. 11. Save the SCF file and click the OK button if prompted to restart the Tag Engine. 12. Close the Tag Configuration Editor.
8-31
Front Panel
13. Create a new VI and build the following front panel.
14. Place a knob located on the ControlsNumeric Controls palette on the front panel and label it Write Value. 15. Place a vertical fill slide located on the ControlsNumeric Controls palette on the front panel and label it Read Value. 16. Place a stop button located on the ControlsButtons & Switches palette on the front panel.
8-32
ni.com
Block Diagram
17. Complete the block diagram as shown in the following figure.
18. Place a While Loop located on the FunctionsAll FunctionsStructures palette on the block diagram and connect the stop button to the conditional terminal. 19. Place a Write Tag VI on the block diagram. Right-click the tag name input and select CreateConstant from the shortcut menu to create a constant. Select the My Temp tag. 20. Place a Read Tag VI on the block diagram and wire the tag constant into the tag name input. 21. Place a Wait function in the While Loop and wire a constant with a value of 500 to the input. 22. Run the VI and try adjusting the Write value knob. 23. Close the VI. When this VI runs, the Tag Engine dynamically launches the VI-Based server called Dummy Server but the user does not see this happening because it is all handled transparently. End of Exercise 8-4
8-33
Notes
8-34
ni.com
This appendix contains additional information about National Instruments technical support options and LabVIEW resources.
If you searched ni.com and could not find the answers you need, contact your local office or NI corporate headquarters. Phone numbers for our worldwide offices are listed at the front of this manual. You also can visit the Worldwide Offices section of ni.com/niglobal to access the branch office Web sites, which provide up-to-date contact information, support phone numbers, email addresses, and current events.
A-1
Appendix A
LabVIEW Resources
This section describes how you can receive more information regarding LabVIEW.
LabVIEW Publications
The following publications offer more information about LabVIEW.
LabVIEW Books
Many books have been written about LabVIEW programming and applications. The National Instruments Web site contains a list of all the LabVIEW books and links to places to purchase these books.
A-2
ni.com
Appendix A
info-labview Listserve
info-labview is an email group of users from around the world who
discuss LabVIEW issues. The list members can answer questions about building LabVIEW systems for particular applications, where to get instrument drivers or help with a device, and problems that appear. To subscribe to info-labview, send email to:
[email protected]
To send other administrative messages to the info-labview list manager, send email to:
[email protected]
A-3
Course Evaluation
Course _______________________________________________________________________________________ Location _____________________________________________________________________________________ Instructor _________________________________________ Date ____________________________________
Instructor
Please evaluate the instructor by checking the appropriate circle. Instructors ability to communicate course concepts Instructors knowledge of the subject matter Instructors presentation skills Instructors sensitivity to class needs Instructors preparation for the class
Unsatisfactory Poor Satisfactory Good Excellent
Course
Training facility quality Training equipment quality Was the hardware set up correctly? The course length was Too long Yes No Too short Just right Not enough No Sometimes Too much Yes Yes No Just right
The detail of topics covered in the course was The course material was clear and easy to follow. Did the course cover material as advertised?
I had the skills or knowledge I needed to attend this course. Yes No If no, how could you have been better prepared for the course? ____________________________________________________________________ _____________________________________________________________________________________________ What were the strong points of the course? __________________________________________________________ _____________________________________________________________________________________________ What topics would you add to the course? ___________________________________________________________ _____________________________________________________________________________________________ What part(s) of the course need to be condensed or removed? ____________________________________________ _____________________________________________________________________________________________ What needs to be added to the course to make it better? ________________________________________________ _____________________________________________________________________________________________ How did you benefit from taking this course? ________________________________________________________ _____________________________________________________________________________________________ Are there others at your company who have training needs? Please list. ____________________________________ _____________________________________________________________________________________________ _____________________________________________________________________________________________ Do you have other training needs that we could assist you with? _________________________________________ _____________________________________________________________________________________________ How did you hear about this course? NI Web site NI Sales Representative Mailing Co-worker Other _____________________________________________________________________________________