User Tools

Site Tools


howtos:toolcoding:feedback_views

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
howtos:toolcoding:feedback_views [2011/06/23 14:09]
chris.strashok
howtos:toolcoding:feedback_views [2017/04/14 16:32] (current)
marcus.williams
Line 5: Line 5:
 There are a few built in tool variables that are available to the view writer to track the feedback process and terminate the loop when ready they are: There are a few built in tool variables that are available to the view writer to track the feedback process and terminate the loop when ready they are:
   * **$fbViewIteration** - the iteration number of the loop   * **$fbViewIteration** - the iteration number of the loop
-  * **$fbViewMaxIters** - the maximum number of iterations the user who starts the view requested +  * **$fbViewMaxIters** - the maximum number of iterations ​requested by the user 
-  * **$fbViewTolerance** - the convergence tolerance the user who starts the view requested+  * **$fbViewTolerance** - the convergence tolerance ​requested by the user
  
-You can declare regular **local** variables however be aware that they are wiped out at the start of each iteration. +Note: 
- +  * You can declare regular **local** variables ​in a feedback view, however be aware that local variables ​are wiped out at the start of each iteration. ​If you want to reuse you local variables for each iteration you need to declare ​it as **keep** ​variable, ​which remain available ​to the view for every iteration. ​ Usually you create ​keep variables ​on the first iteration inside an "if clause" ​as seen below:
-You can declare ​regular ​**keep** ​variables ​which remain available for every iteration. ​ Usually you create ​them on the first iteration inside an "if clause" ​like this:+
 <​code>​ <​code>​
 keep A[] keep A[]
 +
 if ($fbViewIteration) if ($fbViewIteration)
   A[] = create(...)   A[] = create(...)
Line 23: Line 23:
 ==== Example feedback view files ==== ==== Example feedback view files ====
  
-Here is an example of the .v and .t files for a simple feedback view that modifies a model input until the model output matches some given "​golden"​ value in the last time slice.+Here is the code for the .v and .t files for a simple feedback view that modifies a model input until the model output matches some given "​golden"​ value in the last time slice.
  
 viewName.v: viewName.v:
Line 86: Line 86:
  
  if ($numNotConv == 0) or ($fbViewIteration == $fbViewMaxIters)  if ($numNotConv == 0) or ($fbViewIteration == $fbViewMaxIters)
- if ( 
  mumble (" ​  ​numNotConv = ", $numNotConv,​ " at iteration ",​$fbViewIteration,​ " stopping due to ")  mumble (" ​  ​numNotConv = ", $numNotConv,​ " at iteration ",​$fbViewIteration,​ " stopping due to ")
  if ($numNotConv == 0)  if ($numNotConv == 0)
Line 101: Line 100:
 </​file>​ </​file>​
  
 +==== Use of quit () ====
 +
 +''​quit (1)''​ exits the current iteration.
 +
 +''​quit (0)''​ exits the entire feedback view.
  
 ==== Declaring in views.samm ==== ==== Declaring in views.samm ====
howtos/toolcoding/feedback_views.1308838161.txt.gz · Last modified: 2011/06/23 14:09 by chris.strashok