Live data from Hacker News

Boiling Sous-Vide Eggs Using Clojure's Transducers

blog.eikeland.se

11–20 of 28 posts

Re: Boiling Sous-Vide Eggs Using Clojure's Transducers

#11

(defn pid-transducer [set-point k-p k-i k-d] (fn [xf] (let [pid (volatile! (make-pid set-point k-d k-i k-d))] (fn ([] (xf)) ([result] (xf result)) ([result input] (vswap! pid (fn [p] (calculate-pid p input))) (xf result (:output @pid))))))) If guessing that the first 'k-d' on the third line should be a 'k-p'. I'm glad this bug didn't mess up your eggs!

Doh!! Thanks, post updated! No wonder it seemed to converge faster when I added a tiny derivative. (The gains were pretty much just guesswork, did two runs with just water before adding the eggs. It's a one evening toy setup after all, so don't want to spend too much time calibrating the pid loop)

Re: Boiling Sous-Vide Eggs Using Clojure's Transducers

#12
wrt

    (def pid-output (chan (pid-transducer 65 0.1 0.02 0.01)))
Unless something has changed with core async I believe you need to provide a buffer if you are going to use a transducer.

From the current doc: "If a transducer is supplied a buffer must be specified."

Re: Boiling Sous-Vide Eggs Using Clojure's Transducers

#13

wrt (def pid-output (chan (pid-transducer 65 0.1 0.02 0.01))) Unless something has changed with core async I believe you need to provide a buffer if you are going to use a transducer. From the current doc: "If a transducer is supplied a buffer must be specified."

Good catch! Originally while developing and running this I had a buffer of 1000 on both temperatures and pid-output (to avoid deadlocks). I removed the buffers for clarity in the blog-post, but obviously should have left the transducer channel alone). Thanks!

Re: Boiling Sous-Vide Eggs Using Clojure's Transducers

#14

This is a really cool toy example of one of my favorite algorithms. For an algorithm that predates the transistor, I'm constantly blown away at its modern use cases. For example, dynamic pricing, used everywhere from airline tickets to parking meters, is nothing more than a variant of the pid algorithm. It is also used quite a bit in capacity allocation in a wide variety of industries. Instead of using NP Complete sc…

PID is everywhere although for many real control systems the implementation isn't very sophisticated.

I was surprised to learn that it only dates back to the 1890's (according to Wikipedia). Seems to me like the Greeks or Romans would have figured it out already.

Re: Boiling Sous-Vide Eggs Using Clojure's Transducers

#15

This is a really cool toy example of one of my favorite algorithms. For an algorithm that predates the transistor, I'm constantly blown away at its modern use cases. For example, dynamic pricing, used everywhere from airline tickets to parking meters, is nothing more than a variant of the pid algorithm. It is also used quite a bit in capacity allocation in a wide variety of industries. Instead of using NP Complete sc…

PID is everywhere although for many real control systems the implementation isn't very sophisticated. I was surprised to learn that it only dates back to the 1890's (according to Wikipedia). Seems to me like the Greeks or Romans would have figured it out already.

[deleted]

Re: Boiling Sous-Vide Eggs Using Clojure's Transducers

#16

This is a really cool toy example of one of my favorite algorithms. For an algorithm that predates the transistor, I'm constantly blown away at its modern use cases. For example, dynamic pricing, used everywhere from airline tickets to parking meters, is nothing more than a variant of the pid algorithm. It is also used quite a bit in capacity allocation in a wide variety of industries. Instead of using NP Complete sc…

PID is everywhere although for many real control systems the implementation isn't very sophisticated. I was surprised to learn that it only dates back to the 1890's (according to Wikipedia). Seems to me like the Greeks or Romans would have figured it out already.

I was surprised as well when I first learned about them...Control Theory as a formalized scientific/engineering discipline didn't even exist until after the proliferation of the Centrifugal Governor, which has some varied accounting of its history, but generally is not quoted any earlier than the late 1700s.

One of the beauties of the algorithm is how well it scales to complexity. It can be implemented in something as simple as a mechanical or hydrolic controller or DSP, but can also be used in heavily modified forms that take advantage of advances in Machine Learning, OR/Optimization, etc.

Re: Boiling Sous-Vide Eggs Using Clojure's Transducers

#17
post #7
post #2

From the picture it looks to me like egg is undercooked i.e. the white is still runny and kind of mucousy, ideally you want a solid tender white and a totally separate uncooked yolk. A slightly higher temperature (67 deg C) would ensure the white properly solidifies whilst still being cool enough to avoid cooking the yolk. 45 minutes is unnecessarily long a long as he egg remains under 70 degrees not much will be hap…

According to Dave Arnold and his chart 62 will be the perfect temperature for set white and runny yolk (he has a nice chart) http://www.splendidtable.org/story/theres-more-than-one-way-... he has a video demonstrating temperatures https://www.youtube.com/watch?v=GpvbNG1Dzhk Guess it boiles down to personal preference

Dave Arnold and Harold McGee are awesome. Anybody who is interested in food, cooking, and science should listen to the Cooking Issues podcast and read 'On Food and Cooking'.

Re: Boiling Sous-Vide Eggs Using Clojure's Transducers

#20

(defn pid-transducer [set-point k-p k-i k-d] (fn [xf] (let [pid (volatile! (make-pid set-point k-d k-i k-d))] (fn ([] (xf)) ([result] (xf result)) ([result input] (vswap! pid (fn [p] (calculate-pid p input))) (xf result (:output @pid))))))) If guessing that the first 'k-d' on the third line should be a 'k-p'. I'm glad this bug didn't mess up your eggs!

Please take this in the ha-ha-only-serious spirit: I wonder if a static type system would have caught the error in this case...?
Post reply on HN