2394|2

2647

帖子

6

TA的资源

五彩晶圆(初级)

楼主
 

LTspice(11) arbitrary behavioral source [复制链接]

LTspice(11) arbitrary behavioral source

在电子系统里我们需要的信号多种多样,所以为了更加准确的仿真,输入信号应该也是多种多样。在LTspice里通常的电压源支持的模式虽然比较多,但是还不够全面。

常规的电压源可选配置如下⬇️

图1:常规电压源可选配置

如果你的信号超出了这个的定义范围,那么就需要使用arbitrary voltage,在SPICE里面他的开头是B可以是BV也可以是BI分别代表随机电压和电流。以下给出了帮助里的说明。

B. Arbitrary Behavioral Voltage or Current Sources

Symbol names: BV, BI

Syntax: Bnnn n001 n002 V=<expression> [ic=<value>]
        + [tripdv=<value>] [tripdt=<value>]
        + [laplace=<expression> [window=<time>]
        + [nfft=<number>] [mtol=<number>]]

        Bnnn n001 n002 I=<expression> [ic=<value>]
        + [tripdv=<value>] [tripdt=<value>] [Rpar=<value>]
        + [laplace=<expression> [window=<time>]
        + [nfft=<number>] [mtol=<number>]]

The first syntax specifies a behavioral voltage source and the next is a behavioral current source. For the current source, a parallel resistance may be specified with the Rpar instance parameter.

在任意行为仿真源(arbitrary behavioral source)中 time代表当前仿真时间pi代表

3.14159265358979323846.可以使用LTspice几乎所有的表达式,支持的表达式如下所示。

Function Name

Description

abs(x) 

Absolute value of x 

absdelay(x,t[,tmax]) 

x delayed by t. Optional max delay notification tmax.

acos(x) 

Real part of the arc cosine of x, e.g., acos(-5) returns 3.14159, not 3.14159+2.29243i

arccos(x) 

Synonym for acos() 

acosh(x) 

Real part of the arc hyperbolic cosine of x, e.g., acosh(.5) returns 0, not 1.0472i

asin(x) 

Real part of the arc sine of x, asin(-5) is -1.57080, not -1.57080+2.29243i

arcsin(x) 

Synonym for asin() 

asinh(x) 

Arc hyperbolic sine 

atan(x) 

Arc tangent of x 

arctan(x) 

Synonym for atan() 

atan2(y,x) 

Four quadrant arc tangent of y/x

atanh(x) 

Arc hyperbolic tangent

buf(x) 

1 if x > .5, else 0

ceil(x) 

Integer equal or greater than x

cos(x) 

Cosine of x 

cosh(x) 

Hyperbolic cosine of x

ddt(x) 

Time derivative of x 

delay(x,t[,tmax] 

Same as absdelay() 

dnlim(x,y,z) 

Similar to max(x,y) but with a continuous 1st derivative transition width z

exp(x) 

e to the x 

floor(x) 

Integer equal to or less than x

hypot(x,y) 

sqrt(x**2 + y**2) 

idt(x[,ic[,a]]) 

Integrate x, optional initial condition ic, reset if a is true.

idtmod(x[,ic[,m[,o]]]

Integrate x, optional initial condition ic, reset on reaching modulus m, offset output by o.

if(x,y,z) 

If x > .5, then y else z

int(x) 

Convert x to integer

inv(x) 

0. if x > .5, else 1.

limit(x,y,z) 

Intermediate value of x, y, and z

ln(x) 

Natural logarithm of x

log(x) 

Alternate syntax for ln()

log10(x) 

Base 10 logarithm 

max(x,y) 

The greater of x or y 

min(x,y) 

The smaller of x or y 

pow(x,y) 

Real part of x**y, e.g., pow(-1,.5)=0, not i.

pwr(x,y) 

abs(x)**y 

pwrs(x,y) 

sgn(x)*abs(x)**y 

rand(x) 

Random number between 0 and 1 depending on the integer value of x.

random(x) 

Similar to rand(), but smoothly transitions between values.

round(x) 

Nearest integer to x 

sdt(x[,ic[,assert]])

Alternate syntax for idt()

sgn(x) 

Sign of x 

sin(x) 

Sine of x 

sinh(x) 

Hyperbolic sine of x 

smallsig() 

Returns 1 if a .ac or .noise analysis is being done. Otherwise 0.

sqrt(x) 

Square root of x 

table(x,a,b,c,d,...) 

Interpolate a value for x based on a look up table given as a set of pairs of points.

tan(x) 

Tangent of x. 

tanh(x) 

Hyperbolic tangent of x

u(x) 

Unit step, i.e., 1 if x > 0., else 0.

uplim(x,y,z) 

Similar to min(x,y) but with a continuous 1st derivative transition width z

uramp(x) 

x if x > 0., else 0.

white(x) 

Random number between -.5 and .5 smoothly transitions between values even more smoothly than random().

!(x) 

Alternative syntax for inv(x)

~(x) 

Alternative syntax for inv(x)

• The following operations, grouped in reverse order of precedence of evaluation:

Operand

Description

Convert the expressions to either side to Boolean, then AND.

Convert the expressions to either side to Boolean, then OR. 

Convert the expressions to either side to Boolean, then XOR.

 

 

True if expression on the left is greater than the expression on the right, otherwise false.

True if expression on the left is less than the expression on the right, otherwise false.

>= 

True if expression on the left is greater than or equal the expression on the right, otherwise false.

<= 

True if expression on the left is less than or equal the expression on the right, otherwise false.

 

 

Floating point addition

Floating point subtraction

 

 

Floating point multiplication

Floating point division

 

 

** 

Raise left hand side to power of right hand side. Only the real part is returned, e.g., -1**1.5 gives zero not i.

 

 

Convert the following expression to Boolean and invert.

 

了解了大概咋回事,咱们就开始搭建一个简单的任意电压源(arbitrary behavioral voltage source)吧!

在LTspice的器件库中直接搜索bv即可,如图2所示。

图2:任意行为电压源

放置好以后我们就可以对其进行测试,我们可以弄个以时间变化的电压值。如图3所示,仿真结果如图4所示。

图3:随时间变化的电压

图4:仿真结果

也许我们想来个随机信号,那我们只要将随机信号的公式带入即可。我们使用random(x)函数,对于它的描述如下所示。

rand(x) 

Random number between 0 and 1 depending on the integer value of x.

random(x) 

Similar to rand(), but smoothly transitions between values.

 

他可以生成0~1之间的数,具体取决于x的整数值。设置如图5所示。仿真结果如图6所示。

图5:随机电压设置

 

图6:仿真结果

图7:PP值

图8:Meas测量结果 测量代码:.MEAS TRAN B1 PP V(vout)

电路测试代码:

* xutong 2023/3/14

B1 vout 0 V=random(time*1000)/1000

.tran 10

.MEAS TRAN B1 PP V(vout)

.backanno

.end

 

 

今天就先聊到这里啦,拜拜~

此帖出自模拟电子论坛

最新回复

超出了这个的定义范围,需要使用arbitrary voltage,这个任意电压是什么工具   详情 回复 发表于 2023-3-16 13:08
点赞 关注
个人签名

希望做一些大家觉得好用的东西!


回复
举报

2万

帖子

340

TA的资源

版主

沙发
 

超出了这个的定义范围,需要使用arbitrary voltage,这个任意电压是什么工具

此帖出自模拟电子论坛

点评

就是你通常的电压源不能带入任意表达式,使用arbitrary behavioral source 就可以带入 time 啊或者什么 abs()这样的表达式去描述电压源  详情 回复 发表于 2023-3-16 21:42
 
 

回复

2647

帖子

6

TA的资源

五彩晶圆(初级)

板凳
 
qwqwqw2088 发表于 2023-3-16 13:08 超出了这个的定义范围,需要使用arbitrary voltage,这个任意电压是什么工具

就是你通常的电压源不能带入任意表达式,使用arbitrary behavioral source 就可以带入 time 啊或者什么 abs()这样的表达式去描述电压源

此帖出自模拟电子论坛
 
个人签名

希望做一些大家觉得好用的东西!

 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/8 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表