Performing Simulation Analysis: Analyzing Numeric Integration and Events

You can analyze numeric integration and events for a simulated model.

See Related Links for detailed information about analyzing numeric integration and events.

This task shows you how to:


Before you begin:
  1. Activate the following options in the Simulation Setup, in the Debug tab:
    • For analyzing numerics: Which states that dominate error
    • For analyzing events:
      • Events during simulation to get statistics about events
      • (optional) Events during initialization to get statistics also about initialization events
  2. Simulate the model.
    Note: The simulation must be finished before analyzing numeric integration and events.

Analyzing Numerics

You can analyze the numeric integration to inspect state variables that might slow down the simulation of large models.

Note: Analyzing numeric integration is not supported when you use any of the following integrators:
  • Euler
  • Any Rkfix integrator
  • Cvode
  • Any integrator used for inline integration

  1. From the Simulation section of the action bar, click Simulation Analysis .
  2. Click the Numeric Integration tab.
    The Numeric Integration tab contains the following columns:
    • The state variable name.
    • The number of times the variable limits the step size of the numerical integrator. Counts greater than zero are highlighted.
    • The number of times the variable dominates the error, that is, has an integration error larger than any other state variable. Counts greater than zero are highlighted.
    • The number of times the variable contributes to more than 10 % of the integrator error.
    Note: If no information can be displayed, the Numeric Integration tab is not displayed.
  3. To display the result for a variable in a plot, right-click the variable in the window and select Plot Error.
    The following is the result:
    • In the plot that appears a marker is plotted at each time point where such an event occurs, and the value on the vertical axis is the contribution to the numeric error in percent. This plot gives a better understanding of the variable´s effect on the numeric integrator at various stages of the simulation.
    • The variable that you selected is also highlighted in the Variable Browser.
  4. To study the behavior of the numeric integrator, click Plot Integrator Step Size.
    A plot appears, displaying the internal integrator step size, the scaled local error estimate from the integrator, and the integration order.
    Notes:
    • Rejected steps (and subsequent restart with smaller step) are indicated with red cross.
    • You can use the scaled local error estimate to, for example, see if the integration step size is being limited by the error estimate or something else, like frequent restarts because of events.
    .

Analyzing Events

You can analyze the events.

  1. From the Simulation section of the action bar, click Simulation Analysis .
  2. Click the Event Log tab.
    The Event Log tab contains a list of all event points that happened during the simulation, sorted by time, and the number of events for each event point.

    If the option Events during initialization is activated, also those events are displayed at time 0.

    Note: If no events occurred, the Event Log tab is not displayed.
  3. To see also the minor events, activate Minor Events.

    By default this option is cleared, to let you concentrate on the main events.

  4. To see the details of the events for a specific time, expand that time node.

    Tips:
    • You can also double-click a time node to expand it.
    • You can use the Alt and Ctrl keys to select several time nodes, and then use Expand Event to expand them.
    • You can expand all time nodes by right-clicking a node or event line and select Expand All.
    • You can collapse all time nodes by right-clicking a node or event line and select Collapse All.

    The following information appears in the columns:
    • The time of an iteration containing one or several events.
    • The number of iterations.
    • The expression that triggered a specific event.
    • The value of the expression after a specific event.
  5. To search a specific event expression, in the Expression filter field, start entering the event expression.
    The filtering is dynamically applied.
  6. To investigate where a certain event expression appears, including the display of other events, do the following:
    1. Search the event, see previous step.
    2. Right-click the event line and select Highlight Expression.
      The expression for the event is highlighted at all times where it appears.
      Important: Only highlights in expanded nodes are displayed.
    3. In the Expression filter field, remove the expression.
      All event expressions are now displayed. The specific event expression is still highlighted.

    Tip: If you want to do this for an event expression that you see without searching, select it and click Expand Event.

    Important: If you close a node, there is no indication on that node if it contains a highlighted error expression. To check, see next step.
  7. At any time, to display the highlighted error expression and at what times it is used, right-click any node or line and click Expand Highlighted.

    The highlight is remembered until you close the event log window.

  8. To display an overview of the events during the integration in a plot, click Plot Event Overview.
    Time events and state events are plotted in the active plot window, or, if no active plot window exists, in a new plot window.