Object Properties START a blank VI Objectives: - To understand Property Nodes – some review of previous lecture To understand Graph and Chart properties To understand how to use control references To understand how to use LabVIEW type definitions Property Nodes Create a folder and call it Application. Save your work in this application The motivation: Think of instances where you would like to see the front panel’s object appearance change due to certain inputs or commands. For example, you may want the graph area to be cleared every time the program starts. Or for another example, you may want a red LED to start blinking if an invalid data is entered. Or maybe want the chart trace colors to change to red if the temperature exceeds a threshold level! In addition, can resize or hide front panel objects. LabVIEW reference manual has tremendous information on property nodes. In this work we will simply practice changing appearance and functions of a front panel object. - In order to create a property node, right click an object>>create property node. Can create multiple property nodes for the same object. once you create a property node, you can change it to read or write property may add a terminal to a property: right click on the property node and select add element. Then you may associate each property terminal with a different property from the short cut menu. Let us do this: 1- create a numeric control on the front panel. 2- on the block diagram, right click the object>>create>>property node>>select Class ID as shown: 3- Using the operating tool, click on the word “ClassID” and select Visible 4- change the property node to a Write 5- right click on the input terminal node to the property node and select create control 6- on the front panel you should see the Boolean control and the numeric control 78- run the vi with the switch ON, the numeric control disappears. 9- Note: if you placed a numeric constant (False) to the input of the property node, the user will not be able to see the numeric control on the front panel. 101112- Practice the above. 13- Create a Boolean control on the front panel 14- on the block diagram, right click>>create>>property node>>position>all elements 15- right click the position item and change to write 16- expand the item to show left and top choices 17- collapse the item to show only position 18- on the front panel, place two dial controls – call them left and top 19- right click each of the controls and change the representation to I32 20- change the max scale to 500 21- complete the following on the block diagram 2223- run the VI and see how you can move the object 2425- The last practice proves the idea that property nodes execute each terminal in order – from top to bottom. 26- Start a new VI and place a dial control on the front panel 27- on the block diagram, select the visible property node 28- expand the property node as shown (for the Caption and Label: Caption>>Reference and Label>>Reference) 2930- while the context help is on, move over each of the items and read the help on it. 31- What is “Disabled Property” 32- This property writes or reads the user access status of an object. a value of 0 enables an object so a user can operate it. a value of 1 disables the object and the user cannot operate it.a value of 2 disables and dims the object. 33- let us practice the above: 34- create a numeric control on the front panel 35- on the block diagram create the following 36- change the constant to 0, then 1, then 2 and see how you can change control, cannot, and dimmed. 3738- The Key focus property: This reads or writes the key focus of a front panel object. When true, the cursor is active in the associate object. In most controls, you can enter values into the control when you type them on the keyboard. 39- create a numeric control on the front panel (in a new blank vi) 40- on the block diagram create the following 41- now on the front panel, you can change the numeric control values by typing them with keyboard 4243- Blinking Property: do the following in a new vi. When you run it, if the value chosen is less than 0, the numeric control will blink 44- Value Property: The value property writes or reads the current value of an object. When the value property is set to write, the value is written to an object no matter f the object is control or indicator .. this can be very useful in programmatically modifying a control value. likewise, if the value property is set to read, the value in the object is read from an indicator or a control. 45- let us write a numeric value to a control and read a string value and write it to another. 46- A constant value is written to a numeric control. The string in a control string is written to an indicator string 47- 4849- The Bound property: This property reads the boundary of an object on the front panel in the units of pixels. The value includes the control and all of its parts (including label, legend, scale, and so on..) the property consists of a cluster of two unsigned long integers width in pixels and height is pixels. This property is a read only 50- let us determine the bounds of a numeric control 51- in a new blank vi, create a numeric control 52- on the block diagram, create a bound property node, unbundle by name, connect indicators as shown. run it and see the dimensions. change the control size and run again. 53- 5455- Numeric Property – format and precision: Property Node>>Display Format>>All elements It sets the format – type of notation, and the precision – the number of digits displayed after a decimal point of a numeric front panel object. The input is a cluster of unsigned byte integers. 56- let us set the format to an SI notation and the precision to 5 digits. (note: floating point is 0, scientific is 1, SI is 2) I think ! – double check 5758- Property Node Practice -1 (complete it, save to demo to me) this will allow us to build a VI where some characteristics of front panel objects are manipulated. 1- build the following front panel VI 23- complete the following block diagram 45- This item: is found under “ color box constant” in functions palette>>dialog 6- for the tank property node, do the following: 7- create a property node>>ClassID, expand it to show three items (do not mind the heading here, for some reason when I copy and paste, the heading changes !) 89- now, use the operating tool, click on classID and select FillColor, click on the next item (OwingVI) and select position>>all elements, click on the last item and select Disabled 101112- now right click on the property node and select “ change all tow write” 1314- Run the VI and see some of the features. Graph and Chart Properties: one can use the property node to manipulate most graph features such as plot, background, grid colors, x,y scale info such as min, max, and increment, the legend whether visible or not, the size of the plot area, cursors, zoom. Let us take a graph and set the x-axis range from 10 to 110 with a major x-axis increments of 20 and a minor x-axis increments of 2. 12345- place a waveform graph on the front panel create a property node on the block diagram>>X Scale>>range>>all elements change to write right click on the input node to the property node and create constant modify the values and enter the text shown 67- run the vi 8- here is the resulting graph scale – just like wanted! 91011- Active cursor, cursor position, and cursor index properties set to read the active cursor, the position of the cursor on the graph, and the index (x-axis position) in the plot. The cursor position is a cluster of two floating point numbers representing x and y positions on the plot. 12- plot area property: to read or change the size of a graph. 13- let us practice resizing a graph to increase its width to 5 times and height to 3 times 1415- create a waveform graph on the front panel. size it to small 1617- complete the following on the block diagram 1819- run and notice the size change Property Node Practice -2 Temperature limit VI. This is to create a VI that clears waveform chart and then notifies the user whenever the data exceeds a limit. This is done using property nodes. 1- Download, uncompress, and open the temperature limit VI (UNSOLVED) found on my web site under LabVIEW items. Uncompressed it. (save it and open it with LabVIEW) There should be total of three Vis. Save in the application folder 2- open the block diagram 3- (Steps given below) Modify the VI so that the delta X value is set to the sampling rate and so it also clears the chart prior to start. During the acquiring of data, the VI should turn the high limit trace red whenever the temperature goes above the limit value. In addition, the out of range indicator should blink: a. create a property node for the temperature chart, and select as follows: i. x-scale>>offset-and multiplier>.multiplier ii. place in the sequence portion iii. expand to see another item in the property node iv. click in the second item, from the choices, pick the history data v. change all to write vi. in order to clear the chart, send an empty array of data to the history data property. right click on the history node and choose create constant. make sure the constants are empty vii. you should have this now viii. ix. in the case structure create a property node for the temperature chart and make sure it has two terminals: Create the Active Plot Property and the Plot Color Property x. Since the high limit plot is plot 1, set the active plot property to 1 before setting the plot color property. Send the color constant block to the Plot color property as shown: xi. 4- for the “False “ case, repeat – remember, connect the active plot property first, then the plot cooler property 5- the false case is shown below 67- Right click on the out of range LED and create the blink property (the LED will blink whenever the temperature is above the high limit) connect as shown 89- complete the sample rate limit in the sequence structure by connecting the divide output to the Xscale multiplier in the property node 10- save the VI as Temperature Limit.vi in your application folder. 11- Copy the thermometer VI you have created earlier in the course into the application directory. You may have to scale the values so that is works fine with this new vi. run the vi and confirm the operation. (note, this VI uses your thermometer vi you created earlier) make sure the random number multiplier is such a value that will allow the over the limit to occur every once a while.) Make sure this VI is in the same directory as the one you are to run. You may want to use the thermometer vi on my web site in case the one you had is lost or needs lots of work. run and enjoy