File Sort (SRT) and Average (AVE) instructions

P.P.P.S. Update the repo again.

The emulator now flips the bit to trigger the input map routine to receive raw load cell data as integers from the emulator when needed, and also flips the bit at the end of the emulated data to have the PLC go back to reading raw data from an analog channel.

It's still ugly.
 
The bi-valued peaks in the histogram below the suggest yet another approach; I am pretty sure the code to use this could be done on the fly i.e. make the calculations as the data accumulate; it should be simpler than the low-pass filter, but it might still be ugly.
Untitled.png
 
Flogging another dead horse

Below is an annotated version of the histogram hinted at by my previous post. N.B. the ordinate uses a logarithmic scale.

The PLC can build this histogram on-the-fly as the training data are coming in, and calculate the means of the data in the two highest peaks:

  • the higher mean (~271 pixels in the OP's trend) will use the data when the shoe is being manually pressed;
  • the lower mean (~184 pixels in the OP's trend) will use the data when the shoe is released (or not pressed as hard).
  • The two operational setpoints, for the hysteresis control as described by OP, could be calculated from those two means.
  • The other data. i.e. the initial spike when the shoe was first pressed, and the later data when the shoe was being nudged in the other direction, are all in this histogram, but are ignored because the trainer held the steady high and steady low pressure levels for a long enough time.
  • There is nothing magical about the six bins; that seemed to be the right number to catch two histogram peaks plus some noise around each peak for the data in OP's image.
The code for this histogram-based approach, and the code for the previous first-order time filtering approach, are in the Github repo here; that includes both sample PLC code, plus pycomm3-based Python scripts to emulate the data from OP's image.

These two approaches are more complex code-wise than the "sample, sort, and select a percentile" approach OP originally proposed, but operationally they are pretty simple, and they may do a better job at filtering out the noise of the training.


data_histogram.png
 
Here is that same histogram with a linear-scaled ordinate, which should make it easier to see why the bubble-sorted peak-finding approach might work:
data_histogram_nolog.png

And here is a histogram of the scan times (S:35 from MicroLogix status Data File; scan duration in ticks of the 10MHz free-running clock) during one training session. The orange data with [x] symbols are PLC scans during which a load cell datum was "read" and processed (do bubble sort; recalculate one or two peak averages); the blue data with filled [o] symbols are for the entire training session of about four or five minutes. The ordinate is log-scaled so the orange data can be seen as other than a value near 0. It looks like the bubble sort adds at most 4ms to a single scan time.
plot_scan_times_L248.png
 
@Peter: robust was the word I think you were looking for ;). OP asked for alternate approaches: "How would you guys do this?"

OP is trying to calibrate a control system via a manual "training" procedure. The problem, which may be caused by friction as you suggest (although OP has neither confirmed nor denied that), is noise; I don't mean noise in the measurement device (transducer, electronics, shot, etc.) itself, as that source of noise is obviously minimal in this case, as you noted earlier. The noise comes from the operator/trainer's arm having too high a gain when trying to manually assert a steady position or pressure.

In my experience, multiple samples are the most robust way to beat down the noise.

A drunken monkey could play with the guide/shoe for several seconds, then the actual operator could replace the monkey, hold the shoe at two positions, and my method would take the monkey- and operator-driven data in toto, and produce good results.

I am pretty sure just looking at the force and rate of change in the force will do the trick.


P.S. do you realize that my first approach did exactly that?
_
 
Last edited:

Similar Topics

I have a machine with a tag called SP_FLT[57] with a data type of DINT. Each bit in each DINT is a machine fault of some sort. I need a way to...
Replies
12
Views
3,447
Working with a customer today and they have qualified a bunch of changes today on this 1756-L73 v20.01. It crashes with a "fatal application...
Replies
26
Views
10,546
How can I access the web page that allows me to see and upload the pcl or translation file into my Pl1000E? My Pl1000E doesn’t have an ethernet...
Replies
0
Views
1
Hello. I appreciate the insights here and the willingness to share. I've got a lot of Rockwell experience, but my Siemens experience is...
Replies
6
Views
133
Back
Top Bottom