diff --git a/src/builder2ibek/converters/mks937a.py b/src/builder2ibek/converters/mks937a.py index 2bfb06b..c406e77 100644 --- a/src/builder2ibek/converters/mks937a.py +++ b/src/builder2ibek/converters/mks937a.py @@ -10,5 +10,5 @@ def handler(entity: Entity, entity_type: str, ioc: Generic_IOC): XML to YAML specialist convertor function for the mks937a support module """ # remove GUI only parameters (except on mks937aGauge which uses it for object ref) - if entity_type not in ["mks937aGauge", "mks937a"]: + if entity_type not in ["mks937aGauge", "mks937a", "mks937aGaugeEGU"]: entity.remove("name") diff --git a/src/builder2ibek/utils.py b/src/builder2ibek/utils.py index d31c30c..ee5b437 100644 --- a/src/builder2ibek/utils.py +++ b/src/builder2ibek/utils.py @@ -29,3 +29,32 @@ def hex_to_int(entity: Entity, prefix: str): hex_key = f"{prefix}{hex(n)[2:].upper()}" if hex_key in entity: entity.rename(hex_key, f"{prefix}{n}") + + +hz_list = [ + "1Hz", + "2Hz", + "5Hz", + "10Hz", + "20Hz", + "50Hz", + "100Hz", + "200Hz", + "500Hz", + "1kHz", + "2kHz", + "5kHz", + "10kHz", + "20kHz", + "50kHz", + "100kHz", +] + + +def int_to_Hertz(entity: Entity, key: str): + """ + Convert an integer key to a Hertz key + """ + if key in entity and type(entity[key]) is int: + hz = hz_list[entity[key]] + entity[key] = hz diff --git a/tests/samples/bl04i-va-ioc-01.yaml b/tests/samples/bl04i-va-ioc-01.yaml index 66749ba..8936a61 100644 --- a/tests/samples/bl04i-va-ioc-01.yaml +++ b/tests/samples/bl04i-va-ioc-01.yaml @@ -1136,19 +1136,16 @@ entities: - type: rackFan.rackFan c: 60 device: BL04I-PS-FANC-01 - name: VAFAN1 s: 11 - type: rackFan.rackFan c: 60 device: BL04I-PS-PSU-01 - name: PSUFAN s: 12 - type: rackFan.rackFan c: 60 device: BL04I-VA-RACK-01:PSU-01 - name: PSUHEALTH s: 13 - type: water.flow diff --git a/tests/samples/bl11i-va-ioc-01.yaml b/tests/samples/bl11i-va-ioc-01.yaml index 4cc0afa..cf90dd6 100644 --- a/tests/samples/bl11i-va-ioc-01.yaml +++ b/tests/samples/bl11i-va-ioc-01.yaml @@ -221,79 +221,66 @@ entities: - type: rackFan.rackFan c: 60 device: BL11I-EA-FANC-01 - name: FANC1 s: 0 - type: rackFan.rackFan c: 60 device: BL11I-PS-FANC-01 - name: FANC2 s: 1 - type: rackFan.rackFan c: 60 device: BL11I-PS-PSU-01 - name: FANC3 s: 2 - type: rackFan.rackFan c: 60 device: BL11I-VA-FANC-01 - name: FANC4 s: 3 - type: rackFan.rackFan c: 60 device: BL11I-MO-FANC-01 - name: FANC5 s: 4 - type: rackFan.rackFan c: 60 device: BL11I-MO-FANC-02 - name: FANC6 s: 5 - type: rackFan.rackFan c: 60 device: BL11I-VA-FANC-02 - name: FANC7 s: 6 - type: rackFan.rackFan c: 60 device: BL11I-NT-FANC-01 - name: FANC8 s: 7 - type: rackFan.rackFan c: 60 device: BL11I-DA-FANC-01 - name: FANC9 s: 8 - type: rackFan.rackFan c: 60 device: BL11I-MO-FANC-03 - name: FANC10 s: 9 - type: rackFan.rackFan c: 60 device: BL11I-EA-FANC-02 - name: FANC11 s: 10 - type: rackFan.rackFan c: 60 device: BL11I-EA-FANC-03 - name: FANC12 s: 11 - type: rackFan.rackFan c: 60 device: BL11I-OP-FANC-01 - name: FANC13 s: 12 - type: rackFan.rackFan @@ -305,7 +292,6 @@ entities: - type: rackFan.rackFan c: 60 device: BL11I-EA-ROBOT-01:MOVN - name: ROBOT s: 37 - type: temperature.temperaturePLCRead diff --git a/tests/samples/sr03c-va-ioc-01.yaml b/tests/samples/sr03c-va-ioc-01.yaml index 0d32e43..d5483dc 100644 --- a/tests/samples/sr03c-va-ioc-01.yaml +++ b/tests/samples/sr03c-va-ioc-01.yaml @@ -159,36 +159,43 @@ entities: dom: SR03S id: 1 input: SR03S-VA-GAUGE-01:RAW + name: GAUGE_S_01 - type: mks937a.mks937aGaugeEGU dom: SR03S id: 2 input: SR03S-VA-GAUGE-02:RAW + name: GAUGE_S_02 - type: mks937a.mks937aGaugeEGU dom: SR03A id: 1 input: SR03A-VA-GAUGE-01:RAW + name: GAUGE_A_01 - type: mks937a.mks937aGaugeEGU dom: SR03A id: 2 input: SR03A-VA-GAUGE-02:RAW + name: GAUGE_A_02 - type: mks937a.mks937aGaugeEGU dom: SR03A id: 3 input: SR03A-VA-GAUGE-03:RAW + name: GAUGE_A_03 - type: mks937a.mks937aGaugeEGU dom: SR03A id: 4 input: SR03A-VA-GAUGE-04:RAW + name: GAUGE_A_04 - type: mks937a.mks937aGaugeEGU dom: SR03A id: 31 input: SR03A-VA-GAUGE-31:RAW + name: GAUGE_A_31 - type: mks937a.mks937aImg GCTLR: GCTLR_S_01