labview programming

labview programming

labview programming

Recently we have a tendency to tend to were asked by users at several European universities concerning the thanks to call the NAG Library from within the favored LabVIEW programming atmosphere. they're interested in doing this as a results of they wanted to supplement the utility of their LabVIEW applications practice variety of the numerical routines offered by NAG. we have a tendency to tend to possess already got some preliminary material on our information processing system that describes several aspects of practice the NAG algorithmic language Library in LabVIEW, but varied approaches (which is also viewed by some as reflective extra trendy programming paradigms like object orientation) are also possible. Specifically, we’ve been taking a look at job routines from the NAG Library for .NET from LabVIEW, which we have a tendency to describe variety of this work labview programming .


We begin building a LabVIEW application by creating a blank virtual instrument (VI) practice, as an example, the Blank VI selection on LabVIEW’s getting Started splash screen. This brings up two windows: a front panel and a diagram. the previous contains the pc programme of the VI that the user creates practice controls and indicators, each of that's chosen from a palette of selections. Code to control the objects inside the front panel is further by the user to the block diagram; this will be a manifestation of LabVIEW’s visual programming paradigm, that sees associate application as being created from a group of nodes that unit of measurement connected on in associate degree extremely means reflects the flow of knowledge between them.


Our simple example application is built around the NAG technique g01aa, that calculates the mean, variance and varied completely different maths quantities from a bunch of ungrouped data (details concerning the documentation for the NAG Library for .NET is obtainable here, whereas the documentation for the g01aa routine inside the NAG algorithmic language library is here). To load the maneuver, we have a tendency to tend to first refer the Functions Palette, practice the selection on the scan menu on the diagram window. Next, we have a tendency to tend to open the property assortment from the palette, then the .NET item. This palette contains a diffusion of functions for creating .NET objects, setting properties or job ways on those objects. we have a tendency to tend to settle on the Invoke Node item – that invokes ways or performs actions on associate object – and drag it onto the diagram thus on initialize itlabview programming .


To specify the class on it to execute the property, we have a tendency to tend to right-click on the node and select select class >> .NET >> Browse.... This brings up the select Object From Assembly panel. If the NAG Library is not listed inside the Assembly component, then we have a tendency to discover it (typically in associate degree extremely location like C:/Program Files/NAG/NAG Library for .NET/) practice the Browse... component, choosing either NAGLibrary32.dll or NAGLibrary64.dll, reckoning on our machine style. Double-clicking on the NagLibrary item inside the Objects component on the panel then shows the objects that unit of measurement accessible throughout this assembly; in our example we have a tendency to tend to settle on G01, followed by alright to load it into the Property Node. to select the desired technique from within the G01 class, we have a tendency to tend to right-click everywhere once more on the node and select turn out >> technique for NAGLibrary.G01 class >> g01aa (note that the items on the maneuver menu expressly show the perform argument list, beside the .NET types; they’re put together prefixed with [S] if they’re a static .NET method). This creates a node admire a latest instance of the g01aa technique inside the diagram (see figure 1).


Figure 1. The g01aa technique inside the LabVIEW diagram


The next step in building our demo is to feature LabVIEW controls and indicators to handle, severally, the input and output of our application. These get placed on the front panel and corresponding objects appear on the diagram, where they’re then connected to completely different objects to specify the flow of knowledge and management through the program. In our application (see figure 2), we have a tendency to tend to use a Numeric Indicator to point out each output quantity from g01aa, associated a Numeric management within associate degree Array shell management to allow the user to enter info} values that the routine will calculate the statistics (see here for extra data on creating and practice array controls in LabVIEW).