Skip to content
Snippets Groups Projects
Commit ab1acece authored by Lorenzo Pivetta's avatar Lorenzo Pivetta
Browse files

First import

parent 60b6d7fe
Branches master
No related tags found
No related merge requests found
clear all;
for num_sequences=1:300
seq_name = sprintf('seq_executor_%d.txt',num_sequences);
header{1} = '#';
header{2} = '# Description: $description';
header{3} = '# Author: Sequencer Library';
header{4} = '# Date: 2020/06/16';
header{5} = '#';
header{6} = sprintf('# This sequence executes %d multi commands/writes ',num_sequences);
header{7} = '#';
cnt = 0;
cnt = cnt + 1;
blk{cnt} = sprintf('step%d;(write(this/RetryCounter) = 0) && (write(this/ErrorCounter) = 0) && goto(%d);-1',cnt,cnt+1);
% reset executed flag
for seq=1:num_sequences
cnt = cnt + 1;
blk{cnt} = sprintf('step%d;(write(this/Executed%03d) = 0) && goto(%d);Resetting $cmdattr%03d executed flag;Error resetting $cmdattr%03d$ executed flag;-1',cnt,seq,cnt+1,seq,seq);
end
cnt = cnt + 1;
blk{cnt} = sprintf('step%d;read(this/RetryCounter) > read(this/MaxRetryCounter) ? goto(-1) : goto(%d);Checking retry counter;Max number of retries reached;-1',cnt,cnt+1);
% Turn feedbacks ON
for seq=1:num_sequences
cnt = cnt + 1;
blk{cnt} = sprintf('step%d;((read(this/Enabled%03d) == 1) && (read(this/Executed%03d) == 0)) ? $cmdattr%03d$ && (write(this/Executed%03d) = 1) && sleep($sleep_cmd) && goto(%d) : goto(%d);Executing $cmdattr%03d$;Error executing $cmdattr%03d$;-1;tangoerror=goto(%d)',cnt,seq,seq,seq,seq,cnt+2,cnt+2,seq,seq,cnt+1);
cnt = cnt + 1;
blk{cnt} = sprintf('step%d;(write(this/ErrorCounter) = (read(this/ErrorCounter) + 1)) && goto(%d);-1',cnt,cnt+1);
end
cnt = cnt + 1;
blk{cnt} = sprintf('step%d;(write(this/RetryCounter) = read(this/RetryCounter) + 1) && goto(%d);Increasing retry counter;Error increasing retry counter;-1',cnt,cnt+1);
cnt = cnt + 1;
blk{cnt} = sprintf('step%d;read(this/ErrorCounter) == 0 ? goto(%d) : goto(%d);Increasing retry counter;Error increasing retry counter;-1',cnt,cnt+1,2+num_sequences);
cnt = 0;
cnt = cnt + 1;
footer{cnt} = 'attr;ErrorCounter;long;0';
cnt = cnt + 1;
footer{cnt} = 'attr;RetryCounter;long;0';
cnt = cnt + 1;
footer{cnt} = 'attr;MaxRetryCounter;long;1';
% check Enable
for seq=1:num_sequences
cnt = cnt + 1;
footer{cnt} = sprintf('attr;Enabled%03d;bool;1',seq);
end
% check Executed
for seq=1:num_sequences
cnt = cnt + 1;
footer{cnt} = sprintf('attr;Executed%03d;bool;0',seq);
end
fileID = fopen(seq_name,'w');
for i=1:size(header,2)
fprintf(fileID,'%s\n',header{i});
end
for i=1:size(blk,2)
fprintf(fileID,'%s\n',blk{i});
end
for i=1:size(footer,2)
fprintf(fileID,'%s\n',footer{i});
end
fclose(fileID);
end
% Dynamic R/W attributes
% Internal
% attr;ErrorCounter;long;0
% attr;RetryCounter;long;0
% attr;MaxRetryCounter;long;0
% attr;Enabled001;bool;1
% attr;Enabled002;bool;1
% attr;Executed001;bool;0
% attr;Executed002;bool;0
% .....
% Wildcards
% $description=
% $cmd_sleep=0.1
% $cmd_attr_001=command(fel01/diagnostics/mscrccd_fel01.01/ResetCamera)
% $cmd_attr_002=(write(inj/power_supply/psch_inj.01/Current) = 0)
....
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment