From 84e8bf3224f0b99ae58a7cc7838a28416256274c Mon Sep 17 00:00:00 2001 From: Olivier Sauter <olivier.sauter@epfl.ch> Date: Fri, 8 Feb 2019 19:55:55 +0000 Subject: [PATCH] test and adapt connection matrix plot (coil name cell again) git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@11419 d63d8f72-b253-0410-a779-e742ad2e26cf --- .../TCV_IMAS/extract_info_connection_matrix.m | 9 +- crpptbx/TCV_IMAS/plot_connection_matrices.m | 106 +++++++++--------- 2 files changed, 56 insertions(+), 59 deletions(-) diff --git a/crpptbx/TCV_IMAS/extract_info_connection_matrix.m b/crpptbx/TCV_IMAS/extract_info_connection_matrix.m index 2251d518..fa196cc4 100644 --- a/crpptbx/TCV_IMAS/extract_info_connection_matrix.m +++ b/crpptbx/TCV_IMAS/extract_info_connection_matrix.m @@ -4,19 +4,20 @@ function info_pf_active = extract_info_connection_matrix(ids_pf_active) % % Extract the following information from pf_active and connection % matrix and add them to the ids_pf_active structure - +% % ------------------------------------------- % Which coils belong to a specific circuit added to % pf_active.circuit{i}.coils_belonging_to_circuit - +% % Which power supply belongs to a spefic circuit added to % pf_active.circuit{i}.supplies_belonging_to_circuit - +% % Which circuit does a given coil belong to added to % pf_active.coil{i}.belonged_circuit - +% % Which circuit does a given power supply belong to % pf_active.supply{i}.belonged_circuit +% info_pf_active = ids_pf_active; diff --git a/crpptbx/TCV_IMAS/plot_connection_matrices.m b/crpptbx/TCV_IMAS/plot_connection_matrices.m index b15e0721..b3e8be0f 100644 --- a/crpptbx/TCV_IMAS/plot_connection_matrices.m +++ b/crpptbx/TCV_IMAS/plot_connection_matrices.m @@ -1,60 +1,56 @@ -function plot_connection_matrices(IDS) -info = extract_info_connection_matrix(IDS); +function info_pf_active = plot_connection_matrices(ids_pf_active) +% +% info_pf_active = plot_connection_matrices(ids_pf_active); +% -for kk=1:info.ntotcircuits - figure - mat = info.pf_active.circuit{kk}.connections; - - b = zeros([size(mat)]+1); - b(1:end-1, 1:end-1) = mat; - pcolor(b) - - yti = [1:size(b,1)]+0.5; - xti = [1:size(b,2)]+0.5; - - ylab = cellstr(num2str([1:size(b,1)-1]')); - index = 0; - xlab = {}; +info_pf_active = extract_info_connection_matrix(ids_pf_active); + +for kk=1:info_pf_active.ntotcircuits + figure + mat = info_pf_active.circuit{kk}.connections; + b = zeros([size(mat)]+1); + b(1:end-1, 1:end-1) = mat; + pcolor(b) + yti = [1:size(b,1)]+0.5; + xti = [1:size(b,2)]+0.5; + + ylab = cellstr(num2str([1:size(b,1)-1]')); + index = 0; + xlab = {}; + + % Get the labels + for ii=1:info_pf_active.ntotsupplies + index = index +1; - % Get the labels - for ii=1:info.ntotsupplies - index = index +1; - - if any(ii==info.pf_active.circuit{kk}.supplies_ind_belonging_to_circuit) - addcolor = '\color{red}'; - else - addcolor = '\color{green}'; - end - - xlab{index} = [addcolor info.pf_active.supply{ii}.name 'in']; - index = index +1; - xlab{index} = [addcolor info.pf_active.supply{ii}.name 'out']; - end - for ii=1:info.ntotcoils - - if any(ii==info.pf_active.circuit{kk}.coils_ind_belonging_to_circuit) - addcolor = '\color{red}'; - else - addcolor = '\color{black}'; - end - - index = index +1; - xlab{index} = [addcolor info.pf_active.coil{ii}.name 'in']; - index = index +1; - xlab{index} = [addcolor info.pf_active.coil{ii}.name 'out']; + if any(ii==info_pf_active.circuit{kk}.supplies_ind_belonging_to_circuit) + addcolor = '\color{red}'; + else + addcolor = '\color{green}'; end - shg - axis ij - ax = gca; - colormap(bone(2)) - xlabel('Element name. (red) Elemement belonging to circuit. (green) power supplies. (black) coils'); - ylabel('Node'); - title(['Circuit ' num2str(kk) ': ' info.pf_active.circuit{kk}.name]) - set(ax,'Xtick', xti, 'Ytick', yti, 'XTickLabel', xlab, 'YTickLabel', ylab') - -end - + xlab{index} = [addcolor info_pf_active.supply{ii}.name{:} 'in']; + index = index +1; + xlab{index} = [addcolor info_pf_active.supply{ii}.name{:} 'out']; + end + for ii=1:info_pf_active.ntotcoils + if any(ii==info_pf_active.circuit{kk}.coils_ind_belonging_to_circuit) + addcolor = '\color{red}'; + else + addcolor = '\color{black}'; + end + index = index +1; + xlab{index} = [addcolor info_pf_active.coil{ii}.name 'in']; + index = index +1; + xlab{index} = [addcolor info_pf_active.coil{ii}.name 'out']; + end + + shg + axis ij + ax = gca; + colormap(bone(2)) + xlabel('Element name. (red) Elemement belonging to circuit. (green) power supplies. (black) coils'); + ylabel('Node'); + title(['Circuit ' num2str(kk) ': ' info_pf_active.circuit{kk}.name]) + set(ax,'Xtick', xti, 'Ytick', yti, 'XTickLabel', xlab, 'YTickLabel', ylab') + end - - -- GitLab