Browse Source

Fixed a MAJOR bug with the formula. Now performs closer to expectations. It was a self inflicted case where the intial temperature was almost instantaneously being reset to the final temperature, despite it not being a formula restart condition. DAMN

formula
Scott Mobley 11 years ago
parent
commit
167e8f7b41
  1. BIN
      Audio/Cooking/Oven Door/Oven Door Open.wav
  2. BIN
      Audio/Cooking/Oven Door/Oven Door_Full_Close.mp3
  3. 0
      Audio/Cooking/Oven Door/Oven Door_Full_Close.wav
  4. BIN
      Audio/Cooking/Oven Door/Oven_Door_Full_Open.mp3
  5. 0
      Audio/Cooking/Oven Door/Oven_Door_Full_Open.wav
  6. BIN
      Audio/Cooking/Oven Door/Oven_Door_Peek_Close.mp3
  7. BIN
      Audio/Cooking/Oven Door/Oven_Door_Peek_Close.wav
  8. BIN
      Audio/Cooking/Oven Door/Oven_Door_Peek_Open.mp3
  9. 0
      Audio/Cooking/Oven Door/Oven_Door_Peek_Open.wav
  10. BIN
      Audio/Cooking/Oven Door/RAW/Beeps and Toaster Oven.wav
  11. 62
      js/CookingFormula.js

BIN
Audio/Cooking/Oven Door/Oven Door Open.wav

Binary file not shown.

BIN
Audio/Cooking/Oven Door/Oven Door_Full_Close.mp3

Binary file not shown.

0
Audio/Cooking/Oven Door/Oven Do Close Soft.wav → Audio/Cooking/Oven Door/Oven Door_Full_Close.wav

BIN
Audio/Cooking/Oven Door/Oven_Door_Full_Open.mp3

Binary file not shown.

0
Audio/Cooking/Oven Door/Door Open.wav → Audio/Cooking/Oven Door/Oven_Door_Full_Open.wav

BIN
Audio/Cooking/Oven Door/Oven_Door_Peek_Close.mp3

Binary file not shown.

BIN
Audio/Cooking/Oven Door/Oven_Door_Peek_Close.wav

Binary file not shown.

BIN
Audio/Cooking/Oven Door/Oven_Door_Peek_Open.mp3

Binary file not shown.

0
Audio/Cooking/Oven Door/Door Latch Open.wav → Audio/Cooking/Oven Door/Oven_Door_Peek_Open.wav

BIN
Audio/Cooking/Oven Door/RAW/Beeps and Toaster Oven.wav

Binary file not shown.

62
js/CookingFormula.js

