Advertisement
ksoltan

SOLACOOKA

Oct 19th, 2015
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 2.74 KB | None | 0 0
  1. function solar_cooker()
  2. % Models the internal energy of the surface of a pot and the water inside
  3. % of it over time, heated from the sun's solar energy.
  4.     insolation = 1000; % W/m^2
  5.     k = 55; % W/m/K average of cast iron conductivity
  6.     radius_pot = 0.3; %m inner radius where water is at
  7.     height_water = 0.2; %m
  8.     height_pot = 0.3; %m
  9.     density_pot = 1300; % kg / m^3
  10.     d = 0.01; %m
  11.     mass_pot = pi * (radius_pot + d)^2 * height_pot * density_pot;
  12.     c_pot = 500; % J / (kg * K)
  13.     % assuming the pot is a cylinder, short and stout with the lid on
  14.     SA_pot_in = 2 * pi * radius_pot * height_pot + 2 * pi * radius_pot^2;
  15.     SA_pot_out = 2 * pi * (radius_pot + d) * height_pot...
  16.         + 2 * pi * (radius_pot + d)^2;
  17.     mass_water = pi * radius_pot^2 * height_water; %density is 1 kg/m^3
  18.     c_water = 4186; % J /(kg * K)
  19.     Tenv = 293; % K
  20.     Twater = 273 + 10; % CHANGE LATA
  21.     e = 0.97; % reflection efficiency
  22.     emmisivity = 0.65; % of cast iron
  23.     sigma = 5.67e-8; %w/m^2/K Stephen Boltzmann's constnat
  24.     h = k / d; % heat transef coefficient of pot
  25.    
  26.     function res = change_U_pot(t, params)
  27.         % Params: internal energy of pot, internal energy of water
  28.         temp_pot = params(1) / mass_pot / c_pot;
  29.         temp_water = params(2) / mass_water / c_water;
  30.         % Assume that the surface area of the cooker is 1 m^2
  31.         % 1 - emmisivity percent of the radiated energy is reflected from
  32.         % the pot. Therefore, only a certain percentage, corresponding to
  33.         % emmisivity is actually absorbed into the pot and available for us
  34.         % of conduction and convection and then radiation outward
  35.         radiation = insolation * e * emmisivity;
  36.         % convection depends on the outside surface area in contact with the
  37.         % environment
  38.         convection = h * SA_pot_out * (Tenv - temp_pot);
  39.         % conduction depends on the surface area of pot touching the inside
  40.         conduction = k * SA_pot_in / d * (temp_pot - temp_water)...
  41.              * (temp_water < 373);
  42. %          fprintf('Water temp: %d\nConduction amount: %d\n\n', temp_water,...
  43. %              conduction)
  44.         % whatever energy is absorbed into the pot is also emmitted through
  45.         % radiation outwards
  46.         emmission = emmisivity * sigma * SA_pot_out * temp_pot^4;
  47.         res = [radiation - convection - conduction - emmission; ...
  48.             conduction];
  49.     end
  50.    
  51.     [t, u] = ode45(@change_U_pot, [0, 1000], [Tenv * mass_pot * c_pot, ...
  52.         Twater * mass_water * c_water]);
  53.     %disp(u(:, 1) / mass_pot / c_pot)
  54.     %disp(u(:, 2) / mass_pot / c_pot)
  55.     figure(1)
  56.     plot(t, u(:, 2) / mass_water / c_water - 273)
  57.     figure(2)
  58.     plot(t, u(:, 1) / mass_pot / c_pot - 273)
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement