This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
howtos:toolcoding:general_view_writing [2010/01/12 18:16] shona.weldon |
howtos:toolcoding:general_view_writing [2019/07/02 14:32] (current) erik.frenette [Understanding indexing wrt history and background] |
||
---|---|---|---|
Line 5: | Line 5: | ||
Here are some examples of import and exports: [[how_tos::#Working with data]] | Here are some examples of import and exports: [[how_tos::#Working with data]] | ||
+ | |||
+ | ===== Understanding indexing wrt history and background ===== | ||
+ | |||
+ | This is especially useful to understand when working with create and feedback views. For more information | ||
+ | see the product documentation under TOOL Language/TOOL Scripts/View. | ||
+ | |||
+ | When referencing an object array, you must specify the element in the array that you | ||
+ | would like to access. This is accomplished by using array indexes. The form of an object | ||
+ | array reference is: | ||
+ | <code> objectName[upperDims,auxDims][index] </code> | ||
+ | where: | ||
+ | * //index// the array index. It may be one of the following values: | ||
+ | * integer constant | ||
+ | * a positive integer value such as 1,2,3,.... For example, tempObject[][2]. | ||
+ | |||
+ | |||
+ | ^$history^$background^Object Type^Object Array Contents Value of^$numScns^ | ||
+ | |true|true|U|object[][1] = history instance|2| | ||
+ | | | | |object[][2] = background instance| | | ||
+ | |true|true|F|object[][1] = history instance|3| | ||
+ | | | | |object[][2] = background instance| | | ||
+ | | | | |object[][3] = new instance to be filled| | | ||
+ | |true|false|U|object[][1] = history instance|1| | ||
+ | |true|false|F|object[][1] = history instance|2| | ||
+ | | | | |object[][2] = new instance to be filled| | | ||
+ | |false|true|U|object[][1] = background instance|1| | ||
+ | |false|true|F|object[][1] = background instance|2| | ||
+ | | | | |object[][2] = new instance to be filled| | | ||
+ | |false|false|U|object[][1] = no instance - Error —| | | ||
+ | |false|false|F|object[][1] = new instance to be filled|1| | ||
+ | |||
+ | note: ''$history'' has value ''false'' when running views in calibrator. | ||
===== Example Files ===== | ===== Example Files ===== | ||
Line 19: | Line 51: | ||
* import.t - Tool commands to import the external data according to the format of each variable | * import.t - Tool commands to import the external data according to the format of each variable | ||
<file> | <file> | ||
- | creview import testInOut.s import.v import.t "importing first scenario" | + | setpath $HOME/V4/cal/views |
+ | |||
+ | ! Data creation views: | ||
+ | creview import testInOut.c import.v import.t "importing first scenario" | ||
+ | |||
+ | |||
+ | ! Data display views: | ||
+ | disview energyUseRpt myCalc energyUseRpt .v energyUseRpt .t "energy use report" | ||
</file> | </file> | ||
Line 75: | Line 115: | ||
Here are the steps for loading a view: | Here are the steps for loading a view: | ||
- | - In the //Windows// munu, click //Views// . | + | - In the //Windows// menu, click //Views// . |
- Click //Load// in the //View Actions// window | - Click //Load// in the //View Actions// window | ||
- Set the correct path name to the //views.samm// file. This will be found in the //views// folder under the //sim// folder under the model version in your home directory. | - Set the correct path name to the //views.samm// file. This will be found in the //views// folder under the //sim// folder under the model version in your home directory. | ||
Line 89: | Line 129: | ||
- Click //run// in the View Actions menu or double click the view. | - Click //run// in the View Actions menu or double click the view. | ||
- | Note that running a //create// view generates new //instances// of the variables. To see how instances can be combined in a scenario see | + | Note that running a //create// view generates new //instances// of the variables. To see how instances can be combined in a scenario see: |
- | [[concepts:scenario_management::understanding_scenarios_variables_and_instances]] | + | [[concepts:Scenario Management - Understanding Scenarios, Variables and Instances]] |