Event Analysis Functions and Static Functions

Event analysis functions and static functions store equations for use in event analysis flowcharts. The key difference between them is that a event analysis function is always recomputed whenever it is encountered during simulation, and it allows you to pass input variables (also known as parameters or arguments) to the equation while simulation is in progress. A static function, on the other hand, is computed only once, before the simulation begins, and its value will remain constant while the simulation is in progress. It will be recomputed only after the current simulation ends and before the next simulation begins (unless manually forced to recompute).

As a rule of thumb, use an event analysis static function if you need the final value of the equation before the simulation even begins, and use an event analysis function if you expect the equation to find the values of its parameters during the simulation. The following example illustrates these concepts.

Suppose you wish to calculate the area of an object: Area = Length * Width, where Length = 106 and Width = 112. To use a static function to calculate the area, you can define the numerical values directly within the equation or use other event analysis resources (e.g., variables, models, etc.) to represent those values, as shown in the following example.

Once you have defined the static function, you can use it in a flowchart by referencing its name, as shown in the following example.

Tip: You can force all static functions in a flowchart to recompute during simulation by using a reset block. You can also recompute only the static function(s) that you specify by using the event analysis internal function called "staticfunc_reset."

Now suppose that Length is a random number from 100 to 150, and Width = 112. In this case, you first need to obtain the length of the object before you can compute its area, but the value for length can be obtained only during simulation. An event analysis function would therefore be more appropriate for handling this problem.

There are two ways to use event analysis functions: you can use other event analysis resources to supply the values for the equation (similar to the example shown above for the event analysis static function), or you can choose to explicitly define the parameters of the equation by using the optional Function Parameters field, as shown in the example below.

When you explicitly define the parameters, you will be required to define their inputs whenever you use the equation in a flowchart. You can do this by referencing the function name as shown in the example below (where "in" represents the output of the block that obtains the length, and width is set to a value of 112). The Preview area shows the order in which the inputs must be entered.

The following picture shows the modified flowchart:

The expressions in event analysis functions and static functions can include:

You can enter the equation manually, or you can use the function selector or the equation editor to assist you. Resources, ReliaSoft Workbooks and internal functions are automatically color-coded while you are editing the equation, to improve readability.

When the cursor is positioned on a resource, ReliaSoft Workbook or predefined or internal function, a preview area appears and displays a summary of the item. If a function requires parameters, the preview area indicates (in all capital letters) which parameter you are currently entering; additionally, for nested functions, the preview area displays the current function and the parent function. If the item is a resource, you can click the View icon in the preview area to open that resource's properties window.

You can enclose a resource name in single quotes to reference it by name. When the item using the expression is transferred to another project or database, any resource referenced by name will not be transferred along with it. If the destination project contains a resource with the same name as the one referenced by name, that resource will be used during simulation of the transferred item. For example, if you export a diagram that contains a block using the expression 'Model1'(1000) from Project1 to Project2, Model1 will not be transferred along with that diagram. If Project2 already contains a model called Model1, that model will be used in simulating the transferred diagram. You can also reference ReliaSoft Workbooks by name.

IMPORTANT: All values and results are assumed to be in terms of the default unit specified for the database. See Using Time Units in Event Analysis Flowcharts for details on how this may affect your analysis.

Related Topics and Links