Electronics II Physics 3620 / 6620

16
06/14/22 1 Electronics II Electronics II Physics 3620 / 6620 Physics 3620 / 6620 Apr 29, 2009 Part 1 Projects, Formula Nodes, Error Handling Application Builder…etc.

description

Electronics II Physics 3620 / 6620. Apr 29, 2009 Part 1 Projects, Formula Nodes, Error Handling Application Builder…etc. Project Explorer. - PowerPoint PPT Presentation

Transcript of Electronics II Physics 3620 / 6620

Page 1: Electronics II Physics 3620 / 6620

04/19/23 1

Electronics IIElectronics IIPhysics 3620 / 6620Physics 3620 / 6620

Apr 29, 2009Part 1

Projects, Formula Nodes, Error Handling Application Builder…etc.

Page 2: Electronics II Physics 3620 / 6620

04/19/23 2

Project ExplorerProject Explorer• Instead of editing VI’s

and sub-VI’s separately and managing them by hand (one drawback is platform-independence), you can package VI’s and sub-VI’s into “projects”– New feature in Labview

8.0

– Project explorer similar to other “integrated development environment”

• Start new “project” from start menu Empty Project

Page 3: Electronics II Physics 3620 / 6620

04/19/23 3

Make Simple ProjectMake Simple Project• A “project explorer” window pops up (in the picture shown I

have already saved the project as “exa01.lvproj”– Either File Save– Or Project Save Project

• Project root—Contains all other items in the Project Explorer window. This label on the project root includes the filename for the project.

My Computer—Represents the local computer as a target in the project.

– Dependencies—Includes items that VIs under a target require.

– Build Specifications—Includes build configurations for source distributions and other types of builds available in LabVIEW toolkits and modules. If you have the LabVIEW Professional Development System or Application Builder installed, you can use Build Specifications to configure stand-alone applications (EXEs), shared libraries (DLLs) , installers, and zip files.

Page 4: Electronics II Physics 3620 / 6620

04/19/23 4

Project ExplorerProject Explorer• A “project explorer” window pops up (in the picture shown I

have already saved the project as “exa01.lvproj”– Either File Save– Or Project Save Project

• To add a “new” VI to the project:– Project Add To Project New VI

• This will pop up a front-panel + block diagram pair

• If you make a sub-VI remember to link the controls and indicators to the connector panel

Page 5: Electronics II Physics 3620 / 6620

04/19/23 5

ExampleExample

• subVI that converts Farenheit input temperature to Celsius and Kelvin outputs

• We demonstrate the use of a formula node in this case

• Note that formula nodes can also have conditionals

• Your cannot declare then input the variable

• You can but don’t need to declare the output variables

Page 6: Electronics II Physics 3620 / 6620

04/19/23 6

Error HandlingError Handling• Can add “if (…) { } else { } structure in

formula node• Can also use this feature to detect error

condition• Use Error Cluster from Error Code.vi

• Functions Programming Dialog & User Interface - Error Cluster from Error Code.vi

(also see others)

• Put both err-in and err-out onto the connector panel

Page 7: Electronics II Physics 3620 / 6620

04/19/23 7

Make “Main VI”Make “Main VI”• Add main VI that checks for error condition (Farenheit temp

below absolute zero…using the “simple error handler”• Stops the program if error condition met• Save and close both

Page 8: Electronics II Physics 3620 / 6620

04/19/23 8

Project FileProject File• We now open exa01.lvproj with “Wordpad” (or “Notepad”)• It is an Extensible Markup Language (XML) file

– See http://en.wikipedia.org/wiki/XML for a description– Can be edited by hand in an emergency

• This is the “GUI” equivalent of the old UNIX “Make” file

Page 9: Electronics II Physics 3620 / 6620

04/19/23 9

Adding Build SpecificationAdding Build Specification• We can specify a stand-alone application to be built

Notice the five different options

Page 10: Electronics II Physics 3620 / 6620

04/19/23 10

Application InformationApplication Information• Application Information Window pops up: modify/fill in the top three at least

Page 11: Electronics II Physics 3620 / 6620

04/19/23 11

Source FilesSource Files• Click on “Source Files in the window on left,

– Put the startup VI and supporting objects into the containers

• Click OK and then DON’T forget to save the Project.

Page 12: Electronics II Physics 3620 / 6620

04/19/23 12

Building the ApplicationBuilding the Application• From the project file, a “Test01” target should appear under the Build

specifications• Right Click on “Test01” Build will cause Test01.exe to be built• This file can now be run as a stand-alone application• According to NI, neither the base nor the student version of Labview has

the standalone applications builder (but projects are supported). Only the Professional Development Version has this built-in.

Page 13: Electronics II Physics 3620 / 6620

04/19/23 13

Other Build OptionsOther Build Options• Installers Provider -- installs applications, source files, and shared

libraries created with the Application Builder. The providers offers new features, such as Media Spanning to span the installer file over multiple disks, setting System Requirements, creating custom Registry Keys, creating shortcuts to files in the installation, specifying file attributes, including End-User license agreements and a Readme File.

• Shared Library (DLL) Provider -- creates a Dynamic Linked Library (DLL) allowing LabVIEW code to be called from text-based programming languages. Developers must define the function prototypes for each of the exported VIs. 

• Source Distribution Provider -- allows the user to organize source files for distribution to another machine. It creates a copy of the project files (including the dependencies) for easy distribution to another computer. This feature is similar to “Save with Options” from previous versions of LabVIEW.

• Zip File Provider -- creates a compressed Zip file, containing the selected sources files.  It allows you to distribute a large amount of code as a single, portable file.

Page 14: Electronics II Physics 3620 / 6620

04/19/23 14

NI Recommendations and CAVEATSNI Recommendations and CAVEATS• Create a separate directory of files for each project you create. Include the project

file (.lvproj) and any other files that are only used in the project in the same directory. Place any files that are shared with other projects outside of the project directory. Organizing project files into separate directories makes it easier to identify files related to specific projects on disk.

• Directories on disk are not required to match the project structure of folders. After you add a directory on disk to a project, LabVIEW does not automatically update the folder in the project if you make changes to the directory on disk.

• Try to avoid changing the location on disk of files in a project. If you move a file on disk, you must update the location of the file in the project.

• Windows: If you are building an installer, make sure you save the files that are in a project on the same drive as the .lvproj file. If some files are on a different drive, such as a network drive, links can break if you include the project in an installer.

• The structure of files in a source distribution does not have to match the structure in the Project Explorer window. You can specify a different structure when you build source distribution.

• If you plan to edit files that appear under Dependencies, move the files from Dependencies to under the target. Items that a VI calls dynamically do not appear under Dependencies. If you plan to distribute files, add any items that a VI calls dynamically under a target. When you build an application, you can apply settings to an entire folder, so consider grouping all dynamic items in a folder under the target.

Page 15: Electronics II Physics 3620 / 6620

04/19/23 15

Building a ZIP file for distributionBuilding a ZIP file for distribution• To build a zip file for distribution, right click build-spec. New ZIP file• Window pops up…you should set the title and the path

– Here I put the .zip file in the same folder as the exa01 filder containing the project itself

Page 16: Electronics II Physics 3620 / 6620

04/19/23 16

Building a ZIP file (continued)Building a ZIP file (continued)

• Do nothing with “source” files…• Go to “Preview”, click on “Generate Preview” button• You now see a preview of the directory/folder tree that will be generateed• Click OK to exit, and a zip file icon will appear• Right-Click the zip file entry and select build…this will create the zip file• This zip file will be posted along with this representation