Or Elements

or2 Or elements perform a logical Or operation on a list of conditions. Their output is True if any of their inputs are True. Although this can also be done using an Expression, an Or element provides a somewhat more convenient and user-friendly way to do this, particularly if a large number of items are involved. More importantly, the element explicitly illustrates the operation being carried out, increasing the transparency of your model and allowing you to create easy-to-read conditional logic diagrams.

The properties dialog for an Or element looks like this:

Or elements have a single output, which is always a scalar condition. If all of the input conditions to an Or element are False, the output is False; otherwise, the output is True. You add an input to the element by pressing the Add Input button. A browser tree showing all of the elements in the model is 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 (False) item. In either case, the dialog will close and the item will be added to the list of inputs for the element.

The inputs to the Or must all be conditions. Note, however, that the inputs can be conditional 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).

   Note: An Or element with no defined input conditions evaluates to False.

As shown below, the browser view of an Or element shows a single output, and an input for each input condition:

   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 the Or element, as well as other logical elements (Logical.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…