MVP 2023 Ausman Posted October 21, 2022 MVP 2023 Report Share Posted October 21, 2022 Fernando's explanation is the reason for my observation. For simple reading like you are doing, I have had great success in mounting sensors so that they are aligned axially to the motor shaft at the fan end. I machine a "slot" into the end of the shaft at the fan end so that you then have 2 segments of the shaft that the sensor can easily read by being mounted on the cooling fan shroud. This is all very easily set up and machining can be done without disassembling the motor if you are careful. No belts or other bits needed. The way it all then works is the way the sensor is designed to read such things, as the shaft face is parallel to the sensor face. If there is enough shaft length on the fan end that lets you do this with a small hub all the better, but most of the time I find the fan seats properly with very little shaft showing to effectively use a clamped on hub. Done correctly, you have 2 impulses per revolution. The obvious downside is the need to do stuff to the motor, or a replacement, so if you can do the tiny hub method it makes it a lot easier as you just change it to the replacement motor as needed. I did a little drawing but for some reason I can't upload it here at present. The slot is machined by running an end mill of suitable size across the shaft, centred, so that you get 2 equal sized shapes on the end of the shaft that are shaped like woodruff keys. Ohhh....and for some reason after doing the save process in a different way, NOW it does!! Depending on sensing needs and complexity of machining involved, you can vary the shape of the machining to create more or less segments as needed. cheers, Aus Quote Link to comment Share on other sites More sharing options...
draganjr Posted October 25, 2022 Author Report Share Posted October 25, 2022 Thank you all. I am going to try it out with a shaft encoder. Never worked with one but will try it out tonight and the next few days. Quote Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted October 25, 2022 MVP 2023 Report Share Posted October 25, 2022 That sounds exciting. What make and model of encoder did you get? Joe T. Quote Link to comment Share on other sites More sharing options...
draganjr Posted October 26, 2022 Author Report Share Posted October 26, 2022 9 hours ago, Joe Tauser said: That sounds exciting. What make and model of encoder did you get? Joe T. IH490 Hollow Shaft Incremental Encoder IH490-AA00R33-0063-S029 Quote Link to comment Share on other sites More sharing options...
draganjr Posted March 1, 2023 Author Report Share Posted March 1, 2023 Good evening once again. Sorry for the delay. We got the math worked out and the scaling to get footage of the press. My problem now is the ML will only read 2,147,483,647. I can use DW but I would still need to convert it back down to ML. Under Hardware Config for the Encoder I can change it to DW but when back at the logic under the formula we are using it does not see DW. Can I get a little help? Quote Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted March 1, 2023 MVP 2023 Report Share Posted March 1, 2023 I've never had anyone complain that an ML isn't big enough! What kind of math are you pumping this into? What size number do you need to work with? I'd go old school and start chaining registers like in the days before 32 bit integers were available. For example, when ML 0 > 1,000,000,000 add 1 to ML 1 and reset ML 0. This gives you nine more digits by looking at the two registers together. You have to take that into account in whatever math you're doing but it's certainly possible. Joe T. Quote Link to comment Share on other sites More sharing options...
draganjr Posted March 4, 2023 Author Report Share Posted March 4, 2023 Thank you sir. I got it by using MF. My next issue is how to reset a MF to zero via hmi. Quote Link to comment Share on other sites More sharing options...
draganjr Posted March 4, 2023 Author Report Share Posted March 4, 2023 My question is can a MF be reset? Quote Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted March 4, 2023 MVP 2023 Report Share Posted March 4, 2023 4 hours ago, draganjr said: My question is can a MF be reset? Sure, just use the Store Direct function and store zero to the MF. You have to use the special Float Store Direct function under Math/Float/Basic... Quote Link to comment Share on other sites More sharing options...
draganjr Posted March 5, 2023 Author Report Share Posted March 5, 2023 Thank you for that. It worked but the way I am using an encoder to keep footage I will need to reset the DW 0 for encoder count but I can't because it is being used to keep a job count and preset count. Test_Bench_2023_Encoder.vlp Quote Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted March 5, 2023 MVP 2023 Report Share Posted March 5, 2023 Thanks for posting your code. I see you never reset DW 0. In your code, MF 1 (Preset Feet) will continue to increase as DW 0 increases. That's usually not what a preset does. Is this actually the length of the particular part that will become a "job"? Your display indicates you are trying to program what is known as a "Batch Counter", which consists of several pieces (a batch) of a given length. In net 9 you increment ML 5 Job Count, but your display is labelled Job Count (ft). Do you want part count or total usage count? Or both? Let's assume you're trying to make several pieces of a Preset length. In this case you copy the value of DW 0 off to a buffer register when the preset is reached. Then you subtract this offset to another buffer register that you use to compare to the Preset for the next part. I looked at your I/O definition. How do you start and stop this thing? What is the actual product on this machine? Do you need to actuate a cutter or a shear? Can you give us a description of the process and what you actually want the PLC to do? Joe T. Quote Link to comment Share on other sites More sharing options...
draganjr Posted March 5, 2023 Author Report Share Posted March 5, 2023 25 minutes ago, Joe Tauser said: Thanks for posting your code. I see you never reset DW 0. In your code, MF 1 (Preset Feet) will continue to increase as DW 0 increases. That's usually not what a preset does. Is this actually the length of the particular part that will become a "job"? Your display indicates you are trying to program what is known as a "Batch Counter", which consists of several pieces (a batch) of a given length. In net 9 you increment ML 5 Job Count, but your display is labelled Job Count (ft). Do you want part count or total usage count? Or both? Let's assume you're trying to make several pieces of a Preset length. In this case you copy the value of DW 0 off to a buffer register when the preset is reached. Then you subtract this offset to another buffer register that you use to compare to the Preset for the next part. I looked at your I/O definition. How do you start and stop this thing? What is the actual product on this machine? Do you need to actuate a cutter or a shear? Can you give us a description of the process and what you actually want the PLC to do? Joe T. Good evening, sir. The program worked great when I was using a prox to keep count. But once I switched to an encoder and trying to reuse the program I cannot the reset does not working due to DW 0 (encoder pulse) not resetting. I don't want DW 0 to reset because it is the total count, totalizer or forever counter. To answer the how does it work: Total Footage is the forever count, never reset. Preset is the Batch Counter, when reaches a preset number it will stop the press and reset the preset number. Job Count is just for the operator to use bringing their press run. They reset at the end of each shift. Thank you again. Quote Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted March 5, 2023 MVP 2023 Report Share Posted March 5, 2023 That makes more sense. When you used the prox you got one pulse per revolution. If I read the part number right, your encoder is 63 pulses / revolution. Your hardware is set to 2X mode, so now you get 126 pulses / revolution. You're dividing that count by 1843.6 to get feet. I can now see how you're getting such big numbers in DW0. You'll probably have to massage the encoder value to get something more reasonable for your Feet reading. From your math, you're getting 18436 pulses = 1.0 feet. Your display does not include a decimal place for any of the readings. Do you care about decimal feet? If not, I'd change my code to increment an ML when DW 0 >= 18436 and then reset DW 0. You can use that ML in your program now for your forever counter, and you'll be freed from the massive number in DW 0. Can you post the original program using the prox so we can see how that worked? Joe T. Quote Link to comment Share on other sites More sharing options...
draganjr Posted March 5, 2023 Author Report Share Posted March 5, 2023 2 minutes ago, Joe Tauser said: That makes more sense. When you used the prox you got one pulse per revolution. If I read the part number right, your encoder is 63 pulses / revolution. Your hardware is set to 2X mode, so now you get 126 pulses / revolution. You're dividing that count by 1843.6 to get feet. I can now see how you're getting such big numbers in DW0. You'll probably have to massage the encoder value to get something more reasonable for your Feet reading. From your math, you're getting 18436 pulses = 1.0 feet. Your display does not include a decimal place for any of the readings. Do you care about decimal feet? If not, I'd change my code to increment an ML when DW 0 >= 18436 and then reset DW 0. You can use that ML in your program now for your forever counter, and you'll be freed from the massive number in DW 0. Joe T. Thank you. I will look into that next. Currently working on another machine. Quote Link to comment Share on other sites More sharing options...
draganjr Posted March 5, 2023 Author Report Share Posted March 5, 2023 3 minutes ago, Joe Tauser said: That makes more sense. When you used the prox you got one pulse per revolution. If I read the part number right, your encoder is 63 pulses / revolution. Your hardware is set to 2X mode, so now you get 126 pulses / revolution. You're dividing that count by 1843.6 to get feet. I can now see how you're getting such big numbers in DW0. You'll probably have to massage the encoder value to get something more reasonable for your Feet reading. From your math, you're getting 18436 pulses = 1.0 feet. Your display does not include a decimal place for any of the readings. Do you care about decimal feet? If not, I'd change my code to increment an ML when DW 0 >= 18436 and then reset DW 0. You can use that ML in your program now for your forever counter, and you'll be freed from the massive number in DW 0. Joe T. And we don't care for the decimal . Quote Link to comment Share on other sites More sharing options...
draganjr Posted March 6, 2023 Author Report Share Posted March 6, 2023 21 hours ago, Joe Tauser said: That makes more sense. When you used the prox you got one pulse per revolution. If I read the part number right, your encoder is 63 pulses / revolution. Your hardware is set to 2X mode, so now you get 126 pulses / revolution. You're dividing that count by 1843.6 to get feet. I can now see how you're getting such big numbers in DW0. You'll probably have to massage the encoder value to get something more reasonable for your Feet reading. From your math, you're getting 18436 pulses = 1.0 feet. Your display does not include a decimal place for any of the readings. Do you care about decimal feet? If not, I'd change my code to increment an ML when DW 0 >= 18436 and then reset DW 0. You can use that ML in your program now for your forever counter, and you'll be freed from the massive number in DW 0. Can you post the original program using the prox so we can see how that worked? Joe T. Mr. Joe I am stuck. Are you able to assist me further on resetting without resetting the total footage. Thank you Quote Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted March 6, 2023 MVP 2023 Report Share Posted March 6, 2023 From your logic, MF 0, MF 1, and MF 2 all increment together with the encoder. I increment all these in the first network when DW 0 >= 18436 and then reset DW 0. What you do with them in your program is up to you, but they are now independent of the encoder. Load this program and see if it works. Due to the nature of the PLC scan (5-10 ms), you will lose a few pulses (and therefore some fraction of a foot) when you reset the encoder as the count will continue to increase. This may or may not be a problem. You can make this more accurate by configuring the High Speed Counter to use the Reload event feature, but I didn't do this yet because I didn't want to make your brain hurt. Reload resets the counter register immediately based on a preset and sets a bit for you to use in your program to let you know it happened. The Reload feature is described in the Help if you want to check it out. Joe T. Test_Bench_2023_Encoder JT.vlp Quote Link to comment Share on other sites More sharing options...
draganjr Posted March 18, 2023 Author Report Share Posted March 18, 2023 On 3/5/2023 at 11:54 PM, Joe Tauser said: From your logic, MF 0, MF 1, and MF 2 all increment together with the encoder. I increment all these in the first network when DW 0 >= 18436 and then reset DW 0. What you do with them in your program is up to you, but they are now independent of the encoder. Load this program and see if it works. Due to the nature of the PLC scan (5-10 ms), you will lose a few pulses (and therefore some fraction of a foot) when you reset the encoder as the count will continue to increase. This may or may not be a problem. You can make this more accurate by configuring the High Speed Counter to use the Reload event feature, but I didn't do this yet because I didn't want to make your brain hurt. Reload resets the counter register immediately based on a preset and sets a bit for you to use in your program to let you know it happened. The Reload feature is described in the Help if you want to check it out. Joe T. Test_Bench_2023_Encoder JT.vlp 248.58 kB · 4 downloads Thank you sir for your help and guidance. I had to make a few more adjustments to the program because I need to rest the DW0 without effecting the other counters. Now I can not get my rollover to work right. Net 4 and 5. So every time it reaches 1843549000 pulses which equals 1,000,000 feet it should roll over to 0 but carry the 1 from 1,000,000 to ML7. But for some reason it will only do it once andn never again. it would continue to count pass 1,000,000 feet. I tried everything I can think of but lost again. Comco_2023_Encoder_7_R20.vlp Quote Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted March 18, 2023 MVP 2023 Report Share Posted March 18, 2023 Net 3 - Remember in my comment above that you have to take the scan time into account when you're bringing in a number that is tied to the hardware high speed counter. I can guarantee you that some additional pulses are coming in that make the counter go above 1,843,549,000 in the 5ms the PLC takes to scan. Always, always, always use a >= block when you're comparing a count or a time accumulator to a preset value. Using an equal block means that there is only one chance in almost two billion that your logic will be true. Doing this will result in MB 12 turning on when DW 0 equals or goes above your preset. You still may lose a few pulses if the value is 1,843,549,027 by the time the PLC gets around to solving the logic and resetting it, but it should work. In net 4, do you mean to reset DW 1 to zero as well? If so, then Store a 0 to it. I realize that the value in DW 0 will be 0 and it should work, but your code will be more readable if you do what you really mean to do. If you're trying to take a snapshot of DW 0 for DW 1 and it's a non-zero number, then that has to be done somewhere else in your code, not in the network where DW 0 gets reset. Also, on your numeric display elements there's a little box called "Do not reserve space for sign". If you're never going negative then check this box. As a point of observation, the number on the right under "Totalizer Counter" does not represent units of "Thousands". It's just Feet. I did not change this - that's up to you. Let us know how it goes. Joe T. Comco_2023_Encoder_7_R20 JT.vlp Quote Link to comment Share on other sites More sharing options...
draganjr Posted March 20, 2023 Author Report Share Posted March 20, 2023 On 3/18/2023 at 12:34 AM, Joe Tauser said: Net 3 - Remember in my comment above that you have to take the scan time into account when you're bringing in a number that is tied to the hardware high speed counter. I can guarantee you that some additional pulses are coming in that make the counter go above 1,843,549,000 in the 5ms the PLC takes to scan. Always, always, always use a >= block when you're comparing a count or a time accumulator to a preset value. Using an equal block means that there is only one chance in almost two billion that your logic will be true. Doing this will result in MB 12 turning on when DW 0 equals or goes above your preset. You still may lose a few pulses if the value is 1,843,549,027 by the time the PLC gets around to solving the logic and resetting it, but it should work. In net 4, do you mean to reset DW 1 to zero as well? If so, then Store a 0 to it. I realize that the value in DW 0 will be 0 and it should work, but your code will be more readable if you do what you really mean to do. If you're trying to take a snapshot of DW 0 for DW 1 and it's a non-zero number, then that has to be done somewhere else in your code, not in the network where DW 0 gets reset. Also, on your numeric display elements there's a little box called "Do not reserve space for sign". If you're never going negative then check this box. As a point of observation, the number on the right under "Totalizer Counter" does not represent units of "Thousands". It's just Feet. I did not change this - that's up to you. Let us know how it goes. Joe T. Comco_2023_Encoder_7_R20 JT.vlp 250.57 kB · 1 download I did get it. Sorry could not reply in time. And thank you. I am learning this little at a time. I changed what you changed and changed to [] to [P] on NET 4 and 5. It is working great at the moment. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.