Defining Offsets for Inputs and Outputs to a Spreadsheet Element

In some cases, you may want to specify the location in the spreadsheet file to which you are linking in terms of an offset from a defined location, in which the offset is defined by model variables (such as Time or Realization).

For example, you could instruct GoldSim to change the location to which it exports data based on the realization number, with results from each realization being exported to a different column in the spreadsheet file.

You do this by selecting the Offset… button when you are selecting a spreadsheet location while defining inputs or outputs to a Spreadsheet file:

When you press this button, the following dialog is displayed:

You select whether you want to offset by Sheet, Column, and/or Row by clicking the appropriate checkboxes.  For example, if you were exporting a scalar GoldSim output to the spreadsheet file, and wanted to export the value to Sheet1!A1 for realization 1, Sheet1!B1 for realization 2, and so on, you would simply do the following:

1.  Specify Sheet1!A1 for the Location in Spreadsheet

2.  Define the Column offset as follows:

In this case, the offset would be 0 for Realization 1 (and hence the value would be exported to Sheet1!A1), it would be 1 for Realization 2 (and hence the value would be exported to Sheet1!B1), and so on.

   Note: The offsets can be any expression with links to other GoldSim outputs, but should be specified as dimensionless, integer values.  GoldSim will not accept expressions in these fields that have dimensions.  Offsets defined as real numbers are truncated.

   Note: If as a result of an offset, you try to access a cell that is invalid (e.g., if you specify a negative offset from the first column), GoldSim will display a fatal error message at runtime.

If you wish to use a particular unit of time to define an offset, you must cast the output to a dimensionless number.  For example, Time|day| will represent the number of days (which could be fractional, and hence will be truncated).  Note that Run Properties like Day and Year are, by definition, dimensionless.

When you close the Offset dialog and have a defined offset, this is indicated in the Spreadsheet Location (Offset… is checked) and in the list of inputs and outputs (any offset ranges are indicated as such).

   Warning: In order to properly use offsets, you must have a good understanding of the conditions and settings that control when GoldSim exchanges data with the spreadsheet file.

An example model which includes an illustration of the use of offsets for a Spreadsheet element (Spreadsheet.gsm) can be found in the General Examples folder in your GoldSim directory (accessed by selecting File | Open Example... from the main menu).

Related Topics…

Learn more about: