Back: 4. EDL Forward: 4.2 Sections   FastBack: 4. EDL Up: 4. EDL FastForward: 5. Built-in Functions         Top: fsc2 Contents: Table of Contents Index: Index About: About This Document

4.1 Basics

An EDL script is structured similarly to the way an experiment is done. Before you start an experiment you first have to select the devices to be used and set them up. So the first part of an EDL script is just a few lines specifying the devices to be controlled by the program and then setting their parameters, e.g. the timebase of the digitizer, the sensitivity of the lock-in amplifier or which pulses are to be created by the pulse generator. And as you would now start the experiment the second part of the EDL script describes how the experiment is to be done.

To give you a first impression how an EDL script may look like here's a script for a simple cw-EPR experiment:

  er035m_s;                    // gaussmeter module
  aeg_x_band;                  // magnet module
  sr530;                       // lock-in amplifier module

  start_field = 3360.0 G;
  end_field   = 3450.0 G;
  field_step  =    0.5 G;

  field = start_field;
  I = 1;

  magnet_setup( start_field, field_step );
  init_1d( );

  WHILE field <= end_field
      data = lockin_get_data( );
      display_1d( I, data );
      save( data );
      I = I + 1;
      field = sweep_up( );
      wait( lockin_time_constant( ) );

Obviously, the very first section of the script, starting with the section keyword DEVICES, specifies the names of the devices to be used (everything after the double-slashes are comments). In the example these are the Bruker ER035M gaussmeter, the AEG X-band magnet and the Stanford Research lock-in amplifier SR530.

In the following section, starting with the section keyword VARIABLES, all variables that are going to be used in the EDL script are listed and, if appropriate, initialized. The first three variables are for storing the start and end field of the field sweep as well as the field step width to be done between measuring new data points. The next variable field will later be used for storing the actual field value and it's initialized to the value of the start field. Finally, a counter variable I, initialized to 1, and another variable, data, for the data point obtained from the lock-in amplifier, are declared.

In the next section, following the PREPARATIONS section keyword, the devices are set up. The function magnet_setup() tells the magnet to start with the field stored in the variable start_field and to use a field step size of field_step. This will also make the magnet automatically go to the start field (with the selected devices after some calibration) when the experiment starts.

The next function call, init_1d(), tells the program that this is an 1-dimensional experiment and to use the appropriate kind of display for the data.

Now we're already done with the preparations and can start the experiment, as indicated by the section keyword EXPERIMENT. The whole experiment is done in a loop that is repeated as long as the actual field (stored in the variable field) isn't larger than the end_field. To tell the program where this loop starts and ends all the statements belonging to the loop are enclosed in curly braces, `{' and `}'.

The first thing to do in the experiment loop is to fetch a new data point from the lock-in amplifier, storing it in the variable data. Next, we have to display the data point, which is done via the call of the function display_1d() (as you may have guessed there also exists a function called display_2d() that gets used when one wants to display results from an experimnt where 2 parameters are varied, but since here only the field is swept display_1d() will do). Here two arguments are required, the number of the point, stored in the variable I, and the value of the new data point.

Of course, we also need to write the new data point to a data file. This is done by the call of the function save() that automatically writes its argument to a file. When the function is called for the first time it prompts you for the name of the file to be used.

What remains to be done is to increment the counter variable I and to sweep up the field. The function sweep_up() increments the field by the amount you specified previously in the call of magnet_setup() (in the PREPARATIONS section) and returns the new value of the field, which is later used in the test of the loop condition to decide if the experiment is finished, i.e. the end field is reached.

The last function call of wait() with the result of a call of the function lockin_time_constant() as the argument makes the program wait for the time constant of the lock-in amplifier to give it enough time to measure a new data point.

When you have written such a script (using, for example, a simple ASCII editor) you load it into fsc2 and press the Test or the Start button. fsc2 will now analyze the script very thoroughly. It will not only check for misspelt keywords, undefined variables, non-existent functions, syntax errors etc. but will also repeat the loop in the experiment section as often as in the real experiment to find out if no errors are going to happen during the experiment. This includes for example checking that the field is not swept into regions the magnet or the gauss-meter can not handle (e.g. by incidentally setting an end field value of 34500.0 G which the magnet can't produce). So you can be reasonable sure that the experiment will not be aborted due to a faulty EDL script after it has already run for 2 hours and you have to start all over again.

As you can already see from the example most of an EDL script consists of function calls. Functions can be divided into two categories, built-in functions and device functions. Built-in functions (like init_1d(), display_1d(), save() and wait()) are always available, even when there is no DEVICES section (or no devices are listed in that section). In contrast, device functions are bound to certain devices and can only be called when the device they are defined for is listed in the DEVICES section. For example, the functions lockin_sensitivity(), lockin_time_constant() and lockin_get_data() are obviously targeted at lock-in amplifiers and are only available when a lock-in amplifier module is specified in the DEVICES section. Most of these functions are available for all types of lock-in amplifiers (possibly with minor variations) so that using a different lock-in amplifier usually doesn't require a major rewrite of the EDL script but just changing the lock-in's name in the DEVICES section.

To find out about all built-in and device functions, their arguments and where they may be used have a look at the next two chapters of this manual, see Built-in Functions and see Device Functions.

Back: 4. EDL Forward: 4.2 Sections   FastBack: 4. EDL Up: 4. EDL FastForward: 5. Built-in Functions

This document was generated by Jens Thoms Toerring on September 6, 2017 using texi2html 1.82.