
(* Thermal design for solar system with batteries *)
(* Thermal limits for batteries [-20,50C],
   Design limits would be [0,30C] *)

(* Radiator *) 
ThrEmissOpen = 0.9; (* radiator emissivity *)
ThrEmissLid = 0.1; (* Estimated Thermal emissivity at night w lid closed *)
ThrAlphaGood = 0.2;  (* absorptivity *)
ThrAlphaBad = 0.35;
Insolation = 1358; (* Solar insolation *)
ThrSigma = 5.67 10^-8; (* Sigma, constant in Stefan Boltzman radiation law *)
ThrT0 = 4; (* Temperature of free space in kelvin *)
ThrPowerElec = 400; (* Average electronics power consumption *)
ThrHeatBalance[Q_,G_,A_,Alpha_,Emiss_,T2_,T0_] := 
	Q + G*A*Alpha == ThrSigma*Emiss*A*
	(T2 ^ 4 - T0 ^ 4);

(* Design for day, Solar scenario *)
ThrQ := ThrPowerElec; ThrAlpha := ThrAlphaGood; ThrEmiss := ThrEmissOpen;
ThrG := Insolation; ThrQ := ThrPowerElec;
ThrT1BattMax = 30 + 273; (* Design temperature of enclosure 
				- heat pipe junction *)
ThrT2 := ThrT1BattMax - 5; (* Design temperature of radiator *)

ThrTemp = Solve[{ThrHeatBalance[ThrQ,ThrG,ThrA,ThrAlpha,ThrEmiss,ThrT2,ThrT0]
},{ThrA}];
ThrSolarArea = ThrA/.ThrTemp[[1]]//N;
Print["\n\n                         Solar Scenario \n\n"];
Print["Radiator Area in Solar Scenario = ", ThrSolarArea];


(* Solar Scenario, night heating need *)


ThrG := 0; ThrEmiss := ThrEmissLid; 
ThrT1BattMin = 0 + 273; (* Min design temp of battery-heat pipe jct *)
ThrT2 := ThrT1BattMin -5; ThrA = ThrSolarArea;

ThrTemp = Solve[{ThrHeatBalance[ThrQ2,ThrG,ThrA,ThrAlpha,ThrEmiss,ThrT2,ThrT0]
},{ThrQ2}];
ThrSolarRHU = ThrQ2/.ThrTemp[[1]]//N;
Print["Night heating need [RHU Size] = ",ThrSolarRHU];
