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
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
| Type | Examples | Notes |
|---|
| Integer | 5, -10, 0 | Signed whole numbers |
| Float | 0.05, -3.14, 1e-5 | Decimal and scientific notation |
| String | "hello" | Double-quoted; supports \n, \t, \\, \" escapes |
| Boolean | true, false, open, closed, on, off | Aliases are substituted: open/on → true, close/closed/off → false |
| Identifier | M1, Ar1, pm | Device 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
| Command | Syntax | Description |
|---|
begin | begin | Optional recipe start marker. No effect at runtime. |
end | end | Optional recipe end marker. No effect at runtime. |
loop | loop count | Begins a loop block that repeats count times. Count may be a literal integer or a $variable. Sets $_i to the current 0-based iteration. |
endloop | endloop | Ends a loop block. Must pair with a preceding loop. |
if | if sensor_or_var op value | Conditional 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. |
else | else | Optional alternative branch for the preceding if. |
endif | endif | Ends an if/else block. Must pair with a preceding if. |
label | label name | Defines a named jump target. Label names must be unique within the recipe. No effect at runtime. |
goto | goto name | Unconditional 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.
| Command | Syntax | Description |
|---|
function | function name(param1, param2, ...) | Begins a named function definition. Parameters become local variables when the function is called. |
endfunction | endfunction | Ends a function definition. Must pair with a preceding function. |
| name | name 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
| Command | Syntax | Description |
|---|
var | var name = value or var name value | Declares 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
| Command | Syntax | Args | Description |
|---|
delay | delay seconds | seconds — integer, wait duration | Pauses recipe execution for the specified number of seconds. |
wait | wait seconds | seconds — integer, wait duration | Alias for delay. Pauses execution for the given time. |
pwait | pwait sensor target timeout | sensor — sensor ID; target — float, target pressure; timeout — integer, max wait in seconds | Waits until the sensor reading drops to or below target, or until timeout seconds elapse. Used for pressure pump-down waits. |
pressure | pressure sensor target timeout | (same as pwait) | Alias for pwait. Identical behavior. |
check | check sensor condition value | sensor — sensor ID; condition — comparison operator; value — float, threshold | Reads 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
| Syntax | Args | Description |
|---|
valve id action | id — valve name (e.g. M1, V2, V6); action — open or close (also accepts true/false) | Opens or closes a valve. |
valve M1 open
valve V6 close
MFC (Mass Flow Controller)
| Syntax | Args | Description |
|---|
MFC id setpoint | id — 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
| Syntax | Args | Description |
|---|
pump id action | id — pump name; action — on or off (also accepts true/false) | Turns a vacuum pump on or off. |
pump TP1 on
pump TP1 off
Stage Positioning
| Syntax | Args | Description |
|---|
stage id position | id — stage name (e.g. VS); position — float, target position in mm | Moves a linear stage to the specified position. |
stage VS -10
Bias / Power Supply
| Syntax | Args | Description |
|---|
bias id mode value | id — power supply name; mode — operating mode (e.g. voltage, current); value — float, setpoint value | Configures a bias power supply with the specified mode and value. |
Shutter Control
| Syntax | Args | Description |
|---|
shutter id position | id — shutter/drive name; position — open or close | Opens or closes a deposition shutter. |
Holder (Substrate Rotation)
| Syntax | Args | Description |
|---|
holder id action | id — holder drive name; action — on or off | Starts or stops the substrate holder rotation. |
Rotation
| Syntax | Args | Description |
|---|
rotation action [speed] | action — on or off; speed — optional float, rotation speed | Controls 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.
| Command | Syntax | Description |
|---|
warmup | warmup device time power | Runs a source warmup routine: powers a device for the given time at the specified power level. |
scan | scan device start end step | Scans a device parameter from start to end in increments of step. |
deposit | deposit device thickness time | Runs a timed deposition on the specified source, targeting a given thickness and duration. |
set | set device param value | Sets an arbitrary device parameter to a value. Used for general-purpose device configuration. |
Operator Interaction
| Command | Syntax | Description |
|---|
message | message 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 Recipe | Substituted Value |
|---|
open | true |
close / closed | false |
on | true |
off | false |
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:
- Tokenization — ensures the text can be parsed into valid tokens.
- Structure — verifies matched block pairs (loop/endloop, if/endif, function/endfunction), checks nesting depth, validates unique labels, and confirms goto targets exist.
- Commands — checks that command names are recognized and have the minimum required number of arguments.
- Variables — confirms all
$variable references are either declared with var, defined as function parameters, or are known system variables.
- 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