Switch Object
The Switch object can access data from a simple discrete (0/1) device. This object can act as both a discrete input and a discrete output.
Click one of the following Help topics to navigate to information about that topic.
|
Topic Category
|
Topic Subcategory
|
Topic Details
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Overview
The Switch object is an ApplicationObject that can be used to monitor and control a simple two-state device as a traditional discrete-input/discrete-output device. Examples include a limit switch or a discrete level indicator.
You can specify the state names for the true (1) and false (0) states of the Switch object. By default, these are "On" and "Off," respectively.
The Switch object supports three access modes:
- ReadOnly. The object only accepts input (feedback). The process value (PV) will be updated based on the value that is read from the configured input address. A user write to the PV is not allowed.
- WriteOnly. The object only sends output. The PV will be written to the specified output destination.
- ReadWrite. The object accepts input and sends output (with scanned feedback). In this case, the output destination can optionally differ from the input source address.
The value of PV is one of two enumerated states. As an enumeration, the value has both an ordinal value and an associated state label (string). The ordinal value can be either 1 (false state) or 2 (true state). The PVBool attribute value is derived from the PV and can be either 0 (false state) or 1 (true state). The PV value can be historized, logged as an event, and alarmed. The PVBool value can be historized by attaching a history feature.
If you want to monitor and control a discrete field device that has more than two states (for example, open, closed, moving), use the DiscreteDevice object. The DiscreteDevice object also offers more sophisticated supervisory control capabilities, such as command alarms, feedback alarms, and statistics.
For general information on objects, including relationships, deployment, and alarm distribution, see the Integrated Development Environment (IDE) documentation.
For information on configuration options of object scripts, attributes, or features, click Attributes Help in the Help file header.
Related Topics
Run-Time Behavior
Configuration
Run-Time Object Attributes
Quality Handling
Run-Time Behavior
The following table describes the run-time behavior of the object.
|
Topic Category
|
Topic Subcategory
|
Topic Details
|
|
|
|
|
|
|
|
Run-time behavior pertains to the running state of a deployed Switch object. Once deployed and operating, Switch objects can assume one of the following states:
|
State Change
|
Behavior
|
|
Startup
|
- If the Switch object has only an output, the initial PV will be read into the object, stored internally, and then used to write to the output when the object goes onscan.
- When the object starts up after being deployed, the time stamp is set to the time when the attribute is initialized with a deployed value. Otherwise, the checkpointed value and time stamp is set into PV.
|
|
Going onscan
|
- If the object has feedback, then the PV quality is set to INITIALIZING.
- If the object is configured as WriteOnly, the initial PV is written to the output location. For each subsequent onscan state, the output is set to the last written value. The PV quality is GOOD.
- The time stamp is updated to the current time if the quality of PV changes because of a scan state change. The time stamp of the PV is written to the output with the PV value.
|
|
Execute
|
- If the access mode is ReadOnly or ReadWrite, read the new input value and quality and set it into PV.
- If a new PV output is requested, and the access mode is ReadWrite or WriteOnly, the requested new PV value is written to the output location.
- Detect state alarms, if configured.
|
|
Going offscan
|
- If the access mode is ReadOnly or ReadWrite, then the PV quality is set to BAD. The PV is left at the previous value.
- If the access mode is WriteOnly, the PV quality is GOOD.
- The time stamp is updated to the current time if the quality of PV changes because of a scan state change.
|
|
Offscan
|
The object is passive.
|
|
Shutdown
|
If a reference to PV was registered and suspended at startup, that reference is activated and unregistered.
|
Related Topics
Special Set Handling
Continuous Execution
Overview
Configuration
Run-Time Object Attributes
Quality Handling
Special Set Handling
PV is the only attribute that can be written to at run time. If the object has feedback, then the feedback.value is transferred into the PV attribute. If the object has an output, then the value is transferred to output.value. Only when the object does not have feedback will an external write to PV be transferred directly into the attribute.
If you configure the object as WriteOnly or ReadWrite, the original time stamp associated with the value provided by the set request is always forwarded to the output. If only the Time property of the PV is set, the current value of PV and the requested time stamp is forwarded to the output. In WriteOnly mode, the PV time stamp is updated to the current time if the set request contains a zero time stamp or the provided time stamp of the set request contains a non-zero time stamp.
Related Topics
Run-Time Behavior
Continuous Execution
Continuous Execution
If the object has a feedback, then transfer feedback.value into PV.
If you configure the object to have input or input/output and advisement of active items is enabled globally, both the reference count and suspend count for the PV attribute is incremented when the object starts up. This puts the object into a suspended state and propagates a suspend message to the input source.
When the object is in a suspended state, no input scanning occurs, because no new input values are being sent by the input source. The quality of the suspended attribute is INITIALIZING.
Related Topics
Run-Time Behavior
Special Set Handling
Time Propagation
If you configure the object as ReadOnly or ReadWrite, the input value is used to compute the PV value, and the input time stamp is used to update the PV time stamp.
If you configure the object as WriteOnly or ReadWrite:
- If a set request to the PV value property is received, the set request's original value and time stamp is forwarded to the output.
- If a set request to the PV time property is received, the PV's current value and time stamp provided by the set request is forwarded to the output.
If you configure the object as WriteOnly:
- If a set request to the PV value property is received, the PV attribute is updated to the value and requested time stamp if a non-zero timestamp is provided, or value and current time if a zero time stamp is provided.
- If a set request to the PV time property is received, the PV attribute's time stamp is updated to the requested time stamp.
Related Topics
Run-Time Behavior
Special Set Handling
Continuous Execution
Configuration
The following table describes the object editor options for configuration and the associated attributes:
|
Topic Category
|
Topic Subcategory
|
Topic Details
|
|
|
|
|
For general information on objects, including relationships, deployment, and alarm distribution, see the Integrated Development Environment (IDE) documentation.
For information on configuration options of object scripts, attributes, or features, click Attributes Help in the Help file header.
Related Topics
Overview
Run-Time Behavior
Run-Time Object Attributes
Quality Handling
General Configuration
Use the General tab to configure general options for the Switch object.
|
Editor Option
|
Associated Attribute
|
Description
|
Run-Time Access (Supervisory, User, Read-Only, None)
|
|
Access mode
|
AccessMode
|
Used to specify the read/write capabilities for the object. Valid values are ReadOnly, ReadWrite, and WriteOnly.
|
None
|
|
Initial PV
|
PV
|
If the Switch object is configured for WriteOnly, this value is the specified initial PV value. If the object is ReadOnly or ReadWrite, this value is determined by the state of the input (feedback) value.
Before being stored to Wonderware Historian history, the value is converted to an integer, where 1 = FALSE state, 2 = TRUE state.
For extra quality handling, see Quality Handling.
|
Supervisory, User
|
|
Text for value of 0
|
StateNames[1]
|
The text that corresponds to the FALSE state of the switch (where the input value = 0).
|
Read-Only
|
|
Text for value of 1
|
StateNames[2]
|
The text that corresponds to the TRUE state of the switch (where the input value = 1).
|
Read-Only
|
|
Generate event upon PV change
|
PV.LogDataChangeEvent
|
If enabled, data change events for the PV will be logged to event history.
|
Supervisory, User
|
|
PV input source
|
PV.Input.InputSource
|
The target source from which the value (plus quality) is to be read. Click the ellipse button to access the Attribute Browser.
|
Supervisory, User
|
|
Output destination differs from input source
|
DiffOutputDest
|
If enabled, the output destination will be different from the input source.
|
None
|
|
PV output destination
|
PV.Output.OutputDest
|
The target location to which the output value will be written. Click the ellipse button to access the Attribute Browser.
|
Supervisory, User
|
|
Historize PV
|
PV.Historized
|
If enabled, the system will historize the value of PV.
|
None
|
|
Force storage period
|
PV.ForceStoragePeriod
|
The time interval, in milliseconds, at which the value must be stored, even if the value has not changed. A value of 0 disables this feature. As an example, a setting of 3600000 indicates the value must be stored once per hour (measured from the time the object was last put onscan). If this value is less than the scan period of the host object, forced storage will occur every scan period.
|
Supervisory, User
|
|
Sample Count
|
PV.SampleCount
|
An Obsolete. Do not use.
|
Supervisory, User
|
|
Detect alarm
|
PV.AlarmState.Alarmed
|
If enabled, an alarm will be triggered when the value of PV is a certain state.
|
None
|
|
Alarm state
|
PV.AlarmState
|
The state at which an alarm will be triggered.
|
Read-Only
|
|
Alarm priority
|
PV.AlarmState.Priority
|
See Alarm Attributes.
|
Supervisory, User
|
|
Category
|
PV.AlarmState.Category
|
See Alarm Attributes.
|
Supervisory, User
|
|
Alarm message attribute
|
PV.AlarmState.DescAttrName
|
See Alarm Attributes. Click the ellipse button to access the Attribute Browser.
|
None
|
Related Topics
Configuration
Run-Time Object Attributes
The following table describes the run-time only attributes for the object.
|
Topic Category
|
Topic Subcategory
|
Topic Details
|
|
|
|
|
|
|
|
Note Configurable run-time attributes are described in the configuration sections. For more information, see Configuration.
For a list of common attributes, click Attributes Help in the Help file header.
|
Attribute
|
Description
|
Run-Time Access (Supervisory, User, Read-Only, None)
|
|
PV.AlarmState.Condition
|
Set to TRUE when the PV value equals alarm state value.
|
Read-Only
|
|
PV.Input.DataType
|
The expected data type of the value. This value is locked to MxBoolean in the Switch base template.
|
Read-Only
|
|
PV.Input.ReadStatus
|
The cause of any errors that have occurred when data is read from the target feedback reference (object and attribute). This is the Message Exchange status and not the status of the communication to external systems or devices such as Programmable Logic Controllers (PLCs).
|
Read-Only
|
|
PV.Input.Value
|
The value that is "calculated" using data received via Message Exchange.
|
Read-Only
|
|
PV.Output.DataType
|
The expected data type of the value. This value is locked to MxBoolean in the Switch base template.
|
None
|
|
PV.Output.Value
|
The placeholder for values that will be written to the target location.
|
Read-Only
|
|
PV.Output.WriteStatus
|
The cause of any errors when writing data to the target location (object and attribute), or, in the case where that location is in a DeviceIntegration Object, the actual field I/O status. This status is the Message Exchange status and, when OutputDest is a DeviceIntegration Object, the status of the communication to external systems or devices such as Programmable Logic Controllers (PLCs).
|
Read-Only
|
|
PVBool
|
A state value that is derived from the PV. A value of 1 is subtracted from the ordinal value to get a 0 (false) or 1 (true) result any time that PV changes.
|
Read-Only
|
Related Topics
Overview
Run-Time Behavior
Configuration
Quality Handling
Alarm Aggregation Attributes
The following attributes are available for all Objects. If alarm aggregation is enabled on the Area, the following attributes aggregate their respective alarm status values for the Area, for all sub-Areas, contained objects, and their descendants assigned to the Area. If alarm aggregation is disabled, these attributes remain at their default values. Alarm aggregation attributes behave similarly to alarm aggregation of individual attributes.
|
Attribute
|
Description
|
Run-Time Access (Supervisory, User, Read-Only, None)
|
|
<Attribute>.AlarmCntsBySeverity
|
Array of counts of all alarms that are in UNACK_ALM, ACK_ALM, or UNACK_RTN states on the object, aggregated by severity levels 1-4.
|
Read-Only
|
|
<Attribute>.AlarmMostUrgentAcked
|
TRUE (default) indicates that no alarms are in the InAlarm state or waiting to be Acked.
A value of TRUE also indicates that the most urgent alarm(s) on the object and its descendants in the InAlarm state have been acknowledged, whether or not they are currently InAlarm.
|
Read-Only
|
|
<Attribute>.AlarmMostUrgentIn Alarm
|
FALSE (default) indicates that no alarms are in the InAlarm state or waiting to be Acked.
A value of FALSE indicates whether the most urgent alarm(s) on the object and its descendants are in the InAlarm state, whether or not they have been acknowledged.
|
Read-Only
|
|
<Attribute>.AlarmMostUrgentMode
|
The AlarmMode of the most urgent alarm(s) on this Object and its descendants. If no alarms are in the InAlarm state or waiting to be Acked, the value is the same as the AlarmMode for the Object.
|
Read-Only
|
|
<Attribute>.AlarmMostUrgent Severity
|
Severity level expressed as an integer 1-4 of the most urgent alarm(s) on the object and its descendants. If no alarm is in the InAlarm state or waiting to be Acked, the value is 0 (zero).
|
Read-Only
|
|
<Attribute>.AlarmMostUrgent Shelved
|
The Shelved status as a Boolean value for the “most urgent” alarm(s) on this Object and its descendants.
A value of FALSE indicates that no alarms have been Shelved for the "most urgent" alarm(s) on this Object and its descendants.
|
Read-Only
|
Run-Time Behavior
Alarm Attributes
If an alarm attribute is enabled, then the following additional alarm attributes become available. None of these attributes can be alarmed.
|
Attribute
|
Description
|
|
<Attribute>.Acked
|
Used to specify whether an alarm has been acknowledged. This attribute is updated when the AckMsg attribute is set. This attribute is always set to FALSE when a new alarm condition is detected (when the InAlarm attribute changes from FALSE to TRUE).
|
|
<Attribute>.AckMsg
|
The operator comment at the time the alarm is acknowledged. Any received text is stored, and the Acked attribute is set to TRUE. Also, the TimeAlarmAcked attribute is set to the current time. The maximum length is 256 characters.
|
|
<Attribute>.AlarmMode
|
The current alarm mode setting. Valid values are: Enable, Disable, Silence.
|
|
<Attribute>.AlarmModeCmd
|
The command to set the alarm mode. Valid values are: Enable, Disable, Silence.
|
|
<Attribute>.Category
|
The category of the alarm. The label of each alarm category is fixed.
|
|
<Attribute>.DescAttrName
|
The description of the alarm. The description must be of type String or InternationalizedString, with a maximum length of 329 characters. The DescAttrName attribute can contain a static alarm description or a reference to another string attribute within the same object containing the alarm description. The reference must be in the form: "me.AttrName". If the reference is invalid, the actual reference string is used for the description. If nothing is supplied for the DescAttrName attribute, the object’s ShortDesc attribute is used at run time.
|
|
<Attribute>.InAlarm
|
The alarm state. This is exactly the same as the attribute in the host primitive that represents the alarm condition, except when the alarm state is disabled, in which case, InAlarm is set to Off, regardless of the actual condition state.
The quality is set during execute to the quality of the attribute, except when the alarm is disabled, in which case the quality is always GOOD.
|
|
<Attribute>.Inhibit
|
If true, the alarm is disabled. This attribute is intended to be written to by a script, a user, or an input feature. Only the individual alarm is disabled. No other alarms are disabled in the same object or in any objects that are assigned to or contained by this object.
|
|
<Attribute>.Priority
|
The value for the urgency of the alarm. Valid values are 1 through 999, with 1 being the most urgent.
|
|
<Attribute>.TimeAlarmAcked
|
The timestamp indicating the last time this alarm was acknowledged. The date format reflects the current locale setting for the operating system.
|
|
<Attribute>.TimeAlarmOff
|
The timestamp indicating the last time this alarm (as represented by the InAlarm attribute) went off. The date format reflects the current locale setting for the operating system.
|
|
<Attribute>.TimeAlarmOn
|
The timestamp indicating the last time this alarm (as represented by the InAlarm attribute) went on. The date format reflects the current locale setting for the operating system.
|
Quality Handling
The following attributes have extra quality handling:
|
Attribute
|
Quality Handling
|
|
PV
|
When the object goes onscan, if the access mode is ReadOnly or ReadWrite, then the quality is set to INITIALIZING. If the access mode is WriteOnly, then the quality is set to GOOD. While the object is executing, if the access mode is ReadOnly or ReadWrite, the data quality will be the same as the quality of the feedback value. When the object goes offscan, if the access mode is ReadOnly or ReadWrite, then the quality is BAD. If the access mode is WriteOnly, then the quality remains GOOD.
|
Related Topics
Overview
Run-Time Behavior
Configuration
Run-Time Object Attributes
© 2014 Invensys Systems, Inc. All Rights Reserved.
Invensys is a Schneider Electric company
10/17/14