Sum elements add values together. Although this can also be done using an Expression, a Sum element provides a somewhat more convenient and user-friendly way to create a sum if a large number of items are involved. More importantly, it provides a powerful visual indication of what operation it is carrying out, and this adds to the transparency of your model.
The properties dialog for a Sum element looks like this:
Sum elements have a single output, which must be a value, and can be specified as a scalar, a vector or a matrix. You can specify whether the output is a scalar, vector or matrix by pressing the Type… button. By default, a new Sum element is a scalar, dimensionless value. You can also use Sum elements to operate on and/or create vectors and matrices.
You add an item to the Sum by pressing the Add… button. A browser tree showing all of the elements in the model will be displayed.
Note that this tree is organized by containment in the same manner as the main browser. To insert a link from this dialog, you select a specific output object (or an element having a primary output), and then press OK. If you press Cancel, GoldSim will insert a new blank (zero) item. In either case, the dialog will close and the item will be added to the list of inputs for the Sum:
You can remove an item from the Sum by selecting the item and pressing the Remove button. Pressing the Ctrl key when pressing the Remove button allows you to remove all items.
You can move an item up or down in the list by selecting it and using the Move Up and Move Down buttons. The Sort button sorts all items alphabetically. (The order obviously does not affect the output, but can be useful for organizing how the list is displayed.)
The inputs to the Sum must all have the same attributes (data type, order, dimensions) as the output. Note that the inputs can be expressions (in addition to simply links). You can edit any of the input fields after the input is added (and can insert links using the context menu for the input field).
As shown below, the browser view of a Sum element shows a single output, and an input for each item in the Sum:
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 a Sum element (Sum.gsm) can be found in the General Examples folder in your GoldSim directory (accessed by selecting File | Open Example... from the main menu).
Learn more about: