CCW. Programming a PID instruction in an Allen Bradley Micro800 PLC

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi this is Tim today we're gonna go through how to configure a PID control in an allen-bradley micro 820 PLC for this video we're gonna be using our micro 820 PLC trainer and we're gonna be using industrial concepts PID trainer and in the previous video we went through how to wire the two we've also tested to make sure that our fan control works our level sensor we're reading it and then our damper control works now if you're coming to this video and you haven't seen the rest of our PID series look down in the description I'll put a link to it also please take a moment to like this video subscribe to our channel we put out at least one automation video a week and any questions that come up feel free to put them in the comments your question this week could easily be next week's automation topic okay and actually didn't save the program from last time so we are gonna start with the new program but we weren't that far along so let's go ahead and create a new program and we're gonna call this our PID control and we're gonna go to controllers micro 820 and we're using a 28 ELC 2020 qwb we'll select it and add to project and then we're going to create a new program by right-clicking programs add and we're gonna use a function block diagram program for this and the other thing we need to do before we get too far along is we need to configure our Ethernet so we're gonna configure our Ethernet IP address for 192 168 1 10 with a subnet at 255 255 255 0 now it's going to open up our program and let's click over on our toolbox and bring down an instruction block and the first thing we're gonna need to do is we're going to need to scale our sensor in here now if you remember from the previous video down here at rest we were at a hundred and sixty units and up here at 12 inches we were at 31 50 units so we're going to need to configure that for our zero to 12 and we're gonna use an SCAL or scaler instruction to do that now to use the scaler if you mouse over it's going to tell you the data types you need and the scalars gonna use all real numbers but our analog input if we actually go over here and we open up our global variables and we go down to our analog input you'll see it's a word so we're going to convert it first and this is one thing that I think the micro 820 just does an excellent job at is it's any two instructions what I call it for short but really you can convert anything to anything in it without a lot of pain so we're gonna go to our toolbox and let's bring down another instruction block and let's type in E and that's gonna bring up all of these any two things and we want to go down here find the any two real click okay and then we're gonna drag a connector from the oh one to the input of that and now let's go and grab some variables so we're gonna drag one right there and we're gonna go to our micro 820 i/o tab and scroll down and find that analog input so we're looking for IO am AI 0 0 because we've wired our level sensor to input 0 now we need to tell it how to scale it now if yours looks like mine it's all truncated and everything and maybe somebody in the comments can tell me how I can default this to not truncating or like autosize that other size is that what I'm looking for but if you click on it you can grab this and drag it down and make it big enough where you can read it but we need to give it some parameters here and we're gonna use these variables to do that so just drag a variable down we're gonna cancel out of that because right now let's just copy and paste this because we need four of them and I didn't leave us quite enough room here right here you drag these around if you want and let's just drag this one there and then we can drag the next one right up the side of it and yeah if you're really OCD you're gonna get upset with my function blocks because yeah just not always that graceful dragging them out our input minimum and our input max are those raw numbers that we noted that 160 and 30 150 now we don't actually have to create variables for these we can put them right into here so if I put 160 and I remember to designate that it's a real number about putting point 1 then that will work now what will not work is it's the next one if we put 31 250 that's not gonna work because it's going to look at 30 150 as a double integer and this is requiring real numbers so we need to put 30 150 point zero and now our output min and Max I want zero to be here and I want 12-inches to be up here so we are going to put in zero point zero and we're gonna put in 12 point zero and now let's copy and paste this variable one more time for our output over here and this one we are going to create a variable for we're gonna call this one our actual position and it will need to be a real two that will scale our analog from 0 to 12 so next let's go ahead and add our PID instruction so we're gonna go to toolbox and we're gonna drag another instruction block down we're just going to start typing PID and there's gonna be two that come up you're gonna get your IP ID controller and you're going to get your basic PID so in a later video we'll actually do the basic PID instruction but the IP ID is what we're going to be doing of this video we're going to bring it in and again everything mine is truncated so let's drag this out so we can read everything the first one is the process and I'm going to skip over that one and actually come back to it because it ties in with this output and we need to make sure we understand that one and the next one is the set point so that one we do need a variable for it because the set point is gonna be where do we want our PID at in other words we want it here at 6 inches 8 inches we need to tell the PID what it needs to be so we're gonna bring a variable down and if you get it in line close enough at that's that point then it'll actually draw the little line for you it works about half the time for me because yeah my fingers just aren't that coordinated we're going to put in position set point and that is going to be a real and next we have our feedback our feedback is our actual position so we can actually highlight this copy paste and then we can drag it right down here so our next one is gonna be Auto now I'll occasionally mouse over this because I can see here Auto and needs to be a boolean type tag so I'm just going to copy and paste this one bring it down and we're gonna open this up and we're going to create a PID Auto and that is going to be boolean and we'll just copy and paste it again and this one is going to be PID initialize that will also be boolean now our gains are gonna be gain PID has a data type so we're gonna copy and paste that and this time we're going to put in PID gain values and that is going to be a gain PID select it then our auto-tune is boolean so we'll copy and paste again drag it down and this will be PID auto-tune and that is boolean and then let's paste that one more time for our 80 parameters and that's gonna be a data type of 80 parameter parameters for auto tune PID auto tune parameters so that will be an 80 parameter it looks like it's blank and it's not blanking me like I said maybe somebody can I'm have had some issues with my function block this place maybe somebody can help me out with this but yeah well the issue is it's too narrow so by dragging that out also don't show you can see the bottom minor truncated now we're to our output side of this and let's go ahead and hit the easy ones we have absolute error we have 80 warns and we have output gain and those are going to be a real a dent and a game PID so let's go ahead and do those will skip this output for now so we'll just copy and paste one of our parameters again or you can go right over here to the tool box and you can drag it down again and we're gonna call this our PID absolute error and it's gonna be a real then we have our eighty warning which is a double integer so copy and paste this down and this is going to be our PID peytie warning and it was a double integer and then let's paste one more time and these output gains were a gain PID so let's put in PID output gains and will be a gain PID that takes care of everything except our output in process and I wanted to wait till the end all those because they're a little bit different than our studio 5000 and our rslogix 500 PID and that they require you add an external limit to prevent them from winding up or you know to prevent them you know our scale our output is zero to four thousand and eight that's ten volt to keep us from in a bit four billion numbers where it takes forever to come back down that's what we're gonna be doing here I just want to make sure we understood why so first we're gonna need our limit instruction so let's just click an instruction block and bring it down and actually let's let's do it over here out of the way because we're going to add a little bit more before then but let's go ahead and type lemma and we mouse over it it's going to require all double integers now if we go over here to our PID its output and the process that we're talking about are gonna be reals so we're going to do some conversions first so let's go ahead and go to our toolbox we'll bring another instruction block down and we're gonna use that really handy any instruction and we're gonna be doing an any two dent which is right there and we're gonna click our output bring it up to there and then this is going to go to layer now again for some reason my stuff's getting truncated if we drag that out a little bit yeah it's gonna tell us any did the same thing up here listen right here really I should drag out enough to see there we go doesn't take much up there so then we have a min and a max or a min and our max is actually gonna be the min and Max of our analog which is zero and 4008 so we're going to grab a variable bring it down and in this case we're just going to put zero now do not put zero point zero because that will not work and maybe we'll play with that another video to talk about the errors that you can see and how to resolve them but now let's copy and paste that parameter and let's bring it oh I didn't make yourself enough room so let's drag that out and bring in that layer and this one is gonna be four thousand and eight so what this is gonna do is if this parameter coming out of this output is two thousand it's gonna output two thousand but if it's six thousand it's only gonna output four thousand eight if it's a negative six thousand it's gonna output zero so now we need to put this into the real format that this process over here is looking for because you remember we're in dense here and we need reals over here so now we're gonna use another one of these any instructions so we'll bring our instruction block down and we're gonna go for an any but this time we're gonna go for a real and we'll drag that to right there and now you know somebody really wanted to be you know short cutting you could actually drag this here but one that just looks horrible so we're going to make a variable for that plus in some later videos we actually manipulate our output additionally so let's go ahead and put a parameter variable down and let's call this one our EW be speed command oops except I forgot I left that is boolean and as that needs to be a real so I can change that to a real I'll drag that out where we can see what it says there and then we'll put that right there so now we can copy and paste this variable right over to here and that's gonna feed it back into our process so in that takes care of the structure of our PID we've still got some parameters to address but this is a good start now let's add our output because we still this right now is just going to an internal variable first let's just copy and paste this variable again that's our PID speed output which is in a real format and let's just actually I can't remember where I could do this or not so let's try it so we talked about these headings again let's go to the toolbox and let's bring an instruction down and we're going to use a move instruction we're going to go over to our i/o table now and we're gonna go to this analog output right here like one label that this is gonna be our fan speed and we'll click it and let's go ahead and build this just to make sure there's no errors up okay it did not like that I was wondering if it would so what is saying right there is these do have to match and that's how I was just curious so what we're gonna do is we're going to delete this little bit here out we'll drag that over and we're going to put in another one any commands right there and this will be any two word because we'll need a word to make this work and now we can just connect that right in the middle of it and we'll hit our bill button again and everything is great now so that's just a really cool feature is that any function okay let's go ahead and download our program and if you need any help download your program either through the ethernet opti driver or the ethernet devices driver or sara lee then look at the description we've got videos on all of that when you're done downloading make sure that you put your controller back and run mode let's go ahead and look at some of our variable actually even before we do that let's look right here at our output we see our output is 6 point 4 2 1 4 to the negative 5th power right now but when we go through our limit we're putting up an output of 0 and that's what that is for to keep those wind-ups from happening and I'm in a later video we're going to talk more about integral wind-up in this case this particular one just you have to do it so that's why we kind of had to address it now if you have any questions about that just hang tight let's go to our local variables and let's have a look at our gains to start with because we're going to need to put some values than here in fact ok it puts in a very very small value by default and I can't imagine this I don't know maybe in an hour with these values that mine would get somewhere I don't really know but really let's just start just really we're gonna start by throwing something in there and seeing how it does we're gonna put 10 for a proportional and for our integral we're gonna put point 1 and really that's just a guess I mean you gotta have something to get the things started moving and you know over time you probably will find some values that work pretty good for your applications and next we have this Otto and this initialize and we're gonna need to check both of those to get this thing going now we're not actually going at one because I need to turn the trainer on we're sitting still right now but right now we need to put this position set pointed right here and actually I'm gonna go back to our function block diagram to do this just so you can see everything that happens when you do it right now we are putting a little bit of an output out and not really sure why oh because we got a slightly negative position so I was trying to put it actually who's trying to push that ball a little bit but it's a very my need amount but now we're gonna put our set point here we're gonna change it to six four six inches and immediately the ball comes to life and raises up and actually I'm pretty impressed it's lagging a little bit but we're we're right there now so it wasn't bad but now let's open our valve and remember this is our big variability to see how quickly it responds all right I shot up tonight [Applause] back home so he recovers decently but we can make it better and that's what we're going to be going through in the rest of our PID series is really why does this thing shoot up and take such a slow time to come down or you know maybe and some other ones you've seen we're up down why is that that's what we're going to be working on the rest this the main goal here was to get you operating with your PID now the microwave 20 may require some additional what I've already promised that we'll make one on the micro logic style PID that it has but I do believe overall that the ID controller is a better setup so anything that stops you or that you know you think I need to address put it down in the comment again please give this video a like and subscribe to our Channel we're putting our great series about the IDS right now all sort of thing market industrial concepts again or we're working with us through this project I'll put links to both of these trainers down in the description till next time hi this is Dylan and this is amber of TW controls we run the automation store hey thanks for finding our channel here's the playlists with some similar videos and YouTube makes you like this video please like our video and subscribe to our Channel and if our videos have helped you make some money and you're not using our products please consider supporting us on patreon till next time see ya
Info
Channel: Tim Wilborne
Views: 7,427
Rating: undefined out of 5
Keywords: Tim Wilborne
Id: O-Uify45wZY
Channel Id: undefined
Length: 21min 30sec (1290 seconds)
Published: Wed Aug 19 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.