├── .gitattributes ├── .gitignore ├── A9R7B68.png ├── Appendix C.docx ├── Final Presentation.pptx ├── Managerial Report.docx ├── New folder (2) ├── N100.pdf ├── N1000.pdf ├── N10000.pdf ├── Project_report_OPR.pdf └── genscenarios.m ├── OPR_Project_Smart_Grid.pptx ├── Project Report (1).docx ├── Project Report Smart Grid.pdf ├── Project_report_OPR.pdf ├── Scheduling in Smart Grids.pptx ├── User_Interfacefig.fig ├── User_Interfacefig.m ├── Writing Sample.doc ├── Writing Sample.ppt ├── duration.mat ├── pow_app.mat ├── request_time.mat └── start_time.mat /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear on external disk 35 | .Spotlight-V100 36 | .Trashes 37 | 38 | # Directories potentially created on remote AFP share 39 | .AppleDB 40 | .AppleDesktop 41 | Network Trash Folder 42 | Temporary Items 43 | .apdisk 44 | -------------------------------------------------------------------------------- /A9R7B68.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/varunpillai/SmartGrid/958f35ad8bb427f0879024773e143ea88069739e/A9R7B68.png -------------------------------------------------------------------------------- /Appendix C.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/varunpillai/SmartGrid/958f35ad8bb427f0879024773e143ea88069739e/Appendix C.docx -------------------------------------------------------------------------------- /Final Presentation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/varunpillai/SmartGrid/958f35ad8bb427f0879024773e143ea88069739e/Final Presentation.pptx -------------------------------------------------------------------------------- /Managerial Report.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/varunpillai/SmartGrid/958f35ad8bb427f0879024773e143ea88069739e/Managerial Report.docx -------------------------------------------------------------------------------- /New folder (2)/N100.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/varunpillai/SmartGrid/958f35ad8bb427f0879024773e143ea88069739e/New folder (2)/N100.pdf -------------------------------------------------------------------------------- /New folder (2)/N1000.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/varunpillai/SmartGrid/958f35ad8bb427f0879024773e143ea88069739e/New folder (2)/N1000.pdf -------------------------------------------------------------------------------- /New folder (2)/N10000.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/varunpillai/SmartGrid/958f35ad8bb427f0879024773e143ea88069739e/New folder (2)/N10000.pdf -------------------------------------------------------------------------------- /New folder (2)/Project_report_OPR.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/varunpillai/SmartGrid/958f35ad8bb427f0879024773e143ea88069739e/New folder (2)/Project_report_OPR.pdf -------------------------------------------------------------------------------- /New folder (2)/genscenarios.m: -------------------------------------------------------------------------------- 1 | function genscenarios 2 | clear all; clear mex; clc; 3 | global rd dd rc dc rh dh 4 | data_params_single_house 5 | [rd,dd]=scenarios(pon_dish,pof_dish,Nsamples); 6 | [rc,dc]=scenarios(pon_clothes,pof_clothes,Nsamples); 7 | [rh,dh]=scenarios(pon_heater,pof_heater,Nsamples); 8 | % ecost=calcost(2,rd,dd,Pd); 9 | tau0=[0;0;0]; 10 | A=[]; 11 | b=[]; 12 | Aeq=[]; 13 | beq=[]; 14 | lb=[0;0;0]; 15 | ub=[10;10;10]; 16 | options=[]; 17 | vt=[1;1;1]; 18 | [x,h,exitflag,output,lambda,grad,hessian] = fminconint(@calcost_home,tau0,A,b,Aeq,beq,lb,ub,@nonlcon,options,vt,100); 19 | end 20 | 21 | 22 | 23 | 24 | % %r1=min(r); 25 | % %r2=max(r); 26 | % %range=r1:r2; 27 | % %Nr=hist(r,range); 28 | % %bar(range,Nr./numel(r)); 29 | % %d1=min(r); 30 | % %d2=max(r); 31 | % %range=d1:d2; 32 | % %Nd=hist(duration,range); 33 | % %bar(range,Nd./numel(r)); 34 | % % tau=0:10; 35 | % % for i=1:length(tau) 36 | % % ecost_home(i)=calcost_home(tau(i)); 37 | % % end 38 | % 39 | % %plot(tau,ecost_home); 40 | % keyboard 41 | % end 42 | % 43 | % 44 | % 45 | % 46 | function [e_total,g]=calcost_home(tau) 47 | data_params_single_house; 48 | global rd dd rc dc rh dh 49 | for i =1:Napp 50 | ecost_dish = calcost(tau(1),rd,dd,Pd); 51 | ecost_clothes=calcost(tau(2),rc,dc,Pc); 52 | ecost_heater=calcost(tau(3),rh,dh,Ph); 53 | end 54 | e_total=ecost_dish;+ecost_clothes+ecost_heater; 55 | tau; 56 | e_total; 57 | g=0; 58 | end 59 | 60 | function [c,ceq] = nonlcon(tau) 61 | c = []; 62 | ceq = []; 63 | end 64 | 65 | function ecost=calcost(tau,r,d,P) 66 | data_params_single_house; 67 | %P=P*ones(size(e_t,1),1); 68 | %P=[P;P;P]; 69 | %e_t=[e_t;e_t;e_t]; 70 | for i=1:length(r) 71 | %z1=r(i)+tau+1; 72 | %z2=z1+d(i)-1; 73 | t1(i)=r(i)+tau-1; 74 | t2(i)=t1(i)+d(i); 75 | x=t1(i):0.01:t2(i); 76 | for j=1:length(x) 77 | y(j)=electricost(x(j)); 78 | end 79 | c_elec(i)=trapz(x,y)*(P/d(i)); 80 | y=0; 81 | if tau > m_n 82 | c_delay=(m_n*c_n1); 83 | c_add_delay=c_delay+c_n2*(tau-m_n); 84 | else 85 | c_add_delay=0; 86 | c_delay=tau*c_n1; 87 | end 88 | C_T(i)=c_elec(i)+c_delay+c_add_delay; 89 | end 90 | ecost=sum(C_T)/Nsamples; 91 | end 92 | 93 | function c_elec=electricost(t) 94 | if t>24 && t<=48 95 | t=t-24; 96 | elseif t>48 && t<=72 97 | t=t-48; 98 | end 99 | if t < 10 && t >=0 100 | c_elec=0.014; 101 | elseif t >=10 && t <22 102 | c_elec =0.21; 103 | elseif t>=22 && t<=24 104 | c_elec=0.014; 105 | end 106 | end 107 | 108 | 109 | function [r,duration]=scenarios(p_on,p_off,Nsamples) 110 | %Code written by Arun Srikanth for OPR project. 111 | %This function returns the request time slot (not time) and duration for an applicance 112 | %based on on-off probabilites. 113 | %Further more two assumptions are made while generating the scenarios 114 | %1. The duration of an equipment does not exceed 24 hours 115 | %2. An equipment is allowed to be used only once. 116 | %The input arguments for the functions are 117 | %p_on %off to on probability 118 | %p_off %on to off porbability 119 | %No of samples you want to generate 120 | k=1; % Sample no: set it initially to 1. 121 | ton_acc=zeros(Nsamples,1); %Initialize 122 | toff_acc=zeros(Nsamples,1);%Initialize 123 | duration=zeros(Nsamples,1); %Initialize 124 | reject=0; 125 | dcounter=0;% This is the day counter in case one wants to see how many days an equipment is requested, 126 | %however one has to comment out certain parts of the code in order to see this 127 | %due to assumption 1. 128 | t=1;%Set the current clock to 1st time slot, t is the time ticker 129 | while k < Nsamples+1 %Check whether the sample number is less thank k 130 | if t<=24 %Check whether the timeslot is less than 24 131 | reject=0; 132 | p=rand(1); % choose a random number between 0 and 1 133 | %---------------------Check whether the equipment is on based on given probability------------------------------------------------------------------- 134 | if p_on(t) > p %Check whether the machine is on the time slot t 135 | ton_acc(k)=t; % If yes accept t 136 | j=1; %Time ticker which keeps track of the duration 137 | count=0; 138 | toff=ton_acc(k)+1; %increase t by t+1 139 | %---------------This part of the code finds the duration once the request is made-------------------------------------------------------- 140 | %--------------------------------------------------------------------------------------- 141 | while count < 1 %check whether the count is less than one 142 | if toff > 24 % if the next time slot happens to be on the next day 143 | toff=toff-24; % cycle 144 | dcounter=dcounter+1; %Increase the day counter 145 | end 146 | p=rand(1); % Choose a random number between 0 and 1 147 | if p_off(toff) > p %Check whether the machine is off on time slot t+1 148 | toff_acc(k)=toff;%accecpt the time slot if yes 149 | duration(k)=j;%collect the duration as a vector 150 | t=24; %Reset the clock to the end of the day 151 | count=count+1; %Increase the counter to exit the while loop since the equipment is not switched twice on same day 152 | day(k)=dcounter;% Keep the day counter 153 | dcounter=0;%Set the day counter equal to zero 154 | else 155 | %----------------Remove samples if the duration is more than a day----------------------------------------------------------------- 156 | if toff==ton_acc(k) 157 | %j %Uncomment this line to see whether the duration is 158 | %24 hours 159 | count=count+1; %Exit the while loop 160 | t=24;%Reset the clock to the end of the day 161 | dcounter=0; %Set the day counter back to zero 162 | reject=1; 163 | end 164 | %Otherwise go to next time slot to see if its off 165 | j=j+1; 166 | toff=toff+1; 167 | end 168 | end 169 | %-------------------------------------------------------------------------------------------------------------------- 170 | %---------------------End of the part that finds the duration--------------------------------------------- 171 | end 172 | %----------------------------------------------------------------------------------------------------------------------- 173 | t=t+1;%Increase the ticker if no equipment is on at time t 174 | elseif t>24 %if the t exceeds the day 175 | if reject==1 176 | k=k; %If the sample is rejected do not upadate sample number 177 | t=1; %Restart the clock 178 | elseif reject==0 % If there is no rejection 179 | k=k+1; % Collect samples and 180 | t=1; %reset the clock 181 | end 182 | end 183 | end 184 | r=ton_acc'; 185 | day=day'; 186 | ton_acc=ton_acc'; 187 | toff_acc=toff_acc'; 188 | %Importance sampling 189 | Scenario= [r' duration]; 190 | Scenario(any(Scenario==0,2),:)=[]; % Elminate samples that dont contribute to the average 191 | r= Scenario(:,1); 192 | duration=Scenario(:,2); 193 | end 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | -------------------------------------------------------------------------------- /OPR_Project_Smart_Grid.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/varunpillai/SmartGrid/958f35ad8bb427f0879024773e143ea88069739e/OPR_Project_Smart_Grid.pptx -------------------------------------------------------------------------------- /Project Report (1).docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/varunpillai/SmartGrid/958f35ad8bb427f0879024773e143ea88069739e/Project Report (1).docx -------------------------------------------------------------------------------- /Project Report Smart Grid.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/varunpillai/SmartGrid/958f35ad8bb427f0879024773e143ea88069739e/Project Report Smart Grid.pdf -------------------------------------------------------------------------------- /Project_report_OPR.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/varunpillai/SmartGrid/958f35ad8bb427f0879024773e143ea88069739e/Project_report_OPR.pdf -------------------------------------------------------------------------------- /Scheduling in Smart Grids.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/varunpillai/SmartGrid/958f35ad8bb427f0879024773e143ea88069739e/Scheduling in Smart Grids.pptx -------------------------------------------------------------------------------- /User_Interfacefig.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/varunpillai/SmartGrid/958f35ad8bb427f0879024773e143ea88069739e/User_Interfacefig.fig -------------------------------------------------------------------------------- /User_Interfacefig.m: -------------------------------------------------------------------------------- 1 | function varargout = User_Interfacefig(varargin) 2 | % USER_INTERFACEFIG MATLAB code for User_Interfacefig.fig 3 | % USER_INTERFACEFIG, by itself, creates a new USER_INTERFACEFIG or raises the existing 4 | % singleton*. 5 | % 6 | % H = USER_INTERFACEFIG returns the handle to a new USER_INTERFACEFIG or the handle to 7 | % the existing singleton*. 8 | % 9 | % USER_INTERFACEFIG('CALLBACK',hObject,eventData,handles,...) calls the local 10 | % function named CALLBACK in USER_INTERFACEFIG.M with the given input arguments. 11 | % 12 | % USER_INTERFACEFIG('Property','Value',...) creates a new USER_INTERFACEFIG or raises the 13 | % existing singleton*. Starting from the left, property value pairs are 14 | % applied to the GUI before User_Interfacefig_OpeningFcn gets called. An 15 | % unrecognized property name or invalid value makes property application 16 | % stop. All inputs are passed to User_Interfacefig_OpeningFcn via varargin. 17 | % 18 | % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one 19 | % instance to run (singleton)". 20 | % 21 | % See also: GUIDE, GUIDATA, GUIHANDLES 22 | 23 | % Edit the above text to modify the response to help User_Interfacefig 24 | 25 | % Last Modified by GUIDE v2.5 17-Mar-2015 14:04:23 26 | 27 | % Begin initialization code - DO NOT EDIT 28 | gui_Singleton = 1; 29 | gui_State = struct('gui_Name', mfilename, ... 30 | 'gui_Singleton', gui_Singleton, ... 31 | 'gui_OpeningFcn', @User_Interfacefig_OpeningFcn, ... 32 | 'gui_OutputFcn', @User_Interfacefig_OutputFcn, ... 33 | 'gui_LayoutFcn', [] , ... 34 | 'gui_Callback', []); 35 | if nargin && ischar(varargin{1}) 36 | gui_State.gui_Callback = str2func(varargin{1}); 37 | end 38 | 39 | if nargout 40 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); 41 | else 42 | gui_mainfcn(gui_State, varargin{:}); 43 | end 44 | % End initialization code - DO NOT EDIT 45 | 46 | 47 | % --- Executes just before User_Interfacefig is made visible. 48 | function User_Interfacefig_OpeningFcn(hObject, eventdata, handles, varargin) 49 | % This function has no output args, see OutputFcn. 50 | % hObject handle to figure 51 | % eventdata reserved - to be defined in a future version of MATLAB 52 | % handles structure with handles and user data (see GUIDATA) 53 | % varargin command line arguments to User_Interfacefig (see VARARGIN) 54 | 55 | % Choose default command line output for User_Interfacefig 56 | handles.output = hObject; 57 | 58 | % Update handles structure 59 | guidata(hObject, handles); 60 | 61 | % UIWAIT makes User_Interfacefig wait for user response (see UIRESUME) 62 | % uiwait(handles.figure1); 63 | 64 | 65 | % --- Outputs from this function are returned to the command line. 66 | function varargout = User_Interfacefig_OutputFcn(hObject, eventdata, handles) 67 | % varargout cell array for returning output args (see VARARGOUT); 68 | % hObject handle to figure 69 | % eventdata reserved - to be defined in a future version of MATLAB 70 | % handles structure with handles and user data (see GUIDATA) 71 | 72 | % Get default command line output from handles structure 73 | varargout{1} = handles.output; 74 | 75 | 76 | % --- Executes during object creation, after setting all properties. 77 | function V_COST1_CreateFcn(hObject, eventdata, handles) 78 | % hObject handle to V_COST1 (see GCBO) 79 | % eventdata reserved - to be defined in a future version of MATLAB 80 | % handles empty - handles not created until after all CreateFcns called 81 | 82 | 83 | % --- Executes during object creation, after setting all properties. 84 | function V_COST2_CreateFcn(hObject, eventdata, handles) 85 | % hObject handle to V_COST2 (see GCBO) 86 | % eventdata reserved - to be defined in a future version of MATLAB 87 | % handles empty - handles not created until after all CreateFcns called 88 | 89 | % load small data 90 | % --- Executes on button press in pushbutton1. 91 | function pushbutton1_Callback(hObject, eventdata, handles) 92 | % hObject handle to pushbutton1 (see GCBO) 93 | % eventdata reserved - to be defined in a future version of MATLAB 94 | % handles structure with handles and user data (see GUIDAT) 95 | %%%%%%%------------------------------------------------------------ 96 | %% Import data from spreadsheet 97 | % Script for importing data from the following spreadsheet: 98 | % 99 | % Workbook: C:\Stuff\Downloads\MS BSAN\Quarter 2\OPR 100 | % 620\Project\test\Data.xlsx Worksheet: Small 101 | % 102 | % To extend the code for use with different selected data or a different 103 | % spreadsheet, generate a function instead of a script. 104 | 105 | % Auto-generated by MATLAB on 2015/03/15 18:38:32 106 | 107 | %% Import the data 108 | [~, ~, raw] = xlsread('C:\Stuff\Downloads\MS BSAN\Quarter 2\OPR 620\Project\test\Data.xlsx','Small','A2:H4'); 109 | raw(cellfun(@(x) ~isempty(x) && isnumeric(x) && isnan(x),raw)) = {''}; 110 | cellVectors = raw(:,1); 111 | raw = raw(:,[2,3,4,5,6,7,8]); 112 | 113 | %% Create output variable 114 | data = reshape([raw{:}],size(raw)); 115 | 116 | %% Allocate imported array to column variable names 117 | Appliance = cellVectors(:,1); 118 | Job = data(:,1); 119 | RequestHour = data(:,2); 120 | Duration = data(:,3); 121 | StartHour = data(:,4); 122 | DelayCost = data(:,5); 123 | PowerCost = data(:,6); 124 | TotalCost = data(:,7); 125 | 126 | %% Clear temporary variables 127 | clearvars data raw cellVectors 128 | %%%%%%%5555555555555555555555555555555555555555555555555555555555555 129 | 130 | Schedule = [Appliance num2cell([Job RequestHour Duration StartHour DelayCost PowerCost TotalCost])]; 131 | set(handles.uitable1,'data',Schedule); 132 | set(handles.pushbutton4,'Visible','On'); 133 | 134 | % solve button 135 | % --- Executes on button press in pushbutton2. 136 | function pushbutton2_Callback(hObject, eventdata, handles) 137 | % hObject handle to pushbutton2 (see GCBO) 138 | % eventdata reserved - to be defined in a future version of MATLAB 139 | % handles structure with handles and user data (see GUIDATA) 140 | % without scheduling 141 | set(handles.edit3,'String','100'); 142 | %with scheduling 143 | set(handles.edit4,'String','200'); 144 | %savings 145 | set(handles.edit5,'String','100'); 146 | 147 | % display graph button 148 | % --- Executes on button press in pushbutton3. 149 | function pushbutton3_Callback(hObject, eventdata, handles) 150 | % hObject handle to pushbutton3 (see GCBO) 151 | % eventdata reserved - to be defined in a future version of MATLAB 152 | % handles structure with handles and user data (see GUIDATA) 153 | active = get(hObject,'Value'); 154 | if active 155 | set(handles.axes2,'Visible','On'); 156 | set(hObject,'String','Hide Graph'); 157 | else 158 | set(handles.axes2,'Visible','Off'); 159 | set(hObject,'String','Display Graph'); 160 | end 161 | 162 | % reset button 163 | % --- Executes on button press in pushbutton4. 164 | function pushbutton4_Callback(hObject, eventdata, handles) 165 | % hObject handle to pushbutton4 (see GCBO) 166 | % eventdata reserved - to be defined in a future version of MATLAB 167 | % handles structure with handles and user data (see GUIDATA) 168 | %reset values 169 | set(handles.uitable1,'data',[]); 170 | set(handles.axes2,'Visible','Off'); 171 | set(handles.pushbutton4,'Visible','Off'); 172 | set(handles.pushbutton3,'String','Display Graph'); 173 | % without scheduling 174 | set(handles.edit3,'String',''); 175 | %with scheduling 176 | set(handles.edit4,'String',''); 177 | %savings 178 | set(handles.edit5,'String',''); 179 | %total power 180 | set(handles.edit6,'String',''); 181 | %power utilized 182 | set(handles.edit7,'String',''); 183 | %set slider vallue to zero 184 | set(handles.slider1,'Value',0); 185 | 186 | function edit3_Callback(hObject, eventdata, handles) 187 | % hObject handle to edit3 (see GCBO) 188 | % eventdata reserved - to be defined in a future version of MATLAB 189 | % handles structure with handles and user data (see GUIDATA) 190 | 191 | % Hints: get(hObject,'String') returns contents of edit3 as text 192 | % str2double(get(hObject,'String')) returns contents of edit3 as a double 193 | 194 | 195 | % --- Executes during object creation, after setting all properties. 196 | function edit3_CreateFcn(hObject, eventdata, handles) 197 | % hObject handle to edit3 (see GCBO) 198 | % eventdata reserved - to be defined in a future version of MATLAB 199 | % handles empty - handles not created until after all CreateFcns called 200 | 201 | % Hint: edit controls usually have a white background on Windows. 202 | % See ISPC and COMPUTER. 203 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 204 | set(hObject,'BackgroundColor','white'); 205 | end 206 | 207 | function edit4_Callback(hObject, eventdata, handles) 208 | % hObject handle to edit4 (see GCBO) 209 | % eventdata reserved - to be defined in a future version of MATLAB 210 | % handles structure with handles and user data (see GUIDATA) 211 | 212 | % Hints: get(hObject,'String') returns contents of edit4 as text 213 | % str2double(get(hObject,'String')) returns contents of edit4 as a double 214 | 215 | 216 | % --- Executes during object creation, after setting all properties. 217 | function edit4_CreateFcn(hObject, eventdata, handles) 218 | % hObject handle to edit4 (see GCBO) 219 | % eventdata reserved - to be defined in a future version of MATLAB 220 | % handles empty - handles not created until after all CreateFcns called 221 | 222 | % Hint: edit controls usually have a white background on Windows. 223 | % See ISPC and COMPUTER. 224 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 225 | set(hObject,'BackgroundColor','white'); 226 | end 227 | 228 | 229 | 230 | function edit5_Callback(hObject, eventdata, handles) 231 | % hObject handle to edit5 (see GCBO) 232 | % eventdata reserved - to be defined in a future version of MATLAB 233 | % handles structure with handles and user data (see GUIDATA) 234 | 235 | % Hints: get(hObject,'String') returns contents of edit5 as text 236 | % str2double(get(hObject,'String')) returns contents of edit5 as a double 237 | 238 | 239 | % --- Executes during object creation, after setting all properties. 240 | function edit5_CreateFcn(hObject, eventdata, handles) 241 | % hObject handle to edit5 (see GCBO) 242 | % eventdata reserved - to be defined in a future version of MATLAB 243 | % handles empty - handles not created until after all CreateFcns called 244 | 245 | % Hint: edit controls usually have a white background on Windows. 246 | % See ISPC and COMPUTER. 247 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 248 | set(hObject,'BackgroundColor','white'); 249 | end 250 | 251 | % load large data 252 | % --- Executes on button press in pushbutton5. 253 | function pushbutton5_Callback(hObject, eventdata, handles) 254 | % hObject handle to pushbutton5 (see GCBO) 255 | % eventdata reserved - to be defined in a future version of MATLAB 256 | % handles structure with handles and user data (see GUIDATA) 257 | %% Import data from spreadsheet 258 | % Script for importing data from the following spreadsheet: 259 | % 260 | % Workbook: C:\Stuff\Downloads\MS BSAN\Quarter 2\OPR 261 | % 620\Project\test\Data.xlsx Worksheet: Large 262 | % 263 | % To extend the code for use with different selected data or a different 264 | % spreadsheet, generate a function instead of a script. 265 | 266 | % Auto-generated by MATLAB on 2015/03/17 00:55:59 267 | 268 | %% Import the data 269 | [~, ~, raw] = xlsread('C:\Stuff\Downloads\MS BSAN\Quarter 2\OPR 620\Project\test\Data.xlsx','Large','A2:H13'); 270 | raw(cellfun(@(x) ~isempty(x) && isnumeric(x) && isnan(x),raw)) = {''}; 271 | cellVectors = raw(:,1); 272 | raw = raw(:,[2,3,4,5,6,7,8]); 273 | 274 | %% Create output variable 275 | data = reshape([raw{:}],size(raw)); 276 | 277 | %% Allocate imported array to column variable names 278 | Appliance = cellVectors(:,1); 279 | Job = data(:,1); 280 | RequestHour = data(:,2); 281 | Duration = data(:,3); 282 | StartHour = data(:,4); 283 | DelayCost = data(:,5); 284 | PowerCost = data(:,6); 285 | TotalCost = data(:,7); 286 | 287 | %% Clear temporary variables 288 | clearvars data raw cellVectors; 289 | 290 | Schedule = [Appliance num2cell([Job RequestHour Duration StartHour DelayCost PowerCost TotalCost])]; 291 | set(handles.uitable1,'data',Schedule); 292 | set(handles.pushbutton4,'Visible','On'); 293 | 294 | 295 | 296 | function edit6_Callback(hObject, eventdata, handles) 297 | % hObject handle to edit6 (see GCBO) 298 | % eventdata reserved - to be defined in a future version of MATLAB 299 | % handles structure with handles and user data (see GUIDATA) 300 | 301 | % Hints: get(hObject,'String') returns contents of edit6 as text 302 | % str2double(get(hObject,'String')) returns contents of edit6 as a double 303 | 304 | 305 | % --- Executes during object creation, after setting all properties. 306 | function edit6_CreateFcn(hObject, eventdata, handles) 307 | % hObject handle to edit6 (see GCBO) 308 | % eventdata reserved - to be defined in a future version of MATLAB 309 | % handles empty - handles not created until after all CreateFcns called 310 | 311 | % Hint: edit controls usually have a white background on Windows. 312 | % See ISPC and COMPUTER. 313 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 314 | set(hObject,'BackgroundColor','white'); 315 | end 316 | 317 | 318 | 319 | function edit7_Callback(hObject, eventdata, handles) 320 | % hObject handle to edit7 (see GCBO) 321 | % eventdata reserved - to be defined in a future version of MATLAB 322 | % handles structure with handles and user data (see GUIDATA) 323 | 324 | % Hints: get(hObject,'String') returns contents of edit7 as text 325 | % str2double(get(hObject,'String')) returns contents of edit7 as a double 326 | 327 | 328 | % --- Executes during object creation, after setting all properties. 329 | function edit7_CreateFcn(hObject, eventdata, handles) 330 | % hObject handle to edit7 (see GCBO) 331 | % eventdata reserved - to be defined in a future version of MATLAB 332 | % handles empty - handles not created until after all CreateFcns called 333 | 334 | % Hint: edit controls usually have a white background on Windows. 335 | % See ISPC and COMPUTER. 336 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 337 | set(hObject,'BackgroundColor','white'); 338 | end 339 | 340 | 341 | % --- Executes on slider movement. 342 | function slider1_Callback(hObject, eventdata, handles) 343 | % hObject handle to slider1 (see GCBO) 344 | % eventdata reserved - to be defined in a future version of MATLAB 345 | % handles structure with handles and user data (see GUIDATA) 346 | 347 | % Hints: get(hObject,'Value') returns position of slider 348 | % get(hObject,'Min') and get(hObject,'Max') to determine range of slider 349 | power=get(hObject,'Value'); 350 | power=round(power); 351 | set(handles.edit6,'String',power); 352 | 353 | % --- Executes during object creation, after setting all properties. 354 | function slider1_CreateFcn(hObject, eventdata, handles) 355 | % hObject handle to slider1 (see GCBO) 356 | % eventdata reserved - to be defined in a future version of MATLAB 357 | % handles empty - handles not created until after all CreateFcns called 358 | 359 | % Hint: slider controls usually have a light gray background. 360 | if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 361 | set(hObject,'BackgroundColor',[.9 .9 .9]); 362 | end 363 | -------------------------------------------------------------------------------- /Writing Sample.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/varunpillai/SmartGrid/958f35ad8bb427f0879024773e143ea88069739e/Writing Sample.doc -------------------------------------------------------------------------------- /Writing Sample.ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/varunpillai/SmartGrid/958f35ad8bb427f0879024773e143ea88069739e/Writing Sample.ppt -------------------------------------------------------------------------------- /duration.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/varunpillai/SmartGrid/958f35ad8bb427f0879024773e143ea88069739e/duration.mat -------------------------------------------------------------------------------- /pow_app.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/varunpillai/SmartGrid/958f35ad8bb427f0879024773e143ea88069739e/pow_app.mat -------------------------------------------------------------------------------- /request_time.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/varunpillai/SmartGrid/958f35ad8bb427f0879024773e143ea88069739e/request_time.mat -------------------------------------------------------------------------------- /start_time.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/varunpillai/SmartGrid/958f35ad8bb427f0879024773e143ea88069739e/start_time.mat --------------------------------------------------------------------------------