1 |
/* |
2 |
* SlvProc.h |
3 |
* by Ken Tyner and Ben Allan |
4 |
* Created: 6/97 |
5 |
* Version: $Revision: 1.4 $ |
6 |
* Version control file: $RCSfile: SlvProc.h,v $ |
7 |
* Date last modified: $Date: 2003/08/23 18:43:08 $ |
8 |
* Last modified by: $Author: ballan $ |
9 |
* |
10 |
* This file is part of the ASCEND Tcl/Tk interface |
11 |
* |
12 |
* Copyright 1997, Carnegie Mellon University |
13 |
* |
14 |
* The ASCEND Tcl/Tk interface is free software; you can redistribute |
15 |
* it and/or modify it under the terms of the GNU General Public License as |
16 |
* published by the Free Software Foundation; either version 2 of the |
17 |
* License, or (at your option) any later version. |
18 |
* |
19 |
* The ASCEND Tcl/Tk interface is distributed in hope that it will be |
20 |
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
22 |
* General Public License for more details. |
23 |
* |
24 |
* You should have received a copy of the GNU General Public License |
25 |
* along with the program; if not, write to the Free Software Foundation, |
26 |
* Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the file named |
27 |
* COPYING. COPYING is found in ../compiler. |
28 |
* |
29 |
* This probe implementation constitutes a total rework of the probe |
30 |
* first created by Abbott, 1994. |
31 |
*/ |
32 |
|
33 |
#ifndef SlvProc_module_loaded |
34 |
#define SlvProc_module_loaded |
35 |
|
36 |
/* |
37 |
* To include this header, you must include the following: |
38 |
* #include "tcl.h" |
39 |
* #include "interface/HelpProc.h" |
40 |
* #include "interface/SlvProc.h" (which is sort of obvious) |
41 |
*/ |
42 |
|
43 |
#define SLVMONITORPREFIX "slvmon" |
44 |
|
45 |
extern int Asc_VarAnalyzeCmd(ClientData cdata, Tcl_Interp *interp, |
46 |
int argc, CONST84 char *argv[]); |
47 |
extern int Asc_RelAnalyzeCmd(ClientData cdata, Tcl_Interp *interp, |
48 |
int argc, CONST84 char *argv[]); |
49 |
/* |
50 |
* int Asc_VarAnalyzeCmd; |
51 |
* Registered as \"__var_analyze low high |
52 |
* scaling?lower?upper?other |
53 |
* rel?abs tolerance <othervalue>. |
54 |
* int Asc_RelAnalyzeCmd; |
55 |
* Registered as \"__rel_analyze low high |
56 |
* residual?other |
57 |
* rel?abs tolerance <othervalue>. |
58 |
* Comments : |
59 |
* |
60 |
* This function will analyze the elements in the current slv_systemto see |
61 |
* whether they satisfy the proximity queries. The variable type supported is |
62 |
* the "solver_var". It can be used to analyse variables or relations for |
63 |
* proximity to a "othervalue". rel?abs will determine whether |
64 |
* the queries are done relatively or using absolute values. tolerance must |
65 |
* be set appropriately based on rel?abs. The queries ?scaling?lower?upper |
66 |
* pertain to the nominal,lower_bound, and upper_bound of a solver_var with |
67 |
* respect to the value of the solver_var. "residual" pertains to the residual |
68 |
* of a relation as compared to 0.0. If for any of the queries, |
69 |
* the values are too close to zero, then "absolute" queries are made. |
70 |
* Internal units are used for all queries. |
71 |
* |
72 |
* Examples: |
73 |
* 1) __var_analyze 20 46 lower rel 0.2; |
74 |
* will analyse (indexes 20 through 46 inclusive) all solver_vars |
75 |
* that have values which are within 20% of their lower_bounds. |
76 |
* 2) __var_analyze 20 46 lower abs 0.2; |
77 |
* will analyse (indexes 20 through 46 inclusive) all solver_vars |
78 |
* that have values which are within 0.2 of their lower_bounds. |
79 |
* 3) __var_analyze 20 46 other rel 0.2 15.0; |
80 |
* will analyse (indexes 20 through 46 inclusive) all solver_vars |
81 |
* that have values which are within 20% of 15.0. |
82 |
* |
83 |
* Will be return a formatted string with of the form: |
84 |
* {index b_close} {index b_far} where index is the original probe list index. |
85 |
* See the source for more details. |
86 |
*/ |
87 |
|
88 |
STDHLF_H(Asc_SolveMonitorCmd); |
89 |
|
90 |
extern int Asc_SolveMonitorCmd(ClientData, Tcl_Interp *, int, CONST84 char **); |
91 |
/* |
92 |
* status = Asc_SolveMonitorCmd((cdata,interp,argc,argv); |
93 |
* Registered as: */ |
94 |
#define Asc_SolveMonitorCmdHN "slv_monitor" |
95 |
/* which should eventually be __something, when we clean up the slv_ mess */ |
96 |
/* Usage: */ |
97 |
#define Asc_SolveMonitorCmdHU \ |
98 |
"slv_monitor takes no arguments yet" |
99 |
#define Asc_SolveMonitorCmdHS \ |
100 |
"Returns the name of a monitor command to watch var/rel changes" |
101 |
#define Asc_SolveMonitorCmdHL1 "Eventually this should take an argument " |
102 |
#define Asc_SolveMonitorCmdHL2 "that is the id of a tcl solver token.\n" |
103 |
#define Asc_SolveMonitorCmdHL3 "\ |
104 |
* This creates a monitor and returns its symbolic handle.\n\ |
105 |
* Multiple monitors can exist and are manipulated by their\n\ |
106 |
* symbolic handles.\n\ |
107 |
* A monitor may be used on a series of unrelated slv_system_t.\n\ |
108 |
* Currently, this function gets its slv_system_t from g_solvsys_cur,\n\ |
109 |
* but it should be changed to take a slvsys interface id when\n\ |
110 |
* the solver interface is changed to work by name.\n\ |
111 |
" |
112 |
/* |
113 |
* because they need to be defined in a visible place, the info strings |
114 |
* for the monitors created follow: |
115 |
*/ |
116 |
#define SolveMonitorHS \ |
117 |
"Returns the list of changes in residuals, variables, or steps in variables" |
118 |
#define SolveMonitorHU \ |
119 |
"slvmonN destroy OR slvmonN slvsysname change <var,rel> OR\n\ |
120 |
slvmonN slvsysname geometry w h x y rmin rmax vmax OR \n\ |
121 |
slvmonN slvsysname plotdata <value,speed,residual>\n\ |
122 |
" |
123 |
#define SolveMonitorHL1 \ |
124 |
"\ |
125 |
* s change var return scaled values that changed\n\ |
126 |
* s change rel return scaled residuals that changed\n\ |
127 |
* Returns a tcl list whose elements are the changed values\n\ |
128 |
* with master list indices {index value}\n\ |
129 |
* values are scaled by nominals, or 1 if nominal is 0.\n\ |
130 |
* Scaled values > vmax (or rmax) will be returned as having the\n\ |
131 |
* value of the max, rather than their TRUE value.\n\ |
132 |
" |
133 |
#define SolveMonitorHL2 \ |
134 |
"\n\ |
135 |
* s geometry w h x y rmin rmax vmax\n\ |
136 |
* sets conversion parameters for plotdata (w h x y)\n\ |
137 |
* and limits for data values. This is called with a window\n\ |
138 |
* size or range change that will require new drawing.\n\ |
139 |
* x,y is the upper left corner of a coordinate space like a tk canvas.\n\ |
140 |
* w,h is the width and height of the space in distinctly plottable points\n\ |
141 |
* The 0 line of the area is y + h/2 for values. The values will be\n\ |
142 |
* spread evenly over the width in order of increasing solver master index.\n\ |
143 |
" |
144 |
#define SolveMonitorHL3 \ |
145 |
"\n\ |
146 |
* s plotdata value return plot info for scaled values that changed\n\ |
147 |
* s plotdata speed return plot info for scaled rates of value change\n\ |
148 |
* s plotdata residual return plot info for scaled residuals that changed\n\ |
149 |
*\n\ |
150 |
" |
151 |
#define SolveMonitorHL4 \ |
152 |
"\ |
153 |
* Each option returns a list of {x y index} for changed values of the\n\ |
154 |
* variables or relations. The x,y are coordinates at which a point\n\ |
155 |
* should be plotted based on a transformation derived from whxy info\n\ |
156 |
* last obtained by the geometry command of the monitor.\n\ |
157 |
" |
158 |
#define SolveMonitorHL5 \ |
159 |
"\ |
160 |
* The transformation may specify the same coordinate for more than\n\ |
161 |
* one relation or variable.\n\ |
162 |
* If this function raises a floating point exception, it will\n\ |
163 |
* not return data, but an error.\n\ |
164 |
" |
165 |
#define SolveMonitorHL6 \ |
166 |
"\ |
167 |
* value: The variable values v are scaled by nominal.\n\ |
168 |
* They are then reduced to vmax if abs(v) > vmax.\n\ |
169 |
* They are then scaled to the plotting region. The\n\ |
170 |
* returned value is {plotx ploty mastervarindex} for\n\ |
171 |
* all variables that changed since the last call or geometry.\n\ |
172 |
" |
173 |
#define SolveMonitorHL7 \ |
174 |
"\ |
175 |
* speed: The variable values v are scaled by nominal.\n\ |
176 |
* They are then reduced to vmax if abs(v) > vmax.\n\ |
177 |
* The delta in the scaled value since the last call\n\ |
178 |
* is calculated. If the delta has changed, it is scaled\n\ |
179 |
* to the plotting region and returned as\n\ |
180 |
* {plotx ploty mastervarindex} for\n\ |
181 |
* all variables that had a step size change.\n\ |
182 |
" |
183 |
#define SolveMonitorHL8 \ |
184 |
"\ |
185 |
* residual: The relation residuals, as scaled by nominals and reduced\n\ |
186 |
* to rmax if necessary, which have changed since the last call\n\ |
187 |
* are transformed to a dual log scale in the plot region.\n\ |
188 |
* Residuals < rmin considered as rmin. Residuals < 0 plotted\n\ |
189 |
* in the lower half of the plot region. Distance from the\n\ |
190 |
* vertical center of the canvas indicates the residual magnitude" |
191 |
/* end o spew */ |
192 |
|
193 |
#endif /* SlvProc_module_loaded*/ |