Skip to Main Content Skip to Search
Product Documentation

Signal-Based Event Cycle Prevention

This example shows how to eliminate an event-based signal cycle using the following resolution techniques. A signal-based event cycle is a loop formed by blocks that unconditionally update their outputs in response to a signal-based event. Such a cycle can cause an infinite loop during a simulation.

Error Caused by Signal-Based Event Cycle

Simulating the following model (open model) causes an error because of a signal-based event cycle. If the simulation proceeds, a sample time hit of the #d signal causes the following actions to repeat in an infinite loop:

Resolution Using Atomic Subsystem and Unit Delay Blocks

The following model (open model) performs the computation in an Atomic Subsystem block, and includes a Unit Delay block on a signal line that connects to an input port of the Add block. During the simulation, a sample time hit of the #d signal causes the subsystem to execute. The subsystem executes each block inside the subsystem exactly once. The output of the Unit Delay block is the same as the output of the Gain1 block from the previous invocation of the subsystem.

Alternative Resolution Using Signal Latch Block

The following model (open model) includes a Signal Latch block on a signal line that connects to the Add block. As a result, a sample time hit of the #d signal causes the following actions to occur once:

  


Free Discrete Event Simulation Technical Kit

Model electronic system architectures, process flows, and logistics as queuing systems or agent-based systems.

Get free kit

Trials Available

Try the latest version of discrete-event simulation products.

Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS