Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
correlation
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs
util
script
matlab
correlation
Commits
34e1b86c
Commit
34e1b86c
authored
1 year ago
by
Lorenzo Pivetta
Browse files
Options
Downloads
Patches
Plain Diff
First import
parent
51f020b0
No related branches found
Branches containing commit
Tags
1.0.25
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gen_seq_corr_monitor.m
+116
-0
116 additions, 0 deletions
gen_seq_corr_monitor.m
with
116 additions
and
0 deletions
gen_seq_corr_monitor.m
0 → 100644
+
116
−
0
View file @
34e1b86c
clear
all
;
for
num_sequences
=
1
:
32
for
num_cond
=
1
:
10
clear
header
;
clear
footer
;
clear
blk
;
seq_name
=
sprintf
(
'seq_corr_monitor_%02d_%02d.txt'
,
num_sequences
,
num_cond
);
header
{
1
}
=
'#'
;
header
{
2
}
=
'# Description: Calculate FEL On/Off state getting data from $devcorrcalc'
;
header
{
3
}
=
'# Author: Giulio Gaio'
;
header
{
4
}
=
'# Date: 2020/10/19'
;
header
{
5
}
=
'#'
;
cnt
=
0
;
cnt
=
cnt
+
1
;
blk
{
cnt
}
=
sprintf
(
'step%d;sleep($sleep_monitor) && (read($devcorrcalc/State) != RUNNING) ? (write(this/FelOn) = 0) && goto(1) : (write(this/Cnt) = 0) && goto(2);Reading $devcorrcalc state;Error reading $devcorrcalc state;-1'
,
cnt
);
for
seq
=
1
:
num_sequences
cnt
=
cnt
+
1
;
blk
{
cnt
}
=
sprintf
(
'step%d;read($devcorrcalc/$attr%02d$) > read(this/CorrelThreshold) ? (write(this/Cnt) = (read(this/Cnt) + 1)) && goto(%d) : goto(%d);Reading $attr%02d$ value;Error reading $attr%02d$ value;-1;tangoerror=goto(%d)'
,
cnt
,
seq
,
cnt
+
1
,
cnt
+
1
,
seq
,
seq
,
3
+
num_sequences
+
num_cond
*
2
);
end
% additional conditions
for
i
=
1
:
num_cond
cnt
=
cnt
+
1
;
blk
{
cnt
}
=
sprintf
(
'step%d;(read(this/EnaCond%02d) == 1) ? goto(%d) : (write(this/ErrCond%02d) = 0) && goto(%d);Checking $cond_expr%02d;Error checking $cond_expr%02d;-1'
,
cnt
,
i
,
cnt
+
1
,
i
,
cnt
+
2
,
i
,
i
);
cnt
=
cnt
+
1
;
blk
{
cnt
}
=
sprintf
(
'step%d;($cond_expr%02d$) ? (write(this/ErrCond%02d) = 0) && goto(%d) : (write(this/ErrCond%02d) = 1) && goto(%d);Evaluating $cond_expr%02d$;Error evaluating $cond_expr%02d$;-1;tangoerror=goto(%d)'
,
cnt
,
i
,
i
,
cnt
+
1
,
i
,
3
+
num_sequences
+
num_cond
*
2
,
i
,
i
,
3
+
num_sequences
+
num_cond
*
2
);
end
% FEL state calculation
cnt
=
cnt
+
1
;
blk
{
cnt
}
=
sprintf
(
'step%d;(write(this/FelEnabled) = 1) && read(this/Cnt) >= read(this/CntThreshold) ? (write(this/FelOn) = 1) && goto(1) : (write(this/FelOn) = 0) && goto(1);Calculating FEL state;Error calculating FEL state;-1'
,
cnt
);
% Error step
cnt
=
cnt
+
1
;
blk
{
cnt
}
=
sprintf
(
'step%d;(write(this/FelOn) = 0) && (write(this/FelEnabled) = 0) && goto(1);Setting FEL error state;Setting FEL error state;-1'
,
cnt
);
% Dynamic attributes
cnt
=
0
;
cnt
=
cnt
+
1
;
footer
{
cnt
}
=
'attr;Cnt;long;0'
;
cnt
=
cnt
+
1
;
footer
{
cnt
}
=
'attr;CntThreshold;long;0'
;
cnt
=
cnt
+
1
;
footer
{
cnt
}
=
'attr;CorrelThreshold;double;0.6'
;
for
i
=
1
:
num_cond
cnt
=
cnt
+
1
;
footer
{
cnt
}
=
sprintf
(
'attr;EnaCond%02d;bool;1'
,
i
);
end
for
i
=
1
:
num_cond
cnt
=
cnt
+
1
;
footer
{
cnt
}
=
sprintf
(
'attr;ErrCond%02d;bool;0'
,
i
);
end
cnt
=
cnt
+
1
;
footer
{
cnt
}
=
'attr;FelOn;bool;0'
;
cnt
=
cnt
+
1
;
footer
{
cnt
}
=
'attr;FelEnabled;bool;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
end
% Dynamic R/W attributes
%
% User
% attr;CntThreshold;long;2
% attr;CorrelThreshold;long;0.6
% Internal
% attr;Cnt;long;0
% attr;FelOn;bool;0
% Wildcards
% $devcorrcalc=seq/calc/fast_stats_fel
% sleep_monitor=2
% $sleep_monitor=1
% $attr01$=t001_t002_Corr
% $attr02$=t001_t002_Corr
%
% .........
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment