Skip to content

Commit

Permalink
dlsPLC conversion refinements
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Jan 17, 2025
1 parent 0958a67 commit d3e9ccf
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 48 deletions.
2 changes: 1 addition & 1 deletion ibek-support-dls
Submodule ibek-support-dls updated from 2d69b2 to 3d1d67
16 changes: 13 additions & 3 deletions src/builder2ibek/converters/interlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,17 @@ def handler(entity: Entity, entity_type: str, ioc: Generic_IOC):

if entity_type == "interlock":
entity.type = "dlsPLC.interlock"
entity.addr = str(entity.addr) # TODO make int in dlsPLC.ibek.support.yaml
# entity.remove("name")

hex_to_int(entity, "ilk")

if entity_type == "overrideRequestMain":
entity.type = "dlsPLC.overrideRequestMain"
# https://confluence.diamond.ac.uk/x/i4kuAw#:~:text=addr%2C%20in%2C%20and,is%20outaddr%2D1
entity.outaddr = int(entity.addr) * 10 + int(entity["in"])
entity.remove("in")
entity.remove("out")
entity.remove("addr")
entity.remove("name")

if entity_type == "overrideRequestIndividual":
entity.type = "dlsPLC.overrideRequestIndividual"
entity.remove("FIELD")
8 changes: 6 additions & 2 deletions src/builder2ibek/converters/vacuumValve.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def handler(entity: Entity, entity_type: str, ioc: Generic_IOC):
read100Objects[entity.name] = entity.port

entity.type = "dlsPLC.read100"
entity.century = "0" # TODO make int in dlsPLC.ibek.support.yaml
entity.century = 0
entity.remove("name")

if entity_type == "vacuumValveRead2":
Expand All @@ -36,7 +36,11 @@ def handler(entity: Entity, entity_type: str, ioc: Generic_IOC):
entity.type = "dlsPLC.vacValve"

entity.rename("crate", "vlvcc")
entity.addr = str(int(entity.valve) * 10) # TODO should be int
entity.addr = int(entity.valve) * 10
entity.remove("valve")

entity.port = read100Objects[entity.vlvcc]

elif entity_type == "vacuumValveGroup":
entity.type = "dlsPLC.vacValveGroup"
entity.remove("name")
20 changes: 20 additions & 0 deletions src/builder2ibek/converters/water.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from builder2ibek.converters.globalHandler import globalHandler
from builder2ibek.types import Entity, Generic_IOC

xml_component = "water"


@globalHandler
def handler(entity: Entity, entity_type: str, ioc: Generic_IOC):
"""
XML to YAML specialist convertor function for the water support module
This module gets converted to dlsPLC equivalents
"""

# water.flow and dlsPLC.flow do not appear to be equivalent
# I believe there is no dlsPLC for this;
# https://confluence.diamond.ac.uk/display/CNTRLS/Upgrade+a+Vacuum+IOC+to+use+dlsPLC#:~:text=This%20template%20reads,need%20to%20change.
# if entity_type == "flow":
# entity.type = "dlsPLC.flow"
# entity.remove("name")
40 changes: 16 additions & 24 deletions tests/samples/bl04i-va-ioc-01.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -829,12 +829,12 @@ entities:
ionp8: BL04I-VA-IONP-07

- type: dlsPLC.read100
century: '0'
century: 0
device: BL04I-VA-VLVCC-01
port: ty_40_0

- type: dlsPLC.vacValve
addr: '10'
addr: 10
device: BL04I-VA-VALVE-01
gilk0: GAUGE-01
gilk1: GAUGE-02
Expand Down Expand Up @@ -873,7 +873,7 @@ entities:
vlvcc: VLVCC01

- type: dlsPLC.vacValve
addr: '20'
addr: 20
device: BL04I-VA-VALVE-02
gilk0: GAUGE-01
gilk1: GAUGE-02
Expand Down Expand Up @@ -912,7 +912,7 @@ entities:
vlvcc: VLVCC01

- type: dlsPLC.vacValve
addr: '30'
addr: 30
device: BL04I-VA-VALVE-03
gilk0: GAUGE-01
gilk1: GAUGE-02
Expand Down Expand Up @@ -951,7 +951,7 @@ entities:
vlvcc: VLVCC01

