sdefisher Posted June 22, 2022 Share Posted June 22, 2022 I am running a real time PLC that is stuffing position data into registers that I can read from later. I'd like to filter the positions to take random out . My plan was to make a simple average. Is there a feature in PowerPMAC that can already do this for me, or do I need to roll my own? How fast is the RTI PLC operating (or how can I look it up on my machine?). I am reading the data around 2000 Hz, so I need to make sure my running average is a lot faster than that. Quote Link to comment Share on other sites More sharing options...
Eric Hotchkiss Posted June 22, 2022 Share Posted June 22, 2022 5 hours ago, sdefisher said: I am running a real time PLC that is stuffing position data into registers that I can read from later. I'd like to filter the positions to take random out . My plan was to make a simple average. Is there a feature in PowerPMAC that can already do this for me, or do I need to roll my own? You can set an encoder conversion table entry to act as a digital tracking filter by changing the values of index1 and index2. A "motor" could then be set up to read the position and display it in the position window. It would probably look like below. EncTable[n].type = 1 // Single register read EncTable[n].pEnc = [HardwareLocation].a EncTable[n].index1 = (filter Ki) // For possible digital tracking filter EncTable[n].index2 = (filter gain) // For possible digital tracking filter EncTable[n].ScaleFactor = 1/65536 // For result units of LSBs Motor[x].pEnc = EncTable[n].a // Use result for position-loop feedback Motor[x].pEnc2 = EncTable[n].a // Use result for velocity-loop feedback You could also write your own code in PLC 0 (the RTI PLC) if you feel setting up a motor to read the position is too complicated. 5 hours ago, sdefisher said: How fast is the RTI PLC operating (or how can I look it up on my machine?). I am reading the data around 2000 Hz, so I need to make sure my running average is a lot faster than that. RTI is divided down from Servo based on Sys.RtIntPeriod. 1 Quote Link to comment Share on other sites More sharing options...
sdefisher Posted June 23, 2022 Author Share Posted June 23, 2022 16 hours ago, Eric Hotchkiss said: You can set an encoder conversion table entry to act as a digital tracking filter by changing the values of index1 and index2. A "motor" could then be set up to read the position and display it in the position window. It would probably look like below. EncTable[n].type = 1 // Single register read EncTable[n].pEnc = [HardwareLocation].a EncTable[n].index1 = (filter Ki) // For possible digital tracking filter EncTable[n].index2 = (filter gain) // For possible digital tracking filter EncTable[n].ScaleFactor = 1/65536 // For result units of LSBs Motor[x].pEnc = EncTable[n].a // Use result for position-loop feedback Motor[x].pEnc2 = EncTable[n].a // Use result for velocity-loop feedback Any possibility of self referencing a previous EncTable Entry? e,g, EncTable[11].pEnc = EncTable[3].a Quote Link to comment Share on other sites More sharing options...
Eric Hotchkiss Posted June 23, 2022 Share Posted June 23, 2022 Take a look at EncTable[n].PrevEnc. The name might be a little confusing, it's where the ECT output value is saved. EncTable[11].pEnc=EncTable[3].PrevEnc.a Because PrevEnc is an integer, this means a type 1 ECT entry (integer read) can still be used. Note that this register must be multiplied by EncTable[n].ScaleFactor to get the result you expect. This means you can set EncTable[11].ScaleFactor=EncTable[3].ScaleFactor to read both Motor 11 and Motor 3 positions at the same scale. I tried this with a digital tracking filter on my quadrature encoder and I needed EncTable[11].ScaleFactor = EncTable[3].ScaleFactor = 1/256 to read the filtered value correctly. Also note there is a section in the Power Brick ARM Manuals titled "Digital Tracking Filter" that calculates EncTable[n].index1, EncTable[n].index2, and EncTable[n].index4.https://assets.omron.com/m/661730249d3863b4/original/Power-Brick-LV-ARM-User-Manual.pdf EncTable[11].type = 1 EncTable[11].pEnc = EncTable[3].PrevEnc.a EncTable[11].index1 = // From Brick PLC EncTable[11].index2 = // From Brick PLC EncTable[11].index4 = // From Brick PLC EncTable[11].ScaleFactor = EncTable[3].ScaleFactor // or maybe 1/65536 Motor[x].pEnc = EncTable[n].a Motor[x].pEnc2 = EncTable[n].a 1 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.