如何不使用变频器的加减速,通过西门子PLC(TIA博途) S7-1200/1500 SCL程序实现斜坡线性控制电机
一.程序执行输出效果

二.线性平滑功能主要应用场景举:
1.例如大功率的电机的速度设定,不允许速度从0%直接上升到80%,需要有个斜坡,比如3%每秒的速度上升,否则会对电网造成很大冲击。
2.例如大口径的阀门,不允许打开和关闭的速度太快。造成对总管的压力突变或者水锤。
经过上面几个案例介绍,其实都是需要个线性平滑的功能,对于功能而言实现这个功能,我们可以通过控制器去实现,例如变频器的加减速时间设定实现一个斜坡加减速的功能。
三.斜坡线性平滑算法原理
1.算法公式

MaValue:大速度。
MinValue:小速度
SmoothTime:线性平滑总时间
h:计算步长,PLC的循环中断时间

2.新建一个OB30循环中断块,并且设定循环时间10ms

3.调用程序功能块

4.程序演示
假设需要电机需要从0Hz上升到60Hz,从60Hz下降到30Hz,观察程序目标值,可以看到一个爬升上升与下降过程。


四.SCL程序说明
1.符号表

2.程序

REGION 单步变化量 #deltaValue := (#maxValue - #minValue) / DINT_TO_REAL(#smoothTime * 1000 / #h);END_REGION
REGION 计算偏差值 #SetSmSUB := #SetValue - #sm_out_1; IF #SetSmSUB #deltaValue THEN IF #SetValue > #sm_out_1 THEN #factor := 1.0; ELSIF #SetValue = #sm_out_1 THEN #factor := 0.0; ELSIF #SetValue