Documentation Center

  • Trial Software
  • Product Updates

Control States When Function-Call Inputs Reenable Charts

Set Behavior for a Reenabled Chart

If you define a function-call input event for a chart, you can control the behavior of states when this event reenables the chart:

  1. Open the Chart properties dialog box.

  2. For States When Enabling, select one of these options:

    • Held — Maintain most recent values of the states.

    • Reset — Revert to the initial values of the states.

    • Inherit — Inherit this setting from the parent subsystem.

      If...The inherited setting is...

      The parent of the chart is the model root

      Held

      The chart is inside a Model block

      Reset

      For more information, see Model Reference.

    For new charts, the default setting is Held.

Behavior When the Parent Is the Model Root

When the parent of your chart is the model root, the following types of behavior can occur when a function-call input event reenables the chart.

The chart...When you set the States When Enabling property to...
Maintains the most recent values of the statesInherit or Held
Reverts to the initial values of the statesReset

What Happens When the Setting Is Inherit or Held

In the following modelmodel, the Caller chart uses the event E to wake up and execute the Callee chart.

The Caller chart contains two states, A and B.

When you bind E to A:

  • Entering A enables the Callee chart.

  • Exiting A disables the Callee chart.

  • Reentering A reenables the Callee chart.

Each time the Callee chart executes, the output data y increments by one.

In the Chart properties dialog box for Callee, States When Enabling is Inherit. Because the parent of this chart is the model root, the chart maintains the most recent values of all states when reenabled.

During simulation, Callee maintains the most recent value of its state when the function-call input event reenables the chart at t = 20 and 40.

The key behaviors are:

Time IntervalCaller ChartCallee Chart
0 – 10State A is active and enables Callee.State A executes by incrementing y.
10 – 20State B is active and disables Callee.State A does not execute.
20 – 30State A is active and reenables Callee.State A executes by incrementing y.
30 – 40State B is active and disables Callee.State A does not execute.
40 – 50State A is active and reenables Callee.State A executes by incrementing y.

If States When Enabling is Held, the output is the same.

What Happens When the Setting Is Reset

Suppose that the States When Enabling property is Reset for Callee. During simulation, Callee reverts to the initial value of its state when the function-call input event reenables the chart at t = 20 and 40.

Behavior When the Chart Is Inside a Model Block

When your chart is inside a Model block, the following types of behavior can occur when a function-call input event reenables the chart.

The chart...When you set the States When Enabling property to...
Maintains the most recent values of the statesHeld
Reverts to the initial values of the statesInherit or Reset

What Happens When the Setting Is Inherit or Reset

The following model contains a Model block and a scope. (For more information about using Model blocks, see For more information, see Model Reference..)

The Model block contains the Caller and Callee charts from Behavior When the Parent Is the Model Root.

In the Chart properties dialog box for Callee, States When Enabling is Inherit. Because this chart is inside a Model block, the chart reverts to the initial values of all states when reenabled.

During simulation, Callee reverts to the initial value of its state when the function-call input event reenables the chart at t = 20 and 40.

The key behaviors are:

Time IntervalCaller ChartCallee Chart
0 – 10State A is active and enables Callee.State A executes by incrementing y.
10 – 20State B is active and disables Callee.State A does not execute.
20 – 30State A is active and reenables Callee.State A executes by incrementing y.
30 – 40State B is active and disables Callee.State A does not execute.
40 – 50State A is active and reenables Callee.State A executes by incrementing y.

If States When Enabling is Reset, the output is the same.

What Happens When the Setting Is Held

Suppose that the States When Enabling property is Held for Callee. During simulation, Callee maintains the most recent value of its state when the function-call input event reenables the chart at t = 20 and 40.

Was this topic helpful?