@ -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 * 20 0000) {
if ( cookValue >= multiplier * 8 0000) {
return ( "House Fire" )
return ( "House Fire" )
}
}
else if ( cookValue >= multiplier * 140 000) {
else if ( cookValue >= multiplier * 55 000) {
return ( "Charcoal" )
return ( "Charcoal" )
}
}
else if ( cookValue >= multiplier * 11 0000) {
else if ( cookValue >= multiplier * 4 0000) {
return ( "Dry" )
return ( "Dry" )
}
}
else if ( cookValue >= multiplier * 200 00) {
else if ( cookValue >= multiplier * 165 00) {
return ( "Cooked" )
return ( "Cooked" )
}
}
else if ( cookValue >= multiplier * 10 000) {
else if ( cookValue >= multiplier * 8 000) {
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 . finalTemperature = transientSphereSeries ( this . skin . radiusPercent * this . totalRadius , this . totalRadius , this . skin . initialTemp , ovenObject . steadyTemp , globalTime )
this . skin . initialTemp = this . skin . finalTemperature ;
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 {