Machine state, sequences and sessions

Sequence Editor <smart-sequence-editor>

SequenceEditor is a step sequence editor and runner for test sequences, batch procedures and recipes.

<smart-sequence-editor> · 7 properties, 8 methods, 5 events · source/modules/smart.sequenceeditor.js

Usage in Angular

The Angular wrapper is SequenceEditorComponent from SequenceEditorModule: every property is an input, every event an output named on<Event>, and the methods are called on the component reference from @ViewChild. A method that returns a value returns a Promise of it, resolved once the component has rendered; its ...Sync() twin returns the value at once, or null before the component has rendered. Unknown bindings are rejected at compile time.

import { SequenceEditorModule, SequenceEditorComponent } from 'smart-industrial/angular/sequenceeditor';

<smart-sequence-editor #sequenceEditor [stopOnFailure]="true"
    (onSequenceComplete)="onSequenceComplete($event)"></smart-sequence-editor>

@ViewChild('sequenceEditor', { read: SequenceEditorComponent }) sequenceEditor!: SequenceEditorComponent;
// methods are called on the component reference
this.sequenceEditor.abort();

Properties

InputType, defaultDescription
[currentStep]
currentStep
string | nullSets or retrieves the id of the step being run. Null when nothing is running.
[limitEvaluator]
limitEvaluator
function?Sets or gets a function (step, value) that returns true, false, or undefined to fall back to the built-in limit forms. Only needed for a limit that cannot be expressed as a range or as a nominal value with a tolerance.
[mode]
mode
SequenceEditorMode
edit
Sets or retrieves whether the sequence is being edited or run.
[precisionDigits]
precisionDigits
number
3
Sets or gets the number of decimal places used when a measurement is shown.
[showResults]
showResults
boolean
true
Sets or retrieves whether the result column is shown. The property is read when the default columns are built, so set it before the component is initialized. Boolean attributes are presence-based, so the column cannot be turned off from markup.
[steps]
steps
arraySets or retrieves the sequence as [{ id, name, action, unit, min, max, nominal, tolerance, value, skipped, aborted }]. Only id is required. A step with neither a range nor a nominal value is an action rather than a measurement: it can run but cannot fail on a value. The state of a step is derived from its measurement and its limit, so updating the measurement updates the verdict. Assign a new array to update the component.
[stopOnFailure]
stopOnFailure
boolean
false
Sets or retrieves whether a failed step aborts the rest of the run.

Methods

MethodDescription
abort(): voidStops the run and marks every step that has not run as aborted, so that the report shows that the run did not finish.
limitText(step: any): Promise<any>
and limitTextSync(step: any): string
Returns the limit of a step as it appears on a specification sheet: a range, a single bound, or a nominal value with a tolerance. An invalid limit is written with "(invalid limit)" after it, and warned about once in the console.
step object The step.
pause(): voidPauses the run at the current step.
report(): Promise<any>
and reportSync(): any
Returns the record of the run: the verdict, the number of steps in each state, and every step with its limit and measurement. A run passes only when no step failed and no step was left unrun.
run(): voidStarts the run at the first pending step and raises the stepStart event. Does nothing when the sequence is already running.
setResult(id: any, value: any): Promise<any>
and setResultSync(id: any, value: any): boolean
Records a measurement for a step and moves to the next step. While a step is current, only that step takes a result: a result for another step is refused, raises resultRefused, changes nothing and returns false. A non-numeric result is kept and shown, and the step is marked as not evaluated rather than as passed or failed.
id string | number The step's id. Always identify a step by id and never by row index, the table sorts, so an index stops meaning anything the moment a column header is clicked.
value any The measurement.
skip(id: string | number): voidMarks a step as not run and moves to the next step when the sequence is running.
id string | number The step's id.
stateOf(step: any): Promise<any>
and stateOfSync(step: any): string
Returns the state of a step: pending, running, passed, failed, skipped, aborted or notEvaluated. The state is derived from the measurement and the limit. A step with a limit whose result cannot be judged against it - NaN, Infinity, a text such as n/a, or a limit that is itself invalid (a minimum above the maximum, a negative tolerance) - is notEvaluated, never passed; a report with such a step has not passed.
step object The step.

Events

The data of an event is in event.detail. The sequence editor executes no step itself: it sets currentStep, raises stepStart and waits, with no timeout, until the application calls setResult(). stepComplete, sequencePause and sequenceComplete follow changes the editor has already made to steps, currentStep and mode.

OutputDescription and detail
(onSequenceComplete)
sequenceComplete
This event is triggered when the run finishes or is aborted.
aborted boolean Whether it was aborted rather than completed.
report object The full record.
(onSequencePause)
sequencePause
This event is triggered when the run is paused.
step any The step it paused at.
(onStepComplete)
stepComplete
This event is triggered when a measurement is recorded against a step.
id string | number The step's id.
state string The state it settled into.
passed boolean Whether it passed.
step object The step that completed.
(onResultRefused)
resultRefused
This event is triggered when setResult is called for a step that is not the one running. The result is not recorded and the run does not move.
id string | number The step the result was for.
value any The result that was refused.
current string | number The step that is running.
(onStepStart)
stepStart
This event is triggered when the run reaches a step. The application performs the measurement and calls setResult; the component waits and does not execute anything itself.
id string | number The step's id.
step object The step.
index number Its position in the sequence.

Types

type SequenceEditorMode

'edit' | 'run'

CSS variables

The component declares 1 CSS variables; the CSS page shows how to set them.

--smart-sequence-height