- type: dlsPLC.vacValve
addr: '50'
addr: 50
device: BL04I-VA-VALVE-11
gilk0: GAUGE-01
gilk1: GAUGE-02
Expand Down Expand Up @@ -990,7 +990,7 @@ entities:
vlvcc: VLVCC01

- type: dlsPLC.vacValve
addr: '40'
addr: 40
device: BL04I-PS-SHTR-01
gilk0: ''
gilk1: ''
Expand Down Expand Up @@ -1042,7 +1042,7 @@ entities:
port: ty_40_0

- type: dlsPLC.interlock
addr: '7'
addr: 7
desc: Water Flow Interlocks
device: BL04I-VA-VLVCC-01
ilk0: I04 Filter
Expand All @@ -1066,7 +1066,7 @@ entities:
port: ty_40_0

- type: dlsPLC.interlock
addr: '9'
addr: 9
desc: Front End Permit
device: BL04I-VA-VLVCC-01
ilk0: Waterflows
Expand All @@ -1090,7 +1090,7 @@ entities:
port: ty_40_0

- type: dlsPLC.interlock
addr: '39'
addr: 39
desc: Machine Beam Critical
device: BL04I-VA-VLVCC-01
ilk0: V11 Open
Expand Down Expand Up @@ -1229,41 +1229,35 @@ entities:
S: 9
name: DCM.OB1

- type: interlock.overrideRequestMain
- type: dlsPLC.overrideRequestMain
P: BL04I-VA-VLVCC-01
Q: :OVERRIDE
addr: 8
in: 1
name: ITLK
out: 0
outaddr: 81
port: ty_40_0

- type: interlock.overrideRequestIndividual
- type: dlsPLC.overrideRequestIndividual
BIT: 1
DESC: HFM Piezo Overrride
FIELD: B
OVERRIDE: BL04I-VA-VLVCC-01:OVERRIDE
P: BL04I-OP-HFM-01:ILK
PRESSURE1: BL04I-VA-GAUGE-04:P
PRESSURE2: BL04I-VA-GAUGE-04:P
SETPOINT: 500
name: HFMOR

- type: interlock.overrideRequestIndividual
- type: dlsPLC.overrideRequestIndividual
BIT: 2
DESC: VFM Piezo Override
FIELD: C
OVERRIDE: BL04I-VA-VLVCC-01:OVERRIDE
P: BL04I-OP-VFM-01:ILK
PRESSURE1: BL04I-VA-GAUGE-05:P
PRESSURE2: BL04I-VA-GAUGE-05:P
SETPOINT: 500
name: VFMOR

- type: interlock.overrideRequestIndividual
- type: dlsPLC.overrideRequestIndividual
BIT: 3
DESC: Bimorph Override
FIELD: D
OVERRIDE: BL04I-VA-VLVCC-01:OVERRIDE
P: BL04I-OP-BIM-01:ILK
PRESSURE1: BL04I-VA-GAUGE-04:P
Expand All @@ -1283,10 +1277,9 @@ entities:
evr: BL04I-VA-EVR-01
name: CMS.OB1

- type: vacuumValve.vacuumValveGroup
- type: dlsPLC.vacValveGroup
delay: 10
device: BL04I-VA-GVALV-98
name: GVALV98
valve1: FE02I-VA-VALVE-02
valve2: BL04I-VA-VALVE-11
valve3: BL04I-VA-VALVE-01
Expand All @@ -1296,10 +1289,9 @@ entities:
valve7: BL04I-VA-VALVE-02
valve8: BL04I-VA-VALVE-02

- type: vacuumValve.vacuumValveGroup
- type: dlsPLC.vacValveGroup
delay: 10
device: BL04I-VA-GVALV-99
name: GVALV99
valve1: BL04I-VA-VALVE-03
valve2: BL04I-VA-VALVE-03
valve3: BL04I-VA-VALVE-03
Expand Down
36 changes: 18 additions & 18 deletions tests/samples/bl11i-va-ioc-01.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -615,12 +615,12 @@ entities:
name: D1

- type: dlsPLC.read100
century: '0'
century: 0
device: BL11I-VA-VLVCC-01
port: ty_40_3

