Courses: Introduction to GoldSim:

# Unit 5 - Understanding and Working with Elements

# Lesson 6 - The Two Most Basic Elements: Data and Expressions

In the previous Lessons, we have experimented a bit with Data elements and Expression elements. These are the most basic GoldSim elements, so it is worthwhile to spend a few minutes now looking at them in a little more detail. It is perhaps most instructive to look at the two dialogs side-by-side:

As can be seen, the top portions of each dialog are identical (and, in fact, identical to almost all elements). Both have a single input field. The input field for a Data element is labeled **Data Definition**. The input field for an Expression is labeled **Equation**.

Data elements are intended to represent constant inputs to your model. Hence, the **Data Definition** field should simply contain a number (and units). Data elements also have a **Data Source** option that allows you to import data directly from a database. If you are interested in this, you can learn more about it in GoldSim Help.

An Expression element is perhaps the most commonly used element in GoldSim. It simply provides a way for you to write a mathematical expression. In many ways, it is similar to a cell in a spreadsheet. As such, its input field generally would contain a mathematical expression. You will note that the input field for an Expression is larger than for other elements (i.e., it consists of multiple lines). This allows you to easily enter and view long expressions. It should be noted, however, that even for one-line input fields, if you enter a longer expression, GoldSim will automatically wrap the expression and extend the input field downward.

Because the input field for a Data element is functionally identical to the input field for an Expression (or for that matter, any other element), you could actually enter a mathematical expression (equation) into a Data element. Likewise, you could also enter a constant into an Expression element. __ However, you should avoid this!__ This is because the element icons themselves provide visual cues to people viewing the model, making it easier to understand. When someone sees a Data element in the graphics pane, they know this is a constant; when they see an Expression element, they know this is a mathematical expression. If you switch this (e.g., enter a constant into an Expression element), it defeats the entire purpose of the visual cues provided by the icons.

Finally, note that each element has a **Save Results** section at the bottom of the dialog. These two checkboxes are common to almost all elements. They specify whether outputs from the element will be saved. You can save the **Final Values** (the value at the end of each realization) and/or **Time Histories** (the value at selected timesteps). By default, when you create a new scalar element, these will be checked on. For this Course, you need not worry about these checkboxes, as the models will be small, and we will be dealing with scalars, and they will simply default on. As your models get larger, however, you may want to investigate disabling some results.