-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatic_source.py
More file actions
443 lines (431 loc) · 18.9 KB
/
static_source.py
File metadata and controls
443 lines (431 loc) · 18.9 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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
VARIABLES="variables"
VARIABLE_MODIFIERS = "variable_modifiers"
FUNCTION_MODIFIERS = "function_modifiers"
ACTIVE_FUNCTIONS = 'active_functions'
PASSIVE_FUNCTIONS = 'passive_functions'
USER_CHOICE_TYPE = "User's Choice"
active_headers_letters = [
"C", # "Control",
"C", # "Control Indicate",
"C", # "Record Control",
"C", # "Control Valve",
"K", # "Control Station",
"S", # "Switch",
"T", # "Transmit",
"T", # "Indicating Transmit",
"T", # "Recording Transmit",
"U", # "Multifunction",
"V", # "Valve Damper Louver",
"X", # "Unclassified",
"Y", # "Compute, Convert Relay",
"Z", # "Actuator, Drive"
]
active_full_name_headers = [
"Control",
"Control Indicate",
"Record Control",
"Control Valve",
"Control Station",
"Switch",
"Transmit",
"Indicating Transmit",
"Recording Transmit",
"Multifunction",
"Valve Damper Louver",
"Unclassified",
"Compute, Convert Relay",
"Actuator, Drive"
]
passive_full_name_headers = [
"Absolute Alarm",
"Deviation Alarm",
"Primary Element",
"Gauge, Glass",
"Indicate",
"Light",
"Orifice, Restriction",
"Point (Test Conn.)",
"Integrate, Total",
"Record",
"Well, Probe",
"Unclassified"
]
passive_headers_letters = [
"A", # "Absolute Alarm",
"AD", # "Deviation Alarm",
"E", # "Primary Element",
"G", # "Gauge, Glass",
"I", # "Indicate,
"L", # "Light",
"O", # "Orifice, Restriction",
"P", # "Point (Test Conn.)",
"Q", # "Integrate, Total",
"R", # "Record",
"W", # "Well, Probe",
"X", # "Unclassified"
]
bad_combination = {
"V": {"A": ["4"]}
}
refs_codes = {
"3": "Measured/Initiating Variable analysis [A] shall be used for all types of process stream composition and physical property analysis. The type of analyzer, and for stream component analyzers the components of interest, shall be defined outside the tagging bubble.",
"3a": "'User’s Choice' Measured/Initiating Variables [C], [D], and [M] are assigned to identify conductivity, density, and moisture analysis, respectively, when it is the user’s common practice.",
"4": "Measured/Initiating Variable analysis [A] shall not be used to identify vibration or other types of mechanical or machinery analysis, which shall be identified by Measured/Initiating Variable vibration or mechanical analysis [V].",
"5": "'User’s Choice' letters [C], [D], [M], [N], and [O] that cover unlisted repetitive meanings that may have one meaning as a Measured or Initiating Variable and another as a Succeeding-Letter shall be defined only once. For example, [N] may be defined as 'modulus of elasticity' as a Measured/Initiating Variable and 'oscilloscope' as a Readout/Passive Function.",
"6": "Measured/Initiating Variable multivariable [U] identifies an instrument or loop that requires multiple points of measurement or other inputs to generate single or multiple outputs, such as a PLC that uses multiple pressure and temperature measurements to regulate the switching of multiple on-off valves.",
"7": "Measured/Initiating Variable vibration or mechanical analysis [V] is intended to perform the function in machinery monitoring that Measured/Initiating Variable analysis [A] performs in process monitoring and except for vibration, it is expected that the variable of interest will be defined outside the tagging bubble.",
"8": "First-Letter or Succeeding-Letter for unclassified devices or functions [X] for non-repetitive meanings that are used only once or to a limited extent may have any number of meanings that shall be defined outside the tagging bubble or by a note in the document. For example, [XR-2] may be a stress recorder and [XX-4] may be a stress oscilloscope.",
"9": "Measured/Initiating Variable event, state, or presence [Y] is intended for use when control or monitoring responses are not driven by time or time schedule--but driven by events, presence, or state.",
"10": "Measured/Initiating Variable and Variable Modifier combinations shall be selected according to how the property being measured is modified or changed.",
"11": "Direct measured variables that shall be considered as Measured/Initiating Variables for Loop Numbering shall include but are not limited to:",
"11a": "Differential [D] — pressure [PD] or temperature [TD].",
"11b": "Total [Q] — flow totalizer [FQ], when directly measured, such as by a positive displacement flowmeter.",
"11c": "X-axis, y-axis, or z-axis [X], [Y], or [Z] — vibration [VX], [VY], and [VZ], force [WX], [WY], or [WZ] or position [ZX], [ZY], or [ZZ].",
"12": "Derived or calculated from other direct measured variables that should not be considered as Measured/Initiating Variables for Loop Numbering shall include but are not limited to:",
"12a": "Difference [D] — temperature [TD] or weight [WD].",
"12b": "Ratio [F] — Flow [FF], pressure [PF], or temperature [TF].",
"12c": "Time rate of change [K] — pressure [PK], temperature [TK], or weight [WK].",
"13": "Variable Modifier time or time schedule [K] in combination with a Measured/Initiating Variable signifies a time rate of change of the measured or initiating variable; [WK], represents a rate-of-weight-loss loop.",
"14": "Variable Modifier safety [S] is technically not a direct-measured variable but is used to identify self-actuated emergency protective primary and final control elements only when used in conjunction with Measured/Initiating Variables flow [F], pressure [P] or temperature [T].",
"14a": "Flow safety valve [FSV] applies to valves intended to protect against an emergency excess flow or loss of flow condition. Pressure safety valve [PSV] and temperature safety valve [TSV] apply to valves intended to protect against emergency pressure and temperature conditions.",
"14b": "A self-actuated pressure valve that prevents operation of a fluid system at a higher-than-desired pressure by bleeding fluid from the system is a backpressure control valve [PCV].",
"14c": "Pressure rupture disc [PSE] and fusible link [TSE] apply to all sensors or primary elements intended to protect against emergency pressure or temperature conditions.",
"14d": "[S] shall not be used to identify Safety Instrumented Systems and components.",
"15": "The grammatical form of Succeeding Letter meanings shall be modified as required; for example, ‘indicate’ [I] may be read as ‘indicator’ or ‘indicating,’ and ‘transmit’ [T] may be read as ‘transmitter’ or ‘transmitting.’",
"16": "Readout/Passive Function glass, gauge, or viewing device [G] should be used instead of Readout/Passive Function indicate [I] for instruments or devices that provide a secondary view, such as level glasses, pressure gauges, thermometers, and flow sight glasses.",
"17": "Readout/Passive Function indicate [I] applies to the analog or digital readout of an actual measurement or input signal.",
"17a": "In the case of a manual loader, it should be used for the dial or setting indication of the output signal being generated, [HIC] or [HIK].",
"18": "Readout/Passive Function scan [J] when used shall indicate a non-continuous periodic reading of two or more Measured/Initiating Variables of the same or different kinds, such as multipoint temperature and pressure recorders.",
"19": "Readout/Passive Function light [L] identifies devices or functions that are intended to indicate normal operating status, such as motor on-off or actuator position, and is not intended for alarm indication.",
"20": "Readout/Passive Function record [R] applies to any permanent or semi-permanent electronic or paper media storage of information or data in an easily retrievable form.",
"21": "Readout/Passive and Output/Active Function multifunction [U] is used to:",
"21a": "Identify control loops that have more than the usual indicate/record and control functions.",
"21b": "Save space on drawings by not showing tangent bubbles for each function.",
"21c": "A note describing the multiple functions should be on the drawing if needed for clarity.",
"22": "Readout/Passive Function accessory [X] is intended to identify hardware and devices that do not measure or control but are required for the proper operation of instrumentation.",
"23": "There are differences in meaning to be considered when selecting between Output/Active Functions for control [C], switch [S], valve, damper, or louver [V], and auxiliary device [Y]:",
"23a": "Control [C] means an automatic device or function that receives an input signal generated by a Measured/Initiating Variable and generates a variable output signal that is used to modulate or switch a valve [V] or auxiliary device [Y] at a predetermined setpoint for ordinary process control.",
"23b": "Switch [S] means a device or function that connects, disconnects, or transfers one or more air, electronic, electric, or hydraulic signals, or circuits that may be manually actuated or automatically actuated directly by a Measured or Initiating Variable, or indirectly by a Measured or Initiating Variable transmitter.",
"23c": "Valve, damper, or louver [V] means a device that modulates, switches, or turns on/off a process fluid stream after receiving an output signal generated by a controller [C], switch [S], or auxiliary device [Y].",
"23d": "Auxiliary device [Y] means an automatic device or function actuated by a controller [C], transmitter [T], or switch [S] signal that connects, disconnects, transfers, computes, and/or converts air, electronic, electric, or hydraulic signals or circuits.",
"23e": "The succeeding letters CV shall not be used for anything other than a self-actuated control valve.",
"24": "Output/Active Function control station [K] shall be used for:\n",
"- Designating an operator accessible control station used with an automatic controller that does not have an integral operator accessible auto-manual and/or control mode switch.\n"
"-Split architecture or fieldbus control devices where the controller functions are located remotely from the operator station."
"25": "Output/Active Function auxiliary devices and functions [Y] include, but are not limited to, solenoid valves, relays, and computing and converting devices and functions.",
"26": "Output/Active Function auxiliary devices [Y] for signal computing and converting when shown in a diagram or drawing shall be defined outside their bubbles with an appropriate symbol from Table 5.6 Mathematical Function Blocks and when written in text shall include a description of the mathematical function from Table 5 6.",
"27": "Function Modifiers high [H], low [L], and middle or intermediate [M] when applied to positions of valves and other open-close devices, are defined as follows:",
"27a": "High [H], the valve is in or approaching the fully open position, open [O] may be used as an alternative.",
"27b": "Low [L] the valve is in or approaching the fully closed position; closed [C] may be used as an alternative.",
"27c": "Middle or intermediate [M] the valve is traveling or located in between the fully open or closed position.",
"28": "Function Modifier deviation [D] when combined with Readout/Passive Function [A] (alarm) or Output/Active Function S (switch) indicates a measured variable has deviated from a controller or other setpoint more than a predetermined amount.",
"28a": "Function Modifiers high [H] or low [L] shall be added if only a positive or negative deviation, respectively, is of importance.",
"29": "Function Modifiers high [H], low [L], and middle or intermediate [M] when applied to alarms correspond to values of the measured variable, not to values of the alarm-actuating signal, unless otherwise noted:",
"29a": "A high-level alarm derived from a reverse-acting level transmitter signal is an LAH, even though the alarm is actuated when the signal falls to a low value.",
"29b": "The terms shall be used in combination as appropriate to indicate multiple levels of actuation from the same measurement, for example high [H] and high-high [HH], low [L] and low-low [LL], or high-low [HL].",
"30": "Variable Modifier [Z] is technically not a direct-measured variable but is used to identify the components of Safety Instrumented Systems.",
"30a": "[Z] shall not be used to identify the safety devices noted in (14)."
}
known_names_by_code = {
"FSV": "Flow safety valve",
"PSV": "Pressure safety valve",
"PCV": "Backpressure control valve",
"PSE": "Pressure rupture disc",
"TSE": "Fusible link",
}
id_letters = {
VARIABLES: {
"A": {
"name": "Analysis",
"refs": ["3", "4"]
},
"B": {
"name": "Burner, Combustion",
"refs": []
},
"C": {
"name": "User's Choice (Conductivity Analysis)",
"refs": ["3a", "5"]
},
"D": {
"name": "User's Choice (Density Analysis)",
"refs": ["3a", "5"]
},
"E": {
"name": "Voltage",
"refs": []
},
"F": {
"name": "Flow",
"refs": []
},
"G": {
"name": USER_CHOICE_TYPE,
"refs": []
},
"H": {
"name": "Hand",
"refs": []
},
"I": {
"name": "Current",
"refs": []
},
"J": {
"name": "Power",
"refs": []
},
"K": {
"name": "Time, Schedule",
"refs": []
},
"L": {
"name": "Level",
"refs": []
},
"M": {
"name": "User's Choice (Moisture Analysis)",
"refs": ["3a", "5"]
},
"N": {
"name": USER_CHOICE_TYPE,
"refs": ["5"]
},
"O": {
"name": USER_CHOICE_TYPE,
"refs": ["5"]
},
"P": {
"name": "Pressure",
"refs": []
},
"Q": {
"name": "Quantity",
"refs": []
},
"R": {
"name": "Radiation",
"refs": []
},
"S": {
"name": "Speed, Frequency",
"refs": []
},
"T": {
"name": "Temperature",
"refs": []
},
"U": {
"name": "Multivariable",
"refs": ["6"]
},
"V": {
"name": "Vibration, Mechanical Analysis",
"refs": ["4", "7"]
},
"W": {
"name": "Weight, Force",
"refs": []
},
"X": {
"name": "Unclassified",
"refs": ["8"]
},
"Y": {
"name": "Event, State, Presence",
"refs": ["9"]
},
"Z": {
"name": "Position, Dimension",
"refs": []
},
},
"variable_modifiers": {
"D": {
"name": "Difference, Differential",
"refs": ["12a"]
},
"F": {
"name": "Ratio",
"refs": ["12b"]
},
"K": {
"name": "Time Rate Of Change",
"refs": ["12c", "13"]
},
"Q": {
"name": "Integrate, Totalize",
"refs": ["11b"]
},
"S": {
"name": "Safety",
"refs": ["14"]
},
"X": {
"name": "X-axis",
"refs": ["11c"]
},
"Y": {
"name": "Y-axis",
"refs": ["11c"]
},
"Z": {
"name": "Z-axis, Safety Instrumented Systems",
"refs": ["11c", "30"]
},
},
PASSIVE_FUNCTIONS: {
"A": {
"name": "Alarm",
"refs": []
},
"B": {
"name": USER_CHOICE_TYPE,
"refs": ["5"]
},
"E": {
"name": "Sensor, Primary Element",
"refs": []
},
"G": {
"name": "Glass, Gauge, Viewing Device",
"refs": ["16"]
},
"I": {
"name": "Indicate",
"refs": ["17"]
},
"J": {
"name": "Scan",
"refs": ["18"]
},
"L": {
"name": "Light",
"refs": ["19"]
},
"N": {
"name": USER_CHOICE_TYPE,
"refs": ["5"]
},
"O": {
"name": "Orifice, Restriction",
"refs": []
},
"P": {
"name": "Point (Test Connection)",
"refs": []
},
"Q": {
"name": "Integrate, Totalize",
"refs": []
},
"R": {
"name": "Record",
"refs": ["20"]
},
"U": {
"name": "Multifunction",
"refs": ["21"]
},
"W": {
"name": "Well, Probe",
"refs": []
},
"X": {
"name": "Accessory Devices, Unclassified",
"refs": ["22", "8"]
}
},
ACTIVE_FUNCTIONS: {
"B": {
"name": USER_CHOICE_TYPE,
"refs": ["5"]
},
"C": {
"name": "Control",
"refs": ["23a", "23e"]
},
"K": {
"name": "Control Station",
"refs": ["24"]
},
"N": {
"name": USER_CHOICE_TYPE,
"refs": ["5"]
},
"S": {
"name": "Switch",
"refs": ["23b"]
},
"T": {
"name": "Transmit",
"refs": []
},
"U": {
"name": "Multifunction",
"refs": ["21"]
},
"V": {
"name": "Valve, Damper, Louver",
"refs": ["23c", "23e"]
},
"X": {
"name": "Unclassified",
"refs": ["8"]
},
"Y": {
"name": "Auxiliar Devices, Unclassified",
"refs": ["8", "22"]
},
"Z": {
"name": "Driver, Actuator, Unclassified final control element",
"refs": []
}
},
FUNCTION_MODIFIERS: {
"B": {
"name": "User’s Choice",
"refs": ["5"]
},
"C": {
"name": "Close",
"refs": ["27b"]
},
"D": {
"name": "Deviation",
"refs": ["28"]
},
"H": {
"name": "High",
"refs": ["27a", "28a", "29"]
},
"L": {
"name": "Low",
"refs": ["27b", "28", "29"]
},
"M": {
"name": "Middle, Intermediate ",
"refs": ["27c", "28", "29"]
},
"N": {
"name": "User’s Choice",
"refs": ["5"]
},
"O": {
"name": "Open",
"refs": ["27a"]
},
"R": {
"name": "Run",
"refs": []
},
"S": {
"name": "Stop",
"refs": []
},
"X": {
"name": "Unclassified",
"refs": ["8"]
},
}
}