- type: dlsPLC.read100
century: '0'
century: 0
device: BL11I-VA-VLVCC-02
port: ty_41_3

Expand All @@ -633,7 +633,7 @@ entities:
port: ty_40_3

- type: dlsPLC.vacValve
addr: '10'
addr: 10
device: BL11I-VA-VALVE-01
gilk0: Gauge01
gilk1: Gauge02
Expand All @@ -651,7 +651,7 @@ entities:
vlvcc: VLVCC1

- type: dlsPLC.vacValve
addr: '20'
addr: 20
device: BL11I-VA-VALVE-02
gilk0: Gauge01
gilk1: Gauge02
Expand All @@ -670,7 +670,7 @@ entities:
vlvcc: VLVCC1

- type: dlsPLC.vacValve
addr: '40'
addr: 40
device: BL11I-VA-VALVE-03
gilk0: Gauge01
gilk1: Gauge02
Expand All @@ -688,7 +688,7 @@ entities:
vlvcc: VLVCC1

- type: dlsPLC.vacValve
addr: '50'
addr: 50
device: BL11I-VA-VALVE-04
ilk0: Air press. OK
ilk1: IMG5 Healthy
Expand All @@ -702,7 +702,7 @@ entities:
vlvcc: VLVCC1

- type: dlsPLC.vacValve
addr: '20'
addr: 20
device: BL11I-VA-VALVE-05
ilk0: Air press. OK
ilk1: IMG6 Healthy
Expand All @@ -716,7 +716,7 @@ entities:
vlvcc: VLVCC2

- type: dlsPLC.vacValve
addr: '30'
addr: 30
device: BL11I-VA-VALVE-06
ilk0: Air press. OK
ilk1: IMG7 Healthy
Expand All @@ -730,7 +730,7 @@ entities:
vlvcc: VLVCC2

- type: dlsPLC.vacValve
addr: '10'
addr: 10
device: BL11I-PS-SHTR-01
ilk0: Air press. OK
ilk1: Guardline A
Expand All @@ -749,31 +749,31 @@ entities:
vlvcc: VLVCC2

- type: dlsPLC.vacValve
addr: '30'
addr: 30
device: BL11I-DI-PHDGN-02
ilk15: Valve Fault
name: D2
port: ty_40_3
vlvcc: VLVCC1

- type: dlsPLC.vacValve
addr: '60'
addr: 60
device: BL11I-DI-PHDGN-03
ilk15: Valve Fault
name: D3
port: ty_40_3
vlvcc: VLVCC1

- type: dlsPLC.vacValve
addr: '40'
addr: 40
device: BL11I-DI-PHDGN-04
ilk15: Valve Fault
name: D4
port: ty_41_3
vlvcc: VLVCC2

- type: dlsPLC.vacValve
addr: '60'
addr: 60
device: BL11I-PS-SHTR-02
ilk0: Air press. OK
ilk1: Guardline A
Expand All @@ -788,7 +788,7 @@ entities:
vlvcc: VLVCC2

- type: dlsPLC.interlock
addr: '7'
addr: 7
desc: Waterflow Interlocks
device: BL11I-VA-VLVCC-01
ilk0: GBC Water
Expand All @@ -800,7 +800,7 @@ entities:
port: ty_40_3

- type: dlsPLC.interlock
addr: '9'
addr: 9
desc: Front End Absorber
device: BL11I-VA-VLVCC-01
ilk0: Water OK
Expand All @@ -823,7 +823,7 @@ entities:
port: ty_40_3

- type: dlsPLC.interlock
addr: '1'
addr: 1
desc: Temperatures Zone 1
device: BL11I-VA-TMPCC-01
ilk0: GBC Temp 1
Expand All @@ -835,7 +835,7 @@ entities:
port: ty_40_2

- type: dlsPLC.interlock
addr: '2'
addr: 2
desc: Temperatures Zone 2
device: BL11I-VA-TMPCC-01
ilk0: S1 ApA Temp 1
Expand All @@ -851,7 +851,7 @@ entities:
port: ty_40_2

- type: dlsPLC.interlock
addr: '39'
addr: 39
desc: Machine Beam Critical
device: BL11I-VA-VLVCC-01
ilk0: Valve1 Open
Expand Down

0 comments on commit d3e9ccf

Please sign in to comment.