CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Tue Sep 25, 2018 7:04 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Sep 08, 2017 1:20 pm 
Offline

Joined: Thu Jun 01, 2017 11:37 am
Posts: 1
Hello Community

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.
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.

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.

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:

y=a*x+c

Thank you for reading this.


Top
   
PostPosted: Sat Sep 16, 2017 6:30 pm 
Offline
Frequent User
Frequent User

Joined: Wed May 04, 2016 6:00 pm
Posts: 238
Hi.

If x is time and you capture one signal every cycle:

Speed:=(analog_cyclei-analog_cyclei-1)/ cycle_time.

If speed is not stable you can apply a filter.

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.


Top
   
PostPosted: Thu Sep 28, 2017 7:17 pm 
Offline
Frequent User
Frequent User

Joined: Thu Jun 14, 2007 9:49 am
Posts: 985
linear_int is to make an interpolation not a curvefitting.
curve fitting is not a solution as you will need a input to check where it is on your curve.
you can use a filter, and check if the ROC is too high with every sample taken or wit a filter.

_________________
shooter@home.nl
computer shooter
paul deelen
jacob van wassenaerstraat 29
NL 5224 GG 's-Hertogenbosch
skype shooter paul.deelen
phone +31736139136


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited