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

First import

parent ce6fb5fc
No related branches found
No related tags found
No related merge requests found
clear all;
for num_sequences=1:99
seq_name = sprintf('seq_condition_%d.txt',num_sequences);
header{1} = '#';
header{2} = '# Description: $description';
header{3} = '# Author: Giulio Gaio';
header{4} = '# Date: 2021/02/10';
header{5} = '#';
header{6} = sprintf('# This script checks %d conditions and returns FAULT when the first is false',num_sequences);
header{7} = '#';
cnt = 0;
% Check condition
for seq=1:num_sequences
cnt = cnt + 1;
blk{cnt} = sprintf('step%d;read(this/Enable%02d) == 1 ? goto(%d) : goto(%d);Checking enable condition %02d;Error checking enable condition %02d;-1',cnt,seq,cnt+1,cnt+2,seq,seq);
cnt = cnt + 1;
blk{cnt} = sprintf('step%d;($cond%02d) ? goto(%d) : goto(-1);Checking $errmsg%02d;$errmsg%02d;-1',cnt,seq,cnt+1,seq,seq);
end
% dynamic attributes
cnt = 0;
% attributes
for seq=1:num_sequences
cnt = cnt + 1;
footer{cnt} = sprintf('attr;Enable%02d;bool;1',seq);
end
% Wildcards
% $description=
% $cond01=$devplcaccess/Undulator_bst_inhibit_linac[0] == true
% $errmsg01=Ronda pendente nella hutch della Sala Sperimentale // failure description
% $cond02=$devplcaccess/Undulator_bst_inhibit_linac[1] == true
% $errmsg02=Monitore di dose della linea FEL1 in Malfunzionamento
% ........
% $devplcaccess=f/access_control/safety
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
clear all;
for num_sequences=1:99
seq_name = sprintf('seq_condition_recov_%d.txt',num_sequences);
header{1} = '#';
header{2} = '# Description: $description';
header{3} = '# Author: Giulio Gaio';
header{4} = '# Date: 2021/02/10';
header{5} = '#';
header{6} = sprintf('# This script checks %d conditions and returns FAULT when the first is false',num_sequences);
header{7} = '#';
cnt = 0;
% Check condition
for seq=1:num_sequences
cnt = cnt + 1;
blk{cnt} = sprintf('step%d;read(this/Enable%02d) == 1 ? goto(%d) : goto(%d);Checking enable condition %02d;Error checking enable condition %02d;-1',cnt,seq,cnt+1,cnt+2,seq,seq);
cnt = cnt + 1;
blk{cnt} = sprintf('step%d;($cond%02d) ? goto(%d) : goto(%d);Checking $errmsg%02d;$errmsg%02d;-1',cnt,seq,cnt+5,seq,seq);
cnt = cnt + 1;
blk{cnt} = sprintf('step%d;read(this/Recover%02d) == 1 ? command($devseqrecov%02d/Start) && goto(%d) : goto(-1);Checking $errmsg%02d;$errmsg%02d;-1',cnt,seq,seq,cnt+1,seq,seq);
cnt = cnt + 1;
blk{cnt} = sprintf('step%d;sleep($sleep_monitor) && (read($devseqrecov%02d/State) == RUNNING) ? goto(%d) : goto(%d);Waiting recovery sequence for condition %02d;Error waiting recovery sequence for condition %02d;$sequence_timeout000',cnt,seq,cnt,cnt+1,seq,seq);
cnt = cnt + 1;
blk{cnt} = sprintf('step%d;sleep($sleep_monitor) && (read($devseqrecov%02d/State) == OFF) ? goto(%d) : goto(-1);Checking recovery sequence for condition %02d;Checking recovery sequence for condition %02d;-1',cnt,seq,cnt+1,seq,seq);
cnt = cnt + 1;
blk{cnt} = sprintf('step%d;sleep($sleep_monitor) && ($cond%02d) ? goto(%d) : goto(%d);Checking $errmsg%02d;$errmsg%02d;-1',cnt,seq,cnt+1,seq,seq);
end
% dynamic attributes
cnt = 0;
% attributes
for seq=1:num_sequences
cnt = cnt + 1;
footer{cnt} = sprintf('attr;Enable%02d;bool;1',seq);
cnt = cnt + 1;
footer{cnt} = sprintf('attr;Recover%02d;bool;0',seq);
end
% Wildcards
% $description=
% $cond01=$devplcaccess/Undulator_bst_inhibit_linac[0] == true
% $errmsg01=Ronda pendente nella hutch della Sala Sperimentale // failure description
% $devseqrecov01=
% $cond02=$devplcaccess/Undulator_bst_inhibit_linac[1] == true
% $errmsg02=Monitore di dose della linea FEL1 in Malfunzionamento
% $devseqrecov02=
% ........
% $devplcaccess=f/access_control/safety
% $sleep_monitor=1
% $sequence_timeout=120
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
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