Pulse Generator
Generator of rectangular pulses of a given frequency.
Description
The Pulse Generator generates rectangular pulses at regular intervals. The block’s waveform parameters Amplitude, Pulse Width, Period, and Phase delay determine the output waveform. The following diagram shows how each parameter affects the waveform.
The Pulse Generator can generate scalar, vector, or matrix signals. To generate a scalar signal, use scalars to set the waveform parameters. To generate a vector or matrix signal, use vectors or matrices, respectively. Each element of the waveform parameters affects the corresponding element of the output signal. For example, the first element of the vector amplitude parameter determines the amplitude of the first element of the vector output pulse.
The unit can operate in two modes defined by the Pulse type parameter:
-
Simulation time-based mode (
Time-Based
). -
The mode based on calculation steps (
Sample-Based
).
Simulation time-based mode
In Simulation Time-Based mode, Engee calculates the block output value only when the output actually changes. This approach results in fewer calculations. To enable this mode, set the Pulse type parameter to Time based
.
The block does not support a configuration that results in a constant output signal. Engee returns an error if the Pulse Width and Period parameters satisfy either of these conditions:
The Pulse Generator block in the * Time based
Simulation Time
mode is discrete, although it does not have a *Sample time field. As Sample time, the block selects a value that will fit both the pulse width and the period an integer number of times at the same time, so as not to miss values.
The formula is as follows:
If the block is set to Time based
External Signal
mode, then all parameters except Amplitude must be multiples of the Sample time coming to the block input to also not miss values.
If the block uses vector parameters, in addition to taking the greatest common divisor between the elemental parameters, it will also take the greatest divisor between the calculated values.
Mode based on calculation steps
In calculation step based mode, the block calculates its output parameters at fixed intervals set by the block parameters. To enable this mode, set the Pulse type parameter to Sample based
.
In `Sample Based' mode, the block is always discrete.
The unit does not support Sample Based
External Signal
mode
An important difference between time-based and step-based modes is that in time-based mode the block output is based on the simulation time, while in step-based mode the block output depends only on the start of the simulation, regardless of the elapsed time.
Ports
Parameters
Pulse type - mode of operation
Time based (by default)
| Sample based
Block operation mode: Time based
or Sample based
.
Some parameters in the dialogue box are active depending on which mode is selected.
Block parameter |
|
Value |
|
By default |
|
Time (t) - time source.
Use simulation time (by default)
| Use external signal
Selects the time source for calculating the signal value.
Use simulation time
- the unit generates the output signal based on the simulation time.
Use external signal
- the block generates an output pulse based on the value on the input port t (may differ from the simulation time). The block icon shows the input port for source connection.
Block parameter |
|
Value |
|
By default |
|
Amplitude - amplitude of the signal
1 (by default)
| scalar
| vector
| matrix
Amplitude of the generated signal.
Block parameter |
|
Value |
|
By default |
|
Period (secs) - pulse period
10 (by default)
| scalar
| vector
| matrix
The pulse period is specified in seconds when Pulse type is set to Time based
.
Block parameter |
|
Value |
|
By default |
|
Period (number of samples) - period of pulses
10 (by default)
| scalar
| vector
| matrix
If Pulse type is set to Sample based
, the period is set as the number of sampling steps.
Block parameter |
|
Value |
|
By default |
|
Pulse Width (% of period) - pulse width
5 (by default)
| scalar
| vector
| matrix
The pulse width is defined as:
-
a fraction in per cent of the period if Pulse type is set to
Time based
.
The value must be in the range [0,100].
Block parameter |
|
Value |
|
By default |
|
Pulse Width (number of samples) - pulse width
5 (by default)
| scalar
| vector
| matrix
The pulse width is defined as:
-
number of calculation steps if the Pulse type parameter is set to
Sample based
.
The value must be in the range [0,100].
Block parameter |
|
Value |
|
By default |
|
Phase Delay (secs) - delay before the first pulse
0 (By default)
| scalar
The delay before the first pulse is generated, specified in seconds, if Pulse type is set to Time based
.
Block parameter |
|
Value |
|
By default |
|
Phase Delay (number of samples) - delay before the first pulse
0 (By default)
| scalar
The delay before the first pulse is generated, specified as the number of calculation steps if Pulse type is set to Sample based
.
Block parameter |
|
Value |
|
By default |
|
Sample time - interval between calculation steps
-1 (by default)
| scalar
Specify the interval between calculation steps as a non-negative number.
To inherit a calculation step, set this parameter to -1
.
Dependencies
To use this parameter, set the Pulse type parameter to Sample based
.
Block parameter |
|
Value |
|
By default |
|