VT 1

From DIDEAS Wiki
Revision as of 14:53, 28 March 2015 by 1027 (talk | contribs) (Command Line Interface)
Jump to: navigation, search

Visualization Tool


Installation

The tool is known to operate under Windows (64 and 32 bits) and MAC OS systems.

  • At present, MATLAB 2014b or later is required. Versions prior to 2014b do not support the direct interface with python utilized by the VT.
    • In the future, a compiled version of the VT may exist.
  • Python 2.7.9 [1]. Choose the same number of bits as the version of MATLAB (python support under MATLAB requires that the 'bits' match)
  • The Tool lives in the repository Master Branch at the location \Tools\Matlab
    • Pull into a convenient directory (referred to as VT_HOME). To run the tool, this will need to be MATLABs current directory.
  • Optional : For direct connection a UART device, or to a PSoC using the USB CDC profile, the pyserial module is required and the Cypress USBSER driver are required. USBSER instructions are possibly specified in the repository Master Branch under the Documentation directory.
    • The easy install is to open a command prompt or terminal window and type pip install pyserial
    • If the pip command is unknown, then its likely not in your path. It typically lives in c:\Python27\Scripts, in which case you may run c:\Python27\Scripts\pip install pyserial
    • For 64 bit windows, if there is a problem with the pip install, another trusted source is the team at UCI : pyserial‑2.7‑py2‑none‑any.whl


Starting Tool (gui_3) for TCP/IP Operation

Start MATLAB 2014b+ and then cd to the VT_HOME directory. Under Windows you may wish to create a MATLAB shortcut where VT_HOME the startup directory.

  • You'll need to know the IP address or host names of the instrument. Lets assume its 192.168.7.2
  • Within MATLAB, run the command : gui_3('connect', '192.168.7.2')


The Tool GUI and Command Line Interface

The tool may be interacted with both graphically and via the MATLAB command line.

Graphical Interface

Upon startup if the connection is successful, two MATLAB figures will be created. The plotting figure by default is docked with MATLAB and the Variable Chooser is floating.

The variables to be plot are selected by (left) clicking their name within the Variable Chooser figure. Multiple variables are selected by using SHIFT click and/or CTRL click.

The Plot Figure contains several buttons (lower left) and two sliders (bottom).

buttons

  • STOP : Clicking this button is the preferred way to stop the Tool. The two figures and connection will be closed.
  • GRAPH*** : Pause / Resume the update of the graphic display. In the background, data from the instrument is collected. (At
  • DATA : Sending a command to the instrument to stop or start sending data. After stopping and restarting, the graph will typically contain an empty space for the stopped time interval.
  • SAVE : Save a snapshot of the GUI and the instrument data within the 'data accumulator circular queue' variables. The snap shot may require many seconds (a minute?) during which time, current data from the instrument may be lost. This data structure maintains the most recent DATA_ACCUMULATOR_MAX_LENGTH (currently 480,000) samples from each field.
  • LOG and edit box: When LOG 1, all plotable vectors sent from the instrument are save into a sqlite3 database (on the local file system). The base filename for the SQL DB is specified in the edit box. The base file name is extended with current date and time and the extension .sqlite3 (eg The gxlog_20150328_093407.sqlite3)

*** At present the pause/resume button behavior is broken.

sliders

The sliding controls at the bottom are still under development and have broken the graphic pause feature. The sliders themselves are also somewhat working / broken depending on one's expectations.

  • Viewport width slider : The left slider controls the viewport window size. The control linear position (x) specifies an 10^x seconds viewport size. The limits are 1 second and 1000 seconds. This slider operates as expected, although the initial position does not match the actual viewport.
  • Viewport position slider : The larger right slider control the start position of the viewport within the complete set of captured samples with left the oldest data. Ideally moving the slider from the right position would pause the graph at that position, however instead the graph continues to scroll at a reduced by moving it to the right.


Command Line Interface

The MATLAB command line may be used to control several features of the tool and instrument. The primary means of command line control is via a variable 'mc' which is a python object (from client.py named matlab_client). Some of the methods of interest:



  • mc.help(); : List the commands from the command dictionary. This table contains the command, the minimum and maximum number of arguments, a field name for each argument, the data type of the argument list (as a python struct format string), and a description of the command.
  • mc.send_user_command_string(string); : eg mc.send_user_command_string('icore_datarate 100'); Command strings consist of a COMMAND (digits without intervening whitespace or punctuation) followed by and optional set of 1 or more whitespaces and a comma separated list of values. Value types must be consistent with the underlay argument type.
  • mc.stop_data_stream();  : send the GX message to stop sending data
  • mc.start_data_stream(); : send the GX message to start sending data


Access to the data on the MATLAB command line is via the 'daf' (data accumulator fields) and 'da' (data accumulator) variable.

For obtain the 'fd' data with : daf.iCore_in_fd.get()


A user command is sent via the matlab command line. The object 'mc' (matlab client) contains the methods. Some of which are:


Also, I've created a file called: live_data_test.m

Which will access the live data in 'daf' and plot it at 5Hz. Of course, calculations could be performed on the data before plotting.

Bugs / Issues

  • When the 480k sample buffer fills, the current (unreleased) tool crashes. The released too may also.
  • When the data dictionary contains the L data type (unsigned long), values between 2^31 and 2^32-1 cause the tool to crash.
  • Fix right slider behavior. Moving slider from extreme right will cause a pause
  • Selecting pause will adjust position of right slider slightly left. Selecting resume will move the slider to the extreme right.
  • Fix initial values of the sliders


Features To Be Added

  • Ability to save / load a configuration file.
  • Ability to display a description string (units) at either the title or y-axis. The description string could be placed in either the vector dictionary, or the configuration file.
    • The config file will contain the set of selected variables and any other user made interface adjustments (most of which to be developed)
  • Ability to specify the Y axis limits. Each subplot to contain a micro-control to enable/disable AUTO axis
  • Improve Variable chooser variable display. Explorer +- nesting is not possible, but indenting the fields of each vector is. The activity level of each vector to be display.
  • When paused, the X-axis of all subplots optionally linked allowing the MATLAB toolbar pan and zoom to operate.
  • Ability to load saved data from VT created .mat files and sqlite3 databases
  • Ability to place multiple fields within a single subplot
  • Ability to change the X-axis variable
  • Multiple plot figures
  • Ability to stream from a local / remote SQL server/database
  • Ability to send commands from the plot figure
  • Simplify startup allowing the GUI to list / select the instrument connection