Sign in to follow this  
Followers 0
kcor

Micrologix HSC, Rate, and PID

11 posts in this topic

I posted this on another forum as well, but realize that some folks on here may not use the other forum. Thanks for any input. Micrologix and HSC and PID Have a motor that is rated a max speed of 1750 rpm. This motor will have a gearhead with a rating of 15 to 1. The max speed of the output of the gearhead will then be 1750/15 = 116.6, or 117rpm. This will be coupled directly to some drive rollers, and a encoder will be mounted on one of the rollers. This rate of 0-117rpm, will then be used as a master reference for another motor that will be slaved to it. I downloaded a sample file from AB web site that showed how to use a micrologix plc and determine rate, and it appears to work. I can place a tach on the head of a cordless drill which I am using to turn the encoder, and the value in the lad for the rate and the tach are the same. How can I take this information and use the encoder that will be mounted on the second motor and set up a PID to then control the speed of the slave motor, which will have a encoder on it as well? The encoder for that motor will be a 0-1000 pulse per revolution encoder as well. What I am wondering is how can the rate value from the first motor be used to determine the speed that the 2nd motor will need to run, and a encoder that will be mounted on the 2nd motor to show the actual rpm from that motor showing that rate that motor is actually turning, both be used in a PID. Would both the rate values have to be scaled for PID. Attached a sample piece of code where I used a SCP instruction on the bench to try and scale a analog output based on the rate from the input. Not quite sure how to use a PID instead of the SCP. I have been reading all of the post that deal with PID, and still a little confused. Have not ever had a project where I used the PID, and any advice would be appreciated. I hope my explanation is understandable. Rate_PID.zip

Share this post


Link to post
Share on other sites
I think we need more information the important thing is not necessarily the speed of the motor but the speed of what is being driven say that each drive is driving a roller of equal diameter then using SCP to give an input over the range 0-117 can be used to SCP an output which will go to your second drive to follow the speed if the rollers are different diameters then you will have to do the math the 2nd encoder would only be of use to prove the speed of the second roller was what you expected or generate an alarm

Share this post


Link to post
Share on other sites
Here is my first attempt at PID I am totally confused, and hope some of the PID experts on this site will give your advice. N7:50 is the value from a encoder mounted on a roller driven by a motor that I reference as Chamber Mtr1. I only have one encoder at the moment, so on the bench, manually putting a value between 0-117 to simulate that the encoder from that roller has been scaled to be 0-117 rpm. N7:40 is the rate from a encoder mounted on a roller that I reference as Main Motor Master Encoder. It is scaled to give a value between 0-117 for 0-177rpm. From what I have read on this site as well as another forum site, I took this value and used a SCP to scale it to be between 0-16383 to be used in the PID as the setpoint. I then took N7:50 ( which I manully put a value of 0-117 into )which is the encoder reading from the roller referenced as Chamber Mtr1 and used a SCP and used it as the Process Value for the PID. As expected, when the encoder count from the first roller ( setpoint) increased from 0-117, the output from the PID, which I fed into another SCP to give a output of 0-10v increased when I had a value of 0 in N7:50. For example, if the setpoint for the PID saw a value of 117, then the output from the PID that is going into the SCP, caused N7:53 to be 31206 (output of 10v) If I manually increased the value of the process value from 0-117, the output decreased. Here is where I am confused. The first encoder will see a speed that a roller is turning, and if the second encoder sees that the second roller is running slower, then the 0-10v signal out to the motor will be high enough to cause the second roller to turn faster, once the two encoders see the same speed, the PID will cause the output N7:53 to go down. How can I use N7:53 to control the speed of the second motor that is being used to control the roller for the second encoder? I know this has to be not as difficult as I am seeing it at the moment, but it appears that if the two encoders saw the same value, then I would be sending 0v out to the drive, and the drive would not be turning. This would cause the fabric to just be what is causing the roller to turn and not the motor. Could someone take a look and tell me if I am just way out in left field, or that I just do not fully understand how to use a PID to ensure that motor 2 is running the same speed as motor 1, with encoder feedback from a roller driven from each motor. Have to be honest, been messing around with this for a couple of weeks, and seem to be getting nowhere. It is a project that I have coming up in a couple of weeks, so now seeking advice. THANKS A LOT IN ADVANCE FOR ANY GOOD ADVICE TO HELP ME OVERCOME MY CONFUSION, FROM rate_2_pid.zip

Share this post


Link to post
Share on other sites
Sorry still do not see why you are trying to use a PID, this is normally used if say you have a fabric material that you want to keep at a constant tension then you would have a loop and some form of sensor whether dancing bar, photocell, ultrasonic unit with which try to adjust the speed of the 1st motor to keep a constant loop feeding it, the second motor would then be controlled by the speed of the 1st simply using the speed of the first to calculate the speed of the second from the mechanics plus any offset you feel appropriate for shrinkage/growth of product. All you are trying to do is control one motor speed with another you can do this by linking two drives together you do not actually need a plc to do this although using the encoders should a give indication of the speeds and give more accurate control. Why would the second motor run slow if you are feeding an output signal from the first motor speed unless the second motor is heavily loaded and can thus be braked What is actually causing the speed to vary this is the element that should be in your PID loop Edited by comeng

Share this post


