Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
condition
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
condition
Commits
5cbb6eec
Commit
5cbb6eec
authored
1 year ago
by
Lorenzo Pivetta
Browse files
Options
Downloads
Patches
Plain Diff
First import
parent
ce6fb5fc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gen_seq_condition.m
+58
-0
58 additions, 0 deletions
gen_seq_condition.m
gen_seq_condition_recov.m
+72
-0
72 additions, 0 deletions
gen_seq_condition_recov.m
with
130 additions
and
0 deletions
gen_seq_condition.m
0 → 100644
+
58
−
0
View file @
5cbb6eec
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
This diff is collapsed.
Click to expand it.
gen_seq_condition_recov.m
0 → 100644
+
72
−
0
View file @
5cbb6eec
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
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