haoayou 发表于 2024-7-10 18:16:53

一阶滞后滤波法

<p><span style="text-wrap: nowrap;">IF #&quot;a (0-1)&quot; &gt;= 1.0 THEN</span></p><p><span style="text-wrap: nowrap;">&nbsp; &nbsp; #&quot;a (0-1)&quot; := 0.5;</span></p><p><span style="text-wrap: nowrap;">END_IF;</span></p><p><span style="text-wrap: nowrap;"><br/></span></p><p><span style="text-wrap: nowrap;">#ms_time := INT_TO_TIME(#time_ms);</span></p><p><span style="text-wrap: nowrap;">#IEC_Timer_0_Instance(IN := NOT #p,</span></p><p><span style="text-wrap: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PT := #ms_time,</span></p><p><span style="text-wrap: nowrap;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Q =&gt; #p);</span></p><p><span style="text-wrap: nowrap;">IF #p THEN</span></p><p><span style="text-wrap: nowrap;">&nbsp; &nbsp;&nbsp;</span></p><p><span style="text-wrap: nowrap;">&nbsp; &nbsp; #new_value := (1 - #&quot;a (0-1)&quot;) * #IN + #&quot;a (0-1)&quot; * #last_value;</span></p><p><span style="text-wrap: nowrap;">&nbsp; &nbsp; #last_value := #new_value;</span></p><p><span style="text-wrap: nowrap;">&nbsp; &nbsp; #OUT := #new_value;</span></p><p><span style="text-wrap: nowrap;">END_IF;</span></p><p><span style="text-wrap: nowrap;"><br/></span></p><p><img src="/upload/article/20230620/1687249197183861.png" title="1687249197183861.png" alt="image.png"/></p>
页: [1]
查看完整版本: 一阶滞后滤波法