Mce internal ramp

From MCEWiki

mce_internal_ramp can be used to control the MCE Ramp Generator and Arbitrary Waveform Generator features.

The most subtle thing that the program does is parse the output of mce_status -g to determine the card and parameter addresses of the registers being targeted.

The script makes use of the MCE control library mce.py, included with MAS. Ensure that $PYTHONPATH includes /usr/mce/python.

Quick summary

A quick way to set up and run a ramp is like this:

mce_internal_ramp \
 --range 0 1000 10 \
 --target sa bias \
 --offset 8 --count 8 \
 --step-frames 10 \
 go

This will advance the SA bias on RC2 through values 0,10,20,...990,1000,0,10,20,... with updates occuring every 10 multiplexing frames.

Parameter control

Target selection

The best way to select the target register is probably through --target:

--target rc2 sa_bias
--target sq2 fb
--target tes bias

Alternately, use the --stage short-hand:

--stage sa_bias
--stage sq2_fb

Valid stages are {sa,sq2,sq1,tes}_bias and {sa,sq2,sq1}_fb.

When using virtual cards, it will sometimes be necessary to provide an offset and/or a count to help direct the right number of words to the right target card. For example, "sa bias" spans two readout cards, so:

--target sa bias                        # will not work
--target sa bias  --count 8             # will ramp columns 0-7  (RC1)
--target sa bias  --count 8 --offset 8  # will ramp columns 8-15 (RC2)

Special targets for TES biases

As of BC firmware 5.3.0, special registers are available to enable the following:

  • ramping or AWG on any subset of the TES biases
  • perturbing, with a ramp or AWG, the TES biases about different values.

Previously, such generality was not possible in most configurations because internal ramping / AWG only operates by applying a single value (the ramp value) to all elements of a register.

In new BC firmware, the user can identify certain lines to be treated differently than others. This is accomplished through registers:

  • enbl_flux_fb_mod - 32 words, taking values 0 or 1. These 32 words correspond to the 32 channels in flux_fb. (So in a common configuration for 16 column subracks, the upper 16 elements of this register correspond to the TES_BIAS lines.)
  • enbl_bias_mod - 12 words, taking values 0 or 1. These 12 words correspond to the 12 low-noise bi-polar bias lines on revE bias cards.
  • mod_val - 32 words. 32-bit integers.

The behaviour is as follows. Consider the case of the 12 DACS associated with "bc1 bias". Normally the value written to the DAC is

DAC[N] = bias[N]

With new firmware, the value written to the DAC depends on whether the channel has been flagged or not:

DAC[N] = bias[N]  +  enbl_bias_mod[N] * mod_val[N]

A similar story holds for flux_fb. By enabling "enbl_bias_mod" for only those channels that should be ramped, and then setting up a ramp with bc# mod_val as the target parameter, internal ramping / AWG can be made to operate on only the selected channels.

For example, in a 16-column (small) subrack we could step the TES bias column 0,2,4,6,8,10,12,14 only by setting up:

 mce_cmd -qx wb bc3 enbl_flux_fb_mod 0 0 0 0 0 0 0 0  0 0 0 0 0 0 0 0  1 0 1 0 1 0 1 0  1 0 1 0 1 0 1 0
 mce_internal_ramp go --target bc3 mod_val --count=32 --range 0 100 100  --step-frequency 10.

Range selection

The range of values over which the ramp occurs is set with the --range option. It takes 3 arguments:

--range <min_value> <max_value> <step_size>

Note: when setting the range, please be aware that internally applied values may have a different meaning than values available at the software level through normal "rb" and "wb" commands. Particularly in the case of bi-polar DACs on new (Rev E) bias cards, internal values of 32768 correspond to 0V at the DAC output.

Update frequency

The update frequency can be specified in one of three ways. The most direct is:

--step-frames 10

which specifies the frequency in multiples of the ARZ (multiplexing) period.

However, the program is aware of the MCE's multiplexing frequency so you can also pass a frequency in Hz or a period in seconds:

--step-period 0.05
--step-frequency 20.0

Note, however, that the requested frequency will be rounded to the nearest even divisor of the frame rate.

Command actions

Any number of commands can be included in the call to mce_internal_ramp. The allowed commands are:

  • setup: configures the MCE ramp parameters; does not start or stop the ramp.
  • start: start the ramp, using the MCE's current configuration.
  • stop: stop the ramp.
  • go: run the stop, setup, and start commands in succession.

Note that start and stop commands do not require any ramp configuration arguments -- all they do is start or stop the ramp without changing anything else.