Math Lesson

AGENTTINFOIL

Member
Join Date
Jul 2005
Location
Louisville, KY
Posts
222
Guys I need some help.

I am trying to write code to run a docking roller. The docking roller needs to match the fpm of the conveyor belt below it. Now I know the formulas for converting fpm to rpm, that is the easy part. but I am unsure how to proceed to write it in code. The speed of the conveyor is controlled by a speed pot that is connected to an analog input card and analog out to a dinverter. I would like to use the same raw data from the speed pot to control the speed of the docking roller to match the conveyor belt. as so to always change respectively so they are always in sync or at the same speed. I have an idea how to go about this but the math instructions are killing me and I am still trying to dicifer the code as it appears to be indexed addressing and I am new to this addressing method.

the code is attached if some one could take a look and give me some thoughts or suggestions.

Travis
 
Hi, Not sure what a 'docking roller' is so this may not work? If the conveyor is controlled by a VSD there maybe a max frequency parameter which you could adjust so that the conveyor max speed is the same as the docking roller max speed?
 
Control Freak said:
I am certianly no math guru whatsoever, but check out the SCL [Scale Data] or the SCP [Scale with Parameters] functions.

Hmmm...

I would say 'Control Freak' is an imposter, but he joined before me, I guess that would make me the imposter? :confused:
 
What I would do

Your best bet is going to be using a compute instruction, CPT. I would need to spend more time looking at this to understand what the input speed value is related to the potentiometer value. In a nutshell, if you know the equations you need to use, you need to replicate them in PLC instructions, and your best bet is the instruction above. It will allow you to do multiplication and division in one equation. I understand the desire to have both follow the same input reference, but you could also do this by using the output reference you are trying match. Just another idea.

Russ
 
cntrlfrk said:
Hmmm...

I would say 'Control Freak' is an imposter, but he joined before me, I guess that would make me the imposter? :confused:

"Imitation is the sincerest form of flattery" <--- not that your imitating, but I'm flattered ;). (later on I wished that I had chosen 'Control Freq')

russrmartin said:
Your best bet is going to be using a compute instruction, CPT. I would need to spend more time looking at this to understand what the input speed value is related to the potentiometer value. In a nutshell, if you know the equations you need to use, you need to replicate them in PLC instructions, and your best bet is the instruction above. It will allow you to do multiplication and division in one equation. I understand the desire to have both follow the same input reference, but you could also do this by using the output reference you are trying match. Just another idea.

Russ

Russ, Ive never used the CPT instruction, but I must say that after reading about it, I wonder why I haven't! Looks very useful.
 
russrmartin said:
Your best bet is going to be using a compute instruction, CPT. I would need to spend more time looking at this to understand what the input speed value is related to the potentiometer value. In a nutshell, if you know the equations you need to use, you need to replicate them in PLC instructions, and your best bet is the instruction above. It will allow you to do multiplication and division in one equation. I understand the desire to have both follow the same input reference, but you could also do this by using the output reference you are trying match. Just another idea.

Russ

Russ thanks for the reply. I was thinking of using the output instruction and also I agree that seems to be the best way to do it but I am struggling with the math. Right now I am sizing gearbox and motor for this application and I am hoping to get a jump start on the code. I was thinking about the SCP at first but I like the CPT better that seems like a great idea. I am at work right now so I will post later with more info.

thanks again
 
Travis,

You may use either the potentiometer signal or the existing output to the conveyor as your starting computational point for the docking roller. For both cases you will have to know the mathematical relationship between the input and the docking roller. In other words, for each increment in the conveyor pot input signal, how fast will the docking roller turn? Unless it has the same motor speed, gearbox ratio, and head pully size, then it will not be the same as the conveyor.

The bottom line is that you will need to know the speed relationship (scale factor) between the conveyor and the docking roller. For example, for a conveyor analog input = 10 volts and the conveyor runs 60 fpm, then how fast will the roller conveyor run for the same 10 volts input signal? If it would run at only 40 fpm, then your scale factor multiplier would be 60/40 = 1.5. So you could take the conveyor analog output signal, multiply it by 1.5 and send it to the docking roller to make it run the same speed as the conveyor (in theory anyway).
 
