| Contents | Index |
| On this page… |
|---|
Time-based signals and event-based signals have different characteristics, as described in Comparison with Time-Based Signals. Here are some indications that you might need to convert a time-based signal into an event-based signal, or vice versa:
You want to connect a time-based signal to an input port of a SimEvents block. Instead of making the connection directly, you must insert a conversion block before the input port of the SimEvents block. The relevant conversion blocks are Timed to Event Signal for data signals and Timed to Event Function-Call for function-call signals.
You are using data from an event-based signal to affect time-based dynamics. Instead of making the connection directly, you must insert a conversion block before the input port of the SimEvents block. The relevant conversion blocks are Event to Timed Signal for data signals and Event to Timed Function-Call for function-call signals.
You want to perform a computation involving both time-based signals and event-based signals. You must decide how you want the software to perform the computation, and then insert conversion blocks as needed:
If you want the software to perform the computation in an event-based manner, insert a conversion block on each time-based signal line that is an input to the computation. The relevant conversion blocks are Timed to Event Signal for numerical signals and Timed to Event Function-Call for function-call signals.
If you want the software to perform the computation in a time-based manner, insert a conversion block on each event-based signal line that is an input to the computation. The relevant conversion blocks are Event to Timed Signal for numerical signals and Event to Timed Function-Call for function-call signals.
Here are some indications that converting a time-based signal into an event-based signal, or vice versa, might be inappropriate:
You want to convert an event-based signal into a time-based signal because a computational block is not in the list of supported blocks in Computational Blocks. Before converting the signal, consider whether you want the software to perform the computation in an event-based manner. If you do, try connecting your event-based input signal to an Atomic Subsystem block and putting the computational block inside the subsystem.
Converting an event-based signal into a time-based signal causes the loss of zero-duration values that you want to retain.
Converting an event-based signal into a time-based signal is unnecessary and less efficient. If the software is capable of performing a computation on that signal in an event-based manner with equivalent results, the conversion might be unnecessary. For details, see Computations on Event-Based Signals and Computational Blocks. If the conversion causes computations to occur when the inputs to the computations have not changed, the conversion might reduce simulation efficiency.
Note When using gateway blocks, you might notice behavior differences. In particular, you will notice more sample time hits in time-based systems than event-based systems. |
Use the blocks in the tables to convert between time-based and event-based signals. These blocks exist in the Gateways library. The documentation refers to these blocks collectively as gateway blocks.
Converting Numerical Data Signals
| From | To | Conversion Block |
|---|---|---|
| Time-based signal | Event-based signal | Timed to Event Signal |
| Event-based signal | Time-based signal | Event to Timed Signal |
Converting Function-Call Signals
| From | To | Conversion Block |
|---|---|---|
| Time-based signal | Event-based signal | Timed to Event Function-Call |
| Event-based signal | Time-based signal | Event to Timed Function-Call |
When you use custom library blocks in a SimEvents model, be aware of how you use time-based and event-based signals with such blocks. Consider these best-practice guidelines:
If you are designing a new custom library block, consider using a naming convention for input and output ports, which indicates the type of signal intended at each port.
You can create a custom library block which performs computations that occur in either an event-based or time-based manner. In some cases, you might want this flexibility. However, using a name such as IN1–ESignal for the inport of a custom library block, gives a clear indication to other users that an event-based signal is expected. This approach may eliminate situations where custom library blocks intended for use with event-based signals are used instead with time-based signals, and vice versa.
If you are using a custom library block in an event-based model and you require conversion between a time-based signal and an event-based signal, placing the conversion block within the custom library block is not recommended:
It will reduce the flexibility of the custom block, by always converting the incoming signal to either a time-based, or event-based signal, depending on the conversion block used.
It may confuse other users unfamiliar with the design of the custom library block.
If signal conversion is required to use a custom library block in an event-based model, then the required conversion block should be placed outside the custom library block. Inspect the model and determine where in the signal computation path to place the conversion block.
![]() | Using Data Sets to Create Event-Based Signals | Manipulating Signals | ![]() |

Model electronic system architectures, process flows, and logistics as queuing systems or agent-based systems.
Get free kit| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |