Functions

Configuration ‣ General ‣ Functions allows you to create, edit and delete functions.

The Functions window enables you to build and edit customised functions which can be used in other areas of NEXUS IC, such as Asset Information fields, Event fields and Report Sources. You can drag and drop elements into the Function Editor, then connect the elements together to define the way in which data flows through your function.

Functions are integral to NEXUS IC. Functions are used within Risk Models (defining models, matrices and parameters), they are also used in Asset Information fields (e.g. corrosion rates, retirement dates, pressures, wall thicknesses etc) and Event Definitions (e.g. functions to calculate remaining wall thickness or span lengths).

_images/functions.png

Add

To add a new function, click the Add button at the top of the “Configuration - Functions” dialog. Give your new function a name and (optionally) a category. In the bottom half of the dialog, click the ‘+’ next to Elements, and drag a Function Parameter from the Elements tree to the design area at the right. (All functions are required to have at least one function parameter.) Drag other elements as desired.

_images/functions.add.png

Once elements are in the design are at the right, you can connect two elements by dragging from the output square at the bottom of one element to a second element. Your drag must begin on the source element’s output square, but can end anywhere in the target element (not just on its input squares).

You can replace an existing connection by dragging from an output square to the specific input square whose connection you want to replace. You can break an existing connection by dragging it off an input square and dropping it on a blank part of the design area.

You can connect one output to multiple inputs — there is no limit to the number of places you can connect a single output to.

To view “on the fly” values for your function, click the Show Results button. You can also enter Input Values at the bottom of the Tests tab. The function will be evaluated using the input values you specify.

If you give an element an input of a type it is not expecting, instead of a green result you will see a yellow error message at the bottom of that element, explaining the type mismatch. You will similarly get yellow error messages for other error cases, such as division by zero. These errors are only visible if the Show Results button is selected.

To edit an existing function, click the Edit button at the top of the Configuration ‣ Functions dialog, then proceed as above.

To save the function you’re editing, click OK.

To delete existing functions, select them in the Configuration ‣ Functions dialog and click the Delete button at the top of the dialog.

To see if a function is being used elsewhere in the application, click Connections.

Functions and function elements in NEXUS IC 6 are unit aware: if you have a function with two inputs leading to an Addition operation, and one function has units in metres while the other has units in millimetres, NEXUS IC will correctly deduce that one number needs to be scaled by a factor of 1000 before the two numbers are added. (Which direction the scaling happens depends on the output unit you select for the Addition element.) For many function elements, you can select the output unit. (Note that NEXUS IC isn’t dimensionally aware: if you divide a length by a time, it won’t understand that the result is a velocity.)