function SYS = Set_Meters_Sinks(SYS,MODE)
% Function to set all Meters and Sinks inactive or active in a Layout
% Set_Meters_Sinks(SYS,MODE)
% Input Variables:
% SYS - SYS which contains the System
% MODE - 0 to inactivate, 1 to activate
if any(strfind(SYS.className,'Meter')) || any(strfind(SYS.className,'Sink'))    
% if strfind(SYS.className,'Sink')
    name = SYS.hierarchyName;
    if MODE == 0
        SYS = awe_setstatus(SYS, 'inactive');
        fprintf (strcat(name, ' is inactive.\n'));
    else 
        if MODE == 1
            SYS = awe_setstatus(SYS, 'active');
            fprintf (strcat(name, ' is active.\n'));
        end
    end
end

% Iterate over all modules inside subsystems
for k=1:length(SYS.module)
    SYS.module{k} = Set_Meters_Sinks(SYS.module{k}, MODE);
end