
Code: Select all
; PB 5.41
EnableExplicit
Procedure.d EggCookingTime (d.i, t_initial.i, soft.i=#True, elevation.i=0)
; -- Note: The egg must be put into *boiling* water!
; in : d : small diameter of the egg [mm]
; t_initial: initial temperature of the egg [°C]
; soft : #True / #False
; elevation: elevation above sea level [m]
; out: return value: time needed for cooking the egg [minutes],
; or 0 on error
;
; [modified after
; Gruber, Werner (2008):
; Unglaublich einfach - einfach unglaublich. Physik für jeden Tag.
; München: Heyne
; pp. 207-209]
Protected t_water.d, r.d, t_inside.i
t_water = 100 - 0.0033 * elevation ; temperature of boiling water at the given elevation
If t_water <= 82.0
ProcedureReturn 0 ; At an elevation of about 5500 m or higher,
EndIf ; boiling water is not hot enough for cooking eggs.
If soft
t_inside = 62
Else
t_inside = 82
EndIf
r = 2 * (t_water - t_initial) / (t_water - t_inside)
ProcedureReturn 0.0016 * d * d * Log(r)
EndProcedure
; -- Demo
Define d.i, t_s.d, min_s.i, sec_s.s, t_h.d, min_h.i, sec_h.s
Macro ShowTable (_t_initial_)
Debug "Egg " + _t_initial_ + " °C"
Debug ""
Debug " | soft | hard"
Debug "d [mm] | min:sec | min:sec"
Debug "-------+---------+--------"
For d = 35 To 50 Step 5
t_s = EggCookingTime(d, _t_initial_, #True)
min_s = Int(t_s)
sec_s = Str(Int((t_s-min_s)*60.0))
t_h = EggCookingTime(d, _t_initial_, #False)
min_h = Int(t_h)
sec_h = Str(Int((t_h-min_h)*60.0))
Debug " " + d + " | " + min_s + ":" + RSet(sec_s, 2, "0") + " | " + min_h + ":" + RSet(sec_h, 2, "0")
Next
Debug ""
Debug ""
EndMacro
Debug "Time needed for cooking eggs at sea level"
Debug ""
ShowTable( 4) ; refrigerator temperature
ShowTable(20) ; room temperature
