Hi all,
I'm dealing with something here that is probably not that best way to do this but I'm going to give it the best shot I can. If it fails, it fails..
Moving on, I've got a pH sensor (and conductivity sensor, but we'll stick to pH for now) and the application will be measuring run-off water that may have various contaminants. It's possible for the contaminants to come in gobs or be a stream, but it should be detectable.
I'm looking at the best way to implement a type of verification that shows we are in an acceptance range for clean water. Note the runoff water will happen for about 20seconds give or take and my AB analog card updates at 103mS. What I've got so far is:
1. Store first sample in the accumulator, acc1 = input.
2. Future samples (all the way to 20seconds) (lowpass): acc1 = (9*acc1 + input)/10
3. After 5 seconds we begin testing input values to be in a pass range so first we set acc2 = acc1 initially, and if inputs are out of range throw them away: IF (input > (acc2 + epsilon)) OR (input < (acc2 - epsilon)) [Throw away input ] ELSE acc2 = (9*acc2 + input)/10
4. We count up all the thrown away samples, and assuming we have a good acceptance range (less than 20% of samples thrown away), we will use our acc2 filter value to check if it is within the acceptance range for clean water at the end of the test.
5. If more than 20% of samples are thrown away, we use the acc1 filter to test the clean water acceptance range. (If more than 20% of samples are thrown away, it's likely that gobs of contamination were passed through).
Does this sound like a good way to do this? I'm not familiar with this area so I'd love some advice. Thanks!
I'm dealing with something here that is probably not that best way to do this but I'm going to give it the best shot I can. If it fails, it fails..
Moving on, I've got a pH sensor (and conductivity sensor, but we'll stick to pH for now) and the application will be measuring run-off water that may have various contaminants. It's possible for the contaminants to come in gobs or be a stream, but it should be detectable.
I'm looking at the best way to implement a type of verification that shows we are in an acceptance range for clean water. Note the runoff water will happen for about 20seconds give or take and my AB analog card updates at 103mS. What I've got so far is:
1. Store first sample in the accumulator, acc1 = input.
2. Future samples (all the way to 20seconds) (lowpass): acc1 = (9*acc1 + input)/10
3. After 5 seconds we begin testing input values to be in a pass range so first we set acc2 = acc1 initially, and if inputs are out of range throw them away: IF (input > (acc2 + epsilon)) OR (input < (acc2 - epsilon)) [Throw away input ] ELSE acc2 = (9*acc2 + input)/10
4. We count up all the thrown away samples, and assuming we have a good acceptance range (less than 20% of samples thrown away), we will use our acc2 filter value to check if it is within the acceptance range for clean water at the end of the test.
5. If more than 20% of samples are thrown away, we use the acc1 filter to test the clean water acceptance range. (If more than 20% of samples are thrown away, it's likely that gobs of contamination were passed through).
Does this sound like a good way to do this? I'm not familiar with this area so I'd love some advice. Thanks!