Engee 文档

Pulse Generator

给定频率的矩形脉冲发生器。

类型: PulseGenerator

图书馆中的路径:

/Basic/Sources/Pulse Generator

说明

Pulse Generator 块可产生有规律间隔的矩形脉冲。程序块 AmplitudePeriod (secs) (Period (number of samples))、 Pulse Width (% of period) (Pulse Width (number of samples)) 和 Phase Delay (secs) (Phase Delay (number of samples)) 的波形参数决定输出波形。下图显示了各参数对波形的影响。

pulse generator parameter effects

Pulse Generator 单元可以生成标量、矢量或矩阵信号。要生成标量信号,请使用标量设置波形参数。要生成矢量或矩阵信号,请分别使用矢量或矩阵。波形参数的每个元素都会影响输出信号的相应元素。例如,矢量振幅参数的第一个元素决定矢量输出脉冲第一个元素的振幅。

该装置可在参数 Pulse type 所定义的两种模式下运行:

  • 基于模拟时间的模式 (Time based).

  • 基于计算步骤的模式 ( )Sample based).

基于模拟时间的模式

在基于模拟时间的模式下,Engee 仅在输出实际发生变化时计算块输出值。这种方法可减少计算量。要启用此模式,请将 Pulse type 参数设置为 Time based.

程序块不支持导致恒定输出信号的配置。如果参数 Pulse Width (% of period)Period (secs) 满足上述任一条件,Engee 将返回错误信息:

单位 Pulse Generator 模式 `Time based`и `Use simulation time`是离散的,尽管它没有域 Sample time 。与 Sample time 一样,程序块使用以下公式选择一个同时适合脉冲宽度和周期整数倍的值,以确保不遗漏任何值:

如果程序块设置为 Time based`и `Use external signal,则除 Amplitude 之外的所有参数都必须是程序块输入值 Sample time 的倍数,这样才不会跳过这些值。

如果程序块使用矢量参数,除了取元素参数之间的最大公约数外,还将取计算值之间的最大除数。

基于计算步骤的模式

在基于计算步长的模式下,程序块按程序块参数设置的固定间隔计算输出参数。要启用该模式,请将 Pulse type 参数设置为 Sample based.

在该模式下 `Sample based`模式下,程序块始终是离散的。

基于时间的模式和基于计算步长的模式的一个重要区别是,在基于时间的模式下,程序块的输出基于仿真时间,而在基于计算步长的模式下,程序块的输出只取决于仿真的开始时间,而与所用时间无关。

端口

输出

# OUT_1 — 产生的输出信号
标量 | 向量 | 矩阵

Details

根据参数生成矩形脉冲信号。

数据类型

Float64`。

复数支持

输入

# t — 时间
标量 | 向量 | 矩阵

Details

用于计算信号值的时间源。

依赖关系

要使用该端口,请将 Time (t) 参数设置为 Use external signal.

数据类型

Float64

复数支持

参数

主要

# Pulse type — 运行方式
Time based | Sample based

Details

设备的运行模式: Time based`或 `Sample based.

某些参数的激活取决于所选的模式。

Time based | Sample based

默认值

Time based

程序使用名称

PulseType

可调谐

可计算

# Time (t) — 时间源
Use simulation time | Use external signal

Details

选择用于计算信号值的时间源:

  • Use simulation time- 设备根据模拟时间生成输出信号。

  • Use external signal- 块根据输入端口 t 的值(可能与模拟时间不同)生成输出脉冲。程序块图标显示源连接的输入端口。

Use simulation time | Use external signal

默认值

Use simulation time

程序使用名称

TimeSource

可调谐

可计算

# Amplitude — 信号振幅
Scalar / array of real and/or complex numbers

Details

生成信号的振幅。

默认值

1

程序使用名称

Amplitude

可调谐

可计算

# Period (secs) — 脉冲周期
Scalar / array of real and/or complex numbers

Details

脉冲周期(秒)。

依赖关系

要使用此参数,请将 Pulse type 设置为 。 Time based.

默认值

10

程序使用名称

Period

可调谐

可计算

# Period (number of samples) — 脉冲周期
Scalar / array of real and/or complex numbers

Details

计算步数中的脉冲周期。

依赖关系

要使用该参数,请将 Pulse type 设置为 Sample based.

默认值

10

程序使用名称

PeriodNum

可调谐

可计算

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

Details

脉冲宽度定义为周期的百分比。

该值必须在"[0,100]"范围内。

依赖关系

要使用该参数,请将 Pulse type 设置为 Time based.

默认值

5

程序使用名称

PulseWidth

可调谐

可计算

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

Details

以计算步数表示的脉冲宽度。

数值必须在 [0,100] 范围内。

依赖关系

要使用该参数,请将 Pulse type 设置为 Sample based.

默认值

5

程序使用名称

PulseWidthNum

可调谐

可计算

# Phase Delay (secs) — 第一脉冲前的延迟
Scalar / array of real and/or complex numbers

Details

产生第一个脉冲前的延时(秒)。

依赖关系

要使用此参数,请将 Pulse type 设置为 。 Time based.

默认值

0

程序使用名称

PhaseDelay

可调谐

可计算

# Phase Delay (number of samples) — 第一脉冲前的延迟
Scalar / array of real and/or complex numbers

Details

第一个脉冲前的延迟时间按计算步数生成。

依赖关系

要使用该参数,请将 Pulse type 设置为 Sample based.

默认值

0

程序使用名称

PhaseDelayNum

可调谐

可计算

# Sample time — 计算间隔
SampleTime (real number / vector of two real numbers)

Details

以非负数指定计算步骤之间的间隔。

要继承计算步骤,请将此参数设置为 -1

依赖关系

要使用此参数,请将 Pulse type 设置为 Sample based.

默认值

1

程序使用名称

SampleTime

可调谐

可计算

附加选项

C 代码生成: 是