clc
clear
close all hidden

%% ENTER THE SIMULATION PARAMETERS HERE:
tic
% ACTIVATE TM display during simulation
boolFig = 1;

%NUMBER OF TC on each TEG side;
n       = 80;       %IMPORTANT: the total number of TCs employed is 2*n, since there are n TC on each side of the TM cross section

%POWER REQUIREMENT
PowReq  = 10000;    %(W)

%TIME FRAME DEFINITION
step    = 100;      %time step for the simulation (seconds) Above 120s some instabilitis appear in the simulation
lunar_day_duration      = 150;   %time (hours) of simulated lunar day
lunar_night_duration    = 66;   %time (hours) of simulated lunar night

%MESH
mesh_size   = 0.04; %(m) avoid mesh above 0.04

%SIZING MARGINS
performance_margin      = 0.20;  %typical value for low TRL technologies
design_margin           = 0.20;  %typical value for low TRL technologies

%Emissivity of the TM during the night phase (-)
emissivity_reduction_night  = 50;%dividing factor (values over 50 might be unrealistic). 
%during the night, the thermal is covered by a cap with the ability to reflect largely the radiative losses. 
%This is modelled by reducing the emissivity of the TM by a number up to 50. Otherwise, the TM loos most of its energy.
%Here you need to type in this dividing factor

%% SOLAR COLLECTOR

RSI             = 1000; %Reflected Solar Irradiance by the reflectors (W/m2)
DSI             = 300;  %Direct Solar Irradiance provided by the sun during the day(W/m2)
m_factor        = 70;   %magnification factor of the the Fresnel lens (-)
fresnel_eff     = 0.95; %Fresnel lens efficiency (-)

%% CONSTANT DATA 

StefanBoltz     = 5.670373e-8;  %Stefan-Boltzman constant used for radiative losses (W.m-2.K-4)
Tspace          = 3;    %Temperature of deep space: 3K is the usual value to size space thermal control systems;

%% GEOMETRY  SETTINGS

TM_height       = 0.65; %Height of the simulated thermal mass TM (m)
TM_diam         = 0.3;  %diameter of the simulated TM (m)

fluff_thickness = 0.04; %fluff thcikness (m)

TEG_side        = 0.3;  %length of the TEG on the side of the TM (m). Increasing this value, decreases the number of thermocouple per m2.
TEG_y_limit     = 0.2;  %depth at which the TEG is placed (m)
TEG_y_top       = TM_height - TEG_y_limit;  %no need to change
TEG_y_bot       = TEG_y_top - TEG_side;     %no need to change

fluff_width     = 0.2;  %no need to change
depth_nat_reg   = 0.2;  %no need to change%

%% HOT SINK PLATE
%Define the Hot Sink Plate (HSP) geometry. The objective of the HSP is to enable a uniform temperature at the hot side of the TEG. Therefore the HSPshall be a significant thermal conductor.

HSP_y_top       = TEG_y_top;    %(m)
HSP_y_bot       = TEG_y_bot;    %(m)
HSP_thickness   = 0.01;         %(m)

HSP_conductivity= 150;          %thermal conductivity for alumimum (W/Km)
HSP_cp          = 900;          %specific heat for aluminium (J/(kg*K))
HSP_density     = 2700;         %density (kg/m3)

%% THERMAL BEAM
%Thermal beam geometry and properties. The objective of the thermal beam is to conduct the heat deeply into the bulk material of the thermal mass.

thermal_beam_conducitivy    = 150;      %thermal conductivity for alumimum (W/Km)
thermal_beam_cp             = 900;      %specific heat for aluminium (J/(kg*K))
thermal_beam_density        = 2700;     %density (kg/m2)

thermal_beam_length         = 0.3;      %(m)
thermal_beam_y_top          = 0.07;     %(m)
thermal_beam_thickness      = 0.01;     %(m)

%% RADIATOR

RAD_specific_heat           = 900;      %for an aluminium plate, to be confirmed (J/(kg.K))
RAD_density                 = 2700;     %density of aluminium if HS is made of aluminium (kg/m3)
RAD_emissivity              = 0.8;      %at EOL after degradation (BOL can be 0.9)
RAD_abs                     = 0.4;      %at EOL after degradation (BOL can be 0.15)
                            
RAD_thickness               = 0.0025;   %arbitrary (m), radiators are likely to be thin
RAD_area                    = 10;       %radiator area (m2) placed horizontally
RAD_volume                  = RAD_area * RAD_thickness;  % radiator volume (m3)
RAD_mass                    = RAD_volume * RAD_density;  %radiator panel mass without structural mounts (kg)
toc