Last edited:
Not sure

I'm not sure based on your last post if you are struggling with the actual mathematical equations needed to convert the linear speed to rotational speed, or the scaling of 1 signal to the other, or if you understand both of these and just are not sure how to represent these equations in the PLC. Let us know exactly where you're stuck and I think we can get you over the hump.

Russ
 
I think that Lancie1 and Russrmartin have made a good suggestion about using the data going to the output that I am trying to match.

especially since I can not figure out how the data is being moved to the output channel address ( the source value in the move instruction is different than the destination value being moved ) I spent about 2 hours on the phone with Rockwell trying to figure out how the original programmer wrote the code. Needless to say not only has it got me beat but Rockwell also. I would like to figure it out but I think at this point I need to go with a known. Although I would like to challenge anyone that would like to take a stab at it. If you can figure it out you have one up on Rockwell support and maybe you can explain it to me.

Russrmartin- I understand how to convert the linear speed to rpm I think the equation is as follows FPM = PI x RPM x Diameter RPM = FPM / (PI x Diameter) correct me if I am wrong.

I understand scaling values,(Example 0=4mA 100=20mA)I have used this type with SCP before, but I am following short on the scaling of one analog value to another. I am not really sure how to represent the equation in the PLC as well. would this be just like the above equation but in code? and if so how does the analog values come into play with this? as I am having a hard time seeing the relationship between the two.
 
especially since I can not figure out how the data is being moved to the output channel address ( the source value in the move instruction is different than the destination value being moved ) I spent about 2 hours on the phone with Rockwell trying to figure out how the original programmer wrote the code.
Agent,

Your analog speed value for each different motor output is being created when the File 4 JSR's call File 3. The SAME address N7:203 in File 3, Rung 5 is being used for all speed outputs, so it will change as each output is called. The MUL instruction multiplies the potentiometer value by the speed input and sends the result to N7:202. But the "unseen" math register S:13 and S:14 also contains the 32-bit signed integer result of the multiply operation.

The next instruction, the DDV command in Rung 5, is calculating the desired analog speed and saving it in N7:203. The DDV divides the contents of the math register (S:13 and S:14 containing the previous 32 bits of data from the MUL), by the source (16 bits of data, the constant "1000" in your case) and stores the result in the output speed destination (N7:203) and also in the math register.

The desired output speed value N7:203 for each motor is calculated on demand by the JSR and moved to the proper PLC outputs in File 4, Rungs 0 through 18. Therefore, the value in N7:203 will only be shown equal to the last motor output that was calculated (File 4, Rung 18, Upper Extruder Rollers) but not to any of the other motors.

PS: Send any gratuities to Lancie1 :whistle:
 
Last edited:
AGENTTINFOIL said:
Russrmartin- I understand how to convert the linear speed to rpm I think the equation is as follows FPM = PI x RPM x Diameter RPM = FPM / (PI x Diameter) correct me if I am wrong.

I understand scaling values,(Example 0=4mA 100=20mA)I have used this type with SCP before, but I am following short on the scaling of one analog value to another. I am not really sure how to represent the equation in the PLC as well. would this be just like the above equation but in code? and if so how does the analog values come into play with this? as I am having a hard time seeing the relationship between the two.

I think your FPM calculation needs some work. Linear speed at the surface of a rotating circle is equal to the circle's angular velocity multiplied by it's radius. Angular velocity is basically how fast the roll is turning. This is basically what you are trying to control. Your basic equation will look like this:
Velocity (feet/min)= angular velocity(radians/min)*Roll radius.

If you know the FPM you are trying to match, the left side of this equation is set. Let's say 10FPM. For easy math, let's say your roller is 1 foot in diameter. Then you will say that 10ft/min=X(rad/min)*.5ft. Solving for X you get X = 20 rad/min.

