Operator screens and process graphics

Device Control <smart-device-control>

DeviceControl is a faceplate for a discrete device such as a motor, a pump or an on/off valve.

<smart-device-control> · 19 properties, 6 methods, 6 events · source/modules/smart.devicecontrol.js

Usage in Vue

Vue uses the custom element directly. A property is bound with :kebab-name; an array or an object needs the .prop modifier so that Vue sets the property rather than an attribute. Events are listened to with @eventName; methods are called on the element through a template ref.

import 'smart-industrial/source/modules/smart.devicecontrol.js';

<smart-device-control ref="deviceControl" :tag="'P-2101A'" :interactive="true"
    @commandRequest="onEvent"></smart-device-control>

// methods are called on the element the ref holds
deviceControl.value.requestCommand('value');

// an array or an object is set as a property, not converted to an attribute: use .prop
<smart-device-control :available-modes.prop="availableModes"></smart-device-control>

Properties

BindingType, defaultDescription
:tag
tag
stringSets or gets the device tag, the first word of the accessible name and of every event.
:description
description
stringSets or gets the description shown beside the tag.
:kind
kind
DeviceControlKind
motor
Sets or gets the device type: motor, pump or generic devices are started and stopped, a valve is opened and closed.
:state
state
DeviceControlState
unknown
Sets or gets the device feedback as reported by the plant: running, stopped, starting, stopping, open, closed, opening, closing, fault or unknown. Feedback that matches the pending request completes the request. A fault is announced to assistive technology.
:commanded
commanded
stringSets or gets the last command reported by the plant (start, stop, open or close), shown as the filled command button. A command reported by the plant replaces a pending request from the screen.
:mode
mode
DeviceControlMode
auto
Sets or gets who commands the device: auto (the sequence), manual (the operator), local (a field switch; the screen can request stop or close only) or outOfService. Set by the application in response to the modeRequest event.
:available-modes
availableModes
array
["auto","manual"]
Sets or gets the modes the operator may ask for, shown as buttons. An entry that is not a string is skipped.
:quality
quality
DeviceControlQuality
good
Sets or gets the quality of the feedback: good, uncertain, bad or stale. Anything but good is shown as a badge and read out. Start and open are refused while the quality is bad or stale. Bad or stale feedback is drawn as not live: the lamp hollow and dashed, the state word grey and italic.
:interlocked
interlocked
boolean
false
Sets or gets whether an interlock holds the device: start and open are refused while it does, and the reason is shown.
:interlock-reason
interlockReason
stringSets or gets the interlock's reason, in plain language.
:permissives
permissives
arraySets or gets the start permissives as [{ label, met }]. Start and open are refused while one is not met, naming it. A permissive is met only when met is true, a non-zero number, or one of the strings 'true', '1', 'yes', 'on' or 'met'; 'false', 0, 'off', null and anything else are not met. An entry that is not an object is skipped.
:discrepancy
discrepancy
boolean
false
Sets or gets the application's finding that the feedback disagrees with the command, started, still stopped, shown as an alarm on the faceplate.
:fault-text
faultText
stringSets or gets the fault's text, shown and announced with the fault state.
:run-hours
runHours
number?Sets or gets the device's run hours, shown as a counter when given.
:start-count
startCount
number?Sets or gets the number of starts, shown as a counter when given.
:interactive
interactive
boolean
false
Sets or gets whether the screen may command the device at all. Off by default: a command requested from a faceplate the application has not enabled is refused with a reason.
:pending-timeout
pendingTimeout
number
5000
Sets or gets how long a request is shown as on its way before it is dropped and writeTimeout fires, in milliseconds. A pending request keeps its deadline when the element is moved to another parent.
:show-permissives
showPermissives
boolean
true
Sets or gets whether the permissives are listed on the faceplate.
:compact
compact
boolean
false
Sets or gets the compact form, for a strip of devices along an overview. It hides the description, the commanded text, the permissives and the counters, and keeps the tag, the quality badge, the mode chip, the lamp, the state, the notice, the commands (with Reset while faulted) and the mode buttons.

Methods

MethodDescription
requestCommand(command: string): voidRequests a command: start or stop, open or close. Raises the commandRequest event and shows the command as pending, or raises the blocked event with the reason when the command cannot be requested. A command the device kind does not take, such as open on a pump, is ignored without an event. The same command requested again within one second, or a start or open that is already pending, is dropped. A command the feedback already reports, such as start on a running pump, raises commandRequest without being shown as pending. Does nothing while the faceplate is disabled.
command string The command.
requestMode(mode: string): voidRequests a change of mode by raising the modeRequest event. The application responds by setting the mode property. Does nothing when the faceplate is not interactive or is disabled, when the mode is not in availableModes, or when it is already the current mode.
mode string One of the availableModes.
requestReset(): voidRequests a fault reset by raising the resetRequest event, while the state is fault. Does nothing when the faceplate is not interactive or is disabled.
refuse(reason: string): voidCalled by the application when it does not carry out the pending request. The request is no longer shown as pending and the reason is shown instead.
reason string Why, in plain language.
pendingCommand(): stringReturns the command shown as pending, or null.
canRequest(command: string): booleanReturns whether a command could be requested now. Stop and close need an interactive, enabled faceplate, in any mode. Start and open also need manual mode, live feedback (quality not bad or stale), no interlock and every permissive met. Returns false for a command the device kind does not take.
command string The command.

Events

The data of an event is in event.detail. commandRequest, modeRequest and resetRequest are requests: the device control raises them only while interactive is true, shows a command as pending, and keeps state and mode until the application sets them. A command still pending after pendingTimeout raises writeTimeout, blocked reports a refused command, and stateChange reports a new state from the application.

EventDescription and detail
@commandRequestThis event is triggered when a command is requested. The application writes the command to the plant and reports the feedback through the state property; until then the faceplate shows the command as pending.
tag string The device tag.
command string start, stop, open or close.
@modeRequestThis event is triggered when a mode is requested. The application answers by setting mode.
tag string The device tag.
mode string The requested mode.
@resetRequestThis event is triggered when a fault reset is requested.
tag string The device tag.
@blockedThis event is triggered when a start, stop, open or close command could not be requested: the screen is not interactive, or, for start and open, the device is not in manual or is under local control, the feedback is bad or stale, an interlock holds it, or a permissive is not met.
tag string The device tag.
command string The command.
reason string Why, in plain language.
@writeTimeoutThis event is triggered when a pending request got no feedback within pendingTimeout and was dropped.
tag string The device tag.
command string The command that was pending.
@stateChangeThis event is triggered when the feedback state changes.
tag string The device tag.
state string The new state.
oldState string The previous state.

Types

type DeviceControlKind

'motor' | 'pump' | 'valve' | 'generic'

type DeviceControlState

'running' | 'stopped' | 'starting' | 'stopping' | 'open' | 'closed' | 'opening' | 'closing' | 'fault' | 'unknown'

type DeviceControlMode

'auto' | 'manual' | 'local' | 'outOfService'

type DeviceControlQuality

'good' | 'uncertain' | 'bad' | 'stale'

CSS variables

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

--smart-device-width --smart-device-lamp-size --smart-device-panel --smart-device-header --smart-device-border --smart-device-ok --smart-device-warning --smart-device-critical --smart-device-accent --smart-device-neutral