0
$\begingroup$

First, apologies if I have the wrong group or this question is far too easy for this group. I am (as you'll see) a newbie. Please point me to another, more appropriate group OR tell me how to fix the question to be more appropriate for this group.

I have some data that represents a thermometer that is put in a fridge, and then a freezer, and then finally, back out of the freezer to the fridge. The data might look like this:

enter image description here

The horizontal axis is time in seconds and the vertical axis is Celsius. As you can see, it's quite obvious where the thermometer goes into the freezer and where it comes out. One can with the naked eye come up with a pretty good estimate as to where this happens. I'd like to be able to have a computer program (C#) figure this out for me for other data sets that all have this general form. One way might be to look for when the data first reaches -10 and argue that the transition happened at about this time. Another might be to look for a change in the 2nd derivative. That's about the extent of my knowledge. I can imagine there is a whole literature devoted to this problem and probably libraries of code that already do this. I'm looking for

1) Starter ideas on what to read to educate myself about this problem.

2) Example code in C# (or JAVA or C++) that does the automatic detection.

I would like to be able to feed a time series into an algorithm, and have an estimate of when the thermometer was put in the freezer (or taken out) WITH some sort of confidence interval. Example: "it went into the freezer at 18420 seconds +/- 100 seconds with 95% confidence". I am willing to assume (for now) that the thermometer starts changing temperature as soon as it is moved from the fridge to the freezer (I'm still researching this!).

Those are the questions. For those, who are curious for background information, please continue to read. I'll add that the motivation is that we are trying to see if some thermometers in the fridge and freezer are in spec. We have several thermometers in the fridge and freezer that we would like to know are in spec. We have a highly accurate "reference" thermometer that we can move around with a robot to the locations where the fridge/freezer thermometers are. As we move the reference thermometer to the various locations with the robot, we have the relevant fridge or freezer thermometer take a temperature and record it. This we can do with very accurate timing. The problem is that the reference thermometer just has a counter every 10 seconds. Presumably the measurements are really 10 seconds apart but there is not absolute time measurements. It's just a counter from 0. You can see the graph of the reference thermometer in my attached picture. It occurs to me that since I move the reference thermometer to the first freezer station, I should be able to use that point on the graph as a "pin" to connect the two timelines. I'd further point out that I leave the reference thermometer at each station for several minutes, so there is some slop available. Finally, for those wise folks that say, "why not have the reference thermometer communicate with the rest of the system via Bluetooth or similar so you don't have to try and match things up after the fact?", my reply is "already suggested (several times) to management without success" :)

$\endgroup$
1
$\begingroup$

This looks like an interesting problem.

First, if your timing is evenly spaced, your idea of having two "pin" (aka calibration) points should give you an adequate linear relation between your two time scales. If you have more than two points then you can use linear regression to find a best fit.

Second, I think you will want to use the raw values and values of a calculated first derivative to classify parts of your graph. The actual value of a second derivative doesn't seem to me to be particularly helpful. Because of the noise you have, using immediate first difference calculations may lead to bad results.

I have a suggestion for a different approach which may work quite well. Check out the difference technique in my blog article Exponential Smoothing with a Wrinkle. You need not necessarily use exponential smoothing, boxcar smoothing or some other would also work. The idea is to smooth in a forward direction and also smooth in a backward direction. At every point, the forward smoothing gives you the "expected value" from the past and the backward smoothing gives you the "expected value" from the future. Substracting the former from the latter gives you a first derivative like signal. The coding is rather trivial so I will not provide it. I suggest you give it a shot on your data and see what the graphs look like. The smoothing will solve your noise issue.

I'm not sure the best way to calculate your probability values, but I think with a few graphs and calculations under your belt you will be able to provide an estimate that will be valid and fairly consistent across all your cases.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.