Skip to content

Vision: programs and product changeover ​

Last updated

License feature: Machine Vision

A line that makes more than one product needs more than one inspection — different part counts, different limits, a different label to read. Each is a program: a named set of tools. A device holds as many programs as you like and runs one at a time. Cameras, scale, trigger, lighting sequence and archive settings are shared by all programs.

A device set up before programs existed reads as one program with key default, named Default.

The Programs card ​

ControlWhat it does
Program buttonsChoose which program you are editing. The one the device is running has a green dot
AddA new program programN with one Circles tool
DuplicateA deep copy of the program you are editing, key <key>_N, name "… copy". A new product usually starts as a copy of a similar one
Program nameLabel, up to 60 characters. Can be written to the program tag instead of the key
Program keyWhat a recipe or PLC writes. Cleaned when you leave the field (lower case, a–z 0–9 _). "Write "bottle_500" to the program tag to run this one. Changing the key breaks recipes that use the old one."
Run this programMakes the program you are editing the running one — when you press Save. The label changes to "Runs on the device when you save"
Bin iconRemoves the program you are editing. Disabled on the last one ("A device needs at least one program."). Removing the running program makes the first program run on save

Editing a program is not the same as running it. Tuning the next product while the line makes this one is the normal way to prepare a changeover — Grab one uses the program you are editing. Save never changes which program runs unless you pressed Run this program, so a changeover made by a PLC while the page is open is not undone.

Changing over from outside ​

Write to the vision device's tags:

WriteToMatches
The program's key, e.g. bottle_500programKey first, then name (not case-sensitive)
The program's position from 1, e.g. 2program_numberPosition (a whole number)

The switch takes effect on the next inspection and is saved, so it survives a restart. An unknown program is refused: "No program "bottle_750" on this device. Programs: default, bottle_500."

With the recipe engine: add a recipe parameter that writes the program's key to the vision device's program tag. Applying the recipe changes over the inspection with everything else the product needs, and recipe history records it. Put the program parameter before any vision limits in the recipe: a setting written to a vision device applies to the program that is running. See Recipes.

Rules that keep a changeover safe ​

  • Tags never move. The device publishes the tags of every program's tools all the time, so a screen or alarm bound to one keeps working. A tool the running program does not use reads uncertain with its last value.
  • A changeover invalidates the verdict. Until the new program has inspected something, pass, judged and every tool result read uncertain.
  • A changeover resets the counts. It is a batch boundary; the historian keeps the last product's figures.
  • A tool key keeps one type across programs. dots can be a circle counter in two programs with different targets, but not a counter in one and a barcode reader in another. Saving that is refused: "Tool "dots" is a circles tool in "Small tray" and a barcodes tool in "Large tray". A tool key keeps one type across programs, because its tags depend on it — give one of them a different key."
  • Two programs cannot share a key ("Two programs share the key "…"."); on save a duplicate key is renumbered.
  • Settings follow the running program. Writing cap/minValue while a program without a cap tool is running is refused, rather than quietly changing a product that is not being made.
  • Where the same tool key appears in several programs, its setting tags show the values of the running program.

Worked example: two bottle sizes ​

  1. Build program 500 ml (key bottle_500) with tools cap (Presence) and fill (Caliper, liquid level), and tune it.
  2. Duplicate it, rename to 750 ml, key bottle_750. Redraw the fill region for the taller bottle and set new limits. Grab one with a 750 ml bottle to check. Save (the 500 ml program is still running).
  3. In the 750 ml recipe, parameter 1 writes bottle_750 to Bottle Camera → program; later parameters write fill/minValue and fill/maxValue if they vary by batch.
  4. Apply the recipe. program_name reads 750 ml; pass reads uncertain until the next bottle is inspected.

See also ​

Scada.Ink Help Center