Link to post
Share on other sites
thanks for your input. the reason why a pid is being used with the second motor and a encoder is connected to a roller that is being driven by that motor, is the fact that our new corporate bossman (Manager of Engineering), who's background is mechanical/electrical, more mechanical than electrical, said that is what he wanted, so that is what we will use. No sense in trying to argue. I tried to explain to him that you could just link the drives together, he said no, he wanted a plc, with a encoder on what we are calling a master motor, and encoder on another motor, we call the slave. He also said that he wanted a encoder on a roller that is being driven by each motor, so that is what I have been trying to look at doing. When I first looked at doing this, I just the reading from the first encoder to determine the speed that the first motor should run, and then set it up so that through the operator screen , you could select what percentage of that you wanted any other motors to run. But, that was not what he wanted. So, with that said, any sample program, etc. that you or anyone else would like to share that might show a overview on how to have a master motor, with a encoder on what it is driving, being used as the setpoint to determine how another motor should run, and the second motor also have a encoder to show what it is really turning and adjust the speed of that motor in case for some reason it needs to be adjusted, would be greatly appreciated. I have spoke to my local ab rep about this, and at the moment, he is not sure either. Thanks

Share this post


Link to post
Share on other sites
lets look at another scenario away from your project and see how the elements match in An office building hundreds of people simple aircon they select how much air is coming to each desk but every hour the numbers in the building go up and down, as people leave their desks the air con shuts. So the system is setup with a variable speed fan the air con engineer initially assess's that the system pressure for optimum flow is 100mbar (PID setpoint) a pressure transducer feeds the actual pressure back to the input of the PID giving a plus/minus variation from the setpoint to which it responds by increasing/decreasing the speed of the fan so as the air load varies dependent on the people opening and closing vents then the system responds to keep a constant system pressure. OK lets say first motor speed set from a pot (could be a value on an HMI), bring encoder from first motor as an input and scale it to an N10 value (then using another pot or HMI value create a mulitplier number N11 say 0.9) multiply N10 by N11 to give value that can go itno SCP for creation out put for speed of second motor Both encoders would display speeds and the you could cascade speeds down to 3,4,5 drives not in office at minute will try and create something for you tomorrow Edited by comeng

Share this post


Link to post
Share on other sites
thanks will look for your post tomorrow. Have to admit, this one for some reason, has got me, every had one of those? I have a micrologix and a encoder which i am turning with a drill, and when i look at the program i posted, if i leave the N7:50 at 0, then when I turn the first encoder to show that it is running from 0-117 rpm, then the output of a PID/SCP goes up, which I would suspect that it should, since it is trying to turn a motor. Now if for example I run the drill at the max of 117rpm, then the output of the PID/SCP will be the max value out, which is 31200 for 10v. I if put a 117 in N7:50, the output of the PID/SCP goes to zero, which it should, since the setpoint and the process value are now equal. Here is where I get confused. If both are now running at same speed, the with the output being 0, or 0v, the motor will stop. Confused on how to ensure that if motor 1 is running at a certain speed, how to ensure that the second does as well. With the PID/SCP that I have in my program, if the second encoder is not turning the same speed, the the output will be somewhere between 0-10v to try and make the second motor run the same speed, but when they do equal the same speed, then Bam, 0v would be output from the PID/SCP. I hope i have explained this in a way that makes sense, because to be honest, i think i probably need to just walk away from it for a day or two, then maybe i can see what i am doing stupid.

Share this post


Link to post
Share on other sites
thanks for your advice. this is what i have on the test bench and appears to work. adding any difference that the pid sees between the setpoint (encoder1 rate) and the process value (encoder 2 rate) to the scaled value to go out to motor 2. rate2PID.zip

Share this post


Link to post
Share on other sites
couldnt you just use both the encoders and increase the speed of the second drive based on the diffrenced of the encoder speeds? like encoder B > encoder A = decrease motor B by .5 encoder B < encoder A = increase motor B by .5 loop something like that depending on your aplication either a slow loop or fast. Now i would have some fault code to detect if you start having a issue with a bad encoder, but I would think something simple like that would work.

Share this post


Link to post
Share on other sites
What I did, was take the two values from the encoders, and feed the first encoder as the setpoint for the pid and the second encoder as the process value and output the result of the pid and added that to the value going out to the slave motor. Works great on a small test setup. Right now, its just a test, End machine will still have a master encoder, and then 32 other motors that will be slaved to it. With the final, will end up using either Control logics or maybe even a Omron. Not quite decided yet. Thanks to everyone for your advice, but actually a guy that I know that I spoke to that has been doing this longer than I have, gave me some advice that led me in the right direction. Was not asking anyone to write the code, only for assistance. Had me stumped for a few days, until I just put it to the side, and when I came back a few days later, boom-saw a solution very quickly. I been working on a chemical tank farm with 45 chemical tanks for Dominican Republic and using a Omron CJ1 and Indusoft and the Allen Bradley just had me pretty confused. Folks like TWcontrols and some others who use this site have been very helpful, always look for what they post. This site has been very helpful, especially when you trying to do multiple projects with AB, Omron, Setex and Indusoft at the same time, especially when not as talented as some folks who use this site, with mrplc, would be totally lost half the time. Thanks

Share this post


Link to post
Share on other sites
Looks like a pretty reasonable solution. Using the master encoder as a feed forward command value and just using the PID as a trim will definitely help. Be a little careful with the feed forward value. The PID will only allow for positive correction the way it is set up now. If the feed forward value ends up a little too high you have no way to get the slave speed back down. Keith

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0