function Time_Of_Failure(IDcentralina,DTcatena,date,ARRAYdateTL,ARRAYdateIPL,... yesTL,yesTLHR3D,yesIPL,yesIPLHR3D,rTL,rIPL,NodoTiltLink,NodoTiltLinkHR,... NodoTiltLinkHR3D,NodoInPlaceLink,NodoInPlaceLinkHR,NodoInPlaceLinkHR3D,... Mail,Users_Alert,Users_SMS,ini_CoV,activeIT,activeEN,sms,siteID,conn,FileName) fileID = fopen(FileName,'a'); fmt = '%s \r'; text = 'Time_Of_Failure function started'; fprintf(fileID,fmt,text); fclose(fileID); if yesTL == 1 || yesIPL == 1 if yesTL == 1 % Vertical Array ARRAYdate = ARRAYdateTL; yes3D = yesTLHR3D; rNL = rTL; NodoTilt = NodoTiltLink; NodoTiltHR = NodoTiltLinkHR; NodoTiltHR3D = NodoTiltLinkHR3D; else % In Place Array ARRAYdate = ARRAYdateIPL; yes3D = yesIPLHR3D; rNL = rIPL; NodoTilt = NodoInPlaceLink; NodoTiltHR = NodoInPlaceLinkHR; NodoTiltHR3D = NodoInPlaceLinkHR3D; end FileNameFuk = ['' IDcentralina '-' DTcatena '-Fuk.txt']; if isfile(FileNameFuk) == 0 % NON Esiste outdat = fopen(FileNameFuk,'wt+'); fileID = fopen(FileNameFuk,'a'); fmt = '%.10f \r'; DATA = 0; fprintf(fileID,fmt,DATA); fmt = '%.10f \r'; fprintf(fileID,fmt,now); fprintf(fileID,fmt,DATA); fclose(fileID); end if now-datenum(date) > 30 % Fukuzono real-time [alert,alert_local,alarm,alarm_local,Date,RQ,RQ_Loc,DataFuK,DataFuK_local,... Tr_mail,Tr_Loc_mail,Tr_Inf,Tr_Inf_Loc,Tr_Sup,Tr_Sup_Loc,Tr_Loc_HR,... DataFuK_local_HR,Number,Number_Loc] = Fukuzono(IDcentralina,DTcatena,... date,ARRAYdate,yes3D,rNL,NodoTilt,NodoTiltHR,NodoTiltHR3D,conn,FileName); % Fukuzono storico [alarm_STORICO,alarm_local_STORICO,DateGiorno,Tr_Loc_Sup_S,Tr_Loc_Inf_S,... Tr_Loc_S,Tr_Sup_S,Tr_Inf_S,Tr_S,Tr_Loc_HR_S,Tr_mail_S,Tr_Loc_mail_S,... DataFuK_S,DataFuK_local_S,DataFuK_local_HR_S,Number_S,Number_Loc_S,... RQ_S,RQ_Loc_S] = Fukuzono_Giornaliero(IDcentralina,DTcatena,date,... ARRAYdate,yes3D,rNL,NodoTilt,NodoTiltHR,NodoTiltHR3D,conn,FileName); else alert = []; alert_local = []; alarm = []; alarm_local = []; alarm_STORICO = []; alarm_local_STORICO = []; end else alert = []; alert_local = []; alarm = []; alarm_local = []; alarm_STORICO = []; alarm_local_STORICO = []; end fileID = fopen(FileName,'a'); fmt = '%s \r'; activate = 0; % attiva l'invio di mail FileNameFuk = ['' IDcentralina '-' DTcatena '-Fuk.txt']; % - Allerta - if isempty(find(alert)) == 1 && isempty(find(alert_local)) == 1 Alert = 0; % non ho allerte else Alert = 1; % ho allerte activate = 1; end if isempty(find(alarm)) == 1 && isempty(find(alarm_local)) == 1 Alarm = 0; % non ho allarmi else Alarm = 1; % ho allarmi activate = 1; end if isempty(find(alarm_STORICO)) == 1 && isempty(find(alarm_local_STORICO)) == 1 Alarm_Storico = 0; % non ho allarmi else Alarm_Storico = 1; % ho allarmi activate = 1; end if activate == 1 % mando la mail A = importdata(FileNameFuk); DataRif = A(1,1); %% Criterio Real Time if Alert == 1 || Alarm == 1 [numDate,~] = size(alert); Level = zeros(numDate,rNL); Level_Local = zeros(numDate,rNL); for j = 1:rNL % nodi for i = 1:numDate % date % -------- Cumulati ---------- if alert(i,j) == 1 % --- Livello 1 --- if Date(i) >= DataRif if Date(i) >= DataRif+1 Level(i,j) = 1; end if alarm(i,j) == 1 if Tr_mail(i,j)+Date(i) < now % --- Livello 1.5 --- Level(i,j) = 1.5; else % --- Livello 2 --- INI = find(Date >= Date(i,1)-1); Casi = 0; Index = []; for FANFANI = INI(1):i for SCAJOLA = 1:rNL if DataFuK(FANFANI,SCAJOLA)+Tr_mail(FANFANI,SCAJOLA) > now || ... DataFuK_local(FANFANI,SCAJOLA)+Tr_Loc_mail(FANFANI,SCAJOLA) > now Casi = Casi+1; Index = [Index; FANFANI SCAJOLA]; end end end if Number(i,j) > 5 || RQ(i,j) > 0.92 || Casi > 1 % --- Livello 3 --- [rII,~] = size(Index); if rII > 0 for II = 1:rII if Number(i,j) > 5 && RQ(i,j) > 0.92 ||... Number(i,j) > 5 && Number(Index(II,1),Index(II,2)) > 5 && Casi == 2 ||... RQ(i,j) > 0.92 && RQ(Index(II,1),Index(II,2)) > 0.92 && Casi == 2 ||... Casi > 2 % --- Livello 4 --- if Number(i,j) > 5 && RQ(i,j) > 0.92 && Casi >= 2 % --- Livello 5 --- Level(i,j) = 5; else Level(i,j) = 4; end else Level(i,j) = 3; end end else if Number(i,j) > 5 && RQ(i,j) > 0.92 || Casi > 2 % --- Livello 4 --- if Number(i,j) > 5 && RQ(i,j) > 0.92 && Casi >= 2 % --- Livello 5 --- Level(i,j) = 5; else Level(i,j) = 4; end else Level(i,j) = 3; end end else Level(i,j) = 2; end end end end end % -------- Locali ---------- if alert_local(i,j) == 1 % --- Livello 1 --- if Date(i) >= DataRif+1 Level_Local(i,j) = 1; end if Date(i) >= DataRif if alarm_local(i,j) == 1 if Tr_Loc_mail(i,j)+Date(i) < now % --- Livello 1.5 --- Level_Local(i,j) = 1.5; else % --- Livello 2 --- INI = find(Date >= Date(i,1)-1); Casi = 0; Index = []; for CRAXI = INI(1):i for ALEMANNO = 1:rNL if DataFuK_local(CRAXI,ALEMANNO)+Tr_mail(CRAXI,ALEMANNO) > now ||... DataFuK(CRAXI,ALEMANNO)+Tr_Loc_mail(CRAXI,ALEMANNO) > now Casi = Casi+1; Index = [Index; CRAXI ALEMANNO]; end end end if Number_Loc(i,j) > 5 || RQ_Loc(i,j) > 0.92 || Casi > 1 % --- Livello 3 --- [rII,~] = size(Index); if rII > 0 for II = 1:rII if Number_Loc(i,j) > 5 && RQ_Loc(i,j) > 0.92 ||... Number_Loc(i,j) > 5 && Number_Loc(Index(II,1),Index(II,2)) > 5 && Casi == 2 ||... RQ_Loc(i,j) > 0.92 && RQ_Loc(Index(II,1),Index(II,2)) > 0.92 && Casi == 2 ||... Casi > 2 % --- Livello 4 --- if Number_Loc(i,j) > 5 && RQ_Loc(i,j) > 0.92 && Casi >= 2 % --- Livello 5 --- Level_Local(i,j) = 5; else Level_Local(i,j) = 4; end else Level_Local(i,j) = 3; end end else if Number_Loc(i,j) > 5 && RQ_Loc(i,j) > 0.92 || Casi > 2 % --- Livello 4 --- if Number_Loc(i,j) > 5 && RQ_Loc(i,j) > 0.92 && Casi >= 2 % --- Livello 5 --- Level_Local(i,j) = 5; else Level_Local(i,j) = 4; end else Level_Local(i,j) = 3; end end else Level_Local(i,j) = 2; end end end end end end end else Level = 0; Level_Local = 0; end %% Criterio Storico if Alarm_Storico == 1 [numDate,~] = size(alarm_STORICO); Level_Storico = zeros(numDate,rNL); Level_Local_Storico = zeros(numDate,rNL); for j = 1:rNL % nodi for i = 1:numDate % date % -------- Cumulati ---------- if DateGiorno(i) >= DataRif if alarm_STORICO(i,j) == 1 if Tr_S(i,j)+DateGiorno(i) < now % --- Livello 1.5 --- Level_Storico(i,j) = 1.5; else % --- Livello 2 --- INI = find(DateGiorno >= DateGiorno(i,1)-1); Casi = 0; Index = []; for COSSIGA = INI(1):i for SCHIFANI = 1:rNL if DataFuK_S(COSSIGA,SCHIFANI)+Tr_mail_S(COSSIGA,SCHIFANI) > 0 ||... DataFuK_local_S(COSSIGA,SCHIFANI)+Tr_Loc_mail_S(COSSIGA,SCHIFANI) > 0 Casi = Casi+1; Index = [Index; COSSIGA SCHIFANI]; end end end if Number_S(i,j) > 5 || RQ_S(i,j) > 0.92 || Casi > 1 % --- Livello 3 --- [rII,~] = size(Index); if rII > 0 for II = 1:rII if Number_S(i,j) > 5 && RQ_S(i,j) > 0.92 ||... Number_S(i,j) > 5 && Number_S(Index(II,1),Index(II,2)) > 5 && Casi == 2 ||... RQ_S(i,j) > 0.92 && RQ_S(Index(II,1),Index(II,2)) > 0.92 && Casi == 2 ||... Casi > 2 % --- Livello 4 --- if Number_S(i,j) > 5 && RQ_S(i,j) > 0.92 && Casi >= 2 % --- Livello 5 --- Level_Storico(i,j) = 5; else Level_Storico(i,j) = 4; end else Level_Storico(i,j) = 3; end end else if Number_S(i,j) > 5 && RQ_S(i,j) > 0.92 || Casi > 2 % --- Livello 4 --- if Number_S(i,j) > 5 && RQ_S(i,j) > 0.92 && Casi >= 2 % --- Livello 5 --- Level_Storico(i,j) = 5; else Level_Storico(i,j) = 4; end else Level_Storico(i,j) = 3; end end else Level_Storico(i,j) = 2; end end end % -------- Locali ---------- if alarm_local_STORICO(i,j) == 1 if Tr_Loc_S(i,j)+DateGiorno(i) < now % --- Livello 1.5 --- Level_Local_Storico(i,j) = 1.5; else % --- Livello 2 --- INI = find(DateGiorno >= DateGiorno(i,1)-1); Casi = 0; Index = []; for CROSETTO = INI(1):i for CAPEZZONE = 1:rNL if DataFuK_local_S(CROSETTO,CAPEZZONE)+Tr_Loc_mail_S(CROSETTO,CAPEZZONE) > 0 ||... DataFuK_S(CROSETTO,CAPEZZONE)+Tr_mail_S(CROSETTO,CAPEZZONE) > 0 Casi = Casi+1; Index = [Index; CROSETTO CAPEZZONE]; end end end if Number_Loc_S(i,j) > 5 || RQ_Loc_S(i,j) > 0.92 || Casi > 1 % --- Livello 3 --- [rII,~] = size(Index); if rII > 0 for II = 1:rII if Number_Loc_S(i,j) > 5 && RQ_Loc_S(i,j) > 0.92 ||... Number_Loc_S(i,j) > 5 && Number_Loc_S(Index(II,1),Index(II,2)) > 5 && Casi == 2 ||... RQ_Loc_S(i,j) > 0.92 && RQ_Loc_S(Index(II,1),Index(II,2)) > 0.92 && Casi == 2 ||... Casi > 2 % --- Livello 4 --- if Number_Loc_S(i,j) > 5 && RQ_Loc_S(i,j) > 0.92 && Casi >= 2 % --- Livello 5 --- Level_Local_Storico(i,j) = 5; else Level_Local_Storico(i,j) = 4; end else Level_Local_Storico(i,j) = 3; end end else if Number_Loc_S(i,j) > 5 && RQ_Loc_S(i,j) > 0.92 || Casi > 2 % --- Livello 4 --- if Number_Loc_S(i,j) > 5 && RQ_Loc_S(i,j) > 0.92 && Casi >= 2 % --- Livello 5 --- Level_Local_Storico(i,j) = 5; else Level_Local_Storico(i,j) = 4; end else Level_Local_Storico(i,j) = 3; end end else Level_Local_Storico(i,j) = 2; end end end end end end else Level_Storico = 0; Level_Local_Storico = 0; end Data_Text = []; % A partire dal site ID, risalgo al Nome del sito comando = ['select name from sites where id like ''' siteID ''' ']; curs = exec(conn,comando); curs = fetch(curs); Sito = char(curs.Data); %% Mail di Livello 5 [rLV5,cLV5] = find(Level==5); [rLV5_S,cLV5_S] = find(Level_Storico==5); [rLV5_Loc,cLV5_Loc] = find(Level_Local==5); [rLV5_Loc_S,cLV5_Loc_S] = find(Level_Local_Storico==5); nC = 1; nCS = 1; nF = 1; nFS = 1; nW = 1; D = 1; nA = 1; % Contatore Allegati nACL = 1; nACLS = 1; message_LV5 = []; % --- Cumulati --- if isempty(rLV5) ~= 1 || isempty(rLV5_S) ~= 1 [dim,~] = size(rLV5); [dim_S,~] = size(rLV5_S); message_LV5_Cliente{nC,1} = 'Gentile Cliente,'; message_LV5_Cliente{nC+1,1} = 'Il Software di elaborazione automatica Tilt ha rilevato un trend di spostamenti potenzialmente critico, la cui evoluzione ha attivato il Metodo di stima del Tempo di Collasso del versante monitorato: '; message_LV5_Cliente{nC+2,1} = ['- Sito: ' Sito]; message_LV5_Cliente{nC+3,1} = ['- Centralina: ' IDcentralina]; message_LV5_Cliente{nC+4,1} = ['- Catena: ' DTcatena]; message_LV5_Cliente_ENG{nC,1} = 'Dear Client,'; message_LV5_Cliente_ENG{nC+1,1} = 'The automatic software Tilt has detected a potentially critical displacement trend, which triggered the activation of a Failure Forecasting Model in order to estimate the collapse date of the monitored slope: '; message_LV5_Cliente_ENG{nC+2,1} = ['- Site: ' Sito]; message_LV5_Cliente_ENG{nC+3,1} = ['- Data Logger: ' IDcentralina]; message_LV5_Cliente_ENG{nC+4,1} = ['- Array: ' DTcatena]; message_LV5_Cliente_ENG(nC:nC+4,2) = message_LV5_Cliente(nC:nC+4,1); % Prima colonna - Criterio Real Time, Seconda Colonna - Criterio Storico nC = nC+5; if dim ~= 0 % Criterio Real Time for I = 1:dim NodeNum = num2str(cell2mat(NodoTilt(cLV5(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV5(I),3))); data = datestr(DataFuK(rLV5(I),cLV5(I)),'dd-mm-yyyy HH:MM'); Data_Crollo = Tr_mail(rLV5(I),cLV5(I))+Date(rLV5(I),1); if Data_Crollo-now >= 0 % Il dato è significativo solo se nel futuro % --- Mail ASE --- Collasso_Inf = datestr(Tr_Inf(rLV5(I),cLV5(I)),'dd-mm-yyyy HH:MM'); Collasso_Sup = datestr(Tr_Sup(rLV5(I),cLV5(I)),'dd-mm-yyyy HH:MM'); message_LV5{nW,1} = ['ALLARME sui dati cumulati del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' m, centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Possibile collasso stimato nella finestra temporale tra ' Collasso_Inf... ' e ' Collasso_Sup ' ! Analisi eseguita con Metodo dell''Inverso della Velocita''.']; Data_Img = datestr(DataFuK(rLV5(I),cLV5(I)),'dd-mm-yyyy'); Tempo_Img = datestr(DataFuK(rLV5(I),cLV5(I)),'HH-MM-SS'); filename = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'.jpg'); filename2 = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'_Vel.jpg'); attachments{nA,1} = filename; attachments{nA+1,1} = filename2; Data_Text(D,1) = DataFuK(rLV5(I),cLV5(I)); D = D+1; nW = nW+1; nA = nA+2; % --- Mail Cliente --- message_LV5_Cliente{nC,1} = ''; message_LV5_Cliente{nC+1,1} = '- Tipologia dati: spostamenti cumulati'; message_LV5_Cliente{nC+2,1} = ['- Nodo e Profondita'': ' NodeNum ', ' Depth ' m']; message_LV5_Cliente_ENG{nC,1} = ''; message_LV5_Cliente_ENG{nC+1,1} = '- Data Typology: cumulative displacements'; message_LV5_Cliente_ENG{nC+2,1} = ['- Node Typology and Depth: ' NodeNum ', ' Depth 'm']; Finestra_RealTime(nF,1) = Tr_Inf(rLV5(I),cLV5(I)); % Colonna 1: Limite inferiore Finestra_RealTime(nF,2) = Tr_Sup(rLV5(I),cLV5(I)); % Colonna 2: Limite superiore Finestra_RealTime(nF,3) = DataFuK(rLV5(I),cLV5(I)); % Colonna 3: Data di inizio accelerazione allegati_cliente{nACL,1} = filename; allegati_cliente{nACL+1,1} = filename2; nF = nF+1; nC = nC+3; nACL = nACL+2; end text = ['Alarm of Level #5 activated by IVM analysis for cumulated values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end if dim_S ~= 0 % Criterio Storico for I = 1:dim_S NodeNum = num2str(cell2mat(NodoTilt(cLV5_S(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV5_S(I),3))); data = datestr(DataFuK_S(rLV5_S(I),cLV5_S(I)),'dd-mm-yyyy HH:MM'); Data_Crollo = Tr_S(rLV5_S(I),cLV5_S(I))+DateGiorno(rLV5_S(I),1); if Data_Crollo-now >= 0 % Il dato è significativo solo se nel futuro % --- Mail ASE --- Collasso_Inf = datestr(Tr_Inf_S(rLV5_S(I),cLV5_S(I)),'dd-mm-yyyy HH:MM'); Collasso_Sup = datestr(Tr_Sup_S(rLV5_S(I),cLV5_S(I)),'dd-mm-yyyy HH:MM'); message_LV5{nW,1} = ['ALLARME sui dati cumulati del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Possibile collasso stimato nella finestra temporale tra ' Collasso_Inf... ' e ' Collasso_Sup ' ! Analisi eseguita con Metodo Storico dell''Inverso della Velocita''.']; Data_Img = datestr(DataFuK_S(rLV5_S(I),cLV5_S(I)),'dd-mm-yyyy'); Tempo_Img = datestr(DataFuK_S(rLV5_S(I),cLV5_S(I)),'HH-MM-SS'); filename = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'_Storico.jpg'); filename2 = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'_Vel_Storico.jpg'); attachments{nA,1} = filename; attachments{nA+1,1} = filename2; Data_Text(D,1) = DataFuK_S(rLV5_S(I),cLV5_S(I)); D = D+1; nW = nW+1; nA = nA+2; % --- Mail Cliente --- message_LV5_Cliente{nCS,2} = ''; message_LV5_Cliente{nCS+1,2} = '- Tipologia dati: spostamenti cumulati'; message_LV5_Cliente{nCS+2,2} = ['- Nodo e Profondita'': ' NodeNum ', ' Depth 'm']; message_LV5_Cliente_ENG{nCS,2} = ''; message_LV5_Cliente_ENG{nCS+1,2} = '- Data Typology: cumulative displacements'; message_LV5_Cliente_ENG{nCS+2,2} = ['- Node Typology and Depth: ' NodeNum ', ' Depth 'm']; Finestra_Storico(nFS,1)= Tr_Inf_S(rLV5_S(I),cLV5_S(I)); Finestra_Storico(nFS,2)= Tr_Sup_S(rLV5_S(I),cLV5_S(I)); Finestra_Storico(nFS,3) = DataFuK_S(rLV5_S(I),cLV5_S(I)); % Colonna 3: Data di inizio accelerazione allegati_cliente{nACLS,1} = filename; allegati_cliente{nACLS+1,1} = filename2; nFS = nFS+1; nCS = nCS+3; nACLS = nACLS+2; end text = ['Alarm of Level #5 activated by Daily IVM analysis for cumulated values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end else message_LV5_Cliente = []; end % --- Locali --- if isempty(rLV5_Loc) ~= 1 || isempty(rLV5_Loc_S) ~= 1 % Criterio Locale if isempty(message_LV5_Cliente) == 1 message_LV5_Cliente{nC,1} = 'Gentile Cliente,'; message_LV5_Cliente{nC+1,1} = 'Il Software di elaborazione automatica Tilt ha rilevato un trend di spostamenti potenzialmente critico, la cui evoluzione ha attivato il Metodo di stima del Tempo di Collasso del versante monitorato: '; message_LV5_Cliente{nC+2,1} = ['- Sito: ' Sito]; message_LV5_Cliente{nC+3,1} = ['- Centralina: ' IDcentralina]; message_LV5_Cliente{nC+4,1} = ['- Catena: ' DTcatena]; message_LV5_Cliente_ENG{nC,1} = 'Dear Client,'; message_LV5_Cliente_ENG{nC+1,1} = 'The automatic software Tilt has detected a potentially critical displacement trend, which triggered the activation of a Failure Forecasting Model in order to estimate the collapse date of the monitored slope: '; message_LV5_Cliente_ENG{nC+2,1} = ['- Site: ' Sito]; message_LV5_Cliente_ENG{nC+3,1} = ['- Data Logger: ' IDcentralina]; message_LV5_Cliente_ENG{nC+4,1} = ['- Array: ' DTcatena]; message_LV5_Cliente_ENG(nC:nC+4,2) = message_LV5_Cliente(nC:nC+4,1); % Prima colonna - Criterio Real Time, Seconda Colonna - Criterio Storico nC = nC+5; end [dim,~] = size(rLV5_Loc); if dim ~= 0 for I = 1:dim NodeNum = num2str(cell2mat(NodoTilt(cLV5_Loc(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV5_Loc(I),3))); data = datestr(DataFuK_local(rLV5_Loc(I),cLV5_Loc(I)),'dd-mm-yyyy HH:MM'); Data_Crollo = Tr_Loc_mail(rLV5_Loc(I),cLV5_Loc(I))+Date(rLV5_Loc(I),1); if Data_Crollo-now >= 0 % Il dato è significativo solo se nel futuro % --- Mail ASE --- Collasso_Inf = datestr(Tr_Inf_Loc(rLV5_Loc(I),cLV5_Loc(I)),'dd-mm-yyyy HH:MM'); Collasso_Sup = datestr(Tr_Sup_Loc(rLV5_Loc(I),cLV5_Loc(I)),'dd-mm-yyyy HH:MM'); message_LV5{nW,1} = ['ALLARME sui dati locali del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Possibile collasso stimato nella finestra temporale tra ' Collasso_Inf... ' e ' Collasso_Sup ' ! Analisi eseguita con Metodo dell''Inverso della Velocita''.']; Data_Img = datestr(DataFuK_local(rLV5_Loc(I),cLV5_Loc(I)),'dd-mm-yyyy'); Tempo_Img = datestr(DataFuK_local(rLV5_Loc(I),cLV5_Loc(I)),'HH-MM-SS'); filename = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'-Local.jpg'); filename2 = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'-Local_Vel.jpg'); attachments{nA,1} = filename; attachments{nA+1,1} = filename2; Data_Text(D,1) = DataFuK_local(rLV5_Loc(I),cLV5_Loc(I)); D = D+1; nW = nW+1; nA = nA+2; % --- Mail Cliente --- message_LV5_Cliente{nC,1} = ''; message_LV5_Cliente{nC+1,1} = '- Tipologia dati: spostamenti locali'; message_LV5_Cliente{nC+2,1} = ['- Nodo e Profondita'': ' NodeNum ', ' Depth ' m']; message_LV5_Cliente_ENG{nC,1} = ''; message_LV5_Cliente_ENG{nC+1,1} = '- Data Typology: local displacements'; message_LV5_Cliente_ENG{nC+2,1} = ['- Node Typology and Depth: ' NodeNum ', ' Depth ' m']; Finestra_RealTime(nF,1) = Tr_Inf_Loc(rLV5_Loc(I),cLV5_Loc(I)); Finestra_RealTime(nF,2) = Tr_Sup_Loc(rLV5_Loc(I),cLV5_Loc(I)); Finestra_RealTime(nF,3) = DataFuK_local(rLV5_Loc(I),cLV5_Loc(I)); allegati_cliente{nACL,1} = filename; allegati_cliente{nACL+1,1} = filename2; nF = nF+1; nC = nC+3; nACL = nACL+2; end text = ['Alarm of Level #5 activated for local values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end [dim_S,~] = size(rLV5_Loc_S); if dim_S ~= 0 % Criterio Storico for I = 1:dim_S NodeNum = num2str(cell2mat(NodoTilt(cLV5_Loc_S(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV5_Loc_S(I),3))); data = datestr(DataFuK_local_S(rLV5_Loc_S(I),cLV5_Loc_S(I)),'dd-mm-yyyy HH:MM'); Data_Crollo = Tr_Loc_S(rLV5_Loc_S(I),cLV5_Loc_S(I))+DateGiorno(rLV5_Loc_S(I),1); if Data_Crollo-now >= 0 % Il dato è significativo solo se nel futuro % --- Mail ASE --- Collasso_Inf = datestr(Tr_Loc_Inf_S(rLV5_Loc_S(I),cLV5_Loc_S(I)),'dd-mm-yyyy HH:MM'); Collasso_Sup = datestr(Tr_Loc_Sup_S(rLV5_Loc_S(I),cLV5_Loc_S(I)),'dd-mm-yyyy HH:MM'); message_LV5{nW,1} = ['ALLARME sui dati locali del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Possibile collasso stimato nella finestra temporale tra ' Collasso_Inf... ' e ' Collasso_Sup ' ! Analisi eseguita con Metodo Storico dell''Inverso della Velocita''.']; Data_Img = datestr(DataFuK_local_S(rLV5_Loc_S(I),cLV5_Loc_S(I)),'dd-mm-yyyy'); Tempo_Img = datestr(DataFuK_local_S(rLV5_Loc_S(I),cLV5_Loc_S(I)),'HH-MM-SS'); filename = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'-Local_Storico.jpg'); filename2 = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'-Local_Vel_Storico.jpg'); attachments{nA,1} = filename; attachments{nA+1,1} = filename2; Data_Text(D,1) = DataFuK_local_S(rLV5_Loc_S(I),cLV5_Loc_S(I)); D = D+1; nW = nW+1; nA = nA+2; % --- Mail Cliente --- message_LV5_Cliente{nCS,1} = ''; message_LV5_Cliente{nCS+1,2} = '- Tipologia dati: spostamenti locali'; message_LV5_Cliente{nCS+2,2} = ['- Nodo e Profondita'': ' NodeNum ', ' Depth ' m']; message_LV5_Cliente_ENG{nCS,2} = ''; message_LV5_Cliente_ENG{nCS+1,2} = '- Data Typology: local displacements'; message_LV5_Cliente_ENG{nCS+2,2} = ['- Node Typology and Depth: ' NodeNum ', ' Depth ' m']; Finestra_Storico(nFS,1) = Tr_Loc_Inf_S(rLV5_Loc_S(I),cLV5_Loc_S(I)); Finestra_Storico(nFS,2) = Tr_Loc_Sup_S(rLV5_Loc_S(I),cLV5_Loc_S(I)); Finestra_Storico(nFS,3) = DataFuK_local_S(rLV5_Loc_S(I),cLV5_Loc_S(I)); allegati_cliente{nACLS,1} = filename; allegati_cliente{nACLS+1,1} = filename2; nFS = nFS+1; nCS = nCS+3; nACLS = nACLS+2; end text = ['Alarm of Level #5 activated by Daily IVM analysis for local values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end end %% Mail di Livello 4 [rLV4,cLV4] = find(Level==4); [rLV4_S,cLV4_S] = find(Level_Storico==4); [rLV4_Loc,cLV4_Loc] = find(Level_Local==4); [rLV4_Loc_S,cLV4_Loc_S] = find(Level_Local_Storico==4); message_LV4 = []; % --- Cumulati --- if isempty(rLV4) ~= 1 || isempty(rLV4_S) ~= 1 message_LV4_Cliente{1,1} = 'Gentile Cliente,'; message_LV4_Cliente{2,1} = ''; message_LV4_Cliente{3,1} = 'Il Software di elaborazione automatica Tilt ha rilevato un progressivo aumento delle accelerazioni degli spostamenti relativamente al versante monitorato: '; message_LV4_Cliente{4,1} = ['- Sito: ' Sito]; message_LV4_Cliente{5,1} = ['- Centralina: ' IDcentralina]; message_LV4_Cliente{6,1} = ['- Catena: ' DTcatena]; message_LV4_Cliente{7,1} = ''; message_LV4_Cliente_ENG{1,1} = 'Dear Client,'; message_LV4_Cliente_ENG{2,1} = ''; message_LV4_Cliente_ENG{3,1} = 'The automatic software Tilt has detected an increment of the displacements acceleration recorded on the monitored slope: '; message_LV4_Cliente_ENG{4,1} = ['- Site: ' Sito]; message_LV4_Cliente_ENG{5,1} = ['- Data Logger: ' IDcentralina]; message_LV4_Cliente_ENG{6,1} = ['- Array: ' DTcatena]; message_LV4_Cliente_ENG{7,1} = ''; [dim,~] = size(rLV4); [dim_S,~] = size(rLV4_S); if dim ~= 0 % Criterio Real Time for I = 1:dim NodeNum = num2str(cell2mat(NodoTilt(cLV4(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV4(I),3))); data = datestr(DataFuK(rLV4(I),cLV4(I)),'dd-mm-yyyy HH:MM'); Data_Crollo = Tr_mail(rLV4(I),cLV4(I))+Date(rLV4(I),1); if Data_Crollo-now >= 0 % Il dato è significativo solo se nel futuro % --- Mail ASE --- Collasso_Inf = datestr(Tr_Inf(rLV4(I),cLV4(I)),'dd-mm-yyyy HH:MM'); Collasso_Sup = datestr(Tr_Sup(rLV4(I),cLV4(I)),'dd-mm-yyyy HH:MM'); message_LV4{nW,1} = ['Pre-Allarme sui dati cumulati del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Possibile collasso stimato nella finestra temporale tra ' Collasso_Inf... ' e ' Collasso_Sup ' ! Analisi eseguita con Metodo dell''Inverso della Velocita''.']; Data_Img = datestr(DataFuK(rLV4(I),cLV4(I)),'dd-mm-yyyy'); Tempo_Img = datestr(DataFuK(rLV4(I),cLV4(I)),'HH-MM-SS'); filename = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'.jpg'); filename2 = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'_Vel.jpg'); attachments{nA,1} = filename; attachments{nA+1,1} = filename2; Data_Text(D,1) = DataFuK(rLV4(I),cLV4(I)); D = D+1; nW = nW+1; nA = nA+2; % --- Mail Cliente --- end text = ['Alarm of Level #4 activated by IVM analysis for cumulated values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end if dim_S ~= 0 % Criterio Storico for I = 1:dim_S NodeNum = num2str(cell2mat(NodoTilt(cLV4_S(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV4_S(I),3))); data = datestr(DataFuK_S(rLV4_S(I),cLV4_S(I)),'dd-mm-yyyy HH:MM'); Data_Crollo = Tr_S(rLV4_S(I),cLV4_S(I))+DateGiorno(rLV4_S(I),1); if Data_Crollo-now >= 0 % Il dato è significativo solo se nel futuro % --- Mail ASE --- Collasso_Inf = datestr(Tr_Inf_S(rLV4_S(I),cLV4_S(I)),'dd-mm-yyyy HH:MM'); Collasso_Sup = datestr(Tr_Sup_S(rLV4_S(I),cLV4_S(I)),'dd-mm-yyyy HH:MM'); message_LV4{nW,1} = ['Pre-Allarme sui dati cumulati del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Possibile collasso stimato nella finestra temporale tra ' Collasso_Inf... ' e ' Collasso_Sup ' ! Analisi eseguita con Metodo Storico dell''Inverso della Velocita''.']; Data_Img = datestr(DataFuK_S(rLV4_S(I),cLV4_S(I)),'dd-mm-yyyy'); Tempo_Img = datestr(DataFuK_S(rLV4_S(I),cLV4_S(I)),'HH-MM-SS'); filename = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'_Storico.jpg'); filename2 = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'_Vel_Storico.jpg'); attachments{nA,1} = filename; attachments{nA+1,1} = filename2; Data_Text(D,1) = DataFuK_S(rLV4_S(I),cLV4_S(I)); D = D+1; nW = nW+1; nA = nA+2; % --- Mail Cliente --- end text = ['Alarm of Level #4 activated by Daily IVM analysis for cumulated values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end else message_LV4_Cliente = []; end % --- Locali --- if isempty(rLV4_Loc) ~= 1 || isempty(rLV4_Loc_S) ~= 1 % Criterio Real Time if isempty(message_LV4_Cliente) == 1 message_LV4_Cliente{1,1} = 'Gentile Cliente,'; message_LV4_Cliente{2,1} = 'Il Software di elaborazione automatica Tilt ha rilevato un progressivo aumento delle accelerazioni degli spostamenti relativamente al versante monitorato: '; message_LV4_Cliente{3,1} = ['- Sito: ' Sito]; message_LV4_Cliente{4,1} = ['- Centralina: ' IDcentralina]; message_LV4_Cliente{5,1} = ['- Catena: ' DTcatena]; message_LV4_Cliente_ENG{1,1} = 'Dear Client,'; message_LV4_Cliente_ENG{2,1} = 'The automatic software Tilt has detected an increment of the displacements acceleration recorded on the monitored slope: '; message_LV4_Cliente_ENG{3,1} = ['- Site: ' Sito]; message_LV4_Cliente_ENG{4,1} = ['- Data Logger: ' IDcentralina]; message_LV4_Cliente_ENG{5,1} = ['- Array: ' DTcatena]; end [dim,~] = size(rLV4_Loc); if dim ~= 0 for I = 1:dim NodeNum = num2str(cell2mat(NodoTilt(cLV4_Loc(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV4_Loc(I),3))); data = datestr(DataFuK_local(rLV4_Loc(I),cLV4_Loc(I)),'dd-mm-yyyy HH:MM'); Data_Crollo = Tr_Loc_mail(rLV4_Loc(I),cLV4_Loc(I))+Date(rLV4_Loc(I),1); if Data_Crollo-now >= 0 % Il dato è significativo solo se nel futuro Collasso_Inf = datestr(Tr_Inf_Loc(rLV4_Loc(I),cLV4_Loc(I)),'dd-mm-yyyy HH:MM'); Collasso_Sup = datestr(Tr_Sup_Loc(rLV4_Loc(I),cLV4_Loc(I)),'dd-mm-yyyy HH:MM'); message_LV4{nW,1} = ['Pre-Allarme sui dati locali del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Possibile collasso stimato nella finestra temporale tra ' Collasso_Inf... ' e ' Collasso_Sup ' ! Analisi eseguita con Metodo dell''Inverso della Velocita''.']; Data_Img = datestr(DataFuK_local(rLV4_Loc(I),cLV4_Loc(I)),'dd-mm-yyyy'); Tempo_Img = datestr(DataFuK_local(rLV4_Loc(I),cLV4_Loc(I)),'HH-MM-SS'); filename = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'-Local.jpg'); filename2 = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'-Local_Vel.jpg'); attachments{nA,1} = filename; attachments{nA+1,1} = filename2; Data_Text(D,1) = DataFuK_local(rLV4_Loc(I),cLV4_Loc(I)); D = D+1; nW = nW+1; nA = nA+2; end text = ['Alarm of Level #4 activated for local values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end [dim_S,~] = size(rLV4_Loc_S); if dim_S ~= 0 % Criterio Storico for I = 1:dim_S NodeNum = num2str(cell2mat(NodoTilt(cLV4_Loc_S(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV4_Loc_S(I),3))); data = datestr(DataFuK_local_S(rLV4_Loc_S(I),cLV4_Loc_S(I)),'dd-mm-yyyy HH:MM'); Data_Crollo = Tr_Loc_S(rLV4_Loc_S(I),cLV4_Loc_S(I))+DateGiorno(rLV4_Loc_S(I),1); if Data_Crollo-now >= 0 % Il dato è significativo solo se nel futuro Collasso_Inf = datestr(Tr_Loc_Inf_S(rLV4_Loc_S(I),cLV4_Loc_S(I)),'dd-mm-yyyy HH:MM'); Collasso_Sup = datestr(Tr_Loc_Sup_S(rLV4_Loc_S(I),cLV4_Loc_S(I)),'dd-mm-yyyy HH:MM'); message_LV4{nW,1} = ['Pre-Allarme sui dati locali del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Possibile collasso stimato nella finestra temporale tra ' Collasso_Inf... ' e ' Collasso_Sup ' ! Analisi eseguita con Metodo Storico dell''Inverso della Velocita''.']; Data_Img = datestr(DataFuK_local_S(rLV4_Loc_S(I),cLV4_Loc_S(I)),'dd-mm-yyyy'); Tempo_Img = datestr(DataFuK_local_S(rLV4_Loc_S(I),cLV4_Loc_S(I)),'HH-MM-SS'); filename = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'-Local_Storico.jpg'); filename2 = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'-Local_Vel_Storico.jpg'); attachments{nA,1} = filename; attachments{nA+1,1} = filename2; Data_Text(D,1) = DataFuK_local_S(rLV4_Loc_S(I),cLV4_Loc_S(I)); D = D+1; nW = nW+1; nA = nA+2; end text = ['Alarm of Level #4 activated by Daily IVM analysis for local values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end end %% Mail di Livello 3 [rLV3,cLV3] = find(Level==3); [rLV3_S,cLV3_S] = find(Level_Storico==3); [rLV3_Loc,cLV3_Loc] = find(Level_Local==3); [rLV3_Loc_S,cLV3_Loc_S] = find(Level_Local_Storico==3); message_LV3 = []; nW = 1; % --- Cumulati --- if isempty(rLV3) ~= 1 || isempty(rLV3_S) ~= 1 [dim,~] = size(rLV3); [dim_S,~] = size(rLV3_S); if dim ~= 0 % Criterio Real Time for I = 1:dim NodeNum = num2str(cell2mat(NodoTilt(cLV3(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV3(I),3))); data = datestr(DataFuK(rLV3(I),cLV3(I)),'dd-mm-yyyy HH:MM'); Data_Crollo = Tr_mail(rLV3(I),cLV3(I))+Date(rLV3(I),1); if Data_Crollo-now >= 0 % Il dato è significativo solo se nel futuro Collasso_Inf = datestr(Tr_Inf(rLV3(I),cLV3(I)),'dd-mm-yyyy HH:MM'); Collasso_Sup = datestr(Tr_Sup(rLV3(I),cLV3(I)),'dd-mm-yyyy HH:MM'); message_LV3{nW,1} = ['Allerta di Livello 3 sui dati cumulati del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Possibile collasso stimato nella finestra temporale tra ' Collasso_Inf... ' e ' Collasso_Sup ' ! Analisi eseguita con Metodo dell''Inverso della Velocita''.''']; Data_Img = datestr(DataFuK(rLV3(I),cLV3(I)),'dd-mm-yyyy'); Tempo_Img = datestr(DataFuK(rLV3(I),cLV3(I)),'HH-MM-SS'); filename = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'.jpg'); filename2 = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'_Vel.jpg'); attachments{nA,1} = filename; attachments{nA+1,1} = filename2; Data_Text(D,1) = DataFuK(rLV3(I),cLV3(I)); D = D+1; nW = nW+1; nA = nA+2; end text = ['Alarm of Level #3 activated by IVM analysis for cumulated values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end if dim_S ~= 0 % Criterio Storico for I = 1:dim_S NodeNum = num2str(cell2mat(NodoTilt(cLV3_S(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV3_S(I),3))); data = datestr(DataFuK_S(rLV3_S(I),cLV3_S(I)),'dd-mm-yyyy HH:MM'); Data_Crollo = Tr_S(rLV3_S(I),cLV3_S(I))+DateGiorno(rLV3_S(I),1); if Data_Crollo-now >= 0 % Il dato è significativo solo se nel futuro Collasso_Inf = datestr(Tr_Inf_S(rLV3_S(I),cLV3_S(I)),'dd-mm-yyyy HH:MM'); Collasso_Sup = datestr(Tr_Sup_S(rLV3_S(I),cLV3_S(I)),'dd-mm-yyyy HH:MM'); message_LV3{nW,1} = ['Allerta di Livello 3 sui dati cumulati del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Possibile collasso stimato nella finestra temporale tra ' Collasso_Inf... ' e ' Collasso_Sup ' ! Analisi eseguita con Metodo Storico dell''Inverso della Velocita''.''']; Data_Img = datestr(DataFuK_S(rLV3_S(I),cLV3_S(I)),'dd-mm-yyyy'); Tempo_Img = datestr(DataFuK_S(rLV3_S(I),cLV3_S(I)),'HH-MM-SS'); filename = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'_Storico.jpg'); filename2 = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'_Vel_Storico.jpg'); attachments{nA,1} = filename; attachments{nA+1,1} = filename2; Data_Text(D,1) = DataFuK_S(rLV3_S(I),cLV3_S(I)); D = D+1; nW = nW+1; nA = nA+2; end text = ['Alarm of Level #3 activated by Daily IVM analysis for cumulated values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end end % --- Locali --- if isempty(rLV3_Loc) ~= 1 || isempty(rLV3_Loc_S) ~= 1 [dim,~] = size(rLV3_Loc); if dim ~= 0 % Criterio Real Time for I = 1:dim NodeNum = num2str(cell2mat(NodoTilt(cLV3_Loc(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV3_Loc(I),3))); data = datestr(DataFuK_local(rLV3_Loc(I),cLV3_Loc(I)),'dd-mm-yyyy HH:MM'); Data_Crollo = Tr_Loc_mail(rLV3_Loc(I),cLV3_Loc(I))+Date(rLV3_Loc(I),1); if Data_Crollo-now >= 0 % Il dato è significativo solo se nel futuro Collasso_Inf = datestr(Tr_Inf_Loc(rLV3_Loc(I),cLV3_Loc(I)),'dd-mm-yyyy HH:MM'); Collasso_Sup = datestr(Tr_Sup_Loc(rLV3_Loc(I),cLV3_Loc(I)),'dd-mm-yyyy HH:MM'); message_LV3{nW,1} = ['Allerta di Livello 3 sui dati locali del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Possibile collasso stimato nella finestra temporale tra ' Collasso_Inf... ' e ' Collasso_Sup ' ! Analisi eseguita con Metodo dell''Inverso della Velocita''.''']; Data_Img = datestr(DataFuK_local(rLV3_Loc(I),cLV3_Loc(I)),'dd-mm-yyyy'); Tempo_Img = datestr(DataFuK_local(rLV3_Loc(I),cLV3_Loc(I)),'HH-MM-SS'); filename = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'-Local.jpg'); filename2 = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'-Local_Vel.jpg'); attachments{nA,1} = filename; attachments{nA+1,1} = filename2; Data_Text(D,1) = DataFuK_local(rLV3_Loc(I),cLV3_Loc(I)); D = D+1; nW = nW+1; nA = nA+2; end text = ['Alarm of Level #3 activated for local values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end [dim_S,~] = size(rLV3_Loc_S); % Criterio Storico if dim_S ~= 0 for I = 1:dim_S NodeNum = num2str(cell2mat(NodoTilt(cLV3_Loc_S(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV3_Loc_S(I),3))); data = datestr(DataFuK_local_S(rLV3_Loc_S(I),cLV3_Loc_S(I)),'dd-mm-yyyy HH:MM'); Data_Crollo = Tr_Loc_S(rLV3_Loc_S(I),cLV3_Loc_S(I))+DateGiorno(rLV3_Loc_S(I),1); if Data_Crollo-now >= 0 % Il dato è significativo solo se nel futuro Collasso_Inf = datestr(Tr_Loc_Inf_S(rLV3_Loc_S(I),cLV3_Loc_S(I)),'dd-mm-yyyy HH:MM'); Collasso_Sup = datestr(Tr_Loc_Sup_S(rLV3_Loc_S(I),cLV3_Loc_S(I)),'dd-mm-yyyy HH:MM'); message_LV3{nW,1} = ['Allerta di Livello 3 sui dati locali del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Possibile collasso stimato nella finestra temporale tra ' Collasso_Inf... ' e ' Collasso_Sup ' ! Analisi eseguita con Metodo Storico dell''Inverso della Velocita''. ''']; Data_Img = datestr(DataFuK_local_S(rLV3_Loc_S(I),cLV3_Loc_S(I)),'dd-mm-yyyy'); Tempo_Img = datestr(DataFuK_local_S(rLV3_Loc_S(I),cLV3_Loc_S(I)),'HH-MM-SS'); filename = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'-Local_Storico.jpg'); filename2 = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'-Local_Vel_Storico.jpg'); attachments{nA,1} = filename; attachments{nA+1,1} = filename2; Data_Text(D,1) = DataFuK_local_S(rLV3_Loc_S(I),cLV3_Loc_S(I)); D = D+1; nW = nW+1; nA = nA+2; end text = ['Alarm of Level #3 activated by Daily IVM analysis for local values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end end %% Mail di Livello 2 [rLV2,cLV2] = find(Level==2); [rLV2_S,cLV2_S] = find(Level_Storico==2); [rLV2_Loc,cLV2_Loc] = find(Level_Local==2); [rLV2_Loc_S,cLV2_Loc_S] = find(Level_Local_Storico==2); message_LV2 = []; nW = 1; % --- Cumulati --- if isempty(rLV2) ~= 1 || isempty(rLV2_S) ~= 1 [dim,~] = size(rLV2); [dim_S,~] = size(rLV2_S); if dim ~= 0 % Criterio Real Time for I = 1:dim NodeNum = num2str(cell2mat(NodoTilt(cLV2(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV2(I),3))); data = datestr(DataFuK(rLV2(I),cLV2(I)),'dd-mm-yyyy HH:MM'); Data_Crollo = Tr_mail(rLV2(I),cLV2(I))+Date(rLV2(I),1); if Data_Crollo-now >= 0 % Il dato è significativo solo se nel futuro Collasso_Inf = datestr(Tr_Inf(rLV2(I),cLV2(I)),'dd-mm-yyyy HH:MM'); Collasso_Sup = datestr(Tr_Sup(rLV2(I),cLV2(I)),'dd-mm-yyyy HH:MM'); message_LV2{nW,1} = ['Allerta di Livello 2 sui dati cumulati del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Possibile collasso stimato nella finestra temporale tra ' Collasso_Inf... ' e ' Collasso_Sup ' ! Analisi eseguita con Metodo dell''Inverso della Velocita''.''']; Data_Img = datestr(DataFuK(rLV2(I),cLV2(I)),'dd-mm-yyyy'); Tempo_Img = datestr(DataFuK(rLV2(I),cLV2(I)),'HH-MM-SS'); filename = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'.jpg'); filename2 = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'_Vel.jpg'); attachments{nA,1} = filename; attachments{nA+1,1} = filename2; Data_Text(D,1) = DataFuK(rLV2(I),cLV2(I)); D = D+1; nW = nW+1; nA = nA+2; end text = ['Alarm of Level #2 activated by IVM analysis for cumulated values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end if dim_S ~= 0 % Criterio Storico for I = 1:dim_S NodeNum = num2str(cell2mat(NodoTilt(cLV2_S(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV2_S(I),3))); data = datestr(DataFuK_S(rLV2_S(I),cLV2_S(I)),'dd-mm-yyyy HH:MM'); Data_Crollo = Tr_S(rLV2_S(I),cLV2_S(I))+DateGiorno(rLV2_S(I),1); if Data_Crollo-now >= 0 % Il dato è significativo solo se nel futuro Collasso_Inf = datestr(Tr_Inf_S(rLV2_S(I),cLV2_S(I)),'dd-mm-yyyy HH:MM'); Collasso_Sup = datestr(Tr_Sup_S(rLV2_S(I),cLV2_S(I)),'dd-mm-yyyy HH:MM'); message_LV2{nW,1} = ['Allerta di Livello 2 sui dati cumulati del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Possibile collasso stimato nella finestra temporale tra ' Collasso_Inf... ' e ' Collasso_Sup ' ! Analisi eseguita con Metodo Storico dell''Inverso della Velocita''.''']; Data_Img = datestr(DataFuK_S(rLV2_S(I),cLV2_S(I)),'dd-mm-yyyy'); Tempo_Img = datestr(DataFuK_S(rLV2_S(I),cLV2_S(I)),'HH-MM-SS'); filename = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'_Storico.jpg'); filename2 = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'_Vel_Storico.jpg'); attachments{nA,1} = filename; attachments{nA+1,1} = filename2; Data_Text(D,1) = DataFuK_S(rLV2_S(I),cLV2_S(I)); D = D+1; nW = nW+1; nA = nA+2; end text = ['Alarm of Level #2 activated by Daily IVM analysis for cumulated values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end end % --- Locali --- if isempty(rLV2_Loc) ~= 1 || isempty(rLV2_Loc_S) ~= 1 [dim,~] = size(rLV2_Loc); if dim ~= 0 for I = 1:dim NodeNum = num2str(cell2mat(NodoTilt(cLV2_Loc(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV2_Loc(I),3))); data = datestr(DataFuK_local(rLV2_Loc(I),cLV2_Loc(I)),'dd-mm-yyyy HH:MM'); Data_Crollo = Tr_Loc_mail(rLV2_Loc(I),cLV2_Loc(I))+Date(rLV2_Loc(I),1); if Data_Crollo-now >= 0 % Il dato è significativo solo se nel futuro Collasso_Inf = datestr(Tr_Inf_Loc(rLV2_Loc(I),cLV2_Loc(I)),'dd-mm-yyyy HH:MM'); Collasso_Sup = datestr(Tr_Sup_Loc(rLV2_Loc(I),cLV2_Loc(I)),'dd-mm-yyyy HH:MM'); message_LV2{nW,1} = ['Allerta di Livello 2 sui dati locali del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Possibile collasso stimato nella finestra temporale tra ' Collasso_Inf... ' e ' Collasso_Sup ' ! Analisi eseguita con Metodo dell''Inverso della Velocita''. ''']; Data_Img = datestr(DataFuK_local(rLV2_Loc(I),cLV2_Loc(I)),'dd-mm-yyyy'); Tempo_Img = datestr(DataFuK_local(rLV2_Loc(I),cLV2_Loc(I)),'HH-MM-SS'); filename = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'-Local.jpg'); filename2 = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'-Local_Vel.jpg'); attachments{nA,1} = filename; attachments{nA+1,1} = filename2; Data_Text(D,1) = DataFuK_local(rLV2_Loc(I),cLV2_Loc(I)); D = D+1; nW = nW+1; nA = nA+2; end text = ['Alarm of Level #2 activated for local values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end [dim_S,~] = size(rLV2_Loc_S); if dim_S ~= 0 for I = 1:dim_S NodeNum = num2str(cell2mat(NodoTilt(cLV2_Loc_S(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV2_Loc_S(I),3))); data = datestr(DataFuK_local_S(rLV2_Loc_S(I),cLV2_Loc_S(I)),'dd-mm-yyyy HH:MM'); Data_Crollo = Tr_Loc_S(rLV2_Loc_S(I),cLV2_Loc_S(I))+DateGiorno(rLV2_Loc_S(I),1); if Data_Crollo-now >= 0 % Il dato è significativo solo se nel futuro Collasso_Inf = datestr(Tr_Loc_Inf_S(rLV2_Loc_S(I),cLV2_Loc_S(I)),'dd-mm-yyyy HH:MM'); Collasso_Sup = datestr(Tr_Loc_Sup_S(rLV2_Loc_S(I),cLV2_Loc_S(I)),'dd-mm-yyyy HH:MM'); message_LV2{nW,1} = ['Allerta di Livello 2 sui dati locali del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Possibile collasso stimato nella finestra temporale tra ' Collasso_Inf... ' e ' Collasso_Sup ' ! Analisi eseguita con Metodo Storico dell''Inverso della Velocita''. ''']; Data_Img = datestr(DataFuK_local_S(rLV2_Loc_S(I),cLV2_Loc_S(I)),'dd-mm-yyyy'); Tempo_Img = datestr(DataFuK_local_S(rLV2_Loc_S(I),cLV2_Loc_S(I)),'HH-MM-SS'); filename = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'-Local_Storico.jpg'); filename2 = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'-Local_Vel_Storico.jpg'); attachments{nA,1} = filename; attachments{nA+1,1} = filename2; Data_Text(D,1) = DataFuK_local_S(rLV2_Loc_S(I),cLV2_Loc_S(I)); D = D+1; nW = nW+1; nA = nA+2; end text = ['Alarm of Level #2 activated by Daily IVM analysis for local values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end end %% Mail di Livello 1.5 [rLV15,cLV15] = find(Level==1.5); [rLV15_S,cLV15_S] = find(Level_Storico==1.5); [rLV15_Loc,cLV15_Loc] = find(Level_Local==1.5); [rLV15_Loc_S,cLV15_Loc_S] = find(Level_Local_Storico==1.5); message_LV15 = []; nW = 1; % --- Cumulati --- if isempty(rLV15) ~= 1 || isempty(rLV15_S) ~= 1 [dim,~] = size(rLV15); [dim_S,~] = size(rLV15_S); if dim ~= 0 % Criterio Real Time for I = 1:dim if DataFuK(rLV15(I),cLV15(I)) > A(1,1) || DataFuK(rLV15(I),cLV15(I)) > A(2,1) NodeNum = num2str(cell2mat(NodoTilt(cLV15(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV15(I),3))); data = datestr(DataFuK(rLV15(I),cLV15(I)),'dd-mm-yyyy HH:MM'); Data_Crollo = Tr_mail(rLV15(I),cLV15(I))+Date(rLV15(I),1); message_LV15{nW,1} = ['Falso Allarme per data di collasso nel passato sui dati cumulati del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Data di collasso stimata il ' datestr(Data_Crollo,'dd-mm-yyyy HH:MM')... '. Analisi eseguita con Metodo dell''Inverso della Velocita''.''']; Data_Img = datestr(DataFuK(rLV15(I),cLV15(I)),'dd-mm-yyyy'); Tempo_Img = datestr(DataFuK(rLV15(I),cLV15(I)),'HH-MM-SS'); filename = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'.jpg'); filename2 = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'_Vel.jpg'); %%% REPORT DI ALLERTAMENTO %%% DataNum = Number(rLV15(I),cLV15(I)); % numero punti nel dataset LVL = 1.5; % livello raggiunto TipoDisp = 2; % spostamenti cumulati [checkALRPT,nomeALRPT_PDF] = AlertReport(IDcentralina,DTcatena,Sito,... NodeNum,Depth,data,DataNum,LVL,TipoDisp,conn,FileName); attachments{nA,1} = filename; attachments{nA+1,1} = filename2; Data_Text(D,1) = DataFuK(rLV15(I),cLV15(I)); D = D+1; nW = nW+1; if checkALRPT == 1 attachments{nA+2,1} = nomeALRPT_PDF; nA = nA+3; else nA = nA+2; end text = ['False Alarm for cumulated values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end end if dim_S ~= 0 % Criterio Storico for I = 1:dim_S if DataFuK_S(rLV15_S(I),cLV15_S(I)) > A(1,1) || DataFuK_S(rLV15_S(I),cLV15_S(I)) > A(2,1) NodeNum = num2str(cell2mat(NodoTilt(cLV15_S(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV15_S(I),3))); data = datestr(DataFuK_S(rLV15_S(I),cLV15_S(I)),'dd-mm-yyyy HH:MM'); Data_Crollo = Tr_S(rLV15_S(I),cLV15_S(I))+DateGiorno(rLV15_S(I),1); message_LV15{nW,1} = ['Falso Allarme per data di collasso nel passato sui dati cumulati del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Data di collasso stimata il ' datestr(Data_Crollo,'dd-mm-yyyy HH:MM')... '. Analisi eseguita con Metodo Storico dell''Inverso della Velocita''.''']; Data_Img = datestr(DataFuK_S(rLV15_S(I),cLV15_S(I)),'dd-mm-yyyy'); Tempo_Img = datestr(DataFuK_S(rLV15_S(I),cLV15_S(I)),'HH-MM-SS'); filename = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'_Storico.jpg'); filename2 = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'_Vel_Storico.jpg'); attachments{nA,1} = filename; attachments{nA+1,1} = filename2; Data_Text(D,1) = DataFuK_S(rLV15_S(I),cLV15_S(I)); D = D+1; nW = nW+1; nA = nA+2; text = ['False Alarm activated by Daily IVM analysis for cumulated values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end end end % --- Locali --- if isempty(rLV15_Loc) ~= 1 || isempty(rLV15_Loc_S) ~= 1 [dim,~] = size(rLV15_Loc); if dim ~= 0 for I = 1:dim if DataFuK_local(rLV15_Loc(I),cLV15_Loc(I)) > A(1,1) || DataFuK_local(rLV15_Loc(I),cLV15_Loc(I)) > A(2,1) NodeNum = num2str(cell2mat(NodoTilt(cLV15_Loc(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV15_Loc(I),3))); data = datestr(DataFuK_local(rLV15_Loc(I),cLV15_Loc(I)),'dd-mm-yyyy HH:MM'); Data_Crollo = Tr_Loc_mail(rLV15_Loc(I),cLV15_Loc(I))+Date(rLV15_Loc(I),1); message_LV15{nW,1} = ['Falso Allarme per data di collasso nel passato sui dati locali del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Data di collasso stimata il ' datestr(Data_Crollo,'dd-mm-yyyy HH:MM')... '. Analisi eseguita con Metodo dell''Inverso della Velocita''.''']; Data_Img = datestr(DataFuK_local(rLV15_Loc(I),cLV15_Loc(I)),'dd-mm-yyyy'); Tempo_Img = datestr(DataFuK_local(rLV15_Loc(I),cLV15_Loc(I)),'HH-MM-SS'); filename = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'-Local.jpg'); filename2 = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'-Local_Vel.jpg'); attachments{nA,1} = filename; attachments{nA+1,1} = filename2; Data_Text(D,1) = DataFuK_local(rLV15_Loc(I),cLV15_Loc(I)); D = D+1; nW = nW+1; nA = nA+2; text = ['False Alarm for local values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end end [dim_S,~] = size(rLV15_Loc_S); if dim_S ~= 0 for I = 1:dim_S if DataFuK_local_S(rLV15_Loc_S(I),cLV15_Loc_S(I)) > A(1,1) || DataFuK_local_S(rLV15_Loc_S(I),cLV15_Loc_S(I)) > A(2,1) NodeNum = num2str(cell2mat(NodoTilt(cLV15_Loc_S(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV15_Loc_S(I),3))); data = datestr(DataFuK_local_S(rLV15_Loc_S(I),cLV15_Loc_S(I)),'dd-mm-yyyy HH:MM'); Data_Crollo = Tr_Loc_S(rLV15_Loc_S(I),cLV15_Loc_S(I))+DateGiorno(rLV15_Loc_S(I),1); message_LV15{nW,1} = ['Falso Allarme per data di collasso nel passato sui dati locali del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Data di collasso stimata il ' datestr(Data_Crollo,'dd-mm-yyyy HH:MM')... '. Analisi eseguita con Metodo Storico dell''Inverso della Velocita''. ''']; Data_Img = datestr(DataFuK_local_S(rLV15_Loc_S(I),cLV15_Loc_S(I)),'dd-mm-yyyy'); Tempo_Img = datestr(DataFuK_local_S(rLV15_Loc_S(I),cLV15_Loc_S(I)),'HH-MM-SS'); filename = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'-Local_Storico.jpg'); filename2 = strcat(IDcentralina,'-',DTcatena,'-Node_',NodeNum,'-',Data_Img,'_',Tempo_Img,'-Local_Vel_Storico.jpg'); attachments{nA,1} = filename; attachments{nA+1,1} = filename2; nW = nW+1; nA = nA+2; Data_Text(D,1) = DataFuK_local_S(rLV15_Loc_S(I),cLV15_Loc_S(I)); D = D+1; text = ['False Alarm activated by Daily IVM analysis for local values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end end end %% Mail di Livello 1 [rLV1,cLV1] = find(Level==1); [rLV1_Loc,cLV1_Loc] = find(Level_Local==1); nW = 1; message_LV1 = []; % --- Cumulati --- if isempty(rLV1) ~= 1 [dim,~] = size(rLV1); for I = 1:dim NodeNum = num2str(cell2mat(NodoTilt(cLV1(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV1(I),3))); data = datestr(Date(rLV1(I)-3,1),'dd-mm-yyyy HH:MM'); message_LV1{nW,1} = ['Allerta di Livello 1 sui dati cumulati del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '.''']; nW = nW+1; Data_Text(D,1) = Date(rLV1(I)-3,1); D = D+1; text = ['Alert of Level #1 activated for cumulated values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end % --- Locali --- if isempty(rLV1_Loc) ~= 1 [dim,~] = size(rLV1_Loc); for I = 1:dim NodeNum = num2str(cell2mat(NodoTilt(cLV1_Loc(I),2))); Depth = num2str(cell2mat(NodoTilt(cLV1_Loc(I),3))); data = datestr(Date(rLV1_Loc(I)-3,1),'dd-mm-yyyy HH:MM'); message_LV1{nW,1} = ['Allerta di Livello 1 sui dati locali del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '.''']; nW = nW+1; Data_Text(D,1) = Date(rLV1_Loc(I)-3,1); D = D+1; text = ['Alert of Level #1 activated for local values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end %% Mail Celle Elettrolitiche [rHR_Loc,cHR_Loc] = size(Tr_Loc_HR); nW = 1; message_HR = []; if isempty(find(Tr_Loc_HR)) ~= 0 % Criterio Real Time for i=1:rHR_Loc for j=1:cHR_Loc if Tr_Loc_HR(i,j) > 0 NodeNum = num2str(cell2mat(NodoTiltHR(j,2))); Depth = num2str(cell2mat(NodoTiltHR(j,3))); data = datestr(DataFuK_local_HR(i,j,'dd-mm-yyyy HH:MM')); message_HR{nW,1} = ['ALLARME sui dati locali del sensore elettrolitico del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Analisi eseguita con Metodo dell''Inverso della Velocita''.''']; nW = nW+1; text = ['Alert on Electrolytic Cell data activated for local values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end end end [rHR_Loc_S,cHR_Loc_S] = size(Tr_Loc_HR_S); if isempty(find(Tr_Loc_HR_S)) ~= 0 % Criterio Storico for i=1:rHR_Loc_S for j=1:cHR_Loc_S if Tr_Loc_HR_S(i,j) > 0 NodeNum = num2str(cell2mat(NodoTiltHR(j,2))); Depth = num2str(cell2mat(NodoTiltHR(j,3))); data = datestr(DataFuK_local_HR_S(i,j,'dd-mm-yyyy HH:MM')); message_HR{nW,1} = ['ALLARME sui dati locali del sensore elettrolitico del nodo numero ' NodeNum... ' alla profondita'' di ' Depth ' della centralina ' IDcentralina... ', catena ' DTcatena ' nel sito di ' Sito '. Possibile inizio dell''accelerazione in data ' ... data '. Analisi eseguita con Metodo Storico dell''Inverso della Velocita''.''']; nW = nW+1; text = ['Alert on Electrolytic Cell data activated for Daily analysis of local values of node ' NodeNum ' with acceleration date equal to ' data '.']; fprintf(fileID,fmt,text); end end end end %% Email setpref('Internet','E_mail','alert@aseltd.eu'); setpref('Internet','SMTP_Server','smtps.aruba.it'); setpref('Internet','SMTP_Username','alert@aseltd.eu'); setpref('Internet','SMTP_Password','Ase#2013!20@bat'); props=java.lang.System.getProperties; pp=props.setProperty('mail.smtp.auth','true'); %#ok pp=props.setProperty('mail.smtp.socketFactory.class','javax.net.ssl.SSLSocketFactory'); %#ok pp=props.setProperty('mail.smtp.socketFactory.port','465'); %#ok % --- Mail ASE --- recipients = cell(5,1); recipients{1,1} = 'andrea.carri@aseltd.eu'; recipients{2,1} = 'alessandro.valletta@aseltd.eu'; recipients{3,1} = 'roberto.savi@aseltd.eu'; recipients{4,1} = 'andrea.segalini@aseltd.eu'; recipients{5,1} = 'luca.chiapponi@aseltd.eu'; if isempty(message_LV5) == 0 subject = 'ALLARME di Livello 5!'; elseif isempty(message_LV4) == 0 subject = 'Pre-Allarme di Livello 4!'; elseif isempty(message_LV3) == 0 subject = 'Allerta di Livello 3!'; elseif isempty(message_LV2) == 0 subject = 'Allerta di Livello 2!'; elseif isempty(message_LV15) == 0 subject = 'Falso Allarme'; elseif isempty(message_LV1) == 0 subject = 'Allerta di Livello 1'; end message = []; attiva = 0; if isempty(message_LV5) == 0 message = [message; message_LV5]; attiva = 5; end if isempty(message_LV4) == 0 message = [message; message_LV4]; if attiva == 0 attiva = 4; end end if isempty(message_LV3) == 0 message = [message; message_LV3]; if attiva == 0 attiva = 3; end end if isempty(message_LV2) == 0 message = [message; message_LV2]; if attiva == 0 attiva = 2; end end if isempty(message_LV15) == 0 message = [message; message_LV15]; if attiva == 0 attiva = 1.5; end end if isempty(message_LV1) == 0 message = [message; message_LV1]; if attiva == 0 attiva = 1; end end if isempty(message_HR) == 0 message = [message; message_HR]; end % Parte di email ad ASE e SMS fileID = fopen(FileName,'a'); fmt = '%s \r'; Data_LV5 = []; if attiva == 5 sendmail(recipients(1:5), subject, message, attachments) text = 'Email of Level 5 sent.'; fprintf(fileID,fmt,text); Criterio = 'Fukuzono'; Data_LV5 = now; if sms == 1 if now > A(4,1)+1 % SMS se si è superato di 24 h la data di invio dell'ultimo SMS fclose(fileID); SMS(IDcentralina,DTcatena,Sito,Users_SMS,Criterio,FileName); end end elseif attiva == 4 sendmail(recipients(1:4), subject, message, attachments) text = 'Email of Level 4 sent.'; fprintf(fileID,fmt,text); elseif attiva == 3 sendmail(recipients(1:3), subject, message, attachments) text = 'Email of Level 3 sent.'; fprintf(fileID,fmt,text); elseif attiva == 2 || attiva == 1.5 sendmail(recipients(1:2), subject, message, attachments) text = 'Email of Level 1.5 or 2 sent.'; fprintf(fileID,fmt,text); elseif attiva == 1 sendmail(recipients(1:2), subject, message) text = 'Email of Level 1 sent.'; fprintf(fileID,fmt,text); end % Parte di Email al cliente if Mail == 1 recipients_ITA = cell(1); recipients_ENG = cell(1); % A chi mando la mail nI = 1; nE = 1; [rU,cU] = size(Users_Alert); if ini_CoV <= rU rU = ini_CoV; end if cU >1 % sono presenti utenti a cui inviare la mail for i = 1:rU if Users_Alert{i,4} == 2 recipients_ITA{nI,1} = Users_Alert(i,3); nI = nI+1; else recipients_ENG{nE,1} = Users_Alert(i,3); nE = nE+1; end end end % - Definisco la mail if isempty(message_LV5_Cliente) ~= 1 codice_mail = 5; elseif isempty(message_LV4_Cliente) ~= 1 codice_mail = 4; else codice_mail = 0; end if codice_mail >= 4 if codice_mail == 4 if activeIT == 1 subject_ITA = 'Allerta - Incremento delle accelerazioni rilevato!'; message_LV4_Cliente{8,1} = 'Si raccomanda di controllare con attenzione i prossimi dati in arrivo, consultabili nella nostra piattaforma web, in modo da seguire l''evoluzione del fenomeno in atto.'; message_LV4_Cliente{9,1} = ''; message_LV4_Cliente{10,1} = 'Cordiali saluti,'; message_LV4_Cliente{11,1} = 'il Team di ASE S.r.l.'; message_LV4_Cliente{12,1} = ''; message_LV4_Cliente{13,1} = 'Messaggio inviato automaticamente dal sistema di allertamento di ASE S.r.l.'; message_ITA = message_LV4_Cliente; if now > A(1,1) + 1 && attiva == A(3,1) || attiva > A(3,1) % email a partire da 24 h dopo la precedente attivazione di uguale livello o solo se il livello è aumentato sendmail(recipients_ITA, subject_ITA, message_ITA) end end if activeEN == 1 subject_ENG = 'Alert - Accelerations increase detected!'; message_LV4_Cliente_ENG{8,1} = 'We recommend to carefully check the following monitoring data available through our web platform, in order to control the evolution of the ongoing event'; message_LV4_Cliente_ENG{9,1} = ''; message_LV4_Cliente_ENG{10,1} = 'Best regards,'; message_LV4_Cliente_ENG{11,1} = 'ASE Ltd Team'; message_LV4_Cliente_ENG{12,1} = ''; message_LV4_Cliente_ENG{13,1} = 'This is an automatic message sent by ASE Ltd Alert System.'; message_ENG = message_LV4_Cliente_ENG; if now > A(1,1) + 1 && attiva == A(3,1) || attiva > A(3,1) sendmail(recipients_ENG, subject_ENG, message_ENG) end end elseif codice_mail == 5 Criterio = 'Fukuzono'; Data_LV5 = now; if now > A(4,1)+1 % SMS se si è superato di 24 h la data di invio dell'ultimo SMS fclose(fileID); SMS(IDcentralina,DTcatena,Sito,Users_Alert,Criterio,FileName); end if activeIT == 1 subject_ITA = 'Allarme - Rilevata accelerazione potenzialmente critica!'; if isempty(char(message_LV5_Cliente{6,1})) == 1 % Ho solo il criterio storico message_ITA = message_LV5_Cliente{:,2}; [rM,~] = size(message_ITA); message_ITA{rM+1,1} = ''; message_ITA{rM+2,1} = ['Data di inizio accelerazione: ' datestr(min(Finestra_Storico(:,3)),'dd-mm-yyyy HH:MM')]; message_ITA{rM+3,1} = ['Possibile collasso stimato nella finestra compresa tra ' datestr(min(Finestra_Storico(:,1)),'dd-mm-yyyy HH:MM') ' e ' datestr(max(Finestra_Storico(:,2)),'dd-mm-yyyy HH:MM') ' ']; message_ITA{rM+4,1} = 'Stima eseguita con il Metodo dell''Inverso della Velocita'' - Dataset medio giornaliero'; elseif isempty(char(message_LV5_Cliente{6,2})) == 1 % Ho solo il criterio real time message_ITA = message_LV5_Cliente{:,1}; [rM,~] = size(message_ITA); message_ITA{rM+1,1} = ''; message_ITA{rM+2,1} = ['Data di inizio accelerazione: ' datestr(min(Finestra_RealTime(:,3)),'dd-mm-yyyy HH:MM')]; message_ITA{rM+3,1} = ['Possibile collasso stimato nella finestra compresa tra ' datestr(min(Finestra_RealTime(:,1)),'dd-mm-yyyy HH:MM') ' e ' datestr(max(Finestra_RealTime(:,2)),'dd-mm-yyyy HH:MM') ' ']; message_ITA{rM+4,1} = 'Stima eseguita con il Metodo dell''Inverso della Velocita'' '; else % Ho entrambi [rM,~] = size(message_LV5_Cliente); for m = 6:rM if isempty(message_LV5_Cliente{m,1}) == 1 && isempty(message_LV5_Cliente{m-1,1}) == 1 fine = m-2; break end end message_ITA{1:fine,1} = message_LV5_Cliente{m,1}; message_ITA{fine+1,1} = ''; message_ITA{fine+2,1} = ['Data di inizio accelerazione: ' datestr(min(Finestra_RealTime(:,3)),'dd-mm-yyyy HH:MM')]; message_ITA{fine+3,1} = ['Possibile collasso stimato nella finestra compresa tra ' datestr(min(Finestra_RealTime(:,1)),'dd-mm-yyyy HH:MM') ' e ' datestr(max(Finestra_RealTime(:,2)),'dd-mm-yyyy HH:MM') ' ']; message_ITA{fine+4,1} = 'Stima eseguita con il Metodo dell''Inverso della Velocita'' '; message_ITA{fine+5,1} = ''; for m = 6:rM if isempty(message_LV5_Cliente{m,2}) == 1 && isempty(message_LV5_Cliente{m-1,2}) == 1 fine = m-2; break end end message_ITA{fine+1,1} = ['Data di inizio accelerazione: ' datestr(min(Finestra_Storico(:,3)),'dd-mm-yyyy HH:MM')]; message_ITA{fine+2,1} = ['Possibile collasso stimato nella finestra compresa tra ' datestr(min(Finestra_Storico(:,1)),'dd-mm-yyyy HH:MM') ' e ' datestr(max(Finestra_Storico(:,2)),'dd-mm-yyyy HH:MM') ' ']; message_ITA{fine+3,1} = 'Stima eseguita con il Metodo dell''Inverso della Velocita'' - Dataset medio giornaliero'; message_ITA{fine+4,1} = ''; end [rM,~] = size(message_ITA); message_ITA{rM+1,1} = 'Si consiglia di seguire con la massima attenzione l''evoluzione del fenomeno in atto e, laddove si ritenga necessario, predisporre un sopralluogo in sito per accertare le condizioni del versante.'; message_ITA{rM+2,1} = 'Cordiali saluti, il Team di ASE S.r.l.'; message_ITA{rM+3,1} = 'Messaggio inviato automaticamente dal sistema di allertamento di ASE S.r.l.'; if strcmp(char(Users_Alert{i,5}),'EWS') sendmail(recipients_ITA, subject_ITA, message_ITA, allegati_cliente) elseif now > A(4,1)+1 % email a partire da 24 h dopo la precedente attivazione e solo se il livello è aumentato sendmail(recipients_ITA, subject_ITA, message_ITA, allegati_cliente) end end if activeEN == 1 subject_ENG = 'Alarm - potentially critical acceleration detected!'; if isempty(char(message_LV5_Cliente_ENG{6,1})) == 1 % Ho solo il criterio storico message_ENG = message_LV5_Cliente_ENG{:,2}; [rM,~] = size(message_ENG); message_ENG{rM+1,1} = ''; message_ENG{rM+2,1} = ['Onset-of-acceleration date: ' datestr(min(Finestra_Storico(:,3)),'dd-mm-yyyy HH:MM')]; message_ENG{rM+3,1} = ['Time of failure estimated in a time window between ' datestr(min(Finestra_Storico(:,1)),'dd-mm-yyyy HH:MM') ' and ' datestr(max(Finestra_Storico(:,2)),'dd-mm-yyyy HH:MM') ' ']; message_ENG{rM+4,1} = 'Analisys performed with Inverse Velocity Method - Daily average dataset '; elseif isempty(char(message_LV5_Cliente_ENG{6,2})) == 1 % Ho solo il criterio real time message_ENG = message_LV5_Cliente_ENG{:,1}; [rM,~] = size(message_ENG); message_ENG{rM+1,1} = ''; message_ENG{rM+2,1} = ['Onset-of-acceleration date: ' datestr(min(Finestra_RealTime(:,3)),'dd-mm-yyyy HH:MM')]; message_ENG{rM+3,1} = ['Time of failure estimated in a time window between ' datestr(min(Finestra_RealTime(:,1)),'dd-mm-yyyy HH:MM') ' and ' datestr(max(Finestra_RealTime(:,2)),'dd-mm-yyyy HH:MM') ' ']; message_ENG{rM+4,1} = 'Analisys performed with Inverse Velocity Method '; else % Ho entrambi [rM,~] = size(message_LV5_Cliente_ENG); for m = 6:rM if isempty(message_LV5_Cliente_ENG{m,1}) == 1 && isempty(message_LV5_Cliente_ENG{m-1,1}) == 1 fine = m-2; break end end message_ENG{1:fine,1} = message_LV5_Cliente_ENG{m,1}; message_ENG{fine+1,1} = ''; message_ENG{fine+2,1} = ['Onset-of-acceleration date: ' datestr(min(Finestra_RealTime(:,3)),'dd-mm-yyyy HH:MM')]; message_ENG{fine+3,1} = ['Time of failure estimated in a time window between ' datestr(min(Finestra_RealTime(:,1)),'dd-mm-yyyy HH:MM') ' and ' datestr(max(Finestra_RealTime(:,2)),'dd-mm-yyyy HH:MM') ' ']; message_ENG{fine+4,1} = 'Analisys performed with Inverse Velocity Method '; message_ENG{fine+5,1} = ''; for m = 6:rM if isempty(message_LV5_Cliente_ENG{m,2}) == 1 && isempty(message_LV5_Cliente_ENG{m-1,2}) == 1 fine = m-2; break end end message_ENG{fine+1,1} = ['Onset-of-acceleration date: ' datestr(min(Finestra_Storico(:,3)),'dd-mm-yyyy HH:MM')]; message_ENG{fine+2,1} = ['Time of failure estimated in a time window between ' datestr(min(Finestra_Storico(:,1)),'dd-mm-yyyy HH:MM') ' and ' datestr(max(Finestra_Storico(:,2)),'dd-mm-yyyy HH:MM') ' ']; message_ENG{fine+3,1} = 'Analisys performed with Inverse Velocity Method - Daily average dataset '; message_ENG{fine+4,1} = ''; end [rM,~] = size(message_ENG); message_ENG{rM+1,1} = 'We highly suggest to follow very closely the progressive evolution of the ongoing phenomenon and, if necessary, to arrange for an on-site investigation in order to assess the slope conditions. '; message_ENG{rM+2,1} = 'Kind regards, the ASE Ltd Team'; message_ENG{rM+3,1} = 'This is an automatic message sent by ASE Ltd Alert System. '; var = char(Users_Alert(i,5)); [~,cV] = size(var); if cV > 2 if strcmp(var(1,1:3),'EWS') sendmail(recipients_ENG, subject_ENG, message_ENG, allegati_cliente) end elseif now > A(4,1)+1 % email a partire da 24 h dopo la precedente attivazione e solo se il livello è aumentato sendmail(recipients_ENG, subject_ENG, message_ENG, allegati_cliente) end end end end end DATA = max(Data_Text); check = isempty(DATA); if check == 1 DATA = A(1,1); end FileNameFuk = ['' IDcentralina '-' DTcatena '-Fuk.txt']; outdat = fopen(FileNameFuk,'wt+'); fileID = fopen(FileNameFuk,'a'); fmt = '%.10f \r'; fprintf(fileID,fmt,DATA); fmt = '%.10f \r'; if attiva > 1 fprintf(fileID,fmt,now); else fprintf(fileID,fmt,A(2,1)); end fmt = '%.1f \r'; fprintf(fileID,fmt,attiva); if isempty(Data_LV5) == 0 fmt = '%.10f \r'; fprintf(fileID,fmt,Data_LV5); end fclose(fileID); end fileID = fopen(FileName,'a'); text = 'Time_Of_Failure function worked correctly'; fmt = '%s \r'; fprintf(fileID,fmt,text); fclose(fileID); end