News:

  • August 11, 2026, 05:35:00 PM

Login with username, password and session length

Author Topic: Project I'm working on  (Read 9762 times)

jrayb

  • Full Member
  • ***
  • Posts: 46
Project I'm working on
« on: June 27, 2020, 01:13:01 AM »
Ok, i'm going to ask this the best way I know how. So, i'm using a pid loop & I have it all setup & functioning properly. The thing I want to do is to be able to use an input using my HMI numeric input to update a calibration setting. The application is a blown film extrusion line. I am using two ultrasonic sensors to measure the bubble size. I then average both of those & use that as the PV for the PID loop. All systems get out of whack a little bit here & there. What I want to do is say, an operator sets the bubble size that he wants, lets say 40". The system blows the bubble up to what has been programmed to equal 40" & settles out. When the operator takes his final measurement he finds out that the actual size is really 38". I am asking is there a way that he can key in the actual measurement to change what the PLC saw as 40" to the actual 38" to update the settings?

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3841
    • Host Engineering
Re: Project I'm working on
« Reply #1 on: June 27, 2020, 01:36:35 AM »
Are you needing to calibrate your two ultra sonic sensors?

If one is correct, and reading 38", and the other is wrong and reading 42", it would seem like you need to calibrate just the one sensor?

I am not familiar with the linearity of ultra sonic sensors, so could the calibration be off by an offset, or off by a percentage?

Is there a way you can calibrate it and target 10", then 20", then 30", etc. up to some high end, recording the ACTUAL size in inches.  You can then use the LERP (Linear Interpolation) instruction to map the "read" values to its "actual" measurements

LERP
10.0 9.9
20.0 19.5
30.0 29.2
40.0 38.0
50.0 49.1
60.0 60.2
70.0 71.1

Do this for both sensors.  The OUTPUT of the LERP will map the READ value to a CLOSER ACTUAL value.  Average those two LERP OUTPUTs and you should have a very accurate reading.


franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3841
    • Host Engineering
Re: Project I'm working on
« Reply #2 on: June 27, 2020, 01:41:25 AM »
LERP takes variables (see attached)

jrayb

  • Full Member
  • ***
  • Posts: 46
Re: Project I'm working on
« Reply #3 on: June 27, 2020, 11:40:07 PM »
Are you needing to calibrate your two ultra sonic sensors?

If one is correct, and reading 38", and the other is wrong and reading 42", it would seem like you need to calibrate just the one sensor?

I am not familiar with the linearity of ultra sonic sensors, so could the calibration be off by an offset, or off by a percentage?

Is there a way you can calibrate it and target 10", then 20", then 30", etc. up to some high end, recording the ACTUAL size in inches.  You can then use the LERP (Linear Interpolation) instruction to map the "read" values to its "actual" measurements

LERP
10.0 9.9
20.0 19.5
30.0 29.2
40.0 38.0
50.0 49.1
60.0 60.2
70.0 71.1

Do this for both sensors.  The OUTPUT of the LERP will map the READ value to a CLOSER ACTUAL value.  Average those two LERP OUTPUTs and you should have a very accurate reading.

Both ultrasonic sensors will be the very close to the same exact distance from the bubble. I'm not 100% sure that they will need to be calibrated, but I would like to have the option. Basically what I want to be able to do, to simplify it for a normal operator is that if they set the bubble size to be 40" & once the system reaches what it believes is 40" but in reality is only, say 38" then I want them to be able to input the true 38" measurement & have the system take the new measurement & finish blowing the bubble up to the true 40" measurement.

brucek

  • Sr. Member
  • ****
  • Posts: 61
Re: Project I'm working on
« Reply #4 on: June 29, 2020, 09:29:06 AM »
If you just want an offset I use this all the time for temperature in a math box.

AVG + R100

This way if the operator takes a temp and we're 10 degrees off they can go in and change r100 on the touch panel and make it say what they want. The lerp way is probably better to take the operator out but if they have to make changes alot then the offset works pretty well.