Non-linear Regression program

kpElec

Lifetime Supporting Member
Join Date
Oct 2016
Location
Minnesota
Posts
23
Hi all!

I don't get a chance to get on this very often but I know this is a great resource for getting answers.

Does anyone know where i can find an already developed non-linear regression program for RA Logix processors?
My application includes a high friction vacuum pull roll which in my case will be feeding media through a 40 tooth encoder wheel where the wheel matches the flutes on the media. The media will finally wind up on a torque controlled winder hub. I need to anticipate the end of the media so that when the end is known, the media will stop feeding and be cut on the high side of the flute.

I would most be very appreciated for your help. Thank you.
 
Depending on what type of non linear regression you want, I suggest google it and get the code from Wikipedia or wherever then paste into the plc structured text block. Just fix the specific formatting, but the "logic " you have.
 
I don't know of any non-linear regression program for any PLC. Non-linear regression is very CPU intensive so it would be best to send the data points to a PC and have the PC do the math.

What you haven't made clear is what is the data points that you are fitting a curve to. What curve do you think it will be?
 
Hi Pete,

I'm not sure I understand your question but here goes.

I'm capturing the position of a main roller by means of a receiving roller. Every time the 4" diameter receiving roller makes a complete revolution, I capture the position of the 10" diameter main roller and stick that position in an array for each revolution. I am planning to use a proximity switch on the receiving roller and connect it to the registration input of the main roller drive. Mostly because the media can run up to 3000 mm/sec and I'm not confident the scan time of the PLC will catch every revolution of the receiving 4" roller when using a motion arm watch event.
Since I know the circumference of the of the main roller and the receiving roller and have the media thickness, I can calculate the diameter growth and length of media.
My issue is to stop the media at a calculated position length and cut the media at the peak of a corrugated media flute.
I do have an encoder wheel between the main and receiving roller so I should be able to find the peak using the encoder wheel.
It was my understanding that a regression program will do this but I'm not clear what the regression program is actually doing other than speculating what the length of the media will be.
Sorry to be wordy but I wanted to provide as much information to help understand what I am doing.
Thanks,
Kevin
 
Hi Pete,

I'm not sure I understand your question but here goes.

I'm capturing the position of a main roller by means of a receiving roller. Every time the 4" diameter receiving roller makes a complete revolution, I capture the position of the 10" diameter main roller and stick that position in an array for each revolution. I am planning to use a proximity switch on the receiving roller and connect it to the registration input of the main roller drive. Mostly because the media can run up to 3000 mm/sec and I'm not confident the scan time of the PLC will catch every revolution of the receiving 4" roller when using a motion arm watch event.
Since I know the circumference of the of the main roller and the receiving roller and have the media thickness, I can calculate the diameter growth and length of media.
My issue is to stop the media at a calculated position length and cut the media at the peak of a corrugated media flute.
I do have an encoder wheel between the main and receiving roller so I should be able to find the peak using the encoder wheel.
It was my understanding that a regression program will do this but I'm not clear what the regression program is actually doing other than speculating what the length of the media will be.
Sorry to be wordy but I wanted to provide as much information to help understand what I am doing.
Thanks,
Kevin

Kevin, are you cutting corrugated cardboard?

Regression analysis is used to take a number of measurements and turn them into a formula.

Like this (a linear example, that is a straight line):
450px-Linear_regression.svg.png


The formula for above would be y=mx+b
You'll get the m and b constants out of the regression analysis.
In this case b is about 5 and m is around 0.15.

So the formula would be y=0.15*x+5
 
Last edited:
Actually, it's a flat paper glued to a corrugated paper.

Yes, I've seen that chart before for linear regression analysis but thanks for providing it.

There doesn't seem to be a PLC program out there that does the non-linear regression.

I saw spaderkung's suggestion of looking up wikipedia which I have done already. It doesn't seem very intuitive to me.

Thanks.
 
Since you have an encoder why can't you just calculate how many encoder pulses should pass before cutting and then cut at that length?

PS. I've done a number of winder/unwinder applications in the past but I don't quite see why you need to do any kind of regression at all.
 
Last edited:
Are you saying that you have historical data of roll diameter to roll length, and you want to use that historical data to work out the formula of how many encoder pulses you need to stop at, given the roll diameter?

