Difference between revisions of "VT 3"

From DIDEAS Wiki
Jump to: navigation, search
(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...")
 
m
Line 18: Line 18:
 
The file <strong>config_g5.txt</strong> 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' [https://docs.python.org/2/library/configparser.html].   
 
The file <strong>config_g5.txt</strong> 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' [https://docs.python.org/2/library/configparser.html].   
  
==='SUBPLOT_'===
+
===<nowiki>[SUBPLOT_]</nowiki>===
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.
+
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 <nowiki>[SUBPLOT_]</nowiki> 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
 +
* 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
  
  
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.
+
===<nowiki>[SAVE_FIELDS]</nowiki>===
*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.
+
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.
  
  
 +
===<nowiki>[VARLIST_FIELDS]</nowiki>===
 +
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===
  
 
<pre>
 
<pre>
[selected]
+
[Subplot_1]
# these variables are selected
+
fields = Valve_in_td, Valve_in_ad, Valve_in_hs1
Valve_in_td
+
ylim=[-20,60]
Valve_in_ad
+
title = Valve values
Valve_in_hs1
 
  
[axis_limits]
+
[subplot_2]
# specify axis limits and select the variables
+
fields = Valve_in_pd, Valve_in_fd, Valve_in_td
Valve_in_pd=[-51,40]
 
Valve_in_fd=[2,5]
 
Valve_in_vd=[1,10];
 
  
</pre>
 
  
Note : the section names should be lower case, however case of the variables is ignored.
+
[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*
  
Support for grouping variables is forthcoming.
 
  
==ucmd : send user commands to instrument==
+
</pre>
  
  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==
 
==vtsave : save data==
  
  function <field_list> = vtsave(filename, <match_pattern_1>,...<match_pattern_n>)
+
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'
 
   Flatten and save all or specified fields of the global 'daf' object into 'filename'
Line 76: Line 78:
 
   
 
   
 
   If optional arguments are absent, then all fields are saved.
 
   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 immediatly exits.
 
   
 
   
 
   Returns a cell array of strings containing the names of the fields saved.
 
   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 ==
  
=Other changes / fixed issues=
+
Line define the default base filenames for the configfile and for files used to save data.
*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
 
  
 +
  27 DEFAULT_CONFIG_FILE = 'config_g5';  % no extension
 +
  28 DEFAULT_SAVE_FILE = 'gui5'; % no extension
  
=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==
 
==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.
+
The frame rate (interval) is set on line 37 and defaults to 0.1 seconds.  If the Matlab command prompt is not responsive enough, reduce it.  
  
   67 FRAME_RATE = 20;  % frames per second
+
   37 DISPLAY_UPDATE_INTERVAL = 0.1;  %   delay between completion of frame update and start of next one
  
 
==In Memory Data Storage==
 
==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.
 
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:
+
The constant is set on line 31:
 
 
  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:
+
  31 DATA_ACCUMULATOR_MAX_LENGTH = 60000;
<pre>
 
[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];
 
</pre>
 

Revision as of 19:54, 20 April 2015

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


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


[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

[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*



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.
 
 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 immediatly 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, reduce 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;