stoner_measurement.instruments.simulated.SimulatedMagnetController

class stoner_measurement.instruments.simulated.SimulatedMagnetController(transport=None, protocol=None)[source]

Bases: MagnetController

Simple simulated superconducting magnet controller.

abort_ramp() → None[source]

Abort ramping immediately and hold the output at its current value.

Raises:

ConnectionError – If the transport is not open.

property current: float

Return the current output in amps.

Returns:

Instantaneous output current in amps.

Return type:

(float)

Raises:

ConnectionError – If the transport is not open.

property field: float

Return the magnetic field output in tesla.

Returns:

Estimated magnetic field in tesla derived from the output current and the configured magnet constant.

Return type:

(float)

Raises:

ConnectionError – If the transport is not open.

get_firmware_version() → str[source]

Return the firmware version string.

Returns:

Firmware version as reported by the device.

Return type:

(str)

Raises:

ConnectionError – If the transport is not open.

Examples

>>> mc.get_firmware_version()
'1.0'
get_model() → str[source]

Return the instrument model identifier string.

Returns:

Instrument model identifier as reported by the device.

Return type:

(str)

Raises:

ConnectionError – If the transport is not open.

Examples

>>> mc.get_model()
'TestMagnet'
go_to_zero() → None[source]

Ramp the simulated supply output to zero.

property heater: bool

Return the persistent switch heater state.

Returns:

True when the persistent switch heater is energised, False when it is off.

Return type:

(bool)

Raises:

ConnectionError – If the transport is not open.

heater_off() → None[source]

De-energise the persistent switch heater.

Raises:

ConnectionError – If the transport is not open.

heater_on() → None[source]

Energise the persistent switch heater.

Raises:

ConnectionError – If the transport is not open.

hold() → None[source]

Hold the present output without changing field.

identify() → str[source]

Return the instrument identification string (*IDN?).

Sends the standard IEEE 488.2 *IDN? query and returns the response. Instruments that do not support *IDN? should override this method.

Returns:

Identification string returned by the instrument.

Return type:

(str)

Raises:

ConnectionError – If the transport is not open.

Examples

>>> from stoner_measurement.instruments.transport import NullTransport
>>> from stoner_measurement.instruments.protocol import ScpiProtocol
>>> from stoner_measurement.instruments.base_instrument import BaseInstrument
>>> t = NullTransport(responses=[b"ACME,Model1,SN001,v1.0\n"])
>>> instr = BaseInstrument(t, ScpiProtocol())
>>> instr.connect()
>>> instr.identify()
'ACME,Model1,SN001,v1.0'
>>> instr.disconnect()
property limits: MagnetLimits

Return the configured operating limits.

Returns:

Maximum permitted current, field, and ramp rate.

Return type:

(MagnetLimits)

Raises:

ConnectionError – If the transport is not open.

property magnet_constant: float

Return the magnet constant in tesla per amp.

Returns:

Field-to-current conversion factor in T A⁻¹.

Return type:

(float)

Raises:

ConnectionError – If the transport is not open.

pause_ramp() → None[source]

Pause an active ramp, holding the output at its current value.

Raises:

ConnectionError – If the transport is not open.

ramp_to_current(current: float, *, wait: bool = False) → None[source]

Set a new target current and begin ramping.

Parameters:

current (float) – Desired target current in amps.

Keyword Parameters:

wait (bool) – If True, block until the target is reached. Defaults to False.

Raises:
ramp_to_field(field: float, *, wait: bool = False) → None[source]

Set a new target field and begin ramping.

Parameters:

field (float) – Desired target field in tesla.

Keyword Parameters:

wait (bool) – If True, block until the target is reached. Defaults to False.

Raises:
ramp_to_target() → None[source]

Start ramping the output towards the currently programmed target.

Raises:

ConnectionError – If the transport is not open.

return_to_local() → None[source]

No-op for the simulated controller, which has no front panel.

set_limits(limits: MagnetLimits) → None[source]

Set operating limits for the controller.

Parameters:

limits (MagnetLimits) – Maximum current, field, and ramp rate limits to apply.

Raises:

ConnectionError – If the transport is not open.

set_magnet_constant(tesla_per_amp: float) → None[source]

Set the magnet constant used for field calculations.

Parameters:

tesla_per_amp (float) – Field-to-current conversion factor in T A⁻¹.

Raises:
set_ramp_rate_current(rate: float) → None[source]

Set the current ramp rate.

Parameters:

rate (float) – Ramp rate in amps per minute.

Raises:
set_ramp_rate_field(rate: float) → None[source]

Set the field ramp rate.

Parameters:

rate (float) – Ramp rate in tesla per minute.

Raises:
set_target_current(current: float) → None[source]

Set the target output current.

Parameters:

current (float) – Desired target current in amps.

Raises:
set_target_field(field: float) → None[source]

Set the target magnetic field.

Parameters:

field (float) – Desired target field in tesla.

Raises:
property status: MagnetStatus

Return a consolidated status snapshot.

Returns:

Current operational state, output readings, and heater status.

Return type:

(MagnetStatus)

Raises:

ConnectionError – If the transport is not open.

property voltage: float

Return the output voltage in volts.

Returns:

Instantaneous output voltage in volts.

Return type:

(float)

Raises:

ConnectionError – If the transport is not open.