Recipe DSL Reference

The APS recipe language is a line-based Domain Specific Language (DSL) for automating vacuum deposition processes. Each line contains a single command followed by its arguments, separated by whitespace. Recipes are executed sequentially from top to bottom unless redirected by flow-control constructs.

This is the same reference available from the language pane in the Recipe Editor.

Language Basics

Line Format

command arg1 arg2 ...    # optional comment

Each non-blank line is tokenized into a command (first word) followed by zero or more arguments (identifiers, numbers, or strings). Comments begin with # or // and extend to the end of the line. Blank lines and comment-only lines are ignored.

Data Types

TypeExamplesNotes
Integer5, -10, 0Signed whole numbers
Float0.05, -3.14, 1e-5Decimal and scientific notation
String"hello"Double-quoted; supports \n, \t, \\, \" escapes
Booleantrue, false, open, closed, on, offAliases are substituted: open/on → true, close/closed/off → false
IdentifierM1, Ar1, pmDevice or sensor names; may contain letters, digits, underscores, and dots

Variables

Variables are declared with var and referenced with the $ prefix. Variable names are case-insensitive.

var flow_rate = 15
var gas Ar1
MFC $gas $flow_rate

Built-in system variables:

  • $_i — current loop iteration index (0-based), set automatically inside loop blocks
  • $pressure — current system pressure (read-only, from sensor provider)
  • $temperature — current system temperature (read-only)
  • $time — current recipe elapsed time (read-only)

Recipe Envelope

Recipes may optionally be wrapped in begin / end markers. These are silently skipped during execution and exist for visual clarity.

begin
    valve M1 open
    delay 5
    valve M1 close
end

Flow Control Commands

CommandSyntaxDescription
beginbeginOptional recipe start marker. No effect at runtime.
endendOptional recipe end marker. No effect at runtime.
looploop countBegins a loop block that repeats count times. Count may be a literal integer or a $variable. Sets $_i to the current 0-based iteration.
endloopendloopEnds a loop block. Must pair with a preceding loop.
ifif sensor_or_var op valueConditional branch. Executes the following block if the condition is true. Operators: <, >, =, ==, <=, >=, !=. The left-hand side can be a sensor ID or $variable; the right-hand side can be a number, $variable, or boolean keyword.
elseelseOptional alternative branch for the preceding if.
endifendifEnds an if/else block. Must pair with a preceding if.
labellabel nameDefines a named jump target. Label names must be unique within the recipe. No effect at runtime.
gotogoto nameUnconditional jump to the named label. The target must exist within the current execution scope.
# Loop with variable count
var cycles = 3
loop $cycles
    MFC Ar1 15
    delay 5
    MFC Ar1 0
    delay 2
endloop

# Conditional with sensor reading
if pm < 0.05
    valve M1 open
else
    valve M1 close
endif

# Label and goto
label retry
pwait pm 0.01 60
check pm < 0.05
goto retry

Functions

Functions let you define reusable command sequences with parameters.

CommandSyntaxDescription
functionfunction name(param1, param2, ...)Begins a named function definition. Parameters become local variables when the function is called.
endfunctionendfunctionEnds a function definition. Must pair with a preceding function.
namename arg1 arg2 ...Calls a previously defined function, binding positional arguments to parameter names.
function purge_gas(gas, flow, time)
    MFC $gas $flow
    delay $time
    MFC $gas 0
endfunction

# Call the function
purge_gas Ar1 20 10
purge_gas N2 15 5

Variable Declaration

CommandSyntaxDescription
varvar name = value or var name valueDeclares or updates a variable. The = sign is optional. Values can be numbers, strings, booleans (true/false), or identifiers.
var target_pressure = 0.05
var gas_name Ar1
var use_bias = true

Timing Commands

CommandSyntaxArgsDescription
delaydelay secondsseconds — integer, wait durationPauses recipe execution for the specified number of seconds.
waitwait secondsseconds — integer, wait durationAlias for delay. Pauses execution for the given time.
pwaitpwait sensor target timeoutsensor — sensor ID; target — float, target pressure; timeout — integer, max wait in secondsWaits until the sensor reading drops to or below target, or until timeout seconds elapse. Used for pressure pump-down waits.
pressurepressure sensor target timeout(same as pwait)Alias for pwait. Identical behavior.
checkcheck sensor condition valuesensor — sensor ID; condition — comparison operator; value — float, thresholdReads the current sensor value and compares it against the threshold. Throws an error if the condition is not met (instant check, no waiting).
delay 10                  # wait 10 seconds
pwait pm 0.05 60          # wait for pressure < 0.05, timeout 60s
pressure pl 0.01 120      # same as pwait, different sensor
check pm < 0.1            # assert pressure is below 0.1

Device Commands

Valve Control

SyntaxArgsDescription
valve id actionid — valve name (e.g. M1, V2, V6); actionopen or close (also accepts true/false)Opens or closes a valve.
valve M1 open
valve V6 close

MFC (Mass Flow Controller)

SyntaxArgsDescription
MFC id setpointid — MFC name (e.g. Ar1, N2); setpoint — float, flow rate in sccm (0 to shut off)Sets the mass flow controller to the given flow rate.
MFC Ar1 15
MFC Ar1 0        # shut off gas flow

Pump Control

SyntaxArgsDescription
pump id actionid — pump name; actionon or off (also accepts true/false)Turns a vacuum pump on or off.
pump TP1 on
pump TP1 off

Stage Positioning

SyntaxArgsDescription
stage id positionid — stage name (e.g. VS); position — float, target position in mmMoves a linear stage to the specified position.
stage VS -10

Bias / Power Supply

SyntaxArgsDescription
bias id mode valueid — power supply name; mode — operating mode (e.g. voltage, current); value — float, setpoint valueConfigures a bias power supply with the specified mode and value.

Shutter Control

SyntaxArgsDescription
shutter id positionid — shutter/drive name; positionopen or closeOpens or closes a deposition shutter.

Holder (Substrate Rotation)

SyntaxArgsDescription
holder id actionid — holder drive name; actionon or offStarts or stops the substrate holder rotation.

Rotation

SyntaxArgsDescription
rotation action [speed]actionon or off; speed — optional float, rotation speedControls substrate rotation. When turning on, an optional speed parameter can be provided.
rotation on 5.0
rotation off

Compound Commands

Compound commands are higher-level operations that combine multiple device actions into a single step. They are typically defined as external worker operations loaded from a DLL at runtime.

CommandSyntaxDescription
warmupwarmup device time powerRuns a source warmup routine: powers a device for the given time at the specified power level.
scanscan device start end stepScans a device parameter from start to end in increments of step.
depositdeposit device thickness timeRuns a timed deposition on the specified source, targeting a given thickness and duration.
setset device param valueSets an arbitrary device parameter to a value. Used for general-purpose device configuration.

Operator Interaction

CommandSyntaxDescription
messagemessage text...Displays a modal dialog to the operator with the given message text. Recipe execution pauses until the operator acknowledges the message by clicking OK. Useful for manual intervention steps.
message "Load substrate and close chamber door"
message Check water cooling flow

Command Case Sensitivity

Command names are case-insensitive: MFC, mfc, and Mfc are all equivalent. Device and sensor IDs are matched against the hardware configuration and are also generally case-insensitive. Variable names are case-insensitive.

Value Substitution

Before a command is dispatched to the hardware layer, certain keyword values are automatically substituted:

Written in RecipeSubstituted Value
opentrue
close / closedfalse
ontrue
offfalse

Nesting Rules

  • loop, if, and function blocks can be nested up to 8 levels deep (the maximum nesting depth).
  • function definitions cannot appear inside loop blocks.
  • goto targets must be within the current execution scope — you cannot jump into or out of a loop, function, or conditional block.
  • Each if may have at most one else branch.
  • All block constructs must be properly closed: loop/endloop, if/endif, function/endfunction.

Validation

The recipe validator performs five phases of checking before execution:

  1. Tokenization — ensures the text can be parsed into valid tokens.
  2. Structure — verifies matched block pairs (loop/endloop, if/endif, function/endfunction), checks nesting depth, validates unique labels, and confirms goto targets exist.
  3. Commands — checks that command names are recognized and have the minimum required number of arguments.
  4. Variables — confirms all $variable references are either declared with var, defined as function parameters, or are known system variables.
  5. Devices — verifies that device names used with hardware commands (valve, mfc, pump, stage, sensor, power) exist in the hardware configuration.

Complete Example

begin
    # Declare variables
    var base_pressure = 0.05
    var sputter_time = 30

    # Pump down
    pump TP1 on
    pwait pm $base_pressure 120

    # Gas flow
    valve M1 open
    valve V2 open
    MFC Ar1 15
    delay 10

    # Check pressure stabilized
    check pm < 0.1

    # Deposit with rotation
    rotation on 3.0
    shutter S1 open

    loop 3
        MFC Ar1 20
        delay $sputter_time
        MFC Ar1 10
        delay 5
    endloop

    # Shutdown sequence
    shutter S1 close
    rotation off
    MFC Ar1 0
    valve V2 close
    valve M1 close
    pump TP1 off

    message "Process complete - ready for unload"
end