To do non linear regression (aka. regression), you have to know the shape of the curve. If you don't know the shape of the curve, you either work it out, guess it, or do multiple regression test against multiple possible formulae, calculating the R² value and pick the regression test that gives the highest R².

Let's work your one out. I will assume that bending your material does not change the area of the material. This means that the area of the drawn material area is equal to the area it takes up on the roll.

A_drawn=A_roll
T * L = pi (r_outer² - r_inner²)
L = pi/T (r_outer² - r_inner²)

Great, let me also assume that your inner roll is constant.

I now see that a y = ax² + c is probably going to be a good fit.

So now either look up 'y = ax² +c regression', or just substitute P = x² into the above and look up 'linear regression' and do it for y = aP + c.

If after reading this, linear regression is not for you, then tell us what outputs you want to get from what inputs.
 
You can do regression in an Excel spreadsheet. Enter the data points, create a chart, and then add a trend. You can select linear, exponential, logarithmic, etc. Have the formula displayed on the chart, and you can use the equation in your program.
 
You can do regression in an Excel spreadsheet. Enter the data points, create a chart, and then add a trend. You can select linear, exponential, logarithmic, etc. Have the formula displayed on the chart, and you can use the equation in your program.

Good point! I do that a lot too. Unless it has to be calculated in real time.

Great for machine settings that can not easily be calculated. I use it for settings that requires operator touch and feel to get right. By letting the operators run the machine I collect data on how they run it. Use that data to make formulas in Excel. Put those formulas back into the program to be used for automatic settings. That way less experienced operators can get good setting straight of the bat basically.
 
Instead of regression and mathematical formulas you can also use look-up tables that auto-correct themselves.

And you use interpolation to find values that are in between values in your look-up table.
What you end up with is an approximation of a complex curve but without any complex math in the PLC or elsewhere.
 
Last edited:
Thank you all for your insight on this.

The one thing I failed to mention is that there will be multiple sizes of encoder wheels with different amounts of teeth on the wheel, depending on which corrugated media that will be run.
Yes, I did do this on an excel spreadsheet and I have two charts created. One chart is for the diameter which shows a gradual increasing trendline and another chart shows the length of media which is an increasing curved trendline.
The diameter chart shows a formula of y=5.8173x + 101.58 and the length of media trendline shows a formula of y=9.1418x2 + 328.21x + 0.0219.

So, the AustralIan didn't think linear regression wasn't for my application so I assume non-linear was?

Pete, I think you mentioned that since I have an encoder, I could do the calculation with that to find my diameter needed, correct?
I tend to agree with you since I would always know the circumference of the encoder wheel and the pitch of the teeth on the encoder wheel. It seems to me that I could pre-calculate the amount of media passing through the encoder to get my stopping distance of the media by using a MAM, right? Of course, I would also need to include the offset of the location of the cutter as well.

This whole thing seems to be more complicated than it needs to be. I am coming into this project from a previous version but with many changes. I'm just trying to get my head wrapped around it.
 
What are the x and y values in your two formulae?

If it was me, I would forget about regression and use

L = fudge factor * pi/T * (r_o² - r_i²) + distance between roll tangent and encoder + fudge offset

Experiment in excel and see if there is a fudge factor and offset that satisfies all of your measurements and use that.

Also, come up with a better way of describing it than fudge factor, that way people will think you are clever.
 
Sounds like mathematics alone cannot solve your problem. For instance, you probably dont need the full equation of whatever formula it is, just to look in the rear mirror a little bit and predict the immediate future. But to determine exactly what to look for seems to be what you must figure out.
 

Similar Topics

Greetings! I have a assignment where i have to solve a non-linear level measurement with the use of trend line. I have a tank table showing...
Replies
24
Views
6,600
Hi All, Has anyone any experience in controlling a non linear valve with a PID? Traditionally this valve is controlled on flow but would like to...
Replies
36
Views
11,019
Hi guys and gals I have a severely non linear system that i am trying to develop a controller for. The non linear curve can be broken down...
Replies
8
Views
2,690
Hello, I am seeing an issue with inaccurate tank level. It is an elliptical bottom tank with an Anderson Level sensor mounted on the bottom of...
Replies
20
Views
7,495
Hi, i have a pressure sensor (range 0-10 bar) and its output is 0-20 ma. but the current vs pressure curve is non linear such as. pressure...
Replies
3
Views
2,050
Back
Top Bottom