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

First import

parent bb742c92
Branches master
No related tags found
No related merge requests found
clear all;
for num_sequences=1:100
seq_name = sprintf('seq_waveform_%d.txt',num_sequences);
header{1} = '#';
header{2} = '# Description: $description';
header{3} = '# Author: Sequencer Library';
header{4} = '# Date: 2020/02/05';
header{5} = '#';
header{6} = sprintf('# This sequence generates a waveform of %d samples',num_sequences);
header{7} = '#';
error_step = 3 + num_sequences * 3;
cnt = 0;
cnt = cnt + 1;
blk{cnt}=sprintf('step%d;(write(this/StartValue) = read($device/$attribute)) && (write(this/NewValue) = read(this/StartValue)) && goto(%d);Saving $device/$attribute starting value;Error saving $device/$attribute starting value;-1',cnt,cnt+1);
% waveform steps
for seq=1:num_sequences
cnt = cnt + 1;
blk{cnt}=sprintf('step%d;sleep($sleep_monitor) && ((read($device/State) == $allowed_state) && (abs(read(this/NewValue) - read($device/$attribute)) < read(this/ErrorThrehold))) ? goto(%d) : goto(%d);Waiting settling time;Error waiting settling time;$settling_timeout000;tangoerror=goto(%d);timeouterror=goto(%d)',cnt,cnt+1,cnt,error_step,error_step);
cnt = cnt + 1;
blk{cnt}=sprintf('step%d;read(this/AbsMode) == 0 ? (write(this/NewValue) = (read(this/StartValue)+(read(this/Value%d)*read(this/ScalingFactor))) && goto(%d) : (write(this/NewValue) = (read(this/Value%d)*read(this/ScalingFactor))) && goto(%d);Calculating new value;Error calculating new value;-1;tangoerror=goto(%d)',cnt,seq,cnt+1,seq,cnt+1,error_step);
cnt = cnt + 1;
blk{cnt}=sprintf('step%d;(write($device/$attribute) = read(this/NewValue)) && goto(%d);Setting $device/$attribute;Error setting $device/$attribute;-1;tangoerror=goto(%d)',cnt,cnt+1,error_step);
end
cnt = cnt + 1;
blk{cnt}=sprintf('step%d;sleep($sleep_monitor) && ((read($device/State) == $allowed_state) && (abs(read(this/NewValue) - read($device/$attribute)) < read(this/ErrorThrehold))) ? goto(%d) : goto(%d);Waiting settling time;Error waiting settling time;$settling_timeout000;tangoerror=goto(%d);timeouterror=goto(%d)',cnt,cnt+2,cnt,error_step,error_step);
cnt = cnt + 1;
blk{cnt}=sprintf('step%d;(write($device/$attribute) = read(this/StartValue)) && goto(-1);Error, restoring StartValue and exit;Error restoring StartValue;-1',cnt);
cnt = cnt + 1;
blk{cnt}=sprintf('step%d;(write(this/NumCycles) = (read(this/NumCycles)+1)) && ((read(this/InfiniteLoop) == 1) || (read(this/NumCycles) < read(this/MaxNumCycles))) ? goto(3) : goto(%d);Checking NumCycles;Error checking NumCycles;-1',cnt,cnt+1);
% dynamic attributes
cnt = 0;
cnt = cnt + 1;
footer{cnt} = 'attr;AbsMode;bool;0';
cnt = cnt + 1;
footer{cnt} = 'attr;MaxNumCycles;long;1';
cnt = cnt + 1;
footer{cnt} = 'attr;InfiniteLoop;bool;0';
cnt = cnt + 1;
footer{cnt} = 'attr;ScalingFactor;double;1';
for seq=1:num_sequences
cnt = cnt + 1;
footer{cnt} = sprintf('attr;Value%d;double;0',seq);
end
cnt = cnt + 1;
footer{cnt} = 'attr;NumCycles;long;0';
cnt = cnt + 1;
footer{cnt} = 'attr;StartValue;double;0';
cnt = cnt + 1;
footer{cnt} = 'attr;NewValue;double;0';
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
% Wildcards
% $device=sl/piezo/hera_sl.02
% $attribute=Position
% $allowed_state=ON
% $sleep_monitor=0.1
% $settling_timeout=10
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