@ -8,9 +8,9 @@
//Global Variables for Turkey //Global Variables for Turkey
density = 1050; // kg/m3 Assuming Density of Water 1000 kg/m3 density = 1050; // kg/m3 Assuming Density of Water 1000 kg/m3
cp = 7000 // J/kg K for Turkey cp = 2810 // J/kg K for Turkey
heatConvection = 4; // W/m2 K Some Reasonable estimate for natural Convection. Change as needed. 5-25 heatConvection = 5; // W/m2 K Some Reasonable estimate for natural Convection. Change as needed. 5-25
thermalConduct = 0.07 // W/m K // Chicken thermalConduct = 0.412 // W/m K // Chicken
globalTime = 0; globalTime = 0;
function celsiusToFarenheit(celsius) { function celsiusToFarenheit(celsius) {
@ -141,8 +141,7 @@ function layerModel(name,RadiusPercent) {
function turkeyModel(weight) { function turkeyModel(weight) {
var tempLoss = 0; var waterMultiplier = 0
var waterMultiplier = 1
this.totalRadius = calculateRadius(weight) this.totalRadius = calculateRadius(weight)
this.skin = new layerModel("Skin",0.85) this.skin = new layerModel("Skin",0.85)
this.body = new layerModel("Body",0.45) this.body = new layerModel("Body",0.45)
@ -156,19 +155,19 @@ this.core.waterLost = this.core.volume*waterMultiplier
this.cookCondition = function(cookValue,volume) { this.cookCondition = function(cookValue,volume) {
var multiplier = 1; var multiplier = 1;
if (cookValue>=multiplier*200000) { if (cookValue>=multiplier*80000) {
return("House Fire") return("House Fire")
} }
else if(cookValue>=multiplier*140000) { else if(cookValue>=multiplier*55000) {
return("Charcoal") return("Charcoal")
} }
else if (cookValue>=multiplier*110000) { else if (cookValue>=multiplier*40000) {
return("Dry") return("Dry")
} }
else if (cookValue>=multiplier*20000) { else if (cookValue>=multiplier*16500) {
return("Cooked") return("Cooked")
} }
else if (cookValue>=multiplier*10000) { else if (cookValue>=multiplier*8000) {
return("Undercooked") return("Undercooked")
} }
else { else {
@ -176,40 +175,39 @@ this.core.waterLost = this.core.volume*waterMultiplier
} }
} }
this.resetLayerTemps = function () {
this.skin.initialTemp = this.skin.finalTemperature;
this.body.initialTemp = this.body.finalTemperature;
this.core.initialTemp = this.core.finalTemperature;
}
this.updateLayerTemps = function() { this.updateLayerTemps = function() {
//Temperature Calculations //Temperature Calculations
this.skin.finalTemperature = transientSphereSeries (this.skin.radiusPercent*this.totalRadius,this.totalRadius,this.skin.initialTemp,ovenObject.steadyTemp,globalTime)
this.skin.initialTemp = this.skin.finalTemperature;
this.skin.finalTemperature = transientSphereSeries (this.skin.radiusPercent*this.totalRadius,this.totalRadius,this.skin.initialTemp,ovenObject.steadyTemp,globalTime)
this.body.finalTemperature = transientSphereSeries (this.body.radiusPercent*this.totalRadius,this.totalRadius,this.body.initialTemp,ovenObject.steadyTemp,globalTime) this.body.finalTemperature = transientSphereSeries (this.body.radiusPercent*this.totalRadius,this.totalRadius,this.body.initialTemp,ovenObject.steadyTemp,globalTime)
this.body.initialTemp = this.body.finalTemperature;
this.core.finalTemperature = transientSphereSeries (this.core.radiusPercent*this.totalRadius,this.totalRadius,this.core.initialTemp,ovenObject.steadyTemp,globalTime) this.core.finalTemperature = transientSphereSeries (this.core.radiusPercent*this.totalRadius,this.totalRadius,this.core.initialTemp,ovenObject.steadyTemp,globalTime)
this.core.initialTemp = this.core.finalTemperature;
//Water Loss Calculations //Water Loss Calculations
//Skin //Skin
tempLoss = waterLoss(this.skin.initialTemp,this.skin.volume,this.totalRadius) this.skin.waterLost = this.skin.waterLost + waterLoss(this.skin.finalTemperature)
this.skin.waterLost = this.skin.waterLost - (tempLoss);
//Distribute Water //Distribute Water
//this.body.waterLost = this.body.waterLost + surfaceExchange(this.body.radiusPercent*this.totalRadius,this.totalRadius)*(tempLoss); //this.body.waterLost = this.body.waterLost - surfaceExchange(this.body.radiusPercent*this.totalRadius,this.totalRadius)*(tempLoss);
//Body //Body
tempLoss = waterLoss(this.body.initialTemp,this.body.volume,this.totalRadius) this.body.waterLost = this.body.waterLost + waterLoss(this.body.finalTemperature)
this.body.waterLost = this.body.waterLost - (tempLoss);
//Distribute Water //Distribute Water
//this.skin.waterLost = this.skin.waterLost + surfaceExchange(this.skin.radiusPercent*this.totalRadius,this.body.radiusPercent*this.totalRadius)*(tempLoss); //this.skin.waterLost = this.skin.waterLost - surfaceExchange(this.skin.radiusPercent*this.totalRadius,this.body.radiusPercent*this.totalRadius)*(tempLoss);
//this.core.waterLost = this.core.waterLost + surfaceExchange(this.body.radiusPercent*this.totalRadius,this.skin.radiusPercent*this.totalRadius)*(tempLoss); //this.core.waterLost = this.core.waterLost - surfaceExchange(this.body.radiusPercent*this.totalRadius,this.skin.radiusPercent*this.totalRadius)*(tempLoss);
//Core //Core
tempLoss = waterLoss(this.core.initialTemp,this.core.volume,this.totalRadius) this.core.waterLost = this.core.waterLost + waterLoss(this.core.finalTemperature)
this.core.waterLost = this.core.waterLost - (tempLoss);
//Distribute Water //Distribute Water
//this.body.waterLost = this.body.waterLost + (tempLoss); //this.body.waterLost = this.body.waterLost - (tempLoss);
console.log("Skin: "+ this.skin.waterLost + " " + turkey.cookCondition(Math.abs(this.skin.waterLost),this.skin.volume)); console.log("Skin: "+ this.skin.waterLost + " " + turkey.cookCondition(this.skin.waterLost,this.skin.volume));
console.log("Body: "+ this.body.waterLost + " " + turkey.cookCondition(Math.abs(this.body.waterLost),this.body.volume)); console.log("Body: "+ this.body.waterLost + " " + turkey.cookCondition(this.body.waterLost,this.body.volume));
console.log("Core: "+ this.core.waterLost + " " + turkey.cookCondition(Math.abs(this.core.waterLost),this.core.volume)); console.log("Core: "+ this.core.waterLost + " " + turkey.cookCondition(this.core.waterLost,this.core.volume));
} }
} }
@ -225,16 +223,15 @@ function surfaceExchange(outerRadius,innerRadius) {
var denominator = (sphereSurfaceArea(innerRadius) + sphereSurfaceArea(outerRadius) ) var denominator = (sphereSurfaceArea(innerRadius) + sphereSurfaceArea(outerRadius) )
return(sphereSurfaceArea(outerRadius)/denominator ) return(sphereSurfaceArea(outerRadius)/denominator )
} }
function waterLoss(temperature,volume,totalRadius) { function waterLoss(temperature) {
totalVolume = sphereVolume(totalRadius) loss = (1) * Math.pow(7,(temperature-20)/156)-1
loss = (1) * Math.pow(7,(temperature-20)/176)
return (loss) return (loss)
} }
var oldBiot=null; var oldBiot=null;
function transientSphereSeries (rPosition,rTotal,tempInitial,tempInfini,t) { function transientSphereSeries (rPosition,rTotal,tempInitial,tempInfini,t) {
var min = 0; var min = 0;
var max = 1000; // This are for setting Lambda boundries and nothing else var max = 10000; // This are for setting Lambda boundries and nothing else
//thermalConduct = ((tempInitial-20)*(0.13/60)) + 0.32; //thermalConduct = ((tempInitial-20)*(0.13/60)) + 0.32;
var sum=0; var sum=0;
var alpha = thermalConduct/(density*cp) var alpha = thermalConduct/(density*cp)
@ -282,6 +279,7 @@ function time() {
if (ovenObject.steadyTimer>=60*scale && equalized) { if (ovenObject.steadyTimer>=60*scale && equalized) {
ovenObject.steadyTimer = 0; ovenObject.steadyTimer = 0;
ovenObject.steadyTemp = ovenObject.tempInfini ovenObject.steadyTemp = ovenObject.tempInfini
turkey.resetLayerTemps();
globalTime = 0; //Reset the model's time calculation if there are major changes in the tolerance of the temperature globalTime = 0; //Reset the model's time calculation if there are major changes in the tolerance of the temperature
} }
else { else {

Loading…
Cancel
Save