Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ophyd-async device for F-Switch #399

Closed
callumforrester opened this issue Mar 25, 2024 · 4 comments · Fixed by #469
Closed

Ophyd-async device for F-Switch #399

callumforrester opened this issue Mar 25, 2024 · 4 comments · Fixed by #469

Comments

@callumforrester
Copy link
Contributor

callumforrester commented Mar 25, 2024

Required for #377

We need to implement an F-Switch device exposing the fields required for I22 nexus files (see linked issue). The F-Switch is a group of 4 motors.

Acceptance Criteria

@joeshannon
Copy link
Contributor

The f-switch is more complicated than just four motors, it has additional screens relating to filters and beamsize.

It uses the "transfocator" support module.

There is an implementation in dodal already:

def transfocator(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> Transfocator:
"""Get the i04 transfocator device, instantiate it if it hasn't already been.
If this is called when already instantiated in i04, it will return the existing object.
"""
return device_instantiation(
Transfocator,
"transfocator",
"-MO-FSWT-01:",
wait_for_connection,
fake_with_ophyd_sim,
)

This could be converted to ophyd-async and moved to a common location as the device is currently in the i04 module.

Also need to work out what functionality is needed, e.g. the current iml allows for setting the filters but for now presumably they just want to read them.

The desired fields in #337 do not exist in their current GDA Nexus files.

@callumforrester
Copy link
Contributor Author

Also need to check the I04 transfocator PVs are the same as the I22 ones and if not get one set of PVs changed, as in #384

@joeshannon
Copy link
Contributor

@DominicOram It turns out that the i04 f-switch contains an additional component about the beam size which is not present on i22.

I'm not sure what the best approach to take is, split the current device to be composed of an optional beam size component or to make a new device?

@DominicOram
Copy link
Contributor

My first reaction would be to ask i22 if a beamsize calculator would be useful and port the logic over from i04. It looks pretty simple, take the required size, the beam energy and some other constants and put them in a quadratic equation:

record(ao, "BL04I-MO-FSWT-01:PARAM_A")
{
  field(VAL, "53.85")
}

record(ao, "BL04I-MO-FSWT-01:PARAM_B")
{
  field(VAL, "198")
}

record(ai, "BL04I-MO-FSWT-01:VERT_REQ") # this goes to edm
{
  field(VAL, "")
}

record(calc, "BL04I-MO-FSWT-01:LENS_PRED")
{
  field(VAL, "10")
  field(INPA, "BL04I-MO-FSWT-01:PARAM_A") 
  field(INPB, "BL04I-MO-FSWT-01:PARAM_B")
  field(INPC, "BL04I-MO-FSWT-01:VERT_REQ CP")
  field(INPD, "BL04I-MO-DCM-01:ENERGY.RBV CP") 
  field(CALC, "A/(C+B)*D**2") #check if same as (A/(C+B))*(D**2)
}

### Calculate the beamsize from nmber of lenses ###
record(calc, "BL04I-MO-FSWT-01:CALC_VER")
{
  field(VAL, "10")
  field(INPA, "BL04I-MO-DCM-01:ENERGY.RBV CP") 
  field(INPB, "BL04I-MO-FSWT-01:LENSES CP")
  field(INPC, "BL04I-MO-FSWT-01:PARAM_A")
  field(INPD, "BL04I-MO-FSWT-01:PARAM_B")
  field(CALC, "C/B*A**2-D") # check is same as ((C/B)*(A**2))-D
}

@JamesOHeaDLS - how easy would it be to put this somewhere common for i22 too?

joeshannon added a commit that referenced this issue Apr 29, 2024
This is an initial implementation for providing the required data for
i22 Nexus files.

In the future this device should be combined with the i04 version.

See #399 for further details.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants