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

HIFI: Zerofield #8401

Open
5 tasks
KathrynBaker opened this issue Jun 21, 2024 · 4 comments
Open
5 tasks

HIFI: Zerofield #8401

KathrynBaker opened this issue Jun 21, 2024 · 4 comments
Assignees
Labels
8 for release Required for next release in progress

Comments

@KathrynBaker
Copy link
Member

KathrynBaker commented Jun 21, 2024

As a scientist using HIFI under IBEX I want to be able to view my corrected fields.

Acceptance Criteria

What is the acceptance criteria?

  • Verify with the instrument scientists that this is readback only, no control was apparent in the Group 3 Hall Probe VI before undertaking this work, and how it needs to appear
  • Create the wireframe adapted from the VI front panel after a discussion with the instrument scientsts
  • An IOC exists for this functionality
  • An OPI exists for this functionality
  • Appropriate tests and emulators exist

Extra Information

  • This is a spin off ticket from HIFI: IOC and OPI for Group 3 Hall Probe #6088 6088 and there is more detail in there of background

  • The Front panel of that VI is a messy starting point for the one here
    image

  • The field readings will come from the Group 3 Hall Probe (Ticket HIFI: Group 3 Hall Probe #8400) IOC

  • The output values for the PSU Current Readback will come from the appropriate magnets which are served from the cryomagnet system

  • The coil inhomogenities field table is a matrix specified in an ini file at present, this may be achievable as macros, or other file system

  • The persistent gradients are an array specified in an ini file at present, this may be achievable as macros, or other file system

  • The logic to reach the required values is as follows:

    • Adjusted Fields = Array of field readings
    • Interim coil values (context for ease of understanding the next displayed items) = For each PSU: {Adjusted Fields = Adjusted Fields - (multiply each value in the appropriate column in the coil inhomogenities field table with the PSU current readback)}
    • The appropriate columns are x = 0, y = 1, and z = 2
    • Corrected for coils = Interim coil values + [x current, y current, z current, x current, y current, z current]
    • Persistent grad value = Interim Coil Values[4] - Interim Coil Values[1]
    • corrected for persistent fields (context value again) = Interim coil values - (persistent gradients*persistent grad value)
    • Split the corrected for persistent fields into two arrays, elements 0,1,2 in one and 3,4,5 in the other. Add these two arrays together and divide by 2, and subtract the final offsets, then add these values to the psu current readback to get X, Y, and Z.
  • There is a "cleaner" VI Array Maths Example that may make this easier to understand, ask if access is needed, it is the repo for the old LabVIEW modules, and not available via GitHub

How to Test

verbose instructions for reviewer to test changes
(Add before making a PR)

Time in recording of planning meeting: 01h07m 2024/11/28

@davidkeymer
Copy link
Contributor

Possible to use existing IBEX implementation of zerofield system? Have discussion with muon scientists.

@Tom-Willemsen
Copy link
Contributor

Tom-Willemsen commented Dec 4, 2024

JL, @iangillingham-stfc and I had a discussion.

We should fundamentally be able to use our existing zero-field controller. The main differences are:

  • The "correction" logic will need to be put into an IOC - probably the zero field controller ioc as there are two probe iocs. This is a function of 9 variables and a bunch of "fiddle factors", which eventually provide 3 outputs: corrected X, Y & Z fields at the sample position.
  • We may need more "fiddle factors" in the zero field controller IOC to deal with various parameters - e.g. timings.
  • The cryomag IOC may need an extra "set and don't wait" mode for the shim coils (brief discussion with @LilithCole suggests this may already be possible by pointing at _SP rather than SP)
  • Very likely need a mode on the Group3 hall probe IOC to act a bit like the existing magnetometer one:
    • Allow explicit scanning from outside / disable it's own scanning / poke a PV when "done"
  • Instrument scripts that enable/disable ZF:
    • On exiting ZF mode, should record the magnet current settings that were used to settle at zero to a file / PV or similar
    • On reentering ZF mode, the shim coils should first be set to the saved values, and then zeroing starts from there
    • See HIFI: migrate scripts [Timebox: 1 Day] #8546
  • JL would like to be able to set an alert of some sort if more than the "expected" amount of compensation needs to be used to achieve zero field. Again this needs to be a tunable parameter. A sensible initial default is 15 Gauss.

For avoidance of doubt, JL says the existing ZF sets zero field once on entry into zero field mode, but does not attempt to keep doing so continuously. He would prefer it if it could be done continuously in ibex though (which is exactly what the ZFCNTRL ioc does)

@Tom-Willemsen
Copy link
Contributor

Going to put this back into ready as it's becoming very obvious I'm not going to get it completed before leave, having barely managed to make a start on it over the last couple of days...


Tips for next person who picks this up

  • cryosms currently has no emulator/tests as they got lost at some point in git history - will need recovering from git history in order to use the cryosms emulator in the tests for HIFI's zf. Lilith is looking at this. When they get recovered they might be in cryosms support module, if so then you'll need to move them back into deviceemulator/ioctestframework now in order to use them from zero-field tests too.
  • To run the existing zfcntrl tests you need NI-DAQMX which is a large download/install from the NI site (if you're planning to adjust zfcntrl, rather than making a new zfhifi ioc)
  • Two options: make existing zfcntrl generic enough, or fork it to zfhifi and implement hifi-specific stuff there. Although option 1 is probably the nicer approach long-term (less duplicated code etc), we might need to do second approach for expediency if we want to get it in for release.
    • Some fiddly details with first option (making zfcntrl generic enough):
      • Places where we've put in kepco-specific logic in the SNL that would need genericising. Conceptually it is generic enough, but various kepco comms details have gone in over time and would need to be macro'd out etc.
      • Hifi has two magnetometers & a bunch of maths, I think this would work by defining that in zfcntrl_hifi_specific.db and making that have the same general interface as the existing daqmx magnetometer - but will take a certain amount of fiddling to get it right
    • Second option is easier to implement, the "core" of the zero-field loop will be the same but the inputs/outputs are wired to different places. We will have some duplication if we do this, but may end up being more maintainable and likely faster to implement.
  • Relevant VI left open on ndxscidemo in case you need to look at existing code

@Tom-Willemsen Tom-Willemsen removed their assignment Dec 9, 2024
@Tom-Willemsen
Copy link
Contributor

ISISComputingGroup/EPICS-DeviceEmulator@68f5747 is the cryosms emulator that will need to be restored from git in order to write tests for the hifi zf

@KathrynBaker KathrynBaker added the 8 label Dec 19, 2024
@Tom-Willemsen Tom-Willemsen self-assigned this Jan 2, 2025
@Tom-Willemsen Tom-Willemsen moved this from Backlog to In Progress in PI_2024_08 Jan 2, 2025
@KathrynBaker KathrynBaker moved this to In Progress in PI_2025_02 Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8 for release Required for next release in progress
Projects
Status: In Progress
Development

No branches or pull requests

5 participants