Skip to content

Commit

Permalink
fixes to pmac for bl03i-mo-ioc-01
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed May 30, 2024
1 parent d2d029c commit 67aad8c
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions src/builder2ibek/converters/pmac.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,25 @@ def handler(entity: Entity, entity_type: str, ioc: Generic_IOC):
"""
XML to YAML specialist convertor function for the pmac support module
"""
# remove redundant parameters
entity.remove("gda_desc")
entity.remove("gda_name")

if entity_type == "pmacDisableLimitsCheck":
# remove GUI only parameters
entity.remove("name")

elif (
entity_type == "dls_pmac_asyn_motor" or entity_type == "dls_pmac_cs_asyn_motor"
):
elif entity_type in [
"dls_pmac_asyn_motor",
"dls_pmac_cs_asyn_motor",
]:
if entity_type == "dls_pmac_cs_asyn_motor":
entity.type = "pmac.dls_pmac_asyn_motor"
entity.is_cs = True
# standardise the name of the controller port
entity.rename("PORT", "Controller")
# this is calculated
entity.remove("SPORT")
# remove redundant parameters
entity.remove("gda_desc")
entity.remove("gda_name")
# remove GUI only parameters
entity.remove("name")
# convert to enum
Expand All @@ -46,6 +48,21 @@ def handler(entity: Entity, entity_type: str, ioc: Generic_IOC):
entity.DIR = "Pos"
if entity.VMAX is not None:
entity.VMAX = str(entity.VMAX)
# convert to enum
if entity.UEIP == 1:
entity.UEIP = "Yes"
else:
entity.UEIP = "No"
if entity.FOFF == 1:
entity.FOFF = "Frozen"
else:
entity.FOFF = "Variable"

elif entity_type == "auto_translated_motor":
# remove GUI only parameters
entity.remove("name")
if entity.VMAX is not None:
entity.VMAX = str(entity.VMAX)

elif entity_type == "GeoBrick":
entity.rename("Port", "pmacAsynPort")
Expand All @@ -59,6 +76,8 @@ def handler(entity: Entity, entity_type: str, ioc: Generic_IOC):
entity.remove("name")

elif entity_type == "autohome":
# remove GUI only parameters
entity.remove("name")
# standardise the name of the controller port
entity.rename("PORT", "PmacController")

Expand All @@ -67,6 +86,8 @@ def handler(entity: Entity, entity_type: str, ioc: Generic_IOC):
entity.rename("Controller", "PmacController")
# this is calculated
entity.remove("PARENTPORT")
# this is a redundant parameter
entity.remove("PLCNum")

elif entity_type == "pmacVariableWrite":
# remove GUI only parameters
Expand All @@ -75,3 +96,5 @@ def handler(entity: Entity, entity_type: str, ioc: Generic_IOC):

elif entity_type == "pmacAsynIPPort":
entity.remove("simulation")
if ":" not in entity.IP:
entity.IP = entity.IP + ":1025"

0 comments on commit 67aad8c

Please sign in to comment.