Extrema Elements

Extrema PeakAn Extrema element computes the maximum value (peak) or minimum value (valley) achieved by its input during a simulation. For example, in the figure shown below, the Peak and Valley curves are the outputs of Extrema elements with X as an input:

A picture containing screenshot

Description automatically generated

Extrema elements are very useful for tracking things like the peak contaminant concentration in a river, the peak number of customers in a check-out line, or the lowest water level reached in a water supply reservoir.

The properties dialog for an Extrema element looks like this:

An Extrema element has a single primary input (the value you wish to track). This input must have the same attributes (order and dimension) as the Extrema element, and can be a link or an expression. The Type determines whether Peak (maxima) or Valley (minima) values are tracked (as illustrated in the example shown above). Note that the default symbol for the Extrema changes depending on whether you are tracking a Peak or a Valley:

Extrema Peak

Extrema Valley

Peak

Valley

Extrema elements have two outputs, one of which is optional. The primary output is the actual peak or valley. It is always a value, but can be specified as a scalar, a vector or a matrix. You can specify these attributes by pressing the Type… button. By default, a new Extrema element is a scalar, dimensionless value. You can also use Extrema elements to operate on and/or create vectors and matrices.

The secondary output (which is optional) is the time of the greatest peak or valley. This output is only created if Record Time of Occurrence of Peak/Valley is checked. If it is checked, this output represents the elapsed time at which the peak (or valley) last occurred. The output is always a value with dimensions of time. It has the same order (scalar, vector, matrix) as the primary output.

Extrema elements have two options which affect how the primary output of the Extrema is computed:

   Use Absolute Value of the Input: If this is checked, GoldSim uses the absolute value of the input to determine the Peak or Valley, but the primary output retains the sign of the input (i.e., it could be negative). Hence, if you were computing the Peak, the output would represent the value of the Input which has had the highest absolute value since the beginning of the simulation (or since the element has been reset – see below).  If you were computing the Valley, the output would represent the value of the Input which has had the lowest absolute value since the beginning of the simulation (or since the element has been reset – see below).    

   Reset when Triggered: If this is checked, the Reset… button becomes available, which provides access to a standard GoldSim Trigger dialog.

When an Extrema is reset by a trigger, the Peak/Valley calculation is restarted on the next update (ignoring everything that has occurred previously, as if it was the start of the simulation again).

The browser view of an Extrema element shows a single input and two outputs (if you choose to save the time of the peak/valley).  Additional inputs are also present if the element is being reset:

“TofExtreme” is the (optional) time of extreme output.

   Note: Element inputs and outputs are only shown in the browser if you choose to Show Element Subitems (accessed via the browser context menu by right-clicking in the browser).

A simple example model which uses an Extrema element (Extrema.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: