Here's a presentation with information about view writing using_views_with_samm.ppt
Here are some examples of import and exports: Working with data
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:
objectName[upperDims,auxDims][index]
where:
$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.
views.samm -
This is a Create view, which loads the initial data for four variables in a simple input-output model.
Fields:
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"
import.v - The names of the four variables to be imported are listed. The order of the variables must conform to the order in import.t. It is recommended to select from the Documentor the variable names to be imported and paste them here to avoid spelling errors. F indicates …?
! accounts variables finalDemand F accounts/Inputs F accounts/Outputs F accounts/primary F ! inOutModel variables
import.t - The following Tool script associates the imported data to a specific scenario defined by $index. The import command indicates the variable to be filled, the format of the external file, followed by its name.
! accounts variables creview finalDemand[c][] creview Inputs[c,i][] creview Outputs[i,c][] creview primary[i][] ! inOutModel variables string $importDir $importDir = $home + "/models/inOut/PrimaryData" integer $index $index = 1 if $history == true $index = $index + 1 endif if $background == true $index = $index + 1 endif ! accounts variables say ("importing accounts variables") finalDemand[c][$index] = import (; rowTitles=off, dataFile=$importDir/finalDemand.txt) Inputs[c,i][$index] = import (; format=coord, allCoord=on, dataFile=$importDir/Inputs.txt) Outputs[i,c][$index] = import (; rowTitles=on, dataFile=$importDir/Outputs.txt) primary[i][$index] = import (; rowTitles=off, dataFile=$importDir/PrimaryInputs.txt) ! inOutModel variables say ("importing inOutModel variables") say ("Done.")
- Before a a view can be run it must be loaded into SAMM
Here are the steps for loading a view:
Here are the steps for re-loading a view after editing the .t or .v
Here are the steps for running a view:
Note that running a create view generates new instances of the variables. To see how instances can be combined in a scenario see:
Scenario Management - Understanding Scenarios, Variables and Instances