VT 3

From DIDEAS Wiki
Revision as of 13:15, 23 April 2015 by Ceb (talk | contribs)
Jump to: navigation, search

GUI_5 (1st release) Version string $Id: gui_5.m 80 2015-04-20 19:07:18Z brainfog $

All VT Documentation : GUI_3 (1st), GUI_3(2nd), GUI_5


Changes

The new tool is 'gui_5' and represents a new approach to specification of which data is plotted. The 'Variable Chooser' is eliminated (replaced with 'Variable List', the number of subplots and their content is defined in a configuration file. The config file also allows filters to specified for saving of variables, and those displayed in the 'Variable List'.

Other changes include:

  • Functionality of the SAVE button is split to 'SAVE DAF' and 'SAVE GUI'. The 'SAVE DAF' button will save the content of the DAF variable as specified in [SAVE_FIELDS] section of the config file. The 'SAVE GUI' will make a PNG snapshot of the current plot figure.
  • The base filename of the save buttons changed be changed in the SAVE edit box.
  • Saved DAF and GUI files have the current date and time appended to the filename.
  • Alternative config files may be loaded by changing the name in the CFG edit box.
  • GUI PAUSE and DATA PAUSE buttons renamed to 'G PAUSE' and 'D PAUSE'.
  • 'G PAUSE' button now pauses the update of the display.
  • Horizontal position slider eliminated. Instead, similar behavior can be obtained by pausing the display and using the Matlab zoom and pan controls [1]. Before pausing, the timebase width may be increased to allow a greater range of panning.



Starting Tool (gui_5) for TCP/IP Operation

The new tool is started in the same way as gui_3, except that the name is now 'gui_5'.

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 name of the instrument. Assume its 192.168.7.2
  • Within MATLAB, run the command : gui_5('connect', '192.168.7.2')


Note : Later variations of gui_5a() and gui_5b() are also available.

Config File

The file config_g5.txt is read at startup and can be re-read during VT operation by pressing the 'CFG' button. The name of an alternative config file can be specified in the edit box adjacent to the CFG button. The config file format is that of an 'INI file' [2].

Section [SUBPLOT_]

Sections names that start with 'subplot_' will cause the creation of a subplot within the plotting figure. The content after the _ must be unique, but otherwise is ignored. At least one [SUBPLOT_] section must be present.

Within the subplot section, pairs of keyword and values pairs maybe defined. At present the following are processed:

  • fields : A comma separated list of field names to appear in the subplot
    • Note : a fields option required
  • ylim = [ymin, ymax] : Sets the Y-axis limits to ymin, ymax. If absent, auto ranging is used.
  • title = <string> : Sets the title for the subplot

Gui_5b adds additional keyword value pairs:

  • xlabel = <string>: text to display as the X-axis label
  • ylabel = <string>: text to display as the Y-axis label
  • linespec = <string> : Control the appears of traces in the subplot. Either a single linespec (applied to all traces) or a command separated list. Mathworks explanation of linespec
  • grid  : add grid lines to subplot
  • legend  : add a legend to the subplot. The legend significantly increases the time to render a new frame.

Context Menu

Starting with gui_5b ($Id: gui_5.m 88 2015-04-22 19:21:47Z brainfog $), display of a legend in the subplot is optional. To add in the identification of the variable being plot, right clicking on a trace will display the fieldname.


Section [SAVE_FIELDS]

Within this section, field names or field name patterns can be listed, and only those will be save when selecting the 'SAVE DAF' button.

If the special keyword '_ACTIVE' is included in this section, then only fields that have data will be saved.


Section [VARLIST_FIELDS]

The 'Variable Chooser' is replaced with the 'Variable List', and identically looking popup box that lists the names of variables (fields). However, selecting fields within the 'Variable List' has no effect. The purpose of the 'Variable List' is to be an aid when editing the config file.

Within this section, field names or field name patterns can be listed, and only those will be shown in the popup.



example config file

# This line is a comment.

[Subplot_1]
fields = Valve_in_td, Valve_in_ad, Valve_in_hs1
ylim=[-20,60]
title = Valve values

[subplot_2]
fields = Valve_in_pd, Valve_in_fd, Valve_in_td


[VARLIST_FIELDS]  # patterns listed here will be in the varlist
Valve*
# iCore_in*

[SAVE_FIELDS]  # ability to limit capture to active fields and those listed  took more than 60 seconds when saving everything...
_active 
Valve*

Command Line Tools

The vtsave command line tool was introduced with Gui_5.

vtsave : save data

function <field_list> = vtsave(filename, <match_pattern_1>,...<match_pattern_n>)
 
 Flatten and save all or specified fields of the global 'daf' object into 'filename'
 while allowing the VT to continue operating.

 The optional arguments <match_pattern_n> select which fields should be
 saved with support for wildcard matching.
 See https://docs.python.org/2/library/fnmatch.html

 If optional arguments are absent, then all fields are saved.
 
 If an match_pattern contains the string '_ACTIVE' then only active fields
 (fields with data) are saved.

 If any argument contains 'VERSION', then the version is displayed and the
 function immediately exits.

 Returns a cell array of strings containing the names of the fields saved.


 Example, save everything :

 vtsave('my_file');  

 Example, display version :
 vtsave('VERSION')

 Example, save only active Valve fields that end in d or anything ending in _ba
 vtsave('my_file', 'valve_*d', '*_ba', '_ACTIVE')

User Adjustments

There are constants in the gui_5.m file that might need adjusting depending on needs and use case.

Default filenames

Line define the default base filenames for the configfile and for files used to save data.

 27 DEFAULT_CONFIG_FILE = 'config_g5';  % no extension
 28 DEFAULT_SAVE_FILE = 'gui5'; % no extension


Frame Rate / Command Line Responsiveness

The frame rate (interval) is set on line 37 and defaults to 0.1 seconds. If the Matlab command prompt is not responsive enough, increase it.

 37 DISPLAY_UPDATE_INTERVAL = 0.1;  %   delay between completion of frame update and start of next one

In Memory Data Storage

Currently upto 60k data samples are stored in each channel. As more are added, the old ones are lost. Thus at 1000 samples per second, only 1 minute of data is retained. But at lower rates, it'll be much longer.

The constant is set on line 31:

 31 DATA_ACCUMULATOR_MAX_LENGTH = 60000;