Using Scripts
Device control executes python scripts. See below the available properties and functions.
User Class Properties
Section titled “User Class Properties”User class “u” is available for free usage. Following read-only resources are mapped in the user class:
| Property | Description |
|---|---|
u.flow | List of flows |
u.index | Time index within step (x0.25 second) |
u.inputs | List of system inputs |
u.outputs | Dictionary of system outputs |
u.pressure | System pressure value |
u.pressure_gauge | Coarse pressure gauge value |
u.setpoint | Current set temperature |
u.set_points | List of set points within zones |
u.step_index | Current process step index |
u.step_time | Current process step time |
u.tcs | List of temperature values |
u.tcs_health | List of TCs health status |
u.vacuum_gauge | Vacuum gauge value |
u.volume_to_purge | Volume to purge value |
u.pwr_pid | Power PID to system |
u.pwr_pid_f | Power PID to system filtered |
u.pwr_total | Power total to system |
u.pwr_total_f | Power total to system filtered |
u.pwr_done | Power done by system |
u.pwr_done_f | Power done by system filtered |
u.trt | Thermal response tolerance |
Note: All lists start from index zero. For example, to access TC1 health status use u.tcs_health[0]
Any other variable can be dynamically created, e.g., u.ax
Available Functions
Section titled “Available Functions”alarm(message)
Section titled “alarm(message)”Raises an alarm with red light and buzzer signal.
if not u.tcs_health[3]: alarm('TC4 is broken') stop()alert(message)
Section titled “alert(message)”Shows alert message on the screen.
u.a = u.tcs[1] - u.tcs[0]if abs(u.a) > 10.5: alert('Temperature deviation error')await_temp(timeout)
Section titled “await_temp(timeout)”Blocks switching to next step until temperature reaches set point. Timeout in seconds.
await_temp(30)diff(a, b, c, …)
Section titled “diff(a, b, c, …)”Returns the difference between the higlest and lowest value argument
diff(1, 5, 7, 4)# returns 7 - 1 = 1force(out_alias, value)
Section titled “force(out_alias, value)”Force output to value. Available outputs:
"pre"— pre-vacuum limiter"ext-out1"— external output OUT1 (see Customer I/O Interface)"ext-out2"— external output OUT2 (see Customer I/O Interface)
#loopif u.pressure_gauge < 250: force('pre', 0)#enterforce('ext-out1', 1)
#exitforce('ext-out1', 0)jump(step_name, [condition])
Section titled “jump(step_name, [condition])”Jump to step, optionally with a condition.
#loopif u.tc[0] < 250: jump('cooling')Or conditionally:
#loopjump('cooling', u.tc[0] < 250)hold()
Section titled “hold()”Holds for one loop iteration.
if u.vacuum_gauge > 0.08: hold()log(message)
Section titled “log(message)”Prints string to console log.
log(u.tcs_health)out(”)
Section titled “out(”)”Reserved function.
power_off()
Section titled “power_off()”Cuts power until process end.
#loopif u.setpoint < 250: power_off()prop(zone_index, Kc)
Section titled “prop(zone_index, Kc)”Change proportional parameter of particular zone.
prop(2, 55)setpoint(zone_index, value)
Section titled “setpoint(zone_index, value)”Change set point of particular zone.
setpoint(2, u.setpoint - 10)set_trtt(value)
Section titled “set_trtt(value)”Set thermal response tolerance threshold for the current run. Set to zero or negative to disable watchdog.
set_trtt(55)skip([condition])
Section titled “skip([condition])”Skip the rest of the step, optionally with a condition. Similar to stop().
stop([condition])
Section titled “stop([condition])”Terminate execution, optionally with a condition.
#loopif u.tc[0] < 75: stop()Or conditionally:
#loopstop(u.tc[0] < 75)Returns temperature of TCx (starting from 1).
u.my_temp = tc(4)Script Directives
Section titled “Script Directives”Script execution can be controlled with directives:
| Directive | Description |
|---|---|
#enter | Executes at entering step (default) |
#loop | Executes during step loop |
#exit | Executes at exiting step |
Every script after the directive will be executed according to its position.
Example with Directives
Section titled “Example with Directives”This example demonstrates how directives control execution flow across different stages of a process step:
u.ax = 0
#loopu.ax += 0.25
#exitalert('time elapsed: {:.2f}s'.format(u.ax))Explanation:
-
Initialization (implicit #enter):
u.ax = 0- Executes once when the step is entered
- Initializes a custom variable
u.axto track accumulated time
-
Loop execution:
#loopsection withu.ax += 0.25- Executes repeatedly during each loop iteration of the step
- Each iteration represents 0.25 seconds (since
u.indexincrements by 0.25s) - The variable
u.axaccumulates the elapsed time, adding 0.25s each loop - This continues for as long as the step is active
-
Exit handling:
#exitsection with alert message- Executes once when the step is exited or skipped
- Displays the total elapsed time using string formatting:
{:.2f}slimits the value to 2 decimal places - Provides feedback on how long the step took to complete
Use Case: This pattern is useful for monitoring step duration, logging process timing data, or triggering actions based on accumulated time within a step.
Script Examples
Section titled “Script Examples”Vacuum Check
Section titled “Vacuum Check”Stop process and alert if vacuum is faulty after evacuation in previous step:
if u.pressure > 10: alarm('Vacuum error, terminating...') stop()Temperature Deviation Check
Section titled “Temperature Deviation Check”Stop process and alert in case of temperature deviation between any thermocouples and/or the setpoint:
#loopif diff(u.tcs[0], u.tcs[1], u.tcs[3], u.setpoint) > 25: alarm('Temperature deviation error, terminating...') stop()