Using a Time Series Element to Record and Play Back a History

Time Series elements provide an advanced option in which you can read the output of another element in GoldSim, and "record" the results.

To access this capability, the Data Source should be set to "Recording output history". When you select this option, a new tab appears (Recording) from which you specify the link from the other element, as well as several additional options regarding how the output is recorded:

The Record from field represents the output that you wish to record. It must have the same dimensions and Type as specified on the main page (Definition tab) of the Time Series dialog.

The manner in which GoldSim records Time Series is controlled by how you have defined what the Time Series Represents, and whether or not the Trigger recording option is selected:

Time Series Represents

Trigger recording

Default Recording Logic Used by GoldSim

Instantaneous value

On

Records the value at start and end of simulation, and whenever triggered.

Instantaneous value

Off

Records the value at start and end of simulation, and at all scheduled timesteps if value has changed.

Constant value over the next  (or previous) time interval

Not applicable (always On)

Records the average value over the intervals at the start and end of simulation, and when triggered.

Change over the next time (or previous) interval

Not applicable (always On)

Records the change in the value over the intervals at the start and end of simulation, and when triggered.

Discrete change

Not applicable (always Off)

Records every discrete change.

When Trigger recording is checked (either manually or by default based on what the Time Series represents), events that trigger a recording are specified by pressing the Record… button:

This provides access to a standard Triggering dialog.

When recording Time Series, you should follow these general guidelines to ensure that the data is recorded in such a way that it fully captures the actual behavior of the output:

   If the output that is being recorded represents a quantity (e.g., the output of a Reservoir), the Time Series Represents should be set to "Instantaneous value".

   For most other outputs (and particularly for outputs that represent flows of material), the Time Series Represents should be set to "Constant value over the next (or previous) interval".

Note that the recording logic listed in the preceding table represents the minimum set of data points that GoldSim records.  When the Time Series represents Instantaneous data, you can instruct GoldSim to record additional data by selecting one or more of the options below.

Record at unscheduled timesteps (inserted by events). When recording, the Time Series adds a time point at each scheduled timestep in the simulation.  Some elements (that generate events) can also insert "unscheduled" timesteps (in between the scheduled timesteps).  If this box is checked (the default), the Time Series records (adds a timepoint) at these unscheduled events also. 

Record at all timesteps even if the input value is unchanged. By default, when recording for some types of outputs (see above), the Time Series does not necessarily record every time point. If this box is checked, the Time Series records (adds a timepoint) at all timesteps.

The final two options only apply if the input data to the Time Series represent discrete changes.  In this case, the Record from link specified must be a Discrete Change Signal.  Note that multiple discrete change signals can be entered into this field by separating them with a semicolon.

Record discrete changes with zero value. This determines whether or not discrete changes with a zero value are recorded as time points.  This box is defaulted on.

Combine discrete changes that arrive simultaneously. If two or more discrete changes that are being recorded by this Time Series occur at the same time, this checkbox determines whether the discrete changes are combined (the default), or if both are to be recorded separately.

While you are recording a Time Series, the element passes through as its output the instantaneous value of the input being recorded. 

   Note: Even if Enable Rate of Change output is checked, the Rate of Change output is not calculated while recording the history (it is output as zero).

   Note: Even if the Primary Output is set to “Average value over the next timestep”, the output of a Time Series that is currently recording is always the instantaneous value.

Recording time series can also be used to record multiple series.  To do so, you must check Enable Multiple Series on the Time Series dialog:

Note that when enabling multiple series when recording, the Active Series field defaults to “Realization” and cannot be changed.

There are three primary applications for a "recording" Time Series:

   By recording the output of an element and then changing the Data Source field back to "Locally defined data", you can "play back" the history in a subsequent run of the model.

   You can record the times of "unscheduled" updates.

   You can pass the output of a Time Series that is "recording" to another Time Series element. The primary application of this is to transfer time histories between SubModels.

These applications are discussed briefly below.

Recording and Playing Back a History

This can be useful, for example, if you want to copy the result of one model into another model.  In order to use a Time Series in this way, you would need to do the following:

1.  Insert one or more Time Series elements (one for each output you are interested in), set their Data Source to "Recording output history", and specify the output that you wish to record on the Recording tab.

2.  Run the model.  After you run the model, copy and paste the Time Series element into a different model, and set Data Source to “Locally defined data”.

3.  The Time Series elements you have pasted will contain the results from the other model and can now be used as input for te current model.  

Recording the Time of Unscheduled Events

Because GoldSim only saves results at scheduled timesteps, the impact of "unscheduled" timesteps that are inserted by events can sometimes be difficult to see directly.

A recording Time Series element, however, provides a way to actually see when these "unscheduled" timesteps occur. To use the Time Series in this way, you would need to do the following:

1.  Insert a Time Series element into your model, set the Represents field to “Instantaneous value”, set the Data Source to "Recording output history", and specify an output. If you are only interested in the time of the "unscheduled" timesteps themselves, the output that you specify is not important (e.g., you could simply choose Etime).

2.  Make sure that Record at unscheduled timesteps (inserted by events) is checked on.

3.  After the simulation is over, by pressing the View Data button, you will be able to view a table of times for all of the scheduled and unscheduled timesteps.

   Note: Although recording Time Series can be used in this manner, under most circumstances, there is a much easier way to achieve the same thing. GoldSim provides an option (under a specified set of conditions) to view the values of selected outputs at unscheduled updates in the Advanced Time settings.

Transferring a Time History Out of a SubModel

In some situations, you may want to run a SubModel in GoldSim, and then pass the entire time history of one or more outputs to a location outside of the SubModel (e.g., to another SubModel).

To take advantage of this feature, you must use the Time History Definition output of the element. This is a complex output that contains the complete definition for the element and can be passed from the element (through a SubModel interface) to another Time Series element.

To use the Time Series in this way, you would need to do the following:

1.  Insert one or more Time Series elements into your SubModel, set their Data Source to "Recording output history", and specify the outputs that you wish to transfer outside of the SubModel.

2.  Add the Time Series Definition Output of each Time Series that you wish to transfer to the output interface of the SubModel.

3.  For each Time Series that you wish to transfer from the SubModel, you must define a corresponding "play back" Time Series element outside of the SubModel.  For these Time Series, set their Data Source to "Linked to external Time Series Definition", and on the Linked tab, enter the Time Series Definition output from the SubModel interface.

4.  The output of these Time Series elements will directly reflect the time histories generated by the Time Series elements inside the SubModel.

   Note: Although recording Time Series can be used in this manner to transfer a time series out of a SubModel, under most circumstances, there is a more straightforward way to achieve the same thing. GoldSim provides an option to directly add an output inside a SubModel as a Time Series Definition to the SubModel interface. This allows you to skip step #1 above. The primary motivation to use a recording Time Series rather than adding the output directly to the SubModel interface would be if it was necessary to capture high resolution results (i.e., unscheduled updates) from inside the SubModel.

The example file RecordingLinkingTimeSeries.gsm in the TimeSeries subfolder of the General Examples folder of your GoldSim directory (accessed by selecting File | Open Example... from the main menu) includes examples of recording Time Series elements.

Related Topics…

Learn more about: