Skip to content

Magnet control module, notes for developers

Aurore Finco edited this page Feb 10, 2022 · 1 revision

Introduction

The idea is to use the same GUI and logic to control all the vectorial magnets we have. It means that all the specific stuffs have to be done in the hardware.

TODO: for now the sc_magnet_logic and coil_magnet_logic are slightly different, it has to be merged at some point.

Functions and signals of the logic

Functions

_set_field_coil(B, coil): Taking a field in mT and the coil, it checks that the field is in range, converts it to current and send the order to the hardware to apply the field. It returns the corrected (if needed) field value in G.

get_currents(coil): Read the current values for both the power supply and the magnet for a given coil and send a signal for the GUI to update. It returns an array with both currents in A.

get_sweep_status(coil): Check if the coil is in standby or is sweeping. It returns a string displaying the coil's status.

go_to_field(Bx, By, Bz): Taking the magnetic field components in each axis, apply the magnetic field in each axis through the _set_field_coil function.

Signals

sigFieldSet: emitted at the end of the sweep. Is connected to the enable_gui function in the GUI.
sigCurrentsValuesUpdated: emitted in the get_currents function and sending the actual current in the power supply and coil. Is connected to the update_currents_display function in the GUI.
sigNewFieldValues: emitted at the end of the sweep. It gives the corrected (if needed) field value in mT. Is connected to the update_field_values in the GUI.

Attocube SC magnet hardware

For the details about Attocube's APS100 and specifically the string orders, see the documentation. There is 2 power supplies: one for the Z axis and one for the XY axis. To distinguish between the X or Y axis, an additional "channel" parameter is defined: 1 for the X and 2 for the Y. Noteworthy: they have to be in remote mode !

Useful functions

The only functions that may be changed are:

query_device(axis, message, discarded_line_nb=1): The query function from VISA ResourceManager is not working here, probably due to the latency of the APS100[1]. Actually, the APS100 is sending several echoes instead of one. It means that we have to discard those additional echoes. For now, we discard discarded_line_nb echoes and keep the last one as the response.

sweep_coil(Amps, coil): This is the core function. It first checks that the coil is not sweeping, the permanent heater is off, the unit is in amps and if the coil is already at the desired value. Then, it sweeps the power supply's current to the coil's current. It turns on the permanent heater, sweep the power supply's (and coil's since they are now connected) current to the desired value, turns off the heater (to disconnect the power supply from the coil) and bring back the power supply's current to zero. During all the sweeps, it calls the sweep_until_target function to wait for the end of the sweep before going to the next step.

sweep_until_target(axis, target, coil): This function checks if the sweep is complete. To do so, it checks every 2s (arbitrary) if the power supply's current has reached the desired current.

get_constraints(): Gives magnets constraints written in the interface.

Write and read functions

All the functions in this part are writing orders to the magnet or reading its state. See the APS100 doc for more details.

Useless functions

Not supposed to be used, either because it's rather useless (_start_local_mode) or because it may be dangerous (_set_rates).