Pattern generation

Abstraction module for signals. The signal module allows the creation of signals entities, characterized by a series of parameters and linked to a particular pattern generator (PG). The signal module is agnostic about the PG. Communicates to the device via a secondary module from which it requires a specific API. It is up to that module to send the appropriate commands to the PG. The module can use (or not) one of the available lower-level interfacing modules (GPIB, TCP, serial).

As of this writing, modules for the following PG are implemented:

On the following, the signal module and the way to implement new PG modules compatible with it is described. For information on how to interface with the bus modules, refer to their documentation.

_images/cmd_signal.doc.png

Figure 1: Example of interaction between cmd_signal, PG modules and pyrame bus modules (gpib, serial, tcp).

Pool and identification

Every signal in the pool is identified uniquely by an identifier passed to the function init_signal. All the other functions require this id token as the first argument.

During init_signal, the initialization function for the particular model is called. Its name must be init_MODEL (e.g.: init_ag_33500). The convention style for MODEL is a two-letter maker symbol plus the model, separated by an underscore (_).

Initialization

As pointed out previously, cmd_signal provides a function init_signal and requires functions init_MODEL from the modules with which it interfaces. The init_signal declaration is:

init_signal(signal_id, conf_string, function, hl, ll, freq, dc, pw, re, fe, sym, phase, delay, sync)

Registers in the pool and initializes a new PS with signal_id. conf_string is the configuration string for the module to be initialized. On pulse generators supporting multiple channels, the conf_string must include the parameter chan to indicate the channel that will be used. An identificator will be needed for each channel.

The init_MODEL functions of pattern generators must accept a conf_string and initialize all necessary memory structures. Communication with the hardware is performed with the config_MODEL function.

Functions

cmd_signal requires a set of functions on the API of the pulse generator module in order to be compatible with it:

  • init_MODEL (MODEL_id, conf_string, function, hl, ll, freq, dc, pw, re, fe, sym, phase, delay, sync)
  • deinit_MODEL (MODEL_id)
  • config_MODEL (MODEL_id)
  • inval_MODEL (MODEL_id)
  • power_on_MODEL (MODEL_id)
  • power_off_MODEL (MODEL_id)

In addition, at least one configure_FUNCTION function must be implemented. Each one will provide support for the FUNCTION (e.g.: sine) function, as configured with init_signal or set_function_signal. The power_on_signal function of cmd_signal will look for a matching configure_FUNCTION function in the module. configure_FUNCTION functions must have a few mandatory arguments: MODEL_id, frequency, sync, high_level, low_level. Then, depending on the FUNCTION, the following arguments will need to follow:

  • configure_sine_MODEL (MODEL_id, frequency, sync, high_level, low_level, phase)
  • configure_square_MODEL (MODEL_id, frequency, sync, high_level, low_level, phase, duty_cycle)
  • configure_ramp_MODEL (MODEL_id, frequency, sync, high_level, low_level, phase, symmetry)
  • configure_pulse_MODEL (MODEL_id, frequency, sync, high_level, low_level, delay, pulse_width, rising_edge, falling_edge)

Note

Pulse generators not accepting certain parameters must check that their value is undef.

In all cases:

  • Magnitudes (i.e.: voltage, current, slew_rate, etc.), either sent or returned, must be expressed in base units of the International System of Units (V, A, V/s, etc.).

API

cmd_signal.init_signal(signal_id, conf_string, function, hl, ll, freq, dc, pw, re, fe, sym, phase, delay, sync)[source]

Create a signal associated to the conf_string of a PG

cmd_signal.deinit_signal(signal_id)[source]

Deinitialize signal signal_id

cmd_signal.config_signal(signal_id)[source]

Configure signal signal_id

cmd_signal.inval_signal(signal_id)[source]

Invalidate signal signal_id

cmd_signal.set_function_signal(signal_id, function)[source]

Set function of signal_id. Valid values are: ‘sine’, ‘square’, ‘ramp’, ‘pulse’

cmd_signal.set_high_level_signal(signal_id, high_level)[source]

Set high level value of signal_id in Volts.

cmd_signal.set_low_level_signal(signal_id, low_level)[source]

Set low level value of signal_id in Volts.

cmd_signal.set_frequency_signal(signal_id, frequency)[source]

Set frequency of signal_id in Hertz.

cmd_signal.set_duty_cycle_signal(signal_id, duty_cycle)[source]

Set duty cycle of signal_id. Ranges from 0 to 100.

cmd_signal.set_pulse_width_signal(signal_id, pulse_width)[source]

Set width of pulse in seconds for signal_id.

cmd_signal.set_edges_signal(signal_id, rising_edge, falling_edge)[source]

Set rising and falling edge duration in seconds for signal_id with pulse function. The parameters can also be ‘MIN’ and/or ‘MAX’.

cmd_signal.set_symmetry_signal(signal_id, symmetry)[source]

Set symmetry of signal_id with ramp function. Ranges from 0 to 100.

cmd_signal.set_phase_signal(signal_id, phase)[source]

Set phase of signal_id. Ranges from -360 to +360 degrees.

cmd_signal.set_delay_signal(signal_id, delay)[source]

Set delay of signal_id in seconds.

cmd_signal.set_sync_signal(signal_id, sync)[source]

Activate or deactivate output of sync associated to signal_id. sync can be 1 or 0.

cmd_signal.power_on_signal(signal_id)[source]

Turn on signal signal_id

cmd_signal.power_off_signal(signal_id)[source]

Turn off signal signal_id

cmd_signal.get_error_queue_signal(signal_id)[source]

Read error queue of PG