Recent posts to Linear Interpolation - Linear trendlinehttps://forge.codesys.com/forge/talk/CODESYS-V2/thread/1ebd5cd638/Recent posts to Linear Interpolation - Linear trendlineenThu, 27 Feb 2020 22:14:22 -0000Linear Interpolation - Linear trendlinehttps://forge.codesys.com/forge/talk/Codesys%20V2.3/thread/1ebd5cd638/?limit=25#5e8d<div class="markdown_content"><p>linear_int is to make an interpolation not a curvefitting.<br/>
curve fitting is not a solution as you will need a input to check where it is on your curve.<br/>
you can use a filter, and check if the ROC is too high with every sample taken or wit a filter.</p></div>shooterThu, 27 Feb 2020 22:14:22 -0000https://forge.codesys.come3f11dec20c597c6d6e99df03c60b1be128b92ddLinear Interpolation - Linear trendlinehttps://forge.codesys.com/forge/talk/Codesys%20V2.3/thread/1ebd5cd638/?limit=25#411a<div class="markdown_content"><p>Hi.</p>
<p>If x is time and you capture one signal every cycle:</p>
<p>Speed:=(analog_cyclei-analog_cyclei-1)/ cycle_time.</p>
<p>If speed is not stable you can apply a filter.</p>
<p>If not x nor y are time, a lineal regression could be a good solution (wikipedia). Be carefull because sometimes and if the number of samples is big could spend a lot of time.</p></div>josepmariaramsThu, 27 Feb 2020 22:14:21 -0000https://forge.codesys.coma0a879cdd3e5c7beff543c6217efc77e5c9b6db5Linear Interpolation - Linear trendlinehttps://forge.codesys.com/forge/talk/Codesys%20V2.3/thread/1ebd5cd638/?limit=25#13a8<div class="markdown_content"><p><em>Originally created by:</em> amir_aj67@yahoo.com</p>
<p>Hello Community</p>
<p>My aim is to monitor an analogue input to my PLC, if this analogue value rate of change is higher than the defined threshold then i need to stop the machine.<br/>
there are few ways to do this mathematically. The first method is to calculate the rate of change. I have tried to use the ROC in alarms group with no luck. the main problem is that i can't change the threshold online.</p>
<p>The second and my favourite method is to save lets say up to 10 readings in an array and then do a curve fitting, after that we can find the slope of the linear trendline (like what we do in excel) and we can compare the slope of these few trendlines to understand if the analogue input ROC is higher than expected or not. I tried to use the LINEAR_INT in Oscat library but the problem with that one is it does not do a curve fitting for all the points but it cuts it up to 10 linear segments. </p>
<p>does any one of you have any idea what is the best way to do above? is there any function that can output a linear trendline for an (x,y) array? something like equation below:</p>
<p>y=a*x+c</p>
<p>Thank you for reading this.</p></div>AnonymousThu, 27 Feb 2020 22:14:19 -0000https://forge.codesys.comede609b3b08ccc1b5b11f2c480050ae580c512c1