% ebm_0_dim_gui.m % % Graphical User Interface (GUI) to the Energy Balance Model based on Equation 3.8 % from 'A Climate Modeling Primer', 1st Edition, 1987 % A. Henderson-Sellers and K. McGuffie % % Written by Tom Huber, 23-JUN-96 for Envision-It Workshop 1996 % % Requires ebm_0_dim.m to calculate the temperature distribution function ebm_0_dim_gui () % This is the machine-generated representation of a MATLAB object % and its children. Note that handle values may change when these % objects are re-created. This may cause problems with some callbacks. % The command syntax may be supported in the future, but is currently % incomplete and subject to change. % % To re-open this system, just type the name of the m-file at the MATLAB % prompt. The M-file and its associtated MAT-file must be on your path. a = findobj('Tag','EbmGuiFig'); % Get rid of previous windows if a ~= 0 delete(a); end a = figure('Color',[0.8 0.8 0.8], ... 'Position',[30 125 500 353], ... 'Tag','EbmGuiFig'); b = axes('Parent',a, ... 'Box','on', ... 'CameraUpVector',[0 1 0], ... 'Color',[1 1 1], ... 'Position',[0.354 0.116147 0.454 0.705382], ... 'Tag','Axes1', ... 'XColor',[0 0 0], ... 'YColor',[0 0 0], ... 'ZColor',[0 0 0]); c = line('Parent',b, ... 'Color',[0 0 1], ... 'Tag','Line1', ... 'XData',[0 1], ... 'YData',[1 2]); c = text('Parent',b, ... 'Color',[0 0 0], ... 'HandleVisibility','callback', ... 'HorizontalAlignment','center', ... 'Position',[9.95575 14.7732 0], ... 'String','Time (Years)', ... 'Tag','Text1', ... 'VerticalAlignment','cap'); set(get(c,'Parent'),'XLabel',c); c = text('Parent',b, ... 'Color',[0 0 0], ... 'HandleVisibility','callback', ... 'HorizontalAlignment','center', ... 'Position',[-3.14159 16.255 0], ... 'Rotation',90, ... 'String','Temperature (Degrees C)', ... 'Tag','Text2', ... 'VerticalAlignment','baseline'); set(get(c,'Parent'),'YLabel',c); c = text('Parent',b, ... 'Color',[0 0 0], ... 'HandleVisibility','callback', ... 'HorizontalAlignment','right', ... 'Position',[-15.708 18.1401 0], ... 'Tag','Text3', ... 'Visible','off'); set(get(c,'Parent'),'ZLabel',c); c = text('Parent',b, ... 'Color',[0 0 0], ... 'HandleVisibility','callback', ... 'HorizontalAlignment','center', ... 'Position',[9.95575 17.5857 0], ... 'Tag','Text4', ... 'VerticalAlignment','bottom'); set(get(c,'Parent'),'Title',c); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'Callback','global TStart,TStart = str2num(get(gcbo,''String''));', ... 'Position',[54.75 235.5 39 15], ... 'String','15', ... 'Style','edit', ... 'Tag','TStart'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0.658824 0.784314 0.658824], ... 'Position',[100 225.5 45 23], ... 'String','Solar Multiplier', ... 'Style','text', ... 'Tag','StaticText4'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'Callback','global SXInit,SXInit = str2num(get(gcbo,''String''));', ... 'Position',[145 235.5 55 15], ... 'String','1', ... 'Style','edit', ... 'Tag','SXInit'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0.658824 0.784314 0.658824], ... 'Position',[4.5 141.75 45 23.25], ... 'String','Lowered Solar Const', ... 'Style','text', ... 'Tag','TextLowered'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'Callback','global SXLow, SXLow = str2num(get(gcbo,''String''));', ... 'Position',[48 150 34.5 15], ... 'String','1', ... 'Style','edit', ... 'Tag','SXLow'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0.658824 0.784314 0.658824], ... 'Position',[4.5 175 45 15], ... 'String','Solar Const', ... 'Style','text', ... 'Tag','TextSolarConst'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'Callback','global SVal, SVal = str2num(get(gcbo,''String''));', ... 'Position',[48.5 175 34.5 15], ... 'String','1', ... 'Style','edit', ... 'Tag','SVal'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0.658824 0.784314 0.658824], ... 'Position',[17.25 126.75 45 15], ... 'String','First Year', ... 'Style','text', ... 'Tag','TextFirstYear'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'Callback','global FirstYear, FirstYear=str2num(get(gcbo,''String''))', ... 'Position',[61.5 126.75 21 15], ... 'String','1', ... 'Style','edit', ... 'Tag','FirstYear'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0.658824 0.784314 0.658824], ... 'Position',[16.5 114.75 45 12.75], ... 'String','Last Year', ... 'Style','text', ... 'Tag','TextLastYear'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'Callback','global LastYear, LastYear=str2num(get(gcbo,''String''));', ... 'Position',[60.75 112.5 20.25 15], ... 'String','1', ... 'Style','edit', ... 'Tag','LastYear'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0.658824 0.784314 0.658824], ... 'Position',[9.75 234 45 18], ... 'String','Initial Temp', ... 'Style','text', ... 'Tag','StaticText1'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0.66 0.78 0.66], ... 'Position',[6 78.75 84 15], ... 'String','Heat Loss Coefficients', ... 'Style','text', ... 'Tag','TextHeatLoss'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0.66 0.78 0.66], ... 'Position',[6.75 64.5 18.75 15], ... 'String','A', ... 'Style','text', ... 'Tag','TextAVal'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0.66 0.78 0.66], ... 'Position',[6 50.25 18.75 16.5], ... 'String','B', ... 'Style','text', ... 'Tag','TextBVal'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'Callback','global AVal, AVal=str2num(get(gcbo,''String''));', ... 'Position',[25.5 64.5 63.75 15], ... 'String','204', ... 'Style','edit', ... 'Tag','AVal'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'Callback','global BVal, BVal=str2num(get(gcbo,''String''));', ... 'Position',[24.75 49.5 63 15], ... 'String','2.09', ... 'Style','edit', ... 'Tag','BVal'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0.66 0.78 0.66], ... 'Callback','global AdvancedControls AlbedoControls AlbedoButt BlackBodyButt,vv = get(gcbo,''Value'');if vv==1,set(AdvancedControls,''Visible'',''on''),else,set(AlbedoControls,''Visible'',''on''),set(AlbedoButt,''Value'',0),set(BlackBodyButt,''Value'',1),set(AdvancedControls,''Visible'',''off''),end', ... 'Clipping','off', ... 'Position',[12.75 193 79.5 20], ... 'String','Advanced Controls', ... 'Style','checkbox', ... 'Tag','AdvancedCheck', ... 'Value',1); b = uicontrol('Parent',a, ... 'Units','points', ... 'Callback','ebm_0_dim', ... 'Position',[318.75 172.25 45 15], ... 'String','Calculate', ... 'Tag','Pushbutton1'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0 1 1], ... 'Position',[312 140 55 15], ... 'String','Final Temp', ... 'Style','text', ... 'Tag','StaticText2'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0 1 1], ... 'Position',[312 125 55 15], ... 'String','17.4 C', ... 'Style','text', ... 'Tag','TFinal', ... 'Value',13.286); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0 1 1], ... 'Position',[312 80 55 25], ... 'String','Steady-State Temp', ... 'Style','text', ... 'Tag','StaticText2'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0 1 1], ... 'Position',[312 70 55 15], ... 'String','17.4 C', ... 'Style','text', ... 'Tag','TSteady', ... 'Value',13.286); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0.658824 0.784314 0.658824], ... 'Position',[205 237 45 15], ... 'String','Albedo', ... 'Style','text', ... 'Tag','AlbedoText'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'Callback','global AlbedoVal,AlbedoVal=str2num(get(gcbo,''String''));set(findobj(''Tag'',''AlbedoSlider''),''Value'',AlbedoVal)', ... 'Position',[205 222 45 15], ... 'String','0.3', ... 'Style','edit', ... 'Tag','Albedo'); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0.658824 0.784314 0.658824], ... 'Callback','global AlbedoVal,AlbedoVal = get(gcbo,''Value'');set(findobj(''Tag'',''Albedo''),''String'',num2str(AlbedoVal))', ... 'Position',[250 222 81.75 15], ... 'Style','slider', ... 'Tag','AlbedoSlider', ... 'Value',0.3); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0.658824 0.784314 0.658824], ... 'Position',[257.25 237 100 15], ... 'Callback','global AlbedoControls,vv = get(gcbo,''Value'');if vv==1,set(AlbedoControls,''Visible'',''off''),else,set(AlbedoControls,''Visible'',''on''),end', ... 'String','Temperature Dependent', ... 'Style','radiobutton', ... 'Tag','AlbedoButton', ... 'Value',1); b = uicontrol('Parent',a, ... 'Units','points', ... 'BackgroundColor',[0.658824 0.784314 0.658824], ... 'Position',[7.5 26.25 102.75 16.5], ... 'String','BlackBody ', ... 'Style','radiobutton', ... 'Tag','BlackBodyButton'); % ADDED BY TOM HUBER ebmdefaults function ebmdefaults() global SXInit SXLow FirstYear LastYear global TStart SVal global AlbedoVal global AVal BVal global EbmGuiFig global AdvancedControls AlbedoControls AlbedoButt BlackBodyButt disp ('Setting Default Values'); EbmGuiFig = findobj('Tag','EbmGuiFig'); TStart = 13.5; settag('TStart',TStart) SVal = 1370; settag('SVal',SVal) SXInit = 1; settag('SXInit',SXInit) SXLow = 1; settag('SXLow',SXLow) FirstYear = 1; settag('FirstYear',FirstYear) LastYear = 1; settag('LastYear',LastYear) AlbedoVal = 0.32; settag('Albedo',AlbedoVal) AVal = 204; % Radiative Heat Loss Coefficient settag('AVal',AVal) BVal = 2.17; % Radiative Heat Loss Coefficient settag('BVal',BVal) AdvancedControls = [ findobj('Tag','TextSolarConst'); findobj('Tag','SVal'); findobj('Tag','TextLowered'); findobj('Tag','SXLow'); findobj('Tag','TextFirstYear'); findobj('Tag','FirstYear'); findobj('Tag','TextLastYear'); findobj('Tag','LastYear'); findobj('Tag','TextHeatLoss'); findobj('Tag','AlbedoButton'); findobj('Tag','BlackBodyButton'); findobj('Tag','TextAVal'); findobj('Tag','AVal'); findobj('Tag','TextBVal'); findobj('Tag','BVal');]; AlbedoControls = [findobj('Tag','Albedo'); findobj('Tag','AlbedoSlider');]; AlbedoButt = findobj('Tag','AlbedoButton'); BlackBodyButt = findobj('Tag','BlackBodyButton'); HH = findobj('Tag','AdvancedCheck'); set (HH,'Value',0) set (AdvancedControls,'Visible','off') HH = findobj('Tag','BlackBodyButton'); set (HH,'Value',1) HH = findobj('Tag','AlbedoButton'); set (HH,'Value',0) ebm_0_dim function settag(String,Value) global EbmGuiFig HH = findobj(EbmGuiFig,'Tag',String); set(HH,'String',num2str(Value))