diff --git a/gen_seq_saverestore.m b/gen_seq_saverestore.m
new file mode 100644
index 0000000000000000000000000000000000000000..9e71fa95b8563ecbee585a756b66df8d82846094
--- /dev/null
+++ b/gen_seq_saverestore.m
@@ -0,0 +1,171 @@
+clear all;
+
+for num_sequences=1:350
+
+seq_name = sprintf('seq_saverestore_%d.txt',num_sequences);
+
+header{1} = '#';
+header{2} = '# Description: $description';
+header{3} = '# Author: Sequencer Library';
+header{4} = '# Date: 2019/07/26';
+header{5} = '#';
+header{6} = sprintf('# This sequence save and restore automatically %d attributes',num_sequences);
+header{7} = '#';
+
+cnt = 0;
+
+error_step = 4 * num_sequences + 11;
+end_step = error_step + 1;
+store_step = 3 * num_sequences + 9;
+
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;(write(this/RestoreCounter) = 0) && (write(this/RestoreError) = 0) && (write(this/TmpSaveDone) = 0) && goto(%d);Reset variables;Error resetting variables;-1',cnt,cnt+1);
+
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;(write(this/SaveTime) = 0) && (write(this/RestoreTime) = 0) && (write(this/StartTime) = read($devtime_attr)) && (write(this/EndTime) = read(this/StartTime)) && goto(%d);Reset variables;Error resetting variables;-1',cnt,cnt+1);
+
+cnt = cnt + 1;
+startloop_cnt = cnt;
+blk{cnt}=sprintf('step%d;(write(this/StartTime) = read($devtime_attr)) && (write(this/DoneCounter) = 0) && goto(%d);Selection save/restore action;Error selecting save/restore action;-1;tangoerror=goto(%d)',cnt,cnt+1,error_step);
+
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;(read(this/Restore) == 0) ? sleep($sleep_monitor) && goto(%d) : goto(%d);Acquiring monitor counter;Error acquiring monitor counter;-1;tangoerror=goto(%d)',cnt,cnt+1,store_step,error_step);
+
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;(read(this/TmpSaveDone) == 0) ? (write(this/MonitorCounter) = read($devmon_attr)) && (write(this/TmpSaveDone) = 1) && sleep($sleep_monitor) && goto(%d) : goto(%d);Saving temporary data;Error saving temporary data;-1;tangoerror=goto(%d)',cnt,cnt+1,cnt+1+num_sequences*2,error_step);
+
+% Save temporary attributes
+for seq=1:num_sequences
+    cnt = cnt + 1;
+    blk{cnt}=sprintf('step%d;read(this/EnableSave_attr%03d) == 1 ? (write(this/attr%03d_tmp) = read($devattr%03d$)) && (write(this/DoneCounter) = (read(this/DoneCounter) + 1)) && goto(%d) : (write(this/DoneCounter) = (read(this/DoneCounter) + 1)) && goto(%d);Saving temporary $devattr%03d$;Error saving temporary $devattr%03d$;-1;tangoerror=goto(%d)',cnt,seq,seq,seq,cnt+2,cnt+2,seq,seq,cnt+1);
+   cnt = cnt + 1;
+   blk{cnt}=sprintf('step%d;read(this/ForceSave) == 1 ? (write(this/attr%03d_tmp) = 1234567890) && (write(this/DoneCounter) = (read(this/DoneCounter) + 1)) && goto(%d) : goto(%d);Checking ForceSave flag;Error checking ForceSave flag;-1',cnt,seq,cnt+1,error_step);
+end
+
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;(((read(this/StartTime)-read(this/EndTime)) > $sleep_thread) || (read(this/ContinuousMode) == 0)) ? (write(this/TmpSaveDone) = 0) && (write(this/EndTime) = read(this/StartTime)) && goto(%d) : goto(%d);Acquiring monitor counter;Error acquiring monitor counter;-1',cnt,cnt+1,startloop_cnt);
+
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;((read(this/MonitorCounter) == read($devmon_attr)) && ($devmon_cond)) ? goto(%d) : goto(%d);Checking monitor counter;Failed to check monitor counter;-1;tangoerror=goto(%d)',cnt,cnt+1,error_step,error_step);
+
+% Convert temporary attributes to official
+for seq=1:num_sequences
+    cnt = cnt + 1;
+    blk{cnt}=sprintf('step%d;read(this/EnableSave_attr%03d) == 1 ? (write(this/attr%03d) = read(this/attr%03d_tmp)) && goto(%d) : goto(%d);Storing permanent $devattr%03d$;Error storing permanent $devattr%03d$;-1',cnt,seq,seq,seq,cnt+1,cnt+1,seq,seq);
+end    
+    
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;(write(this/SaveCounter) = (read(this/SaveCounter)+1))  && (write(this/SaveTime) = read(this/StartTime)) && goto(%d);Incrementing save counter;Error incrementing save counter;-1',cnt,end_step);
+
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;read(this/SaveCounter) > 0 ? (write(this/DoneCounter) = 0) && goto(%d) : goto(%d);Checking permanent variable;Error checking permanent variable;-1',cnt,cnt+1,error_step);
+
+% Restore attributes 
+for seq=1:num_sequences
+    cnt = cnt + 1;
+    blk{cnt}=sprintf('step%d;((read(this/EnableRestore_attr%03d) == 1) && (read(this/attr%03d) != 1234567890)) ? (write($devattr%03d$) = read(this/attr%03d)) && (write(this/DoneCounter) = (read(this/DoneCounter) + 1)) && sleep($sleep_write) && goto(%d) : (write(this/DoneCounter) = (read(this/DoneCounter) + 1)) && goto(%d);Restoring $devattr%03d$;Error restoring $devattr%03d$;-1;tangoerror=goto(%d)',cnt,seq,seq,seq,seq,cnt+1,cnt+1,seq,seq,cnt+1);
+end
+
+% Check if restore if all attributes are restored
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;(write(this/Restore) = 0) && ((read(this/DoneCounter) != %d) && (read(this/ForceRestore) == 0))  ? (write(this/RestoreError) = 1) && goto(%d) : (write(this/RestoreError) = 0) && (write(this/RestoreCounter) = (read(this/RestoreCounter)+1)) && (write(this/RestoreTime) = read(this/StartTime)) && goto(%d);Check restore execution success;Error checking restore execution success;-1',cnt,num_sequences,error_step,end_step);
+
+% Exit with error
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;read(this/ContinuousMode) == 1 ? (write(this/TmpSaveDone) = 0) && sleep(1) && goto(%d) : goto(-1);Managing error;Error during save sequence;-1',cnt,startloop_cnt);
+
+% Exit ok
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;read(this/ContinuousMode) == 1 ? goto(%d) : goto(%d);Managing error;Error during save sequence;-1',cnt,startloop_cnt,cnt+1);
+
+
+
+% dynamic attributes
+cnt = 0; 
+
+cnt = cnt + 1;
+footer{cnt} = 'attr;ContinuousMode;bool;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;Restore;bool;0';
+
+% permanent stored attributes
+for seq=1:num_sequences
+    cnt = cnt + 1;
+    footer{cnt} = sprintf('attr;attr%03d;double;0',seq);
+end
+
+% permanent stored attributes
+for seq=1:num_sequences
+    cnt = cnt + 1;
+    footer{cnt} = sprintf('attr;EnableSave_attr%03d;bool;1',seq);
+end
+
+% permanent stored attributes
+for seq=1:num_sequences
+    cnt = cnt + 1;
+    footer{cnt} = sprintf('attr;EnableRestore_attr%03d;bool;1',seq);
+end
+
+
+% ptemporary stored attributes
+for seq=1:num_sequences
+    cnt = cnt + 1;
+    footer{cnt} = sprintf('attr;attr%03d_tmp;double;0',seq);
+end
+
+cnt = cnt + 1;
+footer{cnt} = 'attr;ForceRestore;bool;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;ForceSave;bool;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;TmpSaveDone;bool;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;RestoreError;bool;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;SaveCounter;long;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;RestoreCounter;long;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;DoneCounter;long;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;MonitorCounter;long;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;SaveTime;long;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;RestoreTime;long;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;StartTime;long;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;EndTime;long;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
+% $description=
+% $devmon_attr=seq/monitor/dcct_sr/ErrorCount
+% $devtime_attr=sequencer/test/seq_util.01/Date[0]
+% $sleep_thread=1
+% $sleep_monitor=3
+% $sleep_write=1
+% $devattr1$=
+% $devattr2$=
+% $devattr3$=
+% .........
+
diff --git a/gen_seq_saverestore_set.m b/gen_seq_saverestore_set.m
new file mode 100644
index 0000000000000000000000000000000000000000..e633768eab9b93fb3f522f30116939f54aecc37a
--- /dev/null
+++ b/gen_seq_saverestore_set.m
@@ -0,0 +1,171 @@
+clear all;
+
+for num_sequences=1:350
+
+seq_name = sprintf('seq_saverestore_set_%d.txt',num_sequences);
+
+header{1} = '#';
+header{2} = '# Description: $description';
+header{3} = '# Author: Sequencer Library';
+header{4} = '# Date: 2021/04/01';
+header{5} = '#';
+header{6} = sprintf('# This sequence save the set part of the attributes and restore automatically %d attributes',num_sequences);
+header{7} = '#';
+
+cnt = 0;
+
+error_step = 4 * num_sequences + 11;
+end_step = error_step + 1;
+store_step = 3 * num_sequences + 9;
+
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;(write(this/RestoreCounter) = 0) && (write(this/RestoreError) = 0) && (write(this/TmpSaveDone) = 0) && goto(%d);Reset variables;Error resetting variables;-1',cnt,cnt+1);
+
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;(write(this/SaveTime) = 0) && (write(this/RestoreTime) = 0) && (write(this/StartTime) = read($devtime_attr)) && (write(this/EndTime) = read(this/StartTime)) && goto(%d);Reset variables;Error resetting variables;-1',cnt,cnt+1);
+
+cnt = cnt + 1;
+startloop_cnt = cnt;
+blk{cnt}=sprintf('step%d;(write(this/StartTime) = read($devtime_attr)) && (write(this/DoneCounter) = 0) && goto(%d);Selection save/restore action;Error selecting save/restore action;-1;tangoerror=goto(%d)',cnt,cnt+1,error_step);
+
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;(read(this/Restore) == 0) ? sleep($sleep_monitor) && goto(%d) : goto(%d);Acquiring monitor counter;Error acquiring monitor counter;-1;tangoerror=goto(%d)',cnt,cnt+1,store_step,error_step);
+
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;(read(this/TmpSaveDone) == 0) ? (write(this/MonitorCounter) = read($devmon_attr)) && (write(this/TmpSaveDone) = 1) && sleep($sleep_monitor) && goto(%d) : goto(%d);Saving temporary data;Error saving temporary data;-1;tangoerror=goto(%d)',cnt,cnt+1,cnt+1+num_sequences*2,error_step);
+
+% Save temporary attributes
+for seq=1:num_sequences
+    cnt = cnt + 1;
+    blk{cnt}=sprintf('step%d;read(this/EnableSave_attr%03d) == 1 ? (write(this/attr%03d_tmp) = read($devattr%03d$[1])) && (write(this/DoneCounter) = (read(this/DoneCounter) + 1)) && goto(%d) : (write(this/DoneCounter) = (read(this/DoneCounter) + 1)) && goto(%d);Saving temporary $devattr%03d$;Error saving temporary $devattr%03d$;-1;tangoerror=goto(%d)',cnt,seq,seq,seq,cnt+2,cnt+2,seq,seq,cnt+1);
+   cnt = cnt + 1;
+   blk{cnt}=sprintf('step%d;read(this/ForceSave) == 1 ? (write(this/attr%03d_tmp) = 1234567890) && (write(this/DoneCounter) = (read(this/DoneCounter) + 1)) && goto(%d) : goto(%d);Checking ForceSave flag;Error checking ForceSave flag;-1',cnt,seq,cnt+1,error_step); 
+end
+
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;(((read(this/StartTime)-read(this/EndTime)) > $sleep_thread) || (read(this/ContinuousMode) == 0)) ? (write(this/TmpSaveDone) = 0) && (write(this/EndTime) = read(this/StartTime)) && goto(%d) : goto(%d);Acquiring monitor counter;Error acquiring monitor counter;-1',cnt,cnt+1,startloop_cnt);
+
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;((read(this/MonitorCounter) == read($devmon_attr)) && ($devmon_cond)) ? goto(%d) : goto(%d);Checking monitor counter;Failed to check monitor counter;-1;tangoerror=goto(%d)',cnt,cnt+1,error_step,error_step);
+
+% Convert temporary attributes to official
+for seq=1:num_sequences
+    cnt = cnt + 1;
+    blk{cnt}=sprintf('step%d;read(this/EnableSave_attr%03d) == 1 ? (write(this/attr%03d) = read(this/attr%03d_tmp)) && goto(%d) : goto(%d);Storing permanent $devattr%03d$;Error storing permanent $devattr%03d$;-1',cnt,seq,seq,seq,cnt+1,cnt+1,seq,seq);
+end    
+    
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;(write(this/SaveCounter) = (read(this/SaveCounter)+1))  && (write(this/SaveTime) = read(this/StartTime)) && goto(%d);Incrementing save counter;Error incrementing save counter;-1',cnt,end_step);
+
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;read(this/SaveCounter) > 0 ? (write(this/DoneCounter) = 0) && goto(%d) : goto(%d);Checking permanent variable;Error checking permanent variable;-1',cnt,cnt+1,error_step);
+
+% Restore attributes 
+for seq=1:num_sequences
+    cnt = cnt + 1;
+    blk{cnt}=sprintf('step%d;((read(this/EnableRestore_attr%03d) == 1) && (read(this/attr%03d) != 1234567890)) ? (write($devattr%03d$) = read(this/attr%03d)) && (write(this/DoneCounter) = (read(this/DoneCounter) + 1)) && sleep($sleep_write) && goto(%d) : (write(this/DoneCounter) = (read(this/DoneCounter) + 1)) && goto(%d);Restoring $devattr%03d$;Error restoring $devattr%03d$;-1;tangoerror=goto(%d)',cnt,seq,seq,seq,seq,cnt+1,cnt+1,seq,seq,cnt+1);
+end
+
+% Check if restore if all attributes are restored
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;(write(this/Restore) = 0) && ((read(this/DoneCounter) != %d) && (read(this/ForceRestore) == 0)) ? (write(this/RestoreError) = 1) && goto(%d) : (write(this/RestoreError) = 0) && (write(this/RestoreCounter) = (read(this/RestoreCounter)+1)) && (write(this/RestoreTime) = read(this/StartTime)) && goto(%d);Check restore execution success;Error checking restore execution success;-1',cnt,num_sequences,error_step,end_step);
+
+% Exit with error
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;read(this/ContinuousMode) == 1 ? (write(this/TmpSaveDone) = 0) && sleep(1) && goto(%d) : goto(-1);Managing error;Error during save sequence;-1',cnt,startloop_cnt);
+
+% Exit ok
+cnt = cnt + 1;
+blk{cnt}=sprintf('step%d;read(this/ContinuousMode) == 1 ? goto(%d) : goto(%d);Managing error;Error during save sequence;-1',cnt,startloop_cnt,cnt+1);
+
+
+
+% dynamic attributes
+cnt = 0; 
+
+cnt = cnt + 1;
+footer{cnt} = 'attr;ContinuousMode;bool;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;Restore;bool;0';
+
+% permanent stored attributes
+for seq=1:num_sequences
+    cnt = cnt + 1;
+    footer{cnt} = sprintf('attr;attr%03d;double;0',seq);
+end
+
+% permanent stored attributes
+for seq=1:num_sequences
+    cnt = cnt + 1;
+    footer{cnt} = sprintf('attr;EnableSave_attr%03d;bool;1',seq);
+end
+
+% permanent stored attributes
+for seq=1:num_sequences
+    cnt = cnt + 1;
+    footer{cnt} = sprintf('attr;EnableRestore_attr%03d;bool;1',seq);
+end
+
+
+% ptemporary stored attributes
+for seq=1:num_sequences
+    cnt = cnt + 1;
+    footer{cnt} = sprintf('attr;attr%03d_tmp;double;0',seq);
+end
+
+cnt = cnt + 1;
+footer{cnt} = 'attr;ForceRestore;bool;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;ForceSave;bool;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;TmpSaveDone;bool;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;RestoreError;bool;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;SaveCounter;long;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;RestoreCounter;long;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;DoneCounter;long;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;MonitorCounter;long;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;SaveTime;long;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;RestoreTime;long;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;StartTime;long;0';
+cnt = cnt + 1;
+footer{cnt} = 'attr;EndTime;long;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
+% $description=
+% $devmon_attr=seq/monitor/dcct_sr/ErrorCount
+% $devtime_attr=sequencer/test/seq_util.01/Date[0]
+% $sleep_thread=1
+% $sleep_monitor=3
+% $sleep_write=1
+% $devattr1$=
+% $devattr2$=
+% $devattr3$=
+% .........
+