Engee documentation

Pulse Generator

Generator of rectangular pulses of a given frequency.

blockType: PulseGenerator

Path in the library:

/Basic/Sources/Pulse Generator

Description

The Pulse Generator block generates rectangular pulses with regular intervals. The waveform parameters of block Amplitude, Period (secs) (Period (number of samples)), Pulse Width (% of period) (Pulse Width (number of samples)), and Phase Delay (secs) (Phase Delay (number of samples)) determine the output waveform. The following diagram shows how each parameter affects the waveform.

pulse generator parameter effects

The Pulse Generator Unit 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 parameters determines the amplitude of the first element of the vector output pulse.

The unit can operate in two modes defined by the parameters Pulse type:

  • Simulation time based mode (Time based).

  • Mode based on calculation steps (Sample based).

Mode based on simulation time

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 parameters to Time based.

The block does not support a configuration that results in a constant output signal. Engee returns an error if the parameters Pulse Width (% of period) and Period (secs) satisfy either of these conditions:

Unit Pulse Generator in the mode Time based и Use simulation time is discrete, although it does not have a field Sample time. As Sample time, the block selects a value that will fit simultaneously an integer number of times in both the pulse width and the period so that no values are missed, using the following formula:

If the block is set to Time based и Use external signal, then all parameters except Amplitude must be multiples of the block input Sample time, so that the values are also not missing.

If the block uses vector parameters, in addition to taking the greatest common divisor between the element 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 parameters to Sample based.

In the mode Sample based the block is always discrete.

An important difference between time-based and calculation step-based modes is that in time-based mode the block output is based on the simulation time, while in calculation step-based mode the block output depends only on the start of the simulation, regardless of the elapsed time.

Ports

Output

# OUT_1 — generated output signal
scalar | vector | matrix

Details

Generated rectangular pulse signal given parameters.

Data types

Float64.

Complex numbers support

No

Input

# t — time
scalar | vector | matrix

Details

Time source for calculating the value of a signal.

Dependencies

To use this port, set the parameters Time (t) to Use external signal.

Data types

Float64

Complex numbers support

No

Parameters

Main

# Pulse type — mode of operation
Time based | Sample based

Details

The operating mode of the unit: Time based or Sample based.

Some parameters are active depending on which mode is selected.

Values

Time based | Sample based

Default value

Time based

Program usage name

PulseType

Tunable

No

Evaluatable

No

# Time (t) — time source
Use simulation time | Use external signal

Details

Selects the time source for calculating the signal value:

  • Use simulation time - the unit generates an output signal based on the simulation time.

  • Use external signal - block generates an output pulse based on the value at the input port t (may differ from the simulation time). The block icon displays the input port for the source connection.

Values

Use simulation time | Use external signal

Default value

Use simulation time

Program usage name

TimeSource

Tunable

No

Evaluatable

No

# Amplitude — signal amplitude
Scalar / array of real and/or complex numbers

Details

The amplitude of the generated signal.

Default value

1

Program usage name

Amplitude

Tunable

Yes

Evaluatable

Yes

# Period (secs) — pulse period
Scalar / array of real and/or complex numbers

Details

Pulse period in seconds.

Dependencies

To use this parameter, set the Pulse type parameters to . Time based.

Default value

10

Program usage name

Period

Tunable

Yes

Evaluatable

Yes

# Period (number of samples) — pulse period
Scalar / array of real and/or complex numbers

Details

The period of pulses in the number of calculation steps.

Dependencies

To use this parameter, set the Pulse type parameters to . Sample based.

Default value

10

Program usage name

PeriodNum

Tunable

Yes

Evaluatable

Yes

# Pulse Width (% of period) — pulse width
Scalar / array of real and/or complex numbers

Details

The pulse width is defined as a percentage of the period.

The value must be in the range [0,100].

Dependencies

To use this parameter, set the parameter Pulse type to [0,100]. Time based.

Default value

5

Program usage name

PulseWidth

Tunable

Yes

Evaluatable

Yes

# Pulse Width (number of samples) — pulse width
Scalar / array of real and/or complex numbers

Details

Pulse width in the number of calculation steps.

The value must be in the range [0,100].

Dependencies

To use this parameter, set the parameter Pulse type to [0,100]. Sample based.

Default value

5

Program usage name

PulseWidthNum

Tunable

Yes

Evaluatable

Yes

# Phase Delay (secs) — delay before the first pulse
Scalar / array of real and/or complex numbers

Details

Delay before the first pulse is generated in seconds.

Dependencies

To use this parameter, set the Pulse type parameters to . Time based.

Default value

0

Program usage name

PhaseDelay

Tunable

No

Evaluatable

Yes

# Phase Delay (number of samples) — delay before the first pulse
Scalar / array of real and/or complex numbers

Details

The delay before the first pulse is generated in the number of calculation steps.

Dependencies

To use this parameter, set the Pulse type parameters to . Sample based.

Default value

0

Program usage name

PhaseDelayNum

Tunable

No

Evaluatable

Yes

# Sample time — interval between calculation steps
SampleTime (real number / vector of two real numbers)

Details

Specify the interval between calculation steps as a non-negative number.

To inherit a calculation step, set this parameters to -1.

Dependencies

To use this parameter, set the parameter Pulse type to -1. Sample based.

Default value

1

Program usage name

SampleTime

Tunable

No

Evaluatable

Yes

Additional options

C code generation: Yes