Blog

The lab result that arrives twelve hours late

The sample is drawn at two in the morning. The number comes back after lunch. In between, somebody has to run the plant.

Date
Outcome
Quality

Steering by yesterday's news

I once sat with a night-shift operator on a granulation plant. At two in the morning he drew a sample, walked it to the lab hatch and wrote the time on the bag with a marker that had nearly run dry. Then he came back, sat down, and looked at a screen that told him everything about the plant except the one thing he had just asked.

The answer arrived a little after two the next afternoon. He was asleep by then. The day shift read it, frowned, and moved a setpoint to correct a plant that no longer existed, because twelve hours of product had gone down the belt in the meantime.

Nobody in this story is doing anything wrong. The lab is careful, and careful takes time. Drying, sieving, titrating, a queue of other people's samples ahead of yours. The trouble is only that the plant does not wait. It goes on making product at exactly the rate it did before you asked the question.

So the operator does what any sensible person does without information. He plays safe. He runs a little rich, a little hot, a little slow, and the cost of that caution never shows up anywhere because it looks like normal operation.

The plant already knows, roughly

Here is the puzzle that makes a soft sensor possible. The lab value is not an independent fact dropped from the sky. Granule size, moisture, a concentration: each one is the consequence of things that happened in the process an hour or two earlier. Temperatures, flows, a recycle ratio, the amps on a motor. And those things are measured, every few seconds, by instruments that never go home.

A soft sensor is a model that learns the connection. You give it a few thousand past lab results and the process readings that led up to each one. It works out which readings matter and by how much. After that it can look at the readings right now and say what the lab would say, if the lab were infinitely fast.

That is all it is. An estimate, every minute, of a number you used to get twice a day. The name is a little grand for what is really an educated guess with good manners. But a decent guess now beats a perfect answer at lunchtime tomorrow, and operators grasp that faster than anyone.

It is the kind of work I like best among the soft sensors and optimizers we build, because the benefit is so easy to see. A trend line appears where there used to be two dots a day.

Where the time goes wrong

Now the dull part, which is where most of the effort goes.

The first difficulty is the clock. The lab system records when the result was typed in. The model needs to know when the sample was drawn. Those can be hours apart, and the gap is not constant, since it depends on who was on shift and how long the queue was. Train a model against the wrong timestamps and it learns to predict the past from the future, which works beautifully until you switch it on. That marker on the sample bag turns out to be the most important instrument on the plant.

The second is delay inside the process itself. What comes off the end of a dryer now was fed in some minutes ago. Each input has to be lined up with the moment it actually affected the sample. Get that wrong and the model blames the wrong valve.

The third is that plants change. A screen wears, a new ore body comes in, somebody recalibrates an analyzer. The model's estimate slides slowly away from the truth. So the lab is not retired. Every result that comes back is compared with what the model said at the time the sample was taken, and the difference nudges the estimate back into line. The lab stops being the steering wheel and becomes the compass check.

And I think that is the right way round. The lab was never meant to drive. It was meant to be right.