Now we simply have to convert the angular velocity to units you desire, which is RPM. Since there are 2pi radians in one revolution, we say 20 rad/min*1Rev/2pi rad=3.18RPM. So, if you had a 1 foot diameter roller, and wanted it to match a line speed of 10 feet per minute, you would command it to run 3.18 RPM. Of course this did not take into account other conversion factors such as gearbox ratios, etc.

You could do all of this in one instruction, including the gearbox calculations, but if you do, it is a good idea to illustrate what the equation is doing in a rung comment. Hope this helps.

Russ
 
Lancie1 said:
Agent,

Your analog speed value for each different motor output is being created when the File 4 JSR's call File 3. The SAME address N7:203 in File 3, Rung 5 is being used for all speed outputs, so it will change as each output is called. The MUL instruction multiplies the potentiometer value by the speed input and sends the result to N7:202. But the "unseen" math register S:13 and S:14 also contains the 32-bit signed integer result of the multiply operation.

The next instruction, the DDV command in Rung 5, is calculating the desired analog speed and saving it in N7:203. The DDV divides the contents of the math register (S:13 and S:14 containing the previous 32 bits of data from the MUL), by the source (16 bits of data, the constant "1000" in your case) and stores the result in the output speed destination (N7:203) and also in the math register.

The desired output speed value N7:203 for each motor is calculated on demand by the JSR and moved to the proper PLC outputs in File 4, Rungs 0 through 18. Therefore, the value in N7:203 will only be shown equal to the last motor output that was calculated (File 4, Rung 18, Upper Extruder Rollers) but not to any of the other motors.

PS: Send any gratuities to Lancie1 :whistle:

LOL!!! Hey Lancie1 your pretty sharp... I finally got the down low from the original programmer today. He told me that the code is basiclly old school programming. He explained the code to me almost as you have. I knew someone would take the challenge... Thanks for the decipher.
 
russrmartin said:
I think your FPM calculation needs some work. Linear speed at the surface of a rotating circle is equal to the circle's angular velocity multiplied by it's radius. Angular velocity is basically how fast the roll is turning. This is basically what you are trying to control. Your basic equation will look like this:
Velocity (feet/min)= angular velocity(radians/min)*Roll radius.

If you know the FPM you are trying to match, the left side of this equation is set. Let's say 10FPM. For easy math, let's say your roller is 1 foot in diameter. Then you will say that 10ft/min=X(rad/min)*.5ft. Solving for X you get X = 20 rad/min.

Now we simply have to convert the angular velocity to units you desire, which is RPM. Since there are 2pi radians in one revolution, we say 20 rad/min*1Rev/2pi rad=3.18RPM. So, if you had a 1 foot diameter roller, and wanted it to match a line speed of 10 feet per minute, you would command it to run 3.18 RPM. Of course this did not take into account other conversion factors such as gearbox ratios, etc.

You could do all of this in one instruction, including the gearbox calculations, but if you do, it is a good idea to illustrate what the equation is doing in a rung comment. Hope this helps.

Russ

Russ let me soak this up and I will get back. It seems that you are correct my equation is bogus I need to examine a little deeper. I will have more questions for you, I have alot lf info from you guys and other sources I need to piece it all together.

thanks for the help
 

Similar Topics

I have an expression in a structured text routine of a Logix controller that looks more or less like the following: ResultInteger := Integer1 *...
Replies
13
Views
422
This application has a motor with encoder feedback that drives a linear actuator that moves in/out, and is at roughly 45 degs from horiz. As the...
Replies
19
Views
1,391
Hi all. First time programming a machine of this type. A center driven unwind feeding to a center driven rewind. No dancers or load cells, just...
Replies
37
Views
4,924
Hello, Been a while since I posted , Still sucking air been a interesting 3.5 years the dreaded health with old age scenario. Back at it and had a...
Replies
11
Views
2,073
Hello: Some time ago I wrote some basic code for a GuardLogix, in which I needed to add and subtract tags of LINT data type. When tried to use the...
Replies
13
Views
3,766
Back
Top Bottom