PLC PID控制之基于反馈的微分项控制算法

PID(Proportional-Integral-Derivative)控制是工业自动化中最常用的控制算法之一。它通过测量和计算误差的比例、积分和微分部分来调节输出信号,以实现对系统的精确控制。在PLC(可编程逻辑控制器)中,PID控制常用于实时控制和调节各种工业过程。本文将介绍基于反馈的微分项控制算法,并提供相应的源代码。

PID控制算法中的微分项可以增强系统的响应速度和稳定性。基于反馈的微分项控制算法是在传统PID控制算法的基础上引入了反馈路径,用于减小微分项对噪声的敏感性。以下是基于反馈的微分项控制算法的伪代码:

Kp = Proportional Gain
Ki = Integral Gain
Kd = Derivative Gain
Ts = Sampling Time
SP = Setpoint
PV = Process Variable
error = SP - PV
integral = 0
previous_error = 0

loop:
    error = SP - PV
    integral = integral + (error * Ts)
    derivative = (error - previous_error) / Ts
    output = Kp * error + Ki * integral + Kd * derivative
    previous_error = error
    update_output(output)
    wait(Ts)
    goto loop

在上述代码中,Kp、Ki和Kd分别代表比例、积分和微分增益。Ts表示采样周期,SP表示设定值,PV表示过程变量。error代表当前的误差,integ

离散PID控制算法公式全解析 该公式是位置式离散PID控制算法的核心,用于数字控制系统对被控对象进行闭环调节。公式由三部分组成:比例项(Kpek)快速响应当前偏差,积分项(KiΣejT)消除静态误差,微分项(Kd(ek-ek-1)/T)预测趋势抑制超调。离散化处理将连续PID转换为适合数字系统计算的离散形式,通过采样周期T实现积分求和与差分近似。该算法综合比例、积分、微分作用,实现快速响应、精确调节和稳定控制。 阅读详情

相关推荐

pid c语言算法plc,在三菱FX2NPLC上实现了增量式PID算法的控制

在工业生产中,常需要采用闭环控制方式来控制温度、压力、流量等连续变化的模拟量。无论是使用模拟控制器的模拟控制系统,还是使用计算机的数字控制系统,PID控制器都得到了广泛的应用。这是因为这种方法不需要精确的控制系统数学模型,有较强的灵活性和适应性。但是在数字PLC控制系统中,普通的PID算法对所有过去状态存在依赖性,从而引起系统较大的超调,使系统稳定性下降。增量式PID控制算法每次输出只输出控制增量...

weixin_35415045的博客 3521

信捷PLC增量式PID控制算法实现与优化

本文详细介绍了信捷PLC增量式PID控制算法的实现与优化方法。通过实际案例解析,从基础原理到高级优化策略,包括参数整定技巧、抗积分饱和处理、变参数PID实现等,帮助工程师快速掌握增量式PID在工业控制中的应用。特别适合电机控制、温度控制等场景,显著提升系统响应速度和稳定性。

weixin_26841743的博客 437

PID输出反馈回路调控算法原理

本文章学习研究PID闭环回路控制算法,介绍帮助大家理解这个算法,希望看后觉得有用就三连支持一下。

NULL指向我的博客 1817

PLC PID控制之基于反馈的微分项(微分先行)

有些控制系统,PID的输出控制输入的变化率,使用传统的 PI 或 PID 控制,会使系统经常发生超调,有了 PonM (基于反馈的比例项)和正确的整定参数,可以避免系统的超调。 受到到了Brett Beauregard发表的有关PID的系列文章,感觉对于理解PID算法很有帮助,作者Brett Beauregard的原文网址:http://brettbeauregard.com/blog/2017/06/introducing-proportional-on-measurement/,文中公...

RXXW_Dor的博客 1079

改进型增量式PID(基于偏差的微分项改为基于反馈的微分项)

1、CODESYS位置式PIDCODESYS位置式PID(完整ST源代码)_codesys pid功能块-CSDN博客CODESYS增量式PID完整源代码请参看下面文章链接:CODESYS增量式PID功能块(ST完整源代码)_RXXW_Dor的博客-CSDN博客增量式PID的详细算法公式和博途源代码,请参看下面的文章链接:博途1200/1500PLC增量式PID算法(详细SCL代码)_博图scl语言pid增量编码器_RXXW_Dor的博客-CSDN博客。

RXXW_Dor的博客 551

ADRC自抗扰TD跟踪微分器+普通PID组合控制(附完整梯形图代码)

ADRC自抗扰控制专栏有系列文章,大家可以自行搜索。ADRC的模块基本都可以独立使用,这篇博客我们讲解只使用TD跟踪微分器+传统PID的组合来改良PID控制。ADRC 跟踪微分器TD的算法详解请参看下面这篇博客:ADRC/Matlab一步步实现跟踪微分器TD(附完整PLC测试代码链接)_RXXW_Dor的博客-CSDN博客。

RXXW_Dor的博客 1489

实现温度PID控制的PLC程序设计

可编程逻辑控制器(PLC)是一种用于自动化控制的电子设备。它通过接收传感器和其他输入设备的信号,根据用户编程的逻辑指令,对机器或生产过程进行控制。PLC的基本工作原理包括输入采样、程序执行、输出刷新三个阶段。在输入采样阶段,PLC读取所有输入信号,并将它们存储在输入映像表中。在程序执行阶段,PLC按照程序中定义的逻辑顺序扫描用户程序。在输出刷新阶段,PLC根据逻辑处理的结果来更新输出映像表,并输出信号给外部设备。

weixin_29840475的博客 2530

eNSP-Pro配置又丢了?手把手教你用导出功能防患于未然

本文详细介绍了eNSP-Pro配置防丢失的全套方案,包括运行时内存、虚拟存储设备和宿主机文件系统的配置存储机制,以及多维度备份策略和特殊场景下的恢复技巧。通过优化保存流程、自动化定时导出和版本化管理,帮助网络工程师有效防止配置丢失,提升工作效率。

weixin_42665725的博客 253

Dify+firecrawl:一个超好用的网页转Markdown API,打造你的第一个能检索爬虫RAG知识库的聊天机器人

Firecrawl是一个超简单的API服务——你扔给它一个URL,它就能把整个网站(包括子页面!)的内容自动抓下来,并且转换成干净、易读的Markdown格式。不用配置网站的站点地图,不用写爬虫规则,API调一下,数据直接到手。接下来我们一起本地部署吧!

2501_91673550的博客 3010

手把手搭建摄像头驱动(一):I2C设备树插件与OV5640实战

本文手把手指导如何搭建OV5640摄像头驱动,重点讲解I2C设备树插件的编写与实战应用。通过硬件连接验证、I2C驱动框架搭建、设备树插件编译及动态加载调试,系统介绍Linux驱动开发全流程,并提供常见问题解决方案,帮助开发者快速掌握摄像头驱动开发技术。

git9versioner的博客 760

LTR-390UV-01对比VEML6075:5个真实项目中的选型避坑指南

本文对比了LTR-390UV-01和VEML6075两款环境光传感器在5个真实项目中的表现,提供了选型避坑指南。通过智能手环、农业温室、紫外线消毒柜等场景的实测数据,分析了动态范围、抗干扰性、温度稳定性等关键差异,帮助开发者在成本与性能间做出最优选择。

weixin_28733777的博客 226

2025东方财富笔试考什么?cata能力测评攻略|答题技巧真题分享

4月10日-4月20日 专业笔试(行测+金融知识混合双打) 4月25日-5月10日 面试车轮战(AI面+半结构化+压力面) 5月15日起 Offer发放(谈薪必杀技:对标同花顺/雪球)这里不仅是金融极客的乐园,更是**“年薪30万管培生计划”**的主战场——你将用代码重构K线,用算法预判市场,成为资本市场的“数字先知”。东方财富,中国金融信息服务领域的“隐形冠军”,以**“金融数据+互联网”双擎驱动**,打造了覆盖证券、基金、期货的全生态交易平台。:• “我总坚持自己的方案”(HR:团队毒药!

Dgntsj的博客 3273

车载导航GPS欺骗

因此,如果我们能够模拟卫星信号,将模拟的信号通过信号发射装置发送给GPS传感器,那么就有可能实现欺骗GPS传感器获取虚假的位置信息,这种技术即SDR(软件无线电,Software Defined Radio)[2]。究其原因,在不使用时钟模块的条件下,HackRF发送信号的频率可能不十分精准,因此GPS传感器接收到信号之后可能无法正常解析GPS信号,因此时钟信号可能是HackRF进行GPS欺骗的关键。2)HackRF是否使用了时钟模块,时钟模块决定了信号发送频率的精准程度,对实验的成败也是至关重要的。

2503_90751789的博客 1338

零中频接收机实战:DC Offset的5种常见解决方案与调试技巧

本文针对零中频接收机中DC Offset这一核心挑战,深入剖析了其产生机理与对信号解调的严重影响。文章从实战角度出发,系统性地介绍了五种解决方案,包括硬件预防、数字域校正、I/Q不平衡联合校正等,并分享了关键的实验室调试与产线测试技巧,旨在帮助射频工程师有效提升接收机性能。

weixin_29234509的博客 413

TIP 2026 即插即用 | Transformer篇 | 图像变清晰,检测就更准?TA-CAM:给注意力注入“任务意识”!(附代码)

本文提出下游任务启发的水下图像增强框架DTI-UIE,核心创新为Task-Aware Conv-Attention Module(TA-CAM):通过将任务先验注入Query端实现任务感知引导,避免污染主图像特征;采用因子化注意力降低计算复杂度,支持高分辨率输入;引入卷积式相对位置编码(CRPE),兼具局部归纳偏置与动态分辨率适配能力;模块支持双token输入,可无缝嵌入Transformer编码器。实验表明,该方法在语义分割、目标检测等任务上显著提升性能,兼顾效率与任务相关性,适用于多类视觉任务。

主要更新底层视觉(去噪、超分等)相关的科研内容,形式为【论文精读】+【论文复现】 569

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

上一篇: 车载诊断的设计和部署方案汇总及控制算法
下一篇: UDS诊断协议与控制算法
普通网友
博客等级 码龄3年 82粉丝 177原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址