I like a good cup of coffee, while my wife Deborah is partial to tea and we both enjoy sharing a cup of hot cocoa on cold winter nights. ^{(1)} Recently we needed to buy a new kettle for our hot brews, so we purchased one that had a thermometer built in. This enabled brewing at the proper temperature, but we couldn’t tell what difference it was really making.

## In the field, or in the model?

For experimental data it is common to “over log”; that is, to log as many data channels as your system can handle. This ensures if there is an unexpected event^{(2)} you have the best chance of capturing and understanding the event. By contrast in simulation, the environment^{(3)} is controlled and repeatable so unknowns are of low probability.^{(4)} This means that “over logging” just slows down the simulation time.

## How to determine what to log?

In the ideal world you are able to understand the system based off of first principles physics.^{(5)} However, it is often the case that the system as a whole has too many interconnected models that writing out the full system of equations cannot be realistically performed. In that case how do you determine what to log?

The approach I recommend in this case is “self and nearest neighbors”. In other words if you cannot determine the full set of equations that define your whole system, break down the system into components (perhaps at the model reference or lower level) and determine what are the inputs and outputs of those systems. Take the inputs of your Unit Under Test (UUT) and the units directly connected to the UUT and use that to determine what to measure.

## Back to coffee

I’ve started experimenting with coffee (okay, not as rigorously as in the milk first/tea first tea experiments), to determine the factors providing the optimal cup? There are 4 primary factors in the outcome of the cup of coffee.

- Water temperature, Rate of extraction, coffee dose to water amount, coffee quality

The question then is, what is the relative weight to assign to each variable

GoodCup = β

_{(1)}* WaterTemp + β_{(2)}* dr/de + β_{(3)}* CoffeeD + β_{(4)}* CoffeeQ

Through a few simple experiments I learned my personal weights heavily lean towards β_{(3)} and β_{(4)} e.g. the temperature effect was minimal. ^{(6)} In the same way when designing models, think twice before measuring once. ^{(7)}

## Footnotes

- Perhaps one day we will buy this chocolate teapot for our hot cocoa
- The “unexpected” is what you most want to capture; expected data can often be calculated, it is when the dice role snake eyes that you learn the most.
- As an interesting side note, I often make 2 “plant” models. One that models the real world (the environment) and one that models the device I am controlling (e.g. the road and the car, air and an airplane, human veins and the I.V. system).
- Unlike the real world where unknowns are random events, the unknowns in simulation arise from modeling errors, and when that occurs, adding in additional logging is important.
- I was amused that the image of the book cover read “Note: this is not the actual book cover”! The use of a classical cover for fundamental physics seemed spot-on.
- There is a side benefit to brewing at the correct temperature, fewer cases of “wow that’s hot” on the first sip of coffee
- Unless you are cutting wood in which case it is design once; check your design and measure twice, cut once.