function [GI_Cir_Q1,GI_Cir_Q2,GI_Cir_Q3,GI_Cir_Q4,GI_Cir_Q1_Num,GI_Cir_Q2_Num,... GI_Cir_Q3_Num,GI_Cir_Q4_Num,GI_Cir_Seg,GI_Cir_Z,GI_Cir_Date,GI_TuL_RL,... ATTIVA,FIG] = report_TuL_ENG(IDcentralina,DTcatena,rTuL,m,NodoTunnelLink,toolrif,... unitrif,datarif,firstdata_num,Font_caption,Font_tools,siteID,DT,FIG,br,colonna2,... colonna2bis,status,ATTIVA,conn,FileName) import mlreportgen.dom.* import mlreportgen.report.* % Make sure DOM is compilable makeDOMCompilable() GI_Cir_Q1 = []; GI_Cir_Q2 = []; GI_Cir_Q3 = []; GI_Cir_Q4 = []; GI_Cir_Q1_Num = []; GI_Cir_Q2_Num = []; GI_Cir_Q3_Num = []; GI_Cir_Q4_Num = []; GI_Cir_Seg = []; GI_Cir_Z = []; GI_Cir_Date = []; GI_TuL_RL = []; check = 0; while check == 0 if status(m,1) == 1 if ATTIVA == 1 ATTIVA = 0; testo = Paragraph('Array not installed or inactive.'); add(DT,testo); end check = 1; elseif status(m,1) == 3 if ATTIVA == 1 ATTIVA = 0; testo = Paragraph(['Monitoring completed. Please log into the web-based platform '... 'to access the complete dataset.']); add(DT,testo); end check = 1; else [~,Segmenti,~,~,~,Antiorario] = star(IDcentralina,DTcatena,FileName); [dim,~] = size(Segmenti); % numero di punti per il calcolo della stella NODATA(m,1) = 0; Num = zeros(rTuL(m,1),1); for n = 1:rTuL(m,1) NodeNum = num2str(NodoTunnelLink(n,m)); % dati del mese comando = ['select EventDate, EventTime, XShift, ZShift, HShift, '... 'HShift_local, X, Z from ElabDataView where EventDate >= ''' ... datarif ''' and ToolNameID = ''' char(toolrif) ''' and UnitName = ''' ... char(unitrif) ''' and NodeNum = ''' NodeNum ''' ']; curs = exec(conn,comando); curs = fetch(curs); Dati = curs.Data; Num(n,1) = NodoTunnelLink(n,m); datarifNEW = datestr(firstdata_num{m+1,1},'yyyy-mm-dd'); % data riferimento definita sul sito temporifNEW = datestr(firstdata_num{m+1,1},'HH:MM:SS'); % primo dato per la stella comando = ['select HShift from ElabDataView where EventDate = ''' ... datarifNEW ''' and EventTime >= ''' temporifNEW ''' and '... 'ToolNameID = ''' char(toolrif) ''' and UnitName = ''' ... char(unitrif) ''' and NodeNum = ''' NodeNum ''' ']; curs = exec(conn,comando); curs = fetch(curs); Stella1 = cell2mat(curs.Data); % Scarico ay che mi serve per orientare gli spostamenti in % convergenze/divergenza a seconda del quadrante - Inizio mese comando = ['select Val1, Val6 from RawDataView where Date >= ''' datarif ... ''' and UnitName = ''' char(unitrif) ''' and ToolNameID = ''' char(toolrif) ... ''' and NodeNum = ' NodeNum ' ']; curs = exec(conn,comando); curs = fetch(curs); DatiaccY_Mese = curs.Data; % Scarico i parametri di calibrazione di ay comando = ['select Cal0, Cal1, Cal2, Cal3, Cal4, Cal5, Cal6, Cal7, Cal8, '... 'CalA, CalB from CalibrationView where UnitName = ''' char(unitrif) ... ''' and ToolNameID = ''' char(toolrif) ''' and NodeNum = ''' NodeNum '''']; curs = exec(conn,comando); curs = fetch(curs); DCalTuL = curs.Data; [r,c] = size(DCalTuL); MATconv = zeros(r,c); for ii = 1:r for jj = 1:c MATconv(ii,jj) = DCalTuL{ii,jj}; end end DCalTuL = MATconv; caY_Tu = DCalTuL(:,4); pIntY_Tu = DCalTuL(:,5); iIntY_Tu = DCalTuL(:,6); [rD,rC] = size(Dati); if rC ~= 1 T = [cell2mat(Dati(:,1)) repmat(' ', [rD,1]) cell2mat(Dati(:,2))]; Date = datenum(T); % Data if n == 1 % Il primo lo scrivo e creo la variabile di controllo else [rS,~] = size(asseX); if rD ~= rS NODATA(m,1) = 1; check = 0; break else check = 1; end end % divergenza/convergenza dei singoli nodi dall'inizio asseX(:,n) = cell2mat((Dati(:,3))); asseZ(:,n) = cell2mat(Dati(:,4)); X_TuL_Mese(:,n) = cell2mat(Dati(:,7)); Z_TuL_Mese(:,n) = cell2mat(Dati(:,8)); accY_raw(:,n) = str2double(DatiaccY_Mese(:,1)); t_TuL(:,n) = str2double(DatiaccY_Mese(:,2)); accY_Mese(:,n) = accY_raw(:,n)*caY_Tu+(t_TuL(:,n)*pIntY_Tu+iIntY_Tu); diffX(:,n) = asseX(:,n)-asseX(1,n); diffZ(:,n) = asseZ(:,n)-asseZ(1,n); RIS_XZ(:,n) = 1000*cell2mat((Dati(:,6))); if n <= dim stella_Rif(:,n) = 1000*(cell2mat(Dati(:,5))-Stella1(1,1)); stella_Mese(:,n) = 1000*(cell2mat(Dati(:,5))-cell2mat(Dati(1,5))); end % dati relativi al mese RIS_XZ_Mese(1,n) = sqrt(diffX(end,n)^2 + diffZ(end,n)^2)*1000; [rAY,~] = size(accY_Mese); if isnan(accY_Mese(end,n)) == 1 for d = 1:rAY if isnan(accY_Mese(end-d+1,n)) == 0 diffaccY(1,n) = accY_Mese(end-d+1,n)-accY_Mese(1,n); break end end else diffaccY(1,n) = accY_Mese(end,n)-accY_Mese(1,n); end % correggo segno risultante if diffaccY(1,n) < 0 if Antiorario(n,1) == 1 || Antiorario(n,1) == 4 RIS_XZ_Mese(1,n) = -1*RIS_XZ_Mese(1,n); end elseif diffaccY(1,n) > 0 if Antiorario(n,1) == 2 || Antiorario(n,1) == 3 RIS_XZ_Mese(1,n) = -1*RIS_XZ_Mese(1,n); end end else NODATA(m,1) = 1; check = 1; end end if NODATA(m,1) == 0 date = datestr(datenum(colonna2{m+1,1},'dd-mm-yyyy'),'yyyy-mm-dd'); % data riferimento definita sul sito % posizione di progetto dei nodi comando = ['select EventDate, EventTime, X, Z from ElabDataView where EventDate >= ''' ... date ''' and ToolNameID = ''' char(toolrif) ''' and UnitName = ''' char(unitrif) ''' ']; curs = exec(conn,comando); curs = fetch(curs); SezioneXZ = curs.Data; Datasez = SezioneXZ(1,1); Orasez = SezioneXZ(1,2); [rz,~] = size(SezioneXZ); scrivi = 1; for rr = 1:rz if strcmp(SezioneXZ(rr,1),Datasez)==1 && strcmp(SezioneXZ(rr,2),Orasez) ==1 CoordX(scrivi,1) = SezioneXZ(rr,3); CoordZ(scrivi,1) = SezioneXZ(rr,4); scrivi = scrivi+1; end end if strcmp(colonna2bis(m+1,1),colonna2(m+1,1)) == 0 % data zero diversa data riferimento datarifNEW = datestr(firstdata_num{m+1,1},'yyyy-mm-dd'); % data riferimento definita sul sito for nw = 1:rTuL(m,1) NodeNum = num2str(NodoTunnelLink(nw,m)); comando = ['select EventDate, EventTime, XShift, ZShift, X, Z, '... 'from ElabDataView where EventDate = ''' datarifNEW ''' and ToolNameID = ''' char(toolrif) ... ''' and UnitName = ''' char(unitrif) ''' and NodeNum = ''' NodeNum ''' ']; curs = exec(conn,comando); curs = fetch(curs); DatiNEW = curs.Data; % dati registrati alla data di riferimento Num(nw,1) = NodoTunnelLink(nw,m); [~,rC] = size(DatiNEW); if rC ~= 1 % dalla data di riferimento % divergenza/convergenza dei singoli nodi dall'inizio asseX(:,nw) = asseX(:,nw)-cell2mat(DatiNEW(1,3)); asseZ(:,nw) = asseZ(:,nw)-cell2mat(DatiNEW(1,4)); X_TuL_Rif(:,nw) = cell2mat(DatiNEW(1,5)); Z_TuL_Rif(:,nw) = cell2mat(DatiNEW(1,6)); % Scarico ay che mi serve per orientare gli spostamenti in % convergenze/divergenza a seconda del quadrante - dati % dalla data di riferimento comando = ['select Val1, Val6 from RawDataView where Date >= ''' datarifNEW ... ''' and UnitName = ''' char(unitrif) ''' and ToolNameID = ''' char(toolrif) ... ''' and NodeNum = ' NodeNum ' ']; curs = exec(conn,comando); curs = fetch(curs); DatiaccY_Rif = curs.Data; accY_raw(:,n) = str2double(DatiaccY(:,1)); t_TuL(:,n) = str2double(DatiaccY(:,2)); accY_Rif(:,n) = accY_raw(:,n)*caY_Tu+(t_TuL(:,n)*pIntY_Tu+iIntY_Tu); diffX(:,n) = asseX(:,n)-asseX(1,n); diffZ(:,n) = asseZ(:,n)-asseZ(1,n); % Risultati dalla data di riferimento RIS_XZ(:,n) = 1000*((asseX(:,n).^2+asseZ(:,n).^2).^0.5); diffaccY_Rif(1,n) = accY_Mese(end,n)-accY_Rif(1,n); % correggo segno risultante if diffaccY_Rif(1,n) < 0 if Antiorario(n,1) == 1 || Antiorario(n,1) == 4 RIS_XZ(1,n) = -1*RIS_XZ(1,n); end elseif diffaccY_Rif(1,n) > 0 if Antiorario(n,1) == 2 || Antiorario(n,1) == 3 RIS_XZ(1,n) = -1*RIS_XZ(1,n); end end % dati relativi al mese RIS_XZ_Mese(:,n) = sqrt(diffX(end,n).^2 + diffZ(end,n)^2)*1000; diffaccY_Mese(:,n) = accY_Mese(:,n)-accY_Mese(1,n); % correggo segno risultante [rA,~] = size(accY_Mese); for aa = 1:rA if diffaccY_Mese(1,n) < 0 if Antiorario(n,1) == 1 || Antiorario(n,1) == 4 RIS_XZ_Mese(aa,n) = -1*RIS_XZ_Mese(aa,n); end elseif diffaccY_Mese(1,n) > 0 if Antiorario(n,1) == 2 || Antiorario(n,1) == 3 RIS_XZ_Mese(aa,n) = -1*RIS_XZ_Mese(aa,n); end end end else NODATA(m,1) = 1; end end end q1 = find(Antiorario==1); q2 = find(Antiorario==2); q3 = find(Antiorario==3); q4 = find(Antiorario==4); m1 = max(abs(RIS_XZ_Mese(end,q1))); g1 = find(m1==abs(RIS_XZ_Mese)); GI_Cir_Q1 = RIS_XZ_Mese(end,g1(1)); m2 = max(abs(RIS_XZ_Mese(end,q2))); g2 = find(m2==abs(RIS_XZ_Mese)); GI_Cir_Q2 = RIS_XZ_Mese(end,g2(1)); m3 = max(abs(RIS_XZ_Mese(end,q3))); g3 = find(m3==abs(RIS_XZ_Mese)); GI_Cir_Q3 = RIS_XZ_Mese(end,g3(1)); m4 = max(abs(RIS_XZ_Mese(end,q4))); g4 = find(m4==abs(RIS_XZ_Mese)); GI_Cir_Q4 = RIS_XZ_Mese(end,g4(1)); GI_Cir_Q1_Num = Num(g1(1)); GI_Cir_Q2_Num = Num(g2(1)); GI_Cir_Q3_Num = Num(g3(1)); GI_Cir_Q4_Num = Num(g4(1)); GI_Cir_Seg = stella_Mese(end,:); GI_Cir_Date = Date; % Cerco eventuali correlazioni con PreConv Array NomeFile = strcat('Report',siteID,'-PCLvsTuL.txt'); Filetesto = importdata(NomeFile); [rF,~] = size(Filetesto); AAA = 1; Var = 0; ind = 1; while AAA < rF % A un Cir compete (se c'è) uno ed un solo PreConv. Lo vado a cercare check1 = Filetesto(AAA,1); if check1 == 99999 % Non ci sono PreConv Array o non ci sono Cir AAA = 2; else check2 = Filetesto(AAA+1,1); if check1 == str2num(DTcatena(end-2:end)) % Il Cir è da prendere in considerazione ed è riportato nella prima riga del file Nodo = Filetesto(AAA+2,1); Var = 1; elseif check2 == str2num(DTcatena(end-2:end)) % Il Cir è da prendere in considerazione ed è riportato nella seconda riga del file Nodo = Filetesto(AAA+3,1); Var = 1; end AAA = AAA+4; end end if Var == 1 GI_Cir_Z(:,ind) = (asseZ(:,Nodo)-asseZ(1,Nodo))*1000; ind = ind+1; Var = 0; end % Cerco eventuali correlazioni con Rad Array NomeFile = strcat('Report',siteID,'-TuLvsRL.txt'); Filetesto = importdata(NomeFile); [rF,~] = size(Filetesto); AAA = 1; Var = 0; ind = 1; while AAA < rF % A un Cir compete un Rad Array. Lo vado a cercare check1 = Filetesto(AAA,1); if check1 == 99999 % Non ci sono Rad Array o non ci sono Cir AAA = 2; else check2 = Filetesto(AAA+1,1); if check1 == str2num(DTcatena(end-2:end)) % Il Cir è da prendere in considerazione ed è riportato nella prima riga del file Nodo = Filetesto(AAA+2,1); Var = 1; elseif check2 == str2num(DTcatena(end-2:end)) % Il Cir è da prendere in considerazione ed è riportato nella seconda riga del file Nodo = Filetesto(AAA+3,1); Var = 1; end AAA = AAA+4; end if Var == 1 GI_TuL_RL(:,ind) = sqrt(diffX(:,Nodo).^2 + diffZ(:,Nodo).^2)*1000; % ad un Cir possono competere più Rad. Il cir è unico ind = ind+1; Var = 0; end end % Istogramma convergenza/divergenza dei singoli nodi figure(1) [~,nn] = size(RIS_XZ_Mese(end,:)); for w = 1:nn nodi_grafico(1,w) = w; end RIS = [RIS_XZ_Mese(end,:)' RIS_XZ(end,:)']; div_conv = barh(nodi_grafico,RIS); title('2D local displacement'); xlabel('Displacement [mm]'); ylabel('Node [-]'); h = gca; h.XAxis.MinorTick = 'on'; h.YAxis.MinorTick = 'off'; Max(1) = max(RIS_XZ_Mese(end,:)); Max(2) = max(RIS_XZ(end,:)); MAX = max(Max); Min(1) = min(RIS_XZ_Mese(end,:)); Min(2) = min(RIS_XZ(end,:)); MIN = min(Min); in1 = find(Max == MAX); in2 = find(Min == MIN); MM = [abs(MIN) MAX]; MAXX = max(MM); in3 = find(MM == MAXX); if in3 == 1 % DX if in2 == 1 POS = find(RIS_XZ_Mese == Min(1)); else POS = find(RIS_XZ == Min(2)); end else % SX if in1 == 1 POS = find(RIS_XZ_Mese == Max(1)); else POS = find(RIS_XZ == Max(2)); end end if MAXX < 10 % mm xlim([-10 10]); else xlim([-MAXX MAXX]) end ylim([0 nn+2]); yticks(0:1:nn); grid on if in3 == 1 % DX legend('Reference time period','Complete monitoring period','Location','northeast'); else % SX legend('Reference time period','Complete monitoring period','Location','northwest'); end TempName = char(strcat('Report',siteID,'-', char(toolrif),'Convergenza_ENG.png')); saveas(div_conv(1),TempName); ChartCIR = Image(TempName); ChartCIR.Style = {HAlign('justify'),ScaleToFit}; ChartCIR_cap = Paragraph(['Fig. ' num2str(FIG) ' - 2D Local differential displacements '... 'recorded in the section plane by the 3D MEMS sensors during the reference and the '... 'complete monitoring period']); FIG = FIG+1; ChartCIR_cap.Style = {HAlign('justify'),FontSize(Font_caption),Italic(1),Color('midnightblue')}; % --- Sezione - MESE --- contaC_Mese = 1; contaD_Mese = 1; conta0_Mese = 1; for ris = 1:nn if RIS_XZ_Mese(end,ris)< -0.5 nodiCX_Mese(contaC_Mese,1) = CoordX(ris,1); nodiCZ_Mese(contaC_Mese,1) = CoordZ(ris,1); contaC_Mese = contaC_Mese + 1; elseif RIS_XZ_Mese(end,ris)> 0.5 nodiDX_Mese(contaD_Mese,1) = CoordX(ris,1); nodiDZ_Mese(contaD_Mese,1) = CoordZ(ris,1); contaD_Mese = contaD_Mese + 1; else nodiFX_Mese(conta0_Mese,1) = CoordX(ris,1); nodiFZ_Mese(conta0_Mese,1) = CoordZ(ris,1); conta0_Mese = conta0_Mese + 1; end end % --- Sezione - GLOBALI --- contaC = 1; contaD = 1; conta0 = 1; for ris = 1:nn if RIS_XZ(end,ris)< -0.5 nodiCX_tot(contaC,1) = CoordX(ris,1); nodiCZ_tot(contaC,1) = CoordZ(ris,1); contaC = contaC + 1; elseif RIS_XZ(end,ris)> 0.5 nodiDX_tot(contaD,1) = CoordX(ris,1); nodiDZ_tot(contaD,1) = CoordZ(ris,1); contaD = contaD + 1; else nodiFX_tot(conta0,1) = CoordX(ris,1); nodiFZ_tot(conta0,1) = CoordZ(ris,1); conta0 = conta0 + 1; end end % Grafico Sezione Mese figure(2) CoordX = [CoordX(:,1); CoordX(1,1); CoordX(1,1)]; CoordZ = [CoordZ(:,1); CoordZ(end,1); CoordZ(1,1)]; sez = plot(cell2mat(CoordX(:,1)),cell2mat(CoordZ(:,1)),'-','Color','black'); hold on if contaC_Mese > 1 sezC = plot(cell2mat(nodiCX_Mese(:,1)),cell2mat(nodiCZ_Mese(:,1)),'o','Color','red'); set(sezC, 'markerfacecolor', get(sezC, 'color')); end hold on if contaD_Mese > 1 sezD = plot(cell2mat(nodiDX_Mese(:,1)),cell2mat(nodiDZ_Mese(:,1)),'o','Color',[0.4660 0.6740 0.1880]); set(sezD, 'markerfacecolor', get(sezD, 'color')); end hold on if conta0_Mese > 1 sezF = plot(cell2mat(nodiFX_Mese(:,1)),cell2mat(nodiFZ_Mese(:,1)),'o','Color','black'); set(sezF, 'markerfacecolor', get(sezF, 'color')); end if contaC_Mese > 1 && contaD_Mese > 1 && conta0_Mese > 1 legend({'Array geometry','Convergent nodes','Divergent nodes','Stable nodes'},'Position',[0.37 0.37 0.3 0.2]); elseif contaC_Mese > 1 && contaD_Mese > 1 && conta0_Mese == 1 legend({'Array geometry','Convergent nodes','Divergent nodes'},'Position',[0.37 0.37 0.3 0.2]); elseif contaC_Mese > 1 && contaD_Mese == 1 && conta0_Mese > 1 legend({'Array geometry','Convergent nodes','Stable nodes'},'Position',[0.37 0.37 0.3 0.2]); elseif contaC_Mese == 1 && contaD_Mese > 1 && conta0_Mese > 1 legend({'Array geometry','Divergent nodes','Stable nodes'},'Position',[0.37 0.37 0.3 0.2]); elseif contaC_Mese > 1 && contaD_Mese == 1 && conta0_Mese == 1 legend({'Array geometry','Convergent nodes'},'Position',[0.37 0.37 0.3 0.2]); elseif contaC_Mese == 1 && contaD_Mese > 1 && conta0_Mese == 1 legend({'Array geometry','Divergent nodes','Stable nodes'},'Position',[0.37 0.37 0.3 0.2]); elseif contaC_Mese == 1 && contaD_Mese == 1 && conta0_Mese > 1 legend({'Array geometry','Stable nodes'},'Position',[0.37 0.37 0.3 0.2]); end title('Local displacements - Reference time period'); xlabel('X [m]'); ylabel('Z [m]'); h = gca; h.XAxis.MinorTick = 'on'; grid off TempName = char(strcat('Report',siteID,'-', char(toolrif),'SezCIR_ENG.png')); saveas(sez,TempName); ChartSEZ = Image(TempName); ChartSEZ.Style = {HAlign('center'),Height('6.5cm')}; % Grafico Sezione Globali figure(3) sez = plot(cell2mat(CoordX(:,1)),cell2mat(CoordZ(:,1)),'-','Color','black'); hold on if contaC > 1 sezC = plot(cell2mat(nodiCX_tot(:,1)),cell2mat(nodiCZ_tot(:,1)),'o','Color','red'); set(sezC, 'markerfacecolor', get(sezC, 'color')); end hold on if contaD > 1 sezD = plot(cell2mat(nodiDX_tot(:,1)),cell2mat(nodiDZ_tot(:,1)),'o','Color',[0.4660 0.6740 0.1880]); set(sezD, 'markerfacecolor', get(sezD, 'color')); end hold on if conta0 > 1 sezF = plot(cell2mat(nodiFX_tot(:,1)),cell2mat(nodiFZ_tot(:,1)),'o','Color','black'); set(sezF, 'markerfacecolor', get(sezF, 'color')); end if contaC > 1 && contaD > 1 && conta0 > 1 legend({'Array geometry','Convergent nodes','Divergent nodes','Stable nodes'},'Position',[0.37 0.37 0.3 0.2]); elseif contaC > 1 && contaD > 1 && conta0 == 1 legend({'Array geometry','Convergent nodes','Divergent nodes'},'Position',[0.37 0.37 0.3 0.2]); elseif contaC > 1 && contaD == 1 && conta0 > 1 legend({'Array geometry','Convergent nodes','Stable nodes'},'Position',[0.37 0.37 0.3 0.2]); elseif contaC == 1 && contaD > 1 && conta0 > 1 legend({'Array geometry','Divergent nodes','Stable nodes'},'Position',[0.37 0.37 0.3 0.2]); elseif contaC > 1 && contaD == 1 && conta0 == 1 legend({'Array geometry','Convergent nodes'},'Position',[0.37 0.37 0.3 0.2]); elseif contaC == 1 && contaD > 1 && conta0 == 1 legend({'Array geometry','Divergent nodes','Stable nodes'},'Position',[0.37 0.37 0.3 0.2]); elseif contaC == 1 && contaD == 1 && conta0 > 1 legend({'Array geometry','Stable nodes'},'Position',[0.37 0.37 0.3 0.2]); end title('Local displacements - Complete monitoring period'); xlabel('X [m]'); ylabel('Z [m]'); h = gca; h.XAxis.MinorTick = 'on'; grid off TempName = char(strcat('Report',siteID,'-', char(toolrif),'SezCIR2_ENG.png')); saveas(sez,TempName); ChartSEZ2 = Image(TempName); ChartSEZ2.Style = {HAlign('center'),Height('6.5cm')}; ChartSEZ_cap = Paragraph(['Fig. ' num2str(FIG) ' - Direction of the '... '2D local differential displacement vector '... 'observed during the reference time period and strarting from the reference date '... 'reported in Table 1']); FIG = FIG+1; ChartSEZ_cap.Style = {HAlign('justify'),FontSize(Font_caption),Italic(1),Color('midnightblue')}; lot = Table({ChartSEZ, ChartSEZ2}); lot.Style = {ResizeToFitContents(false), Width('100%')}; % immagine stella di convergenza nome = char(strcat(char(unitrif),'-', char(toolrif),'-Star.png')); Star = Image(nome); Star.Style = {Height('6.5cm')}; Star2 = Image(nome); Star2.Style = {Height('6.5cm')}; % --- Segmenti di convergenza MESE --- [~,cs] = size(stella_Mese); for y = 1:cs varseg_Mese(y,1) = stella_Mese(end,y); end maxseg_Mese = max(abs(varseg_Mese)); maxsegindex_Mese = find(abs(varseg_Mese) == maxseg_Mese); maxseg_Mese = varseg_Mese(maxsegindex_Mese); % --- Segmenti di convergenza Globale --- [~,cs] = size(stella_Rif); for y = 1:cs varseg_tot(y,1) = stella_Rif(end,y); numseg(y,1) = y; end maxseg = max(abs(varseg_tot)); maxsegindex = find(abs(varseg_tot) == maxseg); maxseg = varseg_tot(maxsegindex); figure(4) Seg = [varseg_Mese varseg_tot]; segmenti = barh(numseg,Seg); title('Convergence segments variation'); ylabel('Segment [-]'); xlabel('Length variation [mm]'); h = gca; h.XAxis.MinorTick = 'on'; Max(1) = max(varseg_Mese); Max(2) = max(varseg_tot); MAX = max(Max); Min(1) = min(varseg_Mese); Min(2) = min(varseg_tot); MIN = min(Min); MAXX = max(abs(MIN),MAX); MM = [abs(MIN) MAX]; in3 = find(MM == MAXX); % Dx-Sx if in3 == 1 % DX legend('Reference time period','Complete monitoring period','Location','northeast'); else % SX legend('Reference time period','Complete monitoring period','Location','northwest'); end ylim([0 cs+2]); yticks(0:1:nn); if MAXX < 10 % mm xlim([-10 10]); else xlim([-MAXX MAXX]) end grid on grid minor TempName = char(strcat('Report',siteID,'-', char(toolrif),'StarSeg_ENG.png')); saveas(segmenti(1),TempName); ChartSEG = Image(TempName); ChartSEG.Style = {Height('6.8cm')}; ChartSEG_cap = Paragraph(['Fig. ' num2str(FIG) ' - Length variations of each convergence segment '... 'recorded during the reference and the complete monitoring periods']); FIG = FIG+1; ChartSEG_cap.Style = {HAlign('justify'),FontSize(Font_caption),Italic(1),Color('midnightblue')}; lot2 = Table({Star, ChartSEG}); lot2.Style = {ResizeToFitContents(false), Width('100%')}; sezCIR = Heading3('Tunnel Link'); sezCIR.Style = {FontSize(Font_tools),Bold(1),Italic(1)}; CC = Section(); CC.Title = sezCIR; % Testi relativi all'ultimo mese testo1M = Paragraph(['Following graphs display the magnitude and direction of local differential displacements in the section plane '... 'measured by the 3D MEMS sensors, both during the reference and complete monitoring period. '... '... 'The 2D vector is the resultant of displacement components in the X-Z plane, representing the section width and '... 'height, respectively. In particular, negative values indicate that the node is converging towards the centre of '... 'the section, while positive ones correspond to a divergent movement.']); parte1 = ['The following figure summarizes the displacement direction of each single node, '... 'which are represented on the section geometry. During the reference time period, the analysis evidenced '... num2str(contaC_Mese-1) ]; if contaC_Mese-1 == 1 parte2 = ' convergent node'; else parte2 = ' convergent nodes'; end parte3 = [', ' num2str(contaD_Mese-1) ]; if contaD_Mese-1 == 1 parte4 = ' divergent sensor '; else parte4 = ' divergent sensors '; end parte5 = ['and ' num2str(conta0_Mese-1) ]; if conta0_Mese-1 == 1 parte6 = ' stable one. '; else parte6 = ' stable ones. '; end parte7 = ['The same analysis performed on the complete monitoring period '... 'resulted in ' num2str(contaC-1) ]; if conta0-1 == 0 if contaC-1 == 1 parte8 = [' convergent node and ' num2str(contaD-1)]; else parte8 = [' convergent nodes and ' num2str(contaD-1)]; end if contaD-1 == 1 parte9 = ' divergent sensor. '; else parte9 = ' divergent sensors. '; end else if contaC-1 == 1 parte8 = [' convergent node, ' num2str(contaD-1)]; else parte8 = [' convergent nodes, ' num2str(contaD-1)]; end if contaD-1 == 1 parte9 = ' divergent sensor '; else parte9 = ' divergent sensors '; end parte10 = ['and ' num2str(conta0-1)]; if conta0-1 == 1 parte11 = ' stable one. '; else parte11 = ' stable ones. '; end end parte12 = ['In this specific representation, nodes featuring displacement values less than 0.5 mm '... 'are assumed to be stable.']; if conta0-1 == 0 testo2M = Paragraph([parte1 parte2 parte3 parte4 parte5 parte6 parte7 parte8 ... parte9 parte12]); else testo2M = Paragraph([parte1 parte2 parte3 parte4 parte5 parte6 parte7 parte8 ... parte9 parte10 parte11 parte12]); end testo3M = Paragraph(['Moreover, the following graph reports the length variation of '... 'each convergence segment referred to the monitored tunnel section, both during the reference '... 'and complete monitoring periods. Segments definition is based on the topographic star displayed ' ... 'in the corresponding figure. In this case, segment S' num2str(maxsegindex_Mese(1,1)) ' presented the '... 'maximum length variation observed during the reference time period, ' ... 'with a difference of ' num2str(round(maxseg_Mese(1,1),1)) ' mm. '... 'Taking into account the complete monitoring period, the maximum variation is obsverved on segment S' num2str(maxsegindex(1,1)) ... ', with a difference of '... num2str(round(maxseg(1,1),1)) ' mm.']); spazio = Paragraph(''); testo1M.HAlign = 'justify'; testo2M.HAlign = 'justify'; testo3M.HAlign = 'justify'; add(DT,sezCIR); add(DT,testo1M); add(DT,ChartCIR); add(DT,ChartCIR_cap); add(DT,testo2M); add(DT,spazio); add(DT,lot); add(DT,ChartSEZ_cap); add(DT,testo3M); add(DT,lot2); add(DT,ChartSEG_cap); add(DT,br); close(figure(1)); close(figure(2)); close(figure(3)); close(figure(4)); else if ATTIVA == 1 testo = Paragraph('No data available for the reference time period.'); ATTIVA = 0; add(DT,testo); check = 1; end end end end fileID = fopen(FileName,'a'); fmt = '%s \r'; text = 'report_TuL_ENG function executed correctly'; fprintf(fileID,fmt,text); fclose(fileID); end