-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsequences.py
More file actions
262 lines (224 loc) · 9.75 KB
/
Copy pathsequences.py
File metadata and controls
262 lines (224 loc) · 9.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
from dls_fe_sequencer.fe_sequencer import Action, Condition
class Sequence:
def __init__(self):
self.no_of_absorbers = 1
self.close_actions: list[Action] = []
self.close_conditions: list[Condition] = []
self.open_actions: list[Action] = []
self.open_conditions: list[Condition] = []
def define_close_sequence(self):
return self.close_actions, self.close_conditions
def define_open_sequence(self):
return self.open_actions, self.open_conditions
class OneAbsorber(Sequence):
def __init__(self):
super().__init__()
print(f"Creating {self.__class__} sequencer")
self.no_of_absorbers = 1
# Define closing actions
self.close_actions.append(
Action("Updating beam status", "BEAM", "STA", "Closing")
)
self.close_actions.append(Action("Closing absorber", "ABSB", "CON", "Close"))
self.close_actions.append(Action("Closing SHTR 02", "SHTR", "CON", "Close"))
self.close_actions.append(Action("Closing V2", "V2", "CON", "Close"))
self.close_actions.append(
Action("Updating beam status", "BEAM", "STA", "Closed")
)
# Define closing conditions
self.close_conditions.append(Condition())
self.close_conditions.append(
Condition("Waiting for absorber to close", "ABSB", "STA", ["Closed"])
)
self.close_conditions.append(
Condition("Waiting for Shutter to close", "SHTR", "STA", ["Closed"])
)
self.close_conditions.append(
Condition("Waiting for V2 to close", "V2", "STA", ["Closed"])
)
self.close_conditions.append(Condition())
# Define opening actions
self.open_actions.append(
Action("Updating beam status", "BEAM", "STA", "Opening")
)
self.open_actions.append(Action("Resetting FV1", "FV", "CON", "Reset"))
self.open_actions.append(Action("Arming FV1", "FV", "CON", "Arm"))
self.open_actions.append(Action("Resetting V2", "V2", "CON", "Reset"))
self.open_actions.append(Action("Opening V2", "V2", "CON", "Open"))
self.open_actions.append(Action("Resetting Shutter 2", "SHTR", "CON", "Reset"))
self.open_actions.append(Action("Opening Shutter 2", "SHTR", "CON", "Open"))
self.open_actions.append(Action("Resetting Absorber", "ABSB", "CON", "Reset"))
self.open_actions.append(Action("Opening Absorber", "ABSB", "CON", "Open"))
self.open_actions.append(Action("Updating beam status", "BEAM", "STA", "Open"))
# Define opening conditions
self.open_conditions.append(Condition())
self.open_conditions.append(
Condition("Waiting for FV1 to reset", "FV", "ILKSTA", ["OK", "Run Ilks Ok"])
)
self.open_conditions.append(
Condition("Waiting for FV1 to arm", "FV", "STA", ["Open Armed"])
)
self.open_conditions.append(
Condition("Waiting for V2 to reset", "V2", "ILKSTA", ["OK", "Run Ilks Ok"])
)
self.open_conditions.append(
Condition("Waiting for V2 to Open", "V2", "STA", ["Open"])
)
self.open_conditions.append(
Condition(
"Waiting for Shutter 2 to reset",
"SHTR",
"ILKSTA",
["OK", "Run Ilks Ok"],
)
)
self.open_conditions.append(
Condition("Waiting for Shutter 2 to Open", "SHTR", "STA", ["Open"])
)
self.open_conditions.append(
Condition(
"Waiting for Absorber to reset", "ABSB", "ILKSTA", ["OK", "Run Ilks Ok"]
)
)
self.open_conditions.append(
Condition("Waiting for Absorber to Open", "ABSB", "STA", ["Open"])
)
self.open_conditions.append(Condition())
class TwoAbsorbers(OneAbsorber):
def __init__(self):
super().__init__()
self.no_of_absorbers = 2
class OneAbsorberFull(OneAbsorber):
def __init__(self):
super().__init__()
# Create additional steps to open other FE components not normally
# used by the BL
self.open_conditions_full: list[Condition] = []
self.open_actions_full: list[Action] = []
# Define where in the original open_conditions and open_actions we want
# to insert these new steps. This will be at the beginning but after the
# updating of the status PV, hence 1.
insert_index = 1
# Open and arm FV1
self.open_actions_full.append(Action("Resetting FV1", "FV", "CON", "Reset"))
self.open_conditions_full.append(
Condition("Waiting for FV1 to reset", "FV", "ILKSTA", ["OK", "Run Ilks Ok"])
)
self.open_actions_full.append(Action("Opening FV1", "FV", "CON", "Open"))
self.open_conditions_full.append(
Condition(
"Waiting for FV1 to open",
"FV",
"STA",
["Open Disarmed", "Open Armed"],
)
)
self.open_actions_full.append(Action("Arming FV1", "FV", "CON", "Arm"))
self.open_conditions_full.append(
Condition("Waiting for FV1 to arm", "FV", "STA", ["Open Armed"])
)
# Open V1
self.open_actions_full.append(Action("Resetting V1", "V1", "CON", "Reset"))
self.open_conditions_full.append(
Condition("Waiting for V1 to reset", "V1", "ILKSTA", ["OK", "Run Ilks Ok"])
)
self.open_actions_full.append(Action("Opening V1", "V1", "CON", "Open"))
self.open_conditions_full.append(
Condition("Waiting for V1 to open", "V1", "STA", ["Open"])
)
# Open port shutter
self.open_actions_full.append(
Action("Resetting PSHTR", "PSHTR", "CON", "Reset")
)
self.open_conditions_full.append(
Condition(
"Waiting for SHTR-01 to reset",
"PSHTR",
"ILKSTA",
["OK", "Run Ilks Ok"],
)
)
self.open_actions_full.append(Action("Opening PSHTR", "PSHTR", "CON", "Open"))
self.open_conditions_full.append(
Condition("Waiting for SHTR-01 to Open", "PSHTR", "STA", ["Open"])
)
# Insert our new lists into the ones defined in the super class
for i in range(len(self.open_actions_full)):
self.open_actions.insert(insert_index + i, self.open_actions_full[i])
for i in range(len(self.open_conditions_full)):
self.open_conditions.insert(insert_index + i, self.open_conditions_full[i])
class TwoAbsorbersFull(TwoAbsorbers):
def __init__(self):
super().__init__()
# Create additional steps to open other FE components not normally
# used by the BL
self.open_conditions_full: list[Condition] = []
self.open_actions_full: list[Action] = []
# Define where in the original open_conditions and open_actions we
# want to insert these new steps. This will be at the beginning but
# after the updating of the status PV, hence 1.
insert_index = 1
# Open and arm FV1
self.open_actions_full.append(Action("Resetting FV1", "FV", "CON", "Reset"))
self.open_conditions_full.append(
Condition("Waiting for FV1 to reset", "FV", "ILKSTA", ["OK", "Run Ilks Ok"])
)
self.open_actions_full.append(Action("Opening FV1", "FV", "CON", "Open"))
self.open_conditions_full.append(
Condition(
"Waiting for FV1 to open",
"FV",
"STA",
["Open Disarmed", "Open Armed"],
)
)
self.open_actions_full.append(Action("Arming FV1", "FV", "CON", "Arm"))
self.open_conditions_full.append(
Condition("Waiting for FV1 to arm", "FV", "STA", ["Open Armed"])
)
# Open V1
self.open_actions_full.append(Action("Resetting V1", "V1", "CON", "Reset"))
self.open_conditions_full.append(
Condition("Waiting for V1 to reset", "V1", "ILKSTA", ["OK", "Run Ilks Ok"])
)
self.open_actions_full.append(Action("Opening V1", "V1", "CON", "Open"))
self.open_conditions_full.append(
Condition("Waiting for V1 to open", "V1", "STA", ["Open"])
)
# Open ABSB-01
self.open_actions_full.append(
Action("Resetting ABSB-01", "ABSB1", "CON", "Reset")
)
self.open_conditions_full.append(
Condition(
"Waiting for ABSB-01 to reset",
"ABSB1",
"ILKSTA",
["OK", "Run Ilks Ok"],
)
)
self.open_actions_full.append(Action("Opening ABSB-01", "ABSB1", "CON", "Open"))
self.open_conditions_full.append(
Condition("Waiting for ABSB-01 to open", "ABSB1", "STA", ["Open"])
)
# Open port shutter
self.open_actions_full.append(
Action("Resetting PSHTR", "PSHTR", "CON", "Reset")
)
self.open_conditions_full.append(
Condition(
"Waiting for SHTR-01 to reset",
"PSHTR",
"ILKSTA",
["OK", "Run Ilks Ok"],
)
)
self.open_actions_full.append(Action("Opening PSHTR", "PSHTR", "CON", "Open"))
self.open_conditions_full.append(
Condition("Waiting for SHTR-01 to Open", "PSHTR", "STA", ["Open"])
)
# Insert our new lists into the ones defined in the super class
for i in range(len(self.open_actions_full)):
self.open_actions.insert(insert_index + i, self.open_actions_full[i])
for i in range(len(self.open_conditions_full)):
self.open_conditions.insert(insert_index + i, self.open_conditions_full[i])