Docsity
Docsity

Prepare-se para as provas
Prepare-se para as provas

Estude fácil! Tem muito documento disponível na Docsity


Ganhe pontos para baixar
Ganhe pontos para baixar

Ganhe pontos ajudando outros esrudantes ou compre um plano Premium


Guias e Dicas
Guias e Dicas

Pasta Pública no Sky Drive - c?digo 2, Teses (TCC) de Engenharia Elétrica

Programa do TCC

Tipologia: Teses (TCC)

2014

Compartilhado em 23/01/2014

everton-apx-11
everton-apx-11 🇧🇷

7 documentos

1 / 26

Toggle sidebar

Esta página não é visível na pré-visualização

Não perca as partes importantes!

bg1
PROGRAMAÇÃO DA INTERFACE DADOS PARA O
FATURAMENTO ENQUANTO CONSUMIDOR CATIVO
function varargout = tarifascativo(varargin)
% TARIFASCATIVO M-file for tarifascativo.fig
% TARIFASCATIVO, by itself, creates a new TARIFASCATIVO or raises the
existing
% singleton*.
%
% H = TARIFASCATIVO returns the handle to a new TARIFASCATIVO or the
handle to
% the existing singleton*.
%
% TARIFASCATIVO('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in TARIFASCATIVO.M with the given input
arguments.
%
% TARIFASCATIVO('Property','Value',...) creates a new TARIFASCATIVO or
raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before tarifascativo_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to tarifascativo_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help tarifascativo
% Last Modified by GUIDE v2.5 08-Nov-2013 18:08:53
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @tarifascativo_OpeningFcn, ...
'gui_OutputFcn', @tarifascativo_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before tarifascativo is made visible.
function tarifascativo_OpeningFcn(hObject, eventdata, handles, varargin)
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a

Pré-visualização parcial do texto

Baixe Pasta Pública no Sky Drive - c?digo 2 e outras Teses (TCC) em PDF para Engenharia Elétrica, somente na Docsity!

PROGRAMAÇÃO DA INTERFACE DADOS PARA O

FATURAMENTO ENQUANTO CONSUMIDOR CATIVO

function varargout = tarifascativo(varargin) % TARIFASCATIVO M-file for tarifascativo.fig % TARIFASCATIVO, by itself, creates a new TARIFASCATIVO or raises the existing % singleton. % % H = TARIFASCATIVO returns the handle to a new TARIFASCATIVO or the handle to % the existing singleton. % % TARIFASCATIVO('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in TARIFASCATIVO.M with the given input arguments. % % TARIFASCATIVO('Property','Value',...) creates a new TARIFASCATIVO or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before tarifascativo_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to tarifascativo_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help tarifascativo

% Last Modified by GUIDE v2.5 08-Nov-2013 18:08:

% Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @tarifascativo_OpeningFcn, ... 'gui_OutputFcn', @tarifascativo_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end

if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT

% --- Executes just before tarifascativo is made visible. function tarifascativo_OpeningFcn(hObject, eventdata, handles, varargin)

% This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to tarifascativo (see VARARGIN)

% Choose default command line output for tarifascativo handles.output = hObject;

% Update handles structure guidata(hObject, handles);

% UIWAIT makes tarifascativo wait for user response (see UIRESUME) % uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line. function varargout = tarifascativo_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure varargout{1} = handles.output;

% --- Executes on selection change in modalidade. function modalidade_Callback(hObject, eventdata, handles) str=get(handles.modalidade,'String'); val=get(handles.modalidade,'Value'); switch str{val} case'Horo-Sazonal Azul' set(handles.text17,'String','Tolerância de Ultrapassagem de Demanda (%):'); set(handles.text3,'String','Tarifa de Demanda na Ponta (R$/kW):'); set(handles.text4,'String','Tarifa de Demanda Fora de Ponta (R$/ kW):'); set(handles.text5,'String','Tarifa de Ultrapassagem de Demanda na Ponta (R$/kW):'); set(handles.text6,'String','Tarifa de Ultrapassagem de Demanda Fora de Ponta (R$/kW):'); set(handles.text7,'String','Tarifa de Consumo na Ponta Seca (R$/ kWh):'); set(handles.text8,'String','Tarifa de Consumo na Ponta Úmida (R$/ kWh):'); set(handles.text9,'String','Tarifa de Consumo Fora de Ponta Seca (R$/ kWh):'); set(handles.text10,'String','Tarifa de Consumo Fora de Ponta Úmida (R$/kWh):'); set(handles.text11,'String','Tarifa de UFDR na Ponta (R$/kVAr):'); set(handles.text12,'String','Tarifa de UFDR Fora de Ponta (R$/ kVAr):'); set(handles.text13,'String','Tarifa de UFER na Ponta (R$/kVArh):'); set(handles.text14,'String','Tarifa de UFER Fora de Ponta (R$/ kVArh):'); set(handles.text15,'String','PIS/COFINS (%):');

set(handles.tdfp,'String',''); set(handles.text5,'String','Tarifa de Ultrapassagem de Demanda Única(R$/kW):'); set(handles.text6,'String','Não Preencher---->>>>'); set(handles.tudfp,'String',''); set(handles.text7,'String','Tarifa de Consumo na Ponta (R$/kWh):'); set(handles.text8,'String','Não Preencher---->>>>'); set(handles.tcpu,'String',''); set(handles.text9,'String','Tarifa de Consumo Fora de Ponta (R$/ kWh):'); set(handles.text10,'String','Não Preencher---->>>>'); set(handles.tcfpu,'String',''); set(handles.text11,'String','Tarifa Única de UFDR(R$/kVAr):'); set(handles.text12,'String','Não Preencher---->>>>'); set(handles.tufdrfp,'String',''); set(handles.text13,'String','Tarifa de UFER na Ponta (R$/kVArh):'); set(handles.text14,'String','Tarifa de UFER Fora de Ponta (R$/ kVArh):'); set(handles.text15,'String','PIS/COFINS (%):'); set(handles.text16,'String','ICMS (%):'); end % hObject handle to modalidade (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns modalidade contents as cell array % contents{get(hObject,'Value')} returns selected item from modalidade

% --- Executes during object creation, after setting all properties. function modalidade_CreateFcn(hObject, eventdata, handles) % hObject handle to modalidade (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function tdp_Callback(hObject, eventdata, handles) % hObject handle to tdp (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of tdp as text % str2double(get(hObject,'String')) returns contents of tdp as a double

% --- Executes during object creation, after setting all properties. function tdp_CreateFcn(hObject, eventdata, handles) % hObject handle to tdp (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function tdfp_Callback(hObject, eventdata, handles) % hObject handle to tdfp (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of tdfp as text % str2double(get(hObject,'String')) returns contents of tdfp as a double

% --- Executes during object creation, after setting all properties. function tdfp_CreateFcn(hObject, eventdata, handles) % hObject handle to tdfp (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function tudp_Callback(hObject, eventdata, handles) % hObject handle to tudp (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of tudp as text % str2double(get(hObject,'String')) returns contents of tudp as a double

% --- Executes during object creation, after setting all properties. function tudp_CreateFcn(hObject, eventdata, handles) % hObject handle to tudp (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of tcpu as text % str2double(get(hObject,'String')) returns contents of tcpu as a double

% --- Executes during object creation, after setting all properties. function tcpu_CreateFcn(hObject, eventdata, handles) % hObject handle to tcpu (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function tcfps_Callback(hObject, eventdata, handles) % hObject handle to tcfps (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of tcfps as text % str2double(get(hObject,'String')) returns contents of tcfps as a double

% --- Executes during object creation, after setting all properties. function tcfps_CreateFcn(hObject, eventdata, handles) % hObject handle to tcfps (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function tcfpu_Callback(hObject, eventdata, handles) % hObject handle to tcfpu (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of tcfpu as text % str2double(get(hObject,'String')) returns contents of tcfpu as a double

% --- Executes during object creation, after setting all properties. function tcfpu_CreateFcn(hObject, eventdata, handles) % hObject handle to tcfpu (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function tufdrp_Callback(hObject, eventdata, handles) % hObject handle to tufdrp (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of tufdrp as text % str2double(get(hObject,'String')) returns contents of tufdrp as a double

% --- Executes during object creation, after setting all properties. function tufdrp_CreateFcn(hObject, eventdata, handles) % hObject handle to tufdrp (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function tufdrfp_Callback(hObject, eventdata, handles) % hObject handle to tufdrfp (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of tufdrfp as text % str2double(get(hObject,'String')) returns contents of tufdrfp as a double

% --- Executes during object creation, after setting all properties. function tufdrfp_CreateFcn(hObject, eventdata, handles) % hObject handle to tufdrfp (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called

function piscofins_Callback(hObject, eventdata, handles) % hObject handle to piscofins (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of piscofins as text % str2double(get(hObject,'String')) returns contents of piscofins as a double

% --- Executes during object creation, after setting all properties. function piscofins_CreateFcn(hObject, eventdata, handles) % hObject handle to piscofins (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function icms_Callback(hObject, eventdata, handles) % hObject handle to icms (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of icms as text % str2double(get(hObject,'String')) returns contents of icms as a double

% --- Executes during object creation, after setting all properties. function icms_CreateFcn(hObject, eventdata, handles) % hObject handle to icms (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

function tud_Callback(hObject, eventdata, handles) % hObject handle to tud (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of tud as text % str2double(get(hObject,'String')) returns contents of tud as a double

% --- Executes during object creation, after setting all properties. function tud_CreateFcn(hObject, eventdata, handles) % hObject handle to tud (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

% --- Executes on button press in ok. function ok_Callback(hObject, eventdata, handles) format long str=get(handles.modalidade,'String'); val=get(handles.modalidade,'Value'); switch str{val} case'' msg='Primeiramente informe a modalidade tarifária.'; titulo='Ajuda';helpdlg(msg,titulo); case'Horo-Sazonal Azul' format long %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%AZUL%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ok=0;%Deixa salvar matriz se tudo foi preenchido corretamente. tuds=get(handles.tud,'String');%Pega valor do campo. str2=tuds; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a tolerância de ultrapassagem de demanda.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tudn=str2num(tuds);%Tolerância de Ultrapassagem de Demanda. xlswrite('dados.xlsm',tudn,'Azul','T14'); end tdps=get(handles.tdp,'String');%Pega valor do campo. str2=tdps; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a tarifa de demanda na ponta.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tdpn=str2num(tdps);%Tarifa de Demanda na Ponta. end tdfps=get(handles.tdfp,'String');%Pega valor do campo.

tcfpsn=str2num(tcfpss);%Tarifa de Consumo Fora de Ponta Seca. end tcpus=get(handles.tcpu,'String');%Pega valor do campo. str2=tcpus; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a tarifa de consumo na ponta úmida.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tcpun=str2num(tcpus);%Tarifa de Consumo na Ponta Úmida. end tcfpus=get(handles.tcfpu,'String');%Pega valor do campo. str2=tcfpus; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a tarifa de consumo fora de ponta úmida.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tcfpun=str2num(tcfpus);%Tarifa de Consumo Fora de Ponta Úmida. end tufdrps=get(handles.tufdrp,'String');%Pega valor do campo. str2=tufdrps; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a tarifa de UFDR na ponta.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tufdrpn=str2num(tufdrps);%Tarifa de UFDR na Ponta. end tufdrfps=get(handles.tufdrfp,'String');%Pega valor do campo. str2=tufdrfps; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a tarifa de UFDR fora de ponta.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tufdrfpn=str2num(tufdrfps);%Tarifa de UFDR Fora de Ponta. end tuferps=get(handles.tuferp,'String');%Pega valor do campo. str2=tuferps; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a tarifa de UFER na ponta.';%Se não foi preenchido exibe mensagem.

titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tuferpn=str2num(tuferps);%Tarifa de UFER Fora na Ponta. end tuferfps=get(handles.tuferfp,'String');%Pega valor do campo. str2=tuferfps; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a tarifa de UFER fora de ponta.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tuferfpn=str2num(tuferfps);%Tarifa de UFER Fora de Ponta. end piscofinss=get(handles.piscofins,'String');%Pega valor do campo. str2=piscofinss; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a alícota de PIS/COFINS.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else piscofinsn=str2num(piscofinss);%Alícota de PIS/COFINS. xlswrite('dados.xlsm',piscofinsn,'Azul','C27'); end icmss=get(handles.icms,'String');%Pega valor do campo. str2=icmss; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a alícota do ICMS.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else icmsn=str2num(icmss);%Alícota do ICMS. xlswrite('dados.xlsm',icmsn,'Azul','C28') end if(ok==0)

tarifasazul=[tudn,tdpn,tdfpn,tudpn,tudfpn,tcpsn,tcpun,tcfpsn,tcfpun,tufdrpn,tu fdrfpn,tuferpn,tuferfpn,piscofinsn,icmsn]; modalidade=1; usuario=questdlg('Tem certeza que os dados informados estão corretos?','Dados Informados'); switch usuario case'No' case'Yes' save tarifasazul.mat tarifasazul save modalidade.mat modalidade azul close tarifascativo end

if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a tarifa de consumo fora de ponta seca.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tcfpsn=str2num(tcfpss);%Tarifa de Consumo Fora de Ponta Seca. end tcpus=get(handles.tcpu,'String');%Pega valor do campo. str2=tcpus; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a tarifa de consumo na ponta úmida.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tcpun=str2num(tcpus);%Tarifa de Consumo na Ponta Úmida. end tcfpus=get(handles.tcfpu,'String');%Pega valor do campo. str2=tcfpus; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a tarifa de consumo fora de ponta úmida.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tcfpun=str2num(tcfpus);%Tarifa de Consumo Fora de Ponta Úmida. end tufdrus=get(handles.tufdrp,'String');%Pega valor do campo. str2=tufdrus; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a tarifa de UFDR única.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tufdrun=str2num(tufdrus);%Tarifa de UFDR Única. end tuferps=get(handles.tuferp,'String');%Pega valor do campo. str2=tuferps; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a tarifa de UFER na ponta.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tuferpn=str2num(tuferps);%Tarifa de UFER Fora na Ponta. end

tuferfps=get(handles.tuferfp,'String');%Pega valor do campo. str2=tuferfps; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a tarifa de UFER fora de ponta.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tuferfpn=str2num(tuferfps);%Tarifa de UFER Fora de Ponta. end piscofinss=get(handles.piscofins,'String');%Pega valor do campo. str2=piscofinss; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a alícota de PIS/COFINS.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else piscofinsn=str2num(piscofinss);%Alícota de PIS/COFINS. xlswrite('dados.xlsm', piscofinsn,'Verde','C28'); end icmss=get(handles.icms,'String');%Pega valor do campo. str2=icmss; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a alícota do ICMS.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else icmsn=str2num(icmss);%Alícota do ICMS. xlswrite('dados.xlsm',icmsn,'Verde','C29'); end if(ok==0)

tarifasverde=[tudn,tdun,tudun,tcpsn,tcpun,tcfpsn,tcfpun,tufdrun,tuferpn,tuferf pn,piscofinsn,icmsn]; modalidade=2; usuario=questdlg('Tem certeza que os dados informados estão corretos?','Dados Informados'); switch usuario case'No' case'Yes' save tarifasverde.mat tarifasverde save modalidade.mat modalidade verde close tarifascativo end end case'Horo-Sazonal Azul (Sem Periodos Umido e Seco)' format long %%%%%%%%%%%%%%%%%%%%%%%%%%%%AZUL SEM PERÍODOS%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ok=0;%Deixa salvar matriz se tudo foi preenchido corretamente.

titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tudfpn=str2num(tudfps);%Tarifa de Ultrapassagem de Demanda Fora de Ponta. end tcps=get(handles.tcps,'String');%Pega valor do campo. str2=tcps; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a tarifa de consumo na ponta.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tcpn=str2num(tcps);%Tarifa de Consumo na Ponta. end tcfps=get(handles.tcfps,'String');%Pega valor do campo. str2=tcfps; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a tarifa de consumo fora de ponta.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tcfpn=str2num(tcfps);%Tarifa de Consumo Fora de Ponta. end tufdrps=get(handles.tufdrp,'String');%Pega valor do campo. str2=tufdrps; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a tarifa de UFDR na ponta.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tufdrpn=str2num(tufdrps);%Tarifa de UFDR na Ponta. end tufdrfps=get(handles.tufdrfp,'String');%Pega valor do campo. str2=tufdrfps; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a tarifa de UFDR fora de ponta.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tufdrfpn=str2num(tufdrfps);%Tarifa de UFDR Fora de Ponta. end tuferps=get(handles.tuferp,'String');%Pega valor do campo. str2=tuferps; [m,n]=size(str2); if((m==1)&&(n==0))

ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a tarifa de UFER na ponta.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tuferpn=str2num(tuferps);%Tarifa de UFER Fora na Ponta. end tuferfps=get(handles.tuferfp,'String');%Pega valor do campo. str2=tuferfps; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a tarifa de UFER fora de ponta.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else tuferfpn=str2num(tuferfps);%Tarifa de UFER Fora de Ponta. end piscofinss=get(handles.piscofins,'String');%Pega valor do campo. str2=piscofinss; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a alícota de PIS/COFINS.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else piscofinsn=str2num(piscofinss);%Alícota de PIS/COFINS. xlswrite('dados.xlsm',piscofinsn,'Azul','C27'); end icmss=get(handles.icms,'String');%Pega valor do campo. str2=icmss; [m,n]=size(str2); if((m==1)&&(n==0)) ok=1;%Não deixa salvar matriz se não foi preenchido corretamente. msg='Informe a alícota do ICMS.';%Se não foi preenchido exibe mensagem. titulo='Insira os Dados Corretamente';warndlg(msg,titulo);%Se não foi preenchido exibe mensagem. else icmsn=str2num(icmss);%Alícota do ICMS. xlswrite('dados.xlsm',icmss,'Azul','C28'); end if(ok==0)

tarifasazul=[tudn,tdpn,tdfpn,tudpn,tudfpn,tcpn,tcfpn,tufdrpn,tufdrfpn,tuferpn, tuferfpn,piscofinsn,icmsn]; modalidade=3; usuario=questdlg('Tem certeza que os dados informados estão corretos?','Dados Informados'); switch usuario case'No' case'Yes' save tarifasazul.mat tarifasazul save modalidade.mat modalidade