Sign in to follow this  
Followers 0
Ad Infinitum

Micrologix 1100 , pressure indication app. Need advice

12 posts in this topic

Hello Folks - I am preparing a ML1100 for what is a simple enough application, but for the life of me I can't figure out how to overcome one issue I'm having. I have a 0-5vdc Pressure Xdcr attached to the Voltage input of the PLC. I am using the SCP command to scale the input. Here is a basic layout of my application ; I'll be reading the PT, and I need to capture the highest pressure the xdcr reads, and hold that high pressure reading, then move it to an averaging block and a counting block. I was considering a compare instruction to compare the current scan pressure indication with the last scan pressure, and if the reading is GRT, then update the N7. If it is less, then use the last 'higher' reading, move it to an average and counter. Does this sound right ? If it does, how do I do such a thing ? Anyone have any ideas ? If you need a specific app question answered, feel free to pm me also. I appreciate any ideas you all may have. AI.

Share this post


Link to post
Share on other sites
Just to clarify, I read this as - you have a cycle of some type. During that cycle you wish to record the highest pressure reading. Your plan to compare to the current 'highest' reading and, if greater, then move the current to that 'highest' reading should work just fine. Just remember, at the start of the cycle, to set the 'highest' reading to zero. At the end of cycle you can do your averaging (with the readings from previous cycles?) and 'counting' (not sure what that will be.) Edited by b_carlton

Share this post


Link to post
Share on other sites
That is correct. I want to read the pressure values, shuttle them to a register that the HMI will continously display. If the pressure readings are increasing, the value is to be held. If it drops below last scan value, then the last high pressure scan reading will become the final reading for that 'cycle'. At that point, I'll need to move it again, count how many pops I've done and then keep the average PSIG of the 'pops' until a reset is hit on the HMI, and everything starts over. The problem with this process is that it is manually actuated with a filling valve. The only instrumentation to be used is the PT. Hope that helps ?

Share this post


Link to post
Share on other sites
Welcome to the forum. When a cycle begins initialize a PEAK_PRESSURE variable to the current pressure with a one shot. Then whenever the current pressure is greater than the saved peak pressure move the current pressure into the PEAK_PRESSURE variable as the new peak pressure. At the end of the cycle move the PEAK_PRESSURE to a FIFO queue where all the previous peak pressures are held and then compute the average. If you use a FIFO and keep a running sum then you don't have to sum the entire queue every time you compute a new average. See the attached program. PeakStoreAndAverage.RSS Edited by Alaric

Share this post


Link to post
Share on other sites
Question Alaric what add 1 to R6:0.pos for number of data points. I am thinking the way it's written that R6:0.pos is the number of data points. But is a cute little module thanks for sharing.

Share this post


Link to post
Share on other sites
Alaric, thank you for the forum welcome, and thank you for the file. I'll give it a look. I sincerely appreciate your help. Edited by Ad Infinitum

Share this post


Link to post
Share on other sites
Good catch Bob. The Add 1 is not necessary as shown. For some boneheaded reason I was thinking that since a FIFO starts at position 0 I needed to add 1. Except that even though it starts at 0, after it inserts a value it increments the position, so R6:0.POS = the number of element in the FIFO. By bad. I have removed that from the program attached to the previous post. Edited by Alaric

Share this post


Link to post
Share on other sites
Alaric, one more question. I have modified your code , works perfect, and added it to what I already have. At the end of the 'cycle' I've created a button that accepts that cycles values, but the peak value is retained in N7:4. From a best practices standard, what would be the best way to, I'll call it 'flush' the last cycles peak, and immediately jump to the current or new cycle value ? Would just adding a CLR instruction to the already defined rung be best, or would yet another move intruction ? Thanks

Share this post


Link to post
Share on other sites
CLR is the quickest cleanest

Share this post


Link to post
Share on other sites
Alright, logic is basically done, and HMI is good to go. Last question, and I searched the manuals I have ; What method would I use to kick out or basically un-do the newest value added to a FIFO, incase the cycle wasn't accepted by the operator ? Again, this entire process is done with nothing more than an operator controlling 1 single valve, capturing peak values and counting the total number of accepted peak cycles, along with an average of those peak pressures. Any help is appreciated fellas. Edited by Ad Infinitum

Share this post


Link to post
Share on other sites
You can use the FFU instruction again. Just unload the value to a discard register and subtract that much from your running total and reaverage. If you kept the previously unloaded value you could load it back in or you can let the queue be with an empty space in it. You can program multiple FFU and FFL instructions to the same queue.

Share this post


Link to post
Share on other sites
Alaric, I ended up using a LFU/LFL instruction, and just moved the word out to basically a junk address. Worked great, and thanks for the help.

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