Using Model Exporter with Symbion

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search

The following steps will guide you through setting up Symbion (Symbion Systems, Inc., http://www.gosymbion.com ) to work with Model_Exporter TCL files.

Installation

  1. Copy the la1.0 linear algebra library from the Symbion_tools folder in Model_Exporter into the Symbion library folder
    Bob: please verify where this folder should be copied TO
  2. Create a folder named "Eigenvector" in the Symbion\Drivers folder
  3. Copy the eigenvector.tcl wrapper file (located in the Model_Exporter\Symbion_tools folder)

Configuration

 Bob: To be completed...

Initialization Script

The following is an example of a TCL initialization script for use with Symbion. It

 Bob: please finish the previous sentence explaining what this script does

Note: Line numbers are included for reference only - they should not be included in the actual script.

1 global xmat
2 global num_rows
3 global cur_ind
4 global xvals
5 global cur_spc
6
7 global tag1
8 global tag2
9 global tag3
10 global tag4
11 global tag5
12 global tag6
13 global tag7
14
15 set tag1 "Isooctane"
16 set tag2 "Toluene"
17 set tag3 "MX"
18 set tag4 "PX"
19 set tag5 "n_heptane"
20 set tag6 "Q_reduced"
21 set tag7 "T2_reduced"
22
23 source "c:/Symbion/Data/Examples/Eigenvector/spec1.txt"
24
25 set num_rows [La::mrows $xmat]
26 set num_cols [La::mcols $xmat]
27
28 for {set i 1} {$i <= $num_cols} {incr i} {
29    set xvals [lappend xvals $i]
30 }
31
32 set cur_ind 0
33
34 SetTagDisplay $tag1 35 5
35 SetTagDisplay $tag2 35 5
36 SetTagDisplay $tag3 55 25
37 SetTagDisplay $tag4 20 0
38 SetTagDisplay $tag5 35 0
39
40 SetTagDisplay $tag6 3 0
41 SetTagAlarm $tag6 0.95 0 "" ""
42
43 SetTagDisplay $tag7 3 0
44 SetTagAlarm $tag7 0.95 0 "" ""
45
46 set x [La::mrange $xmat 0 end 0 0]
47 set cur_spc [La::show $x]
48 PlotRTSpec "Current spectrum" $xvals $cur_spc red

Run-Time Script

The following is an example of a Run-Time script which ...

 Bob again: please finish the previous sentence
 Bob: also - in both scripts, please insert comments (using # lines, I guess?)
     to indicate what each section is doing.
 Bob: Why are the TCL scripts you are importing named ____.txt? This is a bit confusing.
     Shouldn't the exported scripts be named "____.tcl"?
1 global xmat
2 global num_rows
3 global cur_ind
4 global xvals
5 global cur_spc
6
7 global tag1
8 global tag2
9 global tag3
10 global tag4
11 global tag5
12 global tag6
13 global tag7
14
15
16 SendMessage "cur_ind = $cur_ind"
17
18
19 if {$cur_ind >= $num_rows} {
20  set cur_ind [expr $cur_ind - $num_rows]
21 }
22 set x [La::mrange $xmat 0 end $cur_ind $cur_ind]
23 set prev_spc $cur_spc
24 set cur_spc [La::show $x]
25 set spec_str "Current spectrum"
26 set prev_str "Previous spectrum"
27 PlotRTSpec $prev_str $xvals $prev_spc blue
28 PlotRTSpec $spec_str $xvals $cur_spc red
29
30 source "c:/Symbion/Scripts/Examples/nir_data PLS2 model.txt"
31
32
33
34 set cur_val [lindex [La::show $yhat] 0]
35 PlotRTTag 0 $cur_val $tag1 Concentration "EVRI M_E" "wt.%" blue
36
37 set cur_val [lindex [La::show $yhat] 1]
38 PlotRTTag 0 $cur_val $tag2 Concentration "EVRI M_E" "wt %" orange
39
40 set cur_val [lindex [La::show $yhat] 2]
41 PlotRTTag 0 $cur_val $tag3 Concentration "EVRI M_E" "wt %" green
42
43 set cur_val [lindex [La::show $yhat] 3]
44 PlotRTTag 0 $cur_val $tag4 Concentration "EVRI M_E" "wt %" red
45
46 set cur_val [lindex [La::show $yhat] 4]
47 PlotRTTag 0 $cur_val $tag5 Concentration "EVRI M_E" "wt %" black
48
49 set cur_val [La::show $Q]
50 PlotRTTag 0 $cur_val $tag6 metric "EVRI M_E" none magenta
51
52 set cur_val [La::show $T2]
53 PlotRTTag 0 $cur_val $tag7 metric "EVRI M_E" none cyan
54
55
56 incr cur_ind
57 after 20000

This script produces a page looking something like the following (click for larger view):

Symbion running.png


Post-Edit Note for Jeremy

Once this page is generated, add the following to the original Model_Exporter documentation

Using Model_Exporter with Symbion

Model_Exporter TCL scripts are compatible with Symbion (available from Symbion Systems, Inc., http://www.gosymbion.com). See Using Model_Exporter with Symbion for a step-by-step guide to using Symbion with Model_Exporter scripts.