# Using Variables in the Sequence Wizard

You can view a video tutorial of this section also.

Variables are a powerful aspect of the Sequence Wizard. Variables allow you to make dynamic changes to your sequence, based not only on values you enter, but on values that are measured.

Variables are named objects that you can use in place of normal setup parameters. There are three types of variables:

• Potential
• Real
• Integer.

You can only use variables where the type of the variable is the same as the type of the setup parameter. For example, a Time is usually entered as a real number, so a variable that will be used for a time would be of type Real. Cycle numbers are usually integers. Voltages are usually Potentials.

Variables always have a name. Names are alphanumeric, but must start with a letter from A–Z. There are two reserved names, VLAST and ILAST. VLAST is the last measured potential, in volts. ILAST is the last measured current, in amperes. At the start of a sequence, these two variables both default to a value of zero. They stay at zero until a step which measures voltage, for VLAST, or current, for ILAST, is run.

VLAST is a variable which may commonly be used. For example, you may wish to galvanostatically charge a battery for a specified amount of time. Next you may wish to potentiostatically hold the battery at the last measured voltage and measure the amount of charge that is flowing. This is an instance where VLAST would be used.

The Sequence would look like:

Notice that there is no mention of a variable in this sequence tree. That is because VLAST is always defined. So let's see how to use VLAST.

Open the Chronocoulometry setup:

There are three different voltages in this step: Pre-step Voltage, Step 1 Voltage, and Step 2 Voltage. For our simple example, we want to make all of them the same, and make all of them equal to VLAST.

Click on the Variable Information Icon next to the Pre-step Voltage parameter. A menu that looks like the following appears:

Select VLAST from the menu. The parameter dialog box is now:

Notice that the Pre-step Voltage field is now grayed out, and that the Variable Information Icon has changed. A Variable Information Icon with yellow indicates that a variable is being used. If you click on the Variable Information icon now, you should see that VLAST is selected.

Repeat this process for the Step 1 Voltage and the Step 2 Voltage. Ultimately the parameter dialog box is:

The sequence setup is complete. The Chronocoulometry step uses the last measured voltage from the previous step, Chronopotentiometry.

Let's describe an experiment where a user-defined variable might be used. Let's say you want to perform a constant-voltage experiment (potentiostatic hold) at 12 different, but evenly spaced, voltages. You could create a sequence with 12 different potentiostatic steps, or you could simply use four steps, a Define Variable step, a Loop (Cycle) step, a Potentiostatic step, and a Modify Variable step.

Here is what these two sequences might look like. First, the 12-step method:

and now the experiment using a variable:

You can see that the variable sequence has less for you to setup. You have less work to do. Rather than editing each of the twelve steps, entering a different voltage and a different filename for each, you must edit only four steps.

Open the parameter dialog box for the Define Variable Step. It looks like this:

There are two fields to edit:

 Name The name of the variable Type The type of the variable.

Let's enter our Name, VAPPLIED, and select our Type from the drop-down menu. In this case, our type is a Potential. The parameter dialog box is now:

A new set of controls appears below the Name and Type controls. Using these controls is how you specify the initial value of your variable. In our case, we keep the default of 0 V versus Eref. Click the OK button to save your variable.

Let's set our Loop Count parameter. Open the parameter dialog box for the Loop (Cycle) step by double-clicking on the step, or right clicking on it and selecting Properties . Enter a Loop Count of 12. Your parameter dialog box should be:

Click the OK button to save the Loop Count.

Now we are ready to use our variable. Open the parameter dialog box for the Potentiostatic step by double-clicking on the step:

There are two different potentials in this step, Initial E and Final E. We shall substitute our variable for these two setup parameters.

Click on the Variable Information Icon next to the Initial E setup parameter. A menu appears:

By default, None is selected. But notice that there are two variable names also on the list, VLAST and VAPPLIED. Select VAPPLIED by clicking on it. The parameter dialog box appears:

The Initial E parameter is now grayed out, and the Variable Information Icon has changed. A yellow Variable Information Icon indicates that a variable is being used. If you click on the Variable Information icon now, you should see that VAPPLIED is selected.

Do the same thing for Final E, because we want the same potential applied throughout the step. Also, shorten the times from 100 to 5 seconds for both Initial Time and Final Time. The dialog box is now:

When you are satisfied with your changes, click the OK button.

The final edit is to the Modify Variable step. This step is inside our loop. It is run after every Potentiostatic step. Open its parameter dialog box by double-clicking on the step:

It starts out empty. You first must select the variable you wish to modify from the Variable Name drop-down list. Click on this list and to see a menu:

Select VAPPLIED from the list. The parameter dialog box is now:

Notice that the Modifier drop-down list is now enabled. Select from one of four entries:

 + addition – subtraction * multiplication = assignment

We want to use addition. So select + from the list. The Value field becomes enabled. Enter a Value of 0.1. This increments our VAPPLIED value by 0.1 V each time through the loop. The parameter dialog box is then:

Click the OK button to save changes.

Now we have our sequence defined. Our initial voltage is 0 V versus Eref. After the first Potentiostatic step, we increment VAPPLIED to 0.1 V. After another Potentiostatic step we increment to 0.2 V, and so on, until all 12 steps have been performed, and our final voltage is 1.1 V. The sequence then ends.