Help with recording analog values

mhiceph

Member
Join Date
Feb 2008
Location
Singapore
Posts
6
Hi guys! Im currenly doing a project that involves analog signals from a gas sensor. I want to be able to read the signal for let's say for 30 secs, and record the value where the signal is the most stable. This is important to calibrate the sensor properly... Im thinking about using comparators but I dont know how to implement it.

By the way, I'm using Siemens PLC (314C-2 DP) in S7.

Thanks in advance!
 
In my experience calibrating sensors the output signal is compared to a known.

In the case of a gas sensor it senses a calibration gas with a known concentration. The output of the instrument in terms of concentration (either parts per million or percent etc) is compared to the concentration in the standard.

I am not sure what you will be using comparators for unless you are comparing one instrument to another. Even in this case both instruments will have to be calibrated using a known gas concentration as a standard.

If you have a very long tube feeding the instrument you will have to take into account the transport time ie multiply tube length by cross section area to obtain tube volume then divide by flow rate. After this time delay you should have a stable value plus or minus instrument error.

Dan Bentler
Dan Bentler
 
We use Gas Analyers quite a lot in our industry and we never use the value the PLC gets to calibrate with, it is just used as indication so that the personnel can see where there systems are running.

Most Gas analysers have a display built into them for the the neccassary calibration procedure, and our standard is to put on whatever gas is specified i.e 99.60% oxygen in nitrogen for exampele, and that is then used as our reference point as to what the analyser should be calibrated to.

As to who long to put a test gas on for, our samples bottles are usually +- 20 meteres away so response time is pretty quick, and we normally leave it on a specific gas for +- 30 mins, which is more than enough time for the reading to stabilize, although sometimes manufactures reccommend different times.

If after that amount of time it is still fluctating, then you need to start looking at things like flow rate,pressure, temperature, contanimated samples, leaking pipes, etc..
 
hi guys! thank you for the replies! I'm very much aware about the "calibration gas" and "gas analyzers" that you mentioned. In fact we are currently using these devices in our projects. What we are trying to accomplish here is to actually bypass the gas analyzers and do the calibration in the plc itself (of course with corresponding HMI) since it would be cheaper to do so. I've already developed these functions and they working perfectly fine. It's only that my boss wants me to change one of the functions to the one I mentioned above (which is record the most stable value). What I did initially was only record the highest analog value, which is quite easy...
 
How are you going to get a value for concentration if you bypass the analyzer??

How are you going to do a calibration without a standard??

What is the application??

Dan Bentler
 
Hi Dan! The gas sensor outputs 4-20 mA depending on the gas concentration, which is 0-100% so from these values it is easy to do the calibration. The "calibration" function that I'm doing is actually composed of two major steps: zeroing (record the default output when there is no gas detected) and spanning (record default output when 50% gas is present). The latter part is where I'm having trouble because I dont know how to create a logic that would record the most stable value.
 
Although not quite the same, for your most stable value you could determine the reading that you get the most values that are the same within some appropriate tolerance.

So if you have say 30 readings you might need to separately round each of them (up or down) and then by comparison one with another determine which value you have the most identical readings for.

You could then if you wish average the actual (not rounded) values that you have the most identical (rounded) readings for and call that your most stable reading.
 
I have addressed analog numbers that jump around a variety of ways that may be of interest to you. I don't do seimens, so you'll have to determine how these might be done.

A) The most obvious way is to try the digital filtering to dampen the analog input.
B) A less obvious way is to enter the incoming value into a FIFO register with a about 5 terms and then take the average of the group.
C) When I was doing process capability studies, I did a full statistical analysis including histograms, etc. (This was before there was software available to do this job).

I'm going to guess and say that B would be my first choice for your issue. You will probably be surprised how a 5 term avarage will settle things down.

Best Regards,

Bob A.
 
I have done what you are asking with an HMI to calibrate an analog signal many times, and the biggest problem has always been someone trying to calibrate when there is a real problem or when the test values are not properly prepared.

In one case, they successfully calibrated a loop height detector voltage signal from 1.2 to 1.4 volts, as 0.0 to 13.0 inches. So the resulting values were very "stepped" with such limited resolution. It ran okay, but caused excess variation of the loop position since that value was fed forward into a downstream speed control loop.

That was when I decided to make them adjust the pots to get a minimum differential for a good resolution result, or the calibration process would fail, and tell them why.

For that reason, I like to limit test the new calibration values before applying them.

It will keep them from calibrating when the signal wire breaks too, for example...
When the calbiration at both limits is started, take an average of several samples, and record the peak values, displaying them as well. To let the operator know how noisy or unstable the signal is.

You can even inhibit calibration when the peaks are too far out of the norm.

Then give the HMI a Confirm?/Cancel option.

Paul
 
Hi John! Thanks for your input. That's exactly what I'm trying to do, and haven't yet quite succeeded. hehe

Bob, thanks also for your reply. You're right, B would be the most suitable solution for these. However, I still dont know how to implement that in Siemens since I'm still quite new with PLC programming.

Paul, I already implemented the cancel/confirm/reset option in the HMI but I didn't provide a comparative value for the operator to decide on. I think "limit-testing" is a good idea. Thanks!

I would try to look for ways to implement what you guys suggested. Thanks again!
 
Last edited:
Ok, I attached the programming I did just a while ago although I havent tested them yet (my colleague borrowed my power supply and my loop calibrator, hehe).

The logic goes like this, when the user activates spanning, the program would wait for 20 secs (for the gas to stabilize) and consequently record 5 incoming values (#tempconvert in my program) for every 2 seconds and place these values in a data block. It will then compute for the average of the 5 readings and set them as #new_high.

If anyone has time, can u help me check my program?
 

Similar Topics

I'm working on a control system overhaul for a heat treating application, which must meet AMS2750. My proposed solution is Honeywell's HC900...
Replies
4
Views
3,890
Hi all, hope you are having a great day, I am in need of your help to create a AOI or program that does this kind of job: I have a IO Link...
Replies
0
Views
1
please help me . I have to make this ladder diagram and I can’t figure it out :(
Replies
12
Views
263
Hi Everyone, i was hoping for a little help with this module. i have data that needs to be read from a different plc through the Modbus plus...
Replies
11
Views
188
Hello, I am trying to replicate a piece of logic on the PLC5 onto an SEL RTAC. I am using ladder on SEL and FBD. I am having issue on the ladder...
Replies
13
Views
198
Back
Top Bottom