VT 3

From DIDEAS Wiki
Revision as of 19:40, 20 April 2015 by Ceb (talk | contribs) (Created page with " Previous release Documentation : VT_1 VT_2 <strong>Preliminary documentation for VT_3, the Visualization Tool revision $Id: gui_5.m 80 2015-04-20 19:07:18Z brainfog...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Previous release Documentation : VT_1  VT_2

Preliminary documentation for VT_3, the Visualization Tool revision $Id: gui_5.m 80 2015-04-20 19:07:18Z brainfog $


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'.

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


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' [1].

'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.


The config file must have a section that begins with 'subplot_'

  • selected : any variable listed in this section will be automatically selected when the config file is read.
  • axis_limits : a list of key=value pairs where the key is the variable name and the value is a 2 element vector that specifies that minimum and maximum y-axis. Variables listed in this section are also selected by default.



[selected]
# these variables are selected 
Valve_in_td
Valve_in_ad
Valve_in_hs1

[axis_limits]
# specify axis limits and select the variables
Valve_in_pd=[-51,40]
Valve_in_fd=[2,5]
Valve_in_vd=[1,10];

Note : the section names should be lower case, however case of the variables is ignored.

Support for grouping variables is forthcoming.

ucmd : send user commands to instrument

 Convenience function to send commands to instrument using the global 'mc'
 object and its method send_user_command_string()
 
 example:
 ucmd('data_interval 1');
 ucmd('help');


 If an output argument is present, upon success returns 0
 on error returns a negative value

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 allowed the VT tool 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.

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



Other changes / fixed issues

  • Default buffer size is 60,000 samples (per field)
  • added support for config file (config.txt) that axis limits to be specified and pre-selects variables. Is read automatically and when CFG button pressed.
  • create Matlab convenience function ucmd.m to send user command. See help ucmd
  • major rewrite/expansion of pre-gui testing of Matlab - python compatibility and python setup. (check that bits match, directory is correct, etc)
  • correct use of default TCP port (10000) when not specified.
  • update help contents for many of the Matlab files/functions
  • fixed crash on data_accumulator wrap
  • remove unused files / non-source files from repo


USER ADJUSTMENTS

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

Frame Rate / Command Line Responsiveness

  • The frame rate is set on line 67 and defaults to 20 FPS. If the Matlab command prompt is not responsive enough, reduce it. A frame rate of 5 to 10 FPS is probably a better choice.
 67 FRAME_RATE = 20;  % frames per second

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 27:

 27 DATA_ACCUMULATOR_MAX_LENGTH = 60000;


Default Config File

The default / example config file may have defined axis limits for the Valve. You might need to edit them with :

 edit config.txt


Default config file:

[selected]
# these variables are selected at startup
Valve_in_td
Valve_in_ad
Valve_in_hs1


[axis_limits]
# specify axis limits and select the variables at startup
# remove comment to enable, or add your own
Valve_in_pd=[-51,40]
Valve_in_fd=[2,5]
Valve_in_vd=[1,10];