Expression Elements

Expression elements are probably the most common function element that you will use in your models.

The properties dialog for an Expression element A function element that produces a single output by calculating user-specified mathematical expressions. looks like this:

The properties dialog for an Expression is very simple, and is almost identical to that of the Data element An input element intended to represent constant inputs in a model.. Other than the ID and Description, there is only a single input field. Expressions are intended for input of a mathematical expression into this field.

Note: You could, of course, just enter a number when defining an Expression. In such a case, however, it would be clearer to someone viewing your model if you used a Data element for that. Doing so helps to make your models more transparent, since the Data symbol will visually indicate to anyone viewing the model that the element represents a constant, and the Expression symbol will visually indicate that the element represents a mathematical expression. If you have entered a number into an Expression element, you can easily convert the element to a Data element by right-clicking on it, and selecting Transform to Data.

Note that the input field for an Expression (the "Equation") is always expanded to several lines to better accommodate and display large equations.

Expression elements have a single output, which can be a value or a condition, and can be specified as a scalar An output consisting of a single value or condition., a vector A one-dimensional array. or a matrix A two-dimensional array.. You can specify these attributes by pressing the Type... button. By default, a new Expression element is a scalar, dimensionless value.

The browser An alternative view of a GoldSim model, in which elements are displayed in a tree, and organized either hierarchically, or by type. view of an Expression element shows a single input (referred to as the Definition), and a single 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).

An example model which uses Expression elements (Expression.gsm) can be found in the General Examples folder in your GoldSim directory (accessed by selecting File | Open Example... from the main menu).