Neatware Header
Home   Products   Forums   Partners   Buy   Company   Contact   Blog   

LabVIEW

LabVIEW is a graphical development environment for data acquisition, analysis, and presentation from National Instruments. There are thousands LabVIEW drivers and VI (Virtual Instruments) available for different instruments and interfaces.

Moreover, LabVIEW provides ActiveX Automation that allows other programs such as Tcl scripts developed under MyrmecoX to use and control the LabVIEW VI for advanced users.

In MyrmecoX we can use Tcl script to control the initialization and executation of a LabVIEW VI. This can help us to do the simulation of manipulative operations and the regression testing. Furthermore we can retrive and store data from VI to do post-processing.

  1. Application Integration

    Enterprise Application Integration (EAI) allows programmers to use software from different environments. For example, one package uses LabVIEW or C to acquire data from a DA card, another Tcl package sends data to SQL database.

    Since LabVIEW provides the support of ActiveX automation, a Tcl package can invoke the properties and methods of the LabVIEW application and VI, and use SQLite package and other packages in MyrmecoX to handle the data. So MyrmecoX can integrate applications of LabVIEW, C, and Tcl.

  2. Share Data

    A Tcl client can read or write data on the LabVIEW server. This avoids the cost of data transferring through files. By using Memory Mapping File (MMF) different Tcl client process can share data in memory.

  3. ActiveX Automation

    ActiveX automation allows users send commands and data to different applications using a single format by invoking methods and getting or setting properties. An automation client may connect to an automation server, transfer data, and access methods and properties.

    Tcl scripts in MyrmecoX access LabVIEW VI through its ActiveX Server. An Application object exports the properties of LabVIEW. From this Application object, a VI object is refered to export the properties and methods of a VI. By using these properties and methods developers can use other runtime libraries such as database, testing. and GUI packages of MyrmecoX to complete real-time control and processing along with LabVIEW.

    #
    # LabVIEW Automation by MyrmecoX
    #
    
    package require myrmecox
    
    #
    # open LabVIEW application and bring to front
    #
    
    set lv [::tcom::ref createobject "LabView.Application"]
    
    #
    # launch "Frequency Response.vi" in freqresp libaray
    #
    
    set folder [$lv ApplicationDirectory]
    set path [file join $folder examples apps freqresp.llb \ 
                "Frequency Response.vi"]
    set vi [$lv GetVIReference [file nativename $path]]
    
    #
    # open front panel window in the center
    #
    
    $vi FPWinOpen True
    $vi FPAutoCenter True
    
    #
    # creates parameter list defined in the vi
    #
    
    set names [list "Amplitude" "Number of Steps" "Low Frequency" \ 
                    "High Frequency" "Response Graph"]
    
    #
    # builds value list with variable initial values
    #
    
    set values [list 1 100 1 10000 10]
    
    #
    # run vi with values
    #
    
    $vi Call names values
    
    #
    # close application
    #
    
    $lv Quit
    
  4. Application Object

    Application object exports the properties of LabVIEW. In MyrmecoX an Application object livew is created by

    set lv [::tcom::ref createobject "LabView.Application"]
    

    Below we suppose $lv is the application object.

    • $lv AllVIsInMemory returns the lists all the VIs in memory.
    • $lv AppDefltDataLoc [path] gets or sets the path of LabVIEW default data directory.
    • $lv AppKind returns the installed LabVIEW package on the computer.Where 0 is Invalid application kind; 1 is Development System, including the Base Package, Full Development System, or Professional Development System; 2 is Run-Time System; 3 is Student Edition; 4 is Embedded System, including LabVIEW Real-Time; 5 is Evaluation version; 6 is Custom version.
    • $lv ApplicationDirectory returns the absolute path of the application directory.
    • $lv AppName return the filename of the application executable file.
    • $lv AppTargetCPU returns the target CPU of the application.
    • $lv AppTargetOS returns the target operating system for the application.
    • $lv AutomaticClose [boolean] specifies whether the application closes when all the references to it are released. default is true.
    • $lv CmdArgs returns command-line arguments passed when LabVIEW launched.
    • $lv ExportedVIs returns a list of exported VIs in memory.
    • $lv Language returns the language used as a two letter string according to ISO 3166.
    • $lv OSName returns name of the operating system.
    • $lv OSVersion returns the version number of the running operating system.
    • $lv RTHostConnected for non real-time (RT) platform, this property is always true..
    • $lv ShowFPTipStrips [boolean] true value enables the display of tip strips on front panel controls.
    • $lv UserName sets user name used to open the application.
    • $lv Version returns version number of the application.
    • $lv VIServerPort [long] gets or sets the LabVIEW VI server port.

    There are lots of Print properties available as well, you may refer them in the LabVIEW help documents in more details. Following code clip accesses the propteries of the LabVIEW application.

      array set app_prop   [list \ 
        AppDefltDataLoc       [$lv AppDefltDataLoc] \ 
        AppKind               [$lv AppKind] \ 
        ApplicationDirectory  [$lv ApplicationDirectory] \ 
        AppName               [$lv AppName] \ 
        AppTargetCPU          [$lv AppTargetCPU] \ 
        AppTargetOS           [$lv AppTargetOS] \ 
        AutomaticClose        [$lv AutomaticClose] \ 
        CmdArgs               [$lv CmdArgs] \ 
        ExportedVIs           [$lv ExportedVIs] \ 
        Language              [$lv Language] \ 
        OSName                [$lv OSName] \ 
        OSVersion             [$lv OSVersion] \ 
        RTHostConneted        [$lv RTHostConnected] \ 
        ShowFPTipStrips       [$lv ShowFPTipStrips] \ 
        UserName              [$lv UserName] \ 
        Version               [$lv Version]]
      
  5. Virtual Instruments Object

    You can get a VI object by call application object with the vi file name.

    set vi [$lv GetVIReference $path]
    

    Suppose vi is the VI object

    Properties

    • $vi AllowDebugging [boolean] allow debugging if it is true.
    • $vi BDModificationBitSet returns the modifications made to the block diagram since the VI has been saved or opened, depending on which was last.
    • $vi BDSize returns the size of the block diagram in bytes.
    • $vi Callees returns all the subVIs or callees.
    • $vi Callers returns a list of all the loaded VIs that call the referenced VI.
    • $vi CloseFPAfterCall [boolean] close the front panel after the VI runs if boolean is true.
    • $vi CodeSize returns VI code size in bytes.
    • $vi DataSize returns VI data size in bytes.
    • $vi Description [string] VI description that appears in the Context Help window.
    • $vi EditMode [boolean] VI opens in edit mode if boolean is true.
    • $vi ExecPriority VI priority when it runs in parallel with other tasks. With 0 as Invalid priority, 1 as Background, 2 as Normal, 3 as Above normal, 4 as High 5 as Critical, 6 as Subroutine.
    • $vi ExecState returns the execution state of the VI. With 0 as VI has errors, it cannot run. eIdle; 1 as VI is not running, but the VI is in memory; 2 as VI is running as a top-level VI; 3 as VI is running as a subVI.
    • $vi ExpandWhenDroppedAsSubVI [boolean] expands to show terminals when dropped as a subVI.

      Front Panel

    • $vi FPAllowRTPopup [boolean] display shortcut menus for front panel objects.
    • $vi FPAutoCenter [boolean] centers the front panel window on the computer screen.
    • $vi FPBehavior [long] sets the behavior of the front panel window. Valid values are 0 (Invalid), 1 (Default), 2 (Floating), 3 (Floating/Auto-Hide), and 4 (Modal).
    • $vi FPHiliteReturnButton [boolean] highlights Boolean controls that have a shortcut key of .
    • $vi FPKeepWinProps [boolean] front panel window adjusts its size to fit the monitor resolution.
    • $vi FPMinimizeable [boolean] the user can minimize the front panel window.
    • $vi FPModificationBitSet Indicates whether changes were made to the front panel since the VI was saved.
    • $vi FPResizable [boolean] user can resize the front panel.
    • $vi FPShowMenuBar [boolean] display the menu bar on the front panel.
    • $vi FPShowScrollBars [boolean] show to scrollbars.
    • $vi FPSize return the size of the front panel in bytes.
    • $vi FPSizeToScreen [boolean] automatically resize the front panel to fit the screen.
    • $vi FPState returns current state of the front panel window.
    • $vi FPTitleBarVisible [boolean] display a title bar on the front panel.
    • $vi FPWinBounds [list] specifies the bounds as a list of top, left, bottom, and right values of the front panel window, which includes the interior region, scrollbars, title bar, menu bar, and toolbar.
    • $vi FPWinClosable [boolean] disables the close button in the title bar and the Close item in the File menu.
    • $vi FPWinCustomTitle [boolean] removes custom title string when boolean is false.
    • $vi FPWinIsFrontMost [boolean] brings the front panel to the front if true.
    • $vi FPWinOpen [boolean] opens the front panel.
    • $vi FPWinOrigin {upper left} the front panel interior portion that is in the upper-left corner.
    • $vi FPWinPanelBounds {top left bottom right} specifies the bounds of the interior portion of the front panel,
    • $vi FPWinTitle returns title bar string.

      Help

    • $vi HelpDocumentPath path to an HTML/Help file (.htm.html)/(.chm or .hlp).
    • $vi HelpDocumentTag index keyword or HTML filename for a topic in the compiled help file.

      History

    • $vi HistAddCommentsAtSave [boolean] adds a comment to the VI revision history every time the VI is saved.
    • $vi HistoryText returns all the text in the VI revision history.
    • $vi HistPromptAtClose [boolean] prompts for a VI revision history comment when the VI closes.
    • $vi HistPromptForCommentsAtSave [boolean] prompts for a VI revision history comment when the VI is saved.
    • $vi HistRecordAppComments [boolean] adds comments to the VI revision history when certain events occur.
    • $vi HistUseDefaults [boolean] uses the global default history or uses the values in other history properties.
    • $vi IsReentrant returns true if a VI can be reentrant.
    • $vi LogAtFinish [boolean] writes front panel values to a datalog file after the VI runs.
    • $vi LogFilePath [path] gets or sets path of the datalog file in which front panel data and a time stamp are written.
    • $vi Name returns the VI filename.
    • $vi Path returns the VI file path.
    • $vi PreferredExecSystem returns the execution system. With 0 as Invalid execution system; 1 as User interface; 2 as Standard; 3 as Instrument I/O; 4 as Data acquisition (DAQ); 5 as Other 1; 6 as Other 2; 7 as Same as caller.

    • $vi RevisionNumber returns VI's current revision number.
    • $vi RunOnOpen [boolean] opens and runs VI.
    • $vi RunTimeMenuPath returns the run-time menu path of the VI.
    • $vi ShowFPOnCall shows the front panel on call.
    • $vi ShowFPOnLoad shows the front panel on load.
    • $vi SuspendOnCall suspends VI when call it as a subVI.
    • $vi TBShowAbortButton [boolean] display the Abort Execution button in the toolbar.
    • $vi TBShowFreeRunButton [boolean] display the Run Continuously button in the toolbar.
    • $vi TBShowRunButton [boolean] display the Run button in the toolbar.
    • $vi TBVisible [boolean] display the toolbar.
    • $vi VIModificationBitSet returns the modifications made to the VI settings.
    • $vi VIType returns the type of the VI. With 0 as Invalid VI type; 1 as Standard VI; 2 as Control VI; 3 as Global VI; 4 as Polymorphic VI; 5 as Configuration VI.

    Methods

    • $vi Abort aborts the VI execution.
    • $vi Call [paramName paramVals] calls the VI as a subVI.
    • $vi Call2 [paramName paramVals bOpenFP bCloseFPAfterCall bSuspendOnCall] calls the VI as a subVI with parameters.
    • $vi CloseFrontPanel closes the front panel window.
    • $vi ExportVIStrings stringFile [bInteractive logFile] exports strings about VI and front panel objects to a tagged text file. sets bInteractive as true to prompt a dialog box.
    • $vi GetControlValue controlName gets the value of the named control.
    • $vi GetLockState returns the lock state of the VI and indicates whether the password for the VI is in the password cache.
    • $vi GetPanelImage [visibleonly] [imgdepth] [img] [colors] [bounds] Returns an image of the front panel.
    • $vi ImportVIStrings stringFile [bInteractive logFile] imports strings about VI and front panel objects from a tagged text file.

    • $vi ReinitializeAllToDefault sets the current values of all the controls on the front panel to their defaults.
    • $vi Revert discards changes and reloads the VI from disk.
    • $vi Run executes VI.
    • $vi SaveForPrevious path [warrning] saves a copy of the VI for LabVIEW 6.1 readable.
    • $vi SaveInstrument viPath bSaveACopy bWithoutDiagram saves a VI.
    • $vi SaveRunTimeMenu filePath saves the run-time menu to filePath file.
    • $vi SetControlValue sets the value of the named control or indicator with flattened data.
    • $vi SetLockState lockState [bInteractive password bPutInCache] sets the lock state of a VI. lockState can be 0 as Invalid VI lock state; 1 as Unlocked; 2 as Locked, no password; 3 as Password-protected.
    • $vi SetVIIcon imageFile sets the image of a VI icon from a file.

      There are print methods available.

  6. Exposure of ActiveX Server

    You need to exposure LabView Application and VI to use the LabVIEW ActiveX server.