The run Handshake

Every handshake module has one function, run, under v1/<module>/run/. It is the version 1 handshake of the LumiScan apps: one PLC function block serves every module of the Script Runner and every other app on version 1.

Nodes

Node Type PLC variable Meaning

run/request

BOOL8

xExecute

Written by the client. The run starts on its rising edge.

run/ready

BOOL8

true when a request would be accepted now: the module is built, the licence is valid, no restart is pending, nothing is running, and request was false since the last run.

run/running

BOOL8

xBusy

true from the acknowledge until the run ends, including the time a request waits in its group’s queue.

run/done

BOOL8

xDone

true when the run succeeded and its outputs are written.

run/has-error

BOOL8

xError

true when the run failed; output/status-code says why.

run/output/status-code

INT32

eErrorID

The last run’s outcome: 0 or negative at the end, 2 while it runs. See Status Codes.

run/output/status-text

STRING

The outcome in words.

run/output/package-identifier

UINT64

Grows by one with every successful run.

run/input/…​

One node or image group per input on a node.

run/output/…​

One node or image group per output on a node.

status/code, status/text

INT32, STRING

The module’s state: why ready is false.

Sequence

Step Client Module ready running done has-error

1

Waits for ready = true.

Idle.

true

false

false

false

2

Writes run/input/…​.

Keeps the values.

true

false

false

false

3

Sets request = true.

Acknowledges (status-code 2), takes all inputs, checks them and runs the procedure on its group’s worker.

false

true

false

false

4

Waits for done or has-error.

On success: writes the outputs, increments package-identifier, status-code 0. On failure: status-code and status-text, no output written. Then running falls and done or has-error rises.

false

false

true on success

true on failure

5

Reads the outputs, or status-code and status-text.

6

Sets request = false.

Clears done and has-error, then sets ready.

true

false

false

false

Rules

  • The inputs are taken when the run starts. A value written during a run is kept for the next run; it never changes the running one.

  • A failed input check ends the run before the procedure runs: a missing or wrong-kind value, a number outside min and max, an image of the wrong pixel type or size, an invalid handle from the store. Code -3.

  • A failed run writes no output. The output nodes keep the values of the last successful run. Check done (or package-identifier) before you use them.

  • Lowering request during a run does not stop it. The run ends, and its done or has-error stays until the next acknowledge.

  • A request while ready is false is not acknowledged. Read status/code and status/text of the module to see why.

  • There is no timeout. A procedure runs until it returns; your PLC program times out on its side.

  • One writer per request. Do not let two clients drive the same module.

  • A request in a busy group waits. While another module of the same group runs, ready stays true; the request is acknowledged and waits in the group’s queue.

PLC function block

Map one function block instance onto one module’s run folder:

Function block Node

xExecute (in)

run/request

xBusy (out)

run/running

xDone (out)

run/done

xError (out)

run/has-error

eErrorID (out)

run/output/status-code

Write the module’s inputs before you raise xExecute, and read its outputs when xDone is true. Hold xExecute until you have read xDone or xError.