ScriptDeviceParameters

class ScriptDeviceParameters.ScriptDeviceConnectorSet(iterable=(), /)

Bases: list

The readonly list of connectors for a specific device object.

get_device_object()

Gets the device object associated with this connector set.

Return type:

ScriptDeviceObject

by_id(id)

Gets the specific connector by its id.

Parameters:

id (int) – The id.

Return type:

ScriptDeviceConnector

Returns:

The connector

class ScriptDeviceParameters.ScriptConnector

Bases: object

A connector.

This is implemented by the ScriptDeviceConnector instances returned by the ScriptDeviceConnectorSet as well as by ScriptExplicitConnectorObject.

property module_type

Id of the connector. This id is used by the driver on the runtime system.

The Id’s of matching parent and child connectors are different. Therefore in order to find a matching device for a given parent connector use the ConnectorType Property instead.

Return type:

int

property interface

The unique typename of a connector, eg. “Common.PCI”.

A parent connector may be connected to a child connector, if this connector type matches.

Return type:

str

property interface_name

Get an internationalized version of the interface name for presentation purposes.

Return type:

str

property connector_id

The unique connector id.

Return type:

int

property host_path

Get the id of the next connector towards the host.

-1, if the attached device is the controlling host.

Return type:

int

property connector_role

Get whether this connector is a parent or child connector.

Return type:

ConnectorRole

property is_explicit

Get whether a separate node should be shown in the user interface for this connector.

Return type:

bool

property host_parameters

Get the host parameter set of this connector.

The returned list is read-only which means you can’t add, insert or remove parameters or clear it. The list of available parameters is defined in the device description.

Return type:

ScriptDeviceParameterSet

get_device_object()

Get an instance of the device object this connector belongs to.

Return type:

ScriptDeviceObject

Returns:

The device object.

property additional_interfaces

Gets the additional interfaces of the connector.

This may be useful to find out which child connector of the current parent connector is actually valid.

Version added:

3.5.6.0

Return type:

list

Returns:

A python tuple containing strings declaring the additional interfaces.

class ScriptDeviceParameters.ScriptDeviceConnector

Bases: ScriptConnector

A device connector as contained in the ScriptDeviceConnectorSet.

property parent

Gets the ScriptDeviceConnectorSet defining this connector.

Return type:

ScriptDeviceConnectorSet

property io_always_mapping

Gets a value indicating whether this ScriptDeviceConnector is always mapping the I/Os belonging to this connector, even if they’re not used in the IEC code.

By default, I/Os which are not used in the IEC code are not updated in the I/O task. For debugging and other purposes, this behaviour can be overridden with this property.

Version added:

3.5.8.0

Return type:

bool

property driver_info

Get the driver info of the device connector.

Version added:

3.5.15.0

Return type:

ScriptDriverInfo

class ScriptDeviceParameters.ScriptDeviceParameterSet(iterable=(), /)

Bases: list

A device parameter set.

The list is read-only which means you can’t add, insert or remove parameters or clear it. The list of available parameters is defined in the device description.

property parent

Gets the parent.

This is either a ScriptDeviceObject, a ScriptConnector, or a ScriptExplicitConnectorObject.

Return type:

obj

get_device_object()

Gets the device object or explicit connector object defining this parameter set.

Return type:

ScriptDeviceObject

by_id(id: int)

Gets the ScriptDeviceParameter with the specified id.

Return type:

ScriptDeviceParameter

class ScriptDeviceParameters.ScriptMappableDeviceParameterSet(iterable=(), /)

Bases: ScriptDeviceParameterSet

Extension interface for the ScriptDeviceParameterSet returned by ScriptDeviceObject.device_parameters().

property io_always_mapping

Gets a value indicating whether this ScriptMappableDeviceParameterSet is always mapping the I/Os belonging to device parameter set (not part of any connectors), even if they’re not used in the IEC code.

By default, I/Os which are not used in the IEC code are not updated in the I/O task. For debugging and other purposes, this behaviour can be overridden with this property.

Return type:

bool

class ScriptDeviceParameters.ScriptDataElement

Bases: object

A data element of an online parameter.

Notice that instances of this interface usually also implement at least one of the related interfaces ScriptCompoundDataElement, ScriptValueDataElement, ScriptDeviceParameter, ScriptCompoundDataElement, ScriptEnumerationDataElement, ScriptRangeDataElement, which contain additional useful members, e. G. ScriptValueDataElement.value. Which interface applies can be determined via the properties has_sub_elements, is_range_type, is_enumeration, is_union and parameter.

property parent

Gets the parent.

This property returns either the parent ScriptDataElement (which may be the ScriptDeviceParameter), or the ScriptDeviceParameterSet if the current element is the device parameter.

Return type:

obj

property parameter

Gets the parameter defining this data element.

This will return the same instance if called on the ScriptDeviceParameter.

Return type:

ScriptDeviceParameter

property identifier

Unique identifier of this data element within it’s parent element.

Return type:

str

property visible_name

Internationalized name of the data element (this is the name used in the user interface).

Return type:

str

property description

Internationalized description of the data element.

Return type:

str

property unit

Internationalized unit of the data element. To be used by the presentation layer.

Return type:

str

property bit_size

Get the size of this parameters value in bits.

Return type:

int

property user_comment

Get or set a specified user comment.

Return type:

str

property has_sub_elements

Get information whether this element is a compound type.

True for structs, arrays, bitfields, … - in this case, the element implements ScriptCompoundDataElement. If this is False, the element implements ScriptPrimitiveTypeDataElement. The properties is_enumeration and has_sub_elements are mutually exclusive, only one of them can be true at the same time.

Return type:

bool

property is_range_type

True, if the elements value must be within a certain range.

If this is true, the element implements the ScriptRangeDataElement interface.

Return type:

bool

property is_enumeration

True if this element is defined as an enumeration. It then also implements ScriptEnumerationDataElement.

The properties is_enumeration and has_sub_elements are mutually exclusive, only one of them can be true at the same time.

Return type:

bool

property is_union

Gets a value indicating whether this ScriptDataElement is an union.

Return type:

bool

property can_access_online

Gets a value indicating whether this ScriptDataElement can be read online.

If this is true, the element additionally implements ScriptValueDataElement.

Return type:

bool

property is_mappable_io

Gets a value indicating whether this ScriptDataElement is a mappable input or output.

Version added:

3.5.8.0

Return type:

bool

Returns:

True if is a mappable input or output; otherwise, False.

property io_mapping

Gets the io mapping of this data element.

Version added:

3.5.8.0

Return type:

ScriptIoMapping

Returns:

The mapping, or None if no mapping exists (e. G. the data element is a device parameter and not an input or output).

class ScriptDeviceParameters.ScriptCompoundDataElement(iterable=(), /)

Bases: list

Data element representing compound values which cannot be read or written, but they have subelements which can be modified (if they’re not ScriptCompoundDataElements themselves).

Implementations of this interface also implement ScriptDataElement and sometimes also ScriptDeviceParameter.

class ScriptDeviceParameters.ScriptValueDataElement

Bases: ScriptDataElement

Data element representing values of basic member elements which can be read and written.

property default_value

Get the default value for this data element.

If the string is empty, then no explicit defaultvalue has been set.

Return type:

str

property value

Set/get the value for this element as a string representation.

Invalid values are accepted, but cause the error flag to be set.

Raises:

InvalidOperationException – Thrown if this element is a compound type (struct, array, …) - in other words, when ScriptDataElement.has_sub_elements is True - in that case, you need to set the values of the sub elements.

Return type:

str

property base_type

Gets the base type of this data element, or None if the type is a compound type.

Return type:

str

read_online_value(nTimeOut=1000)

Get the online value with the specified timeout.

You need to check ScriptDataElement.can_access_online before using this property.

Parameters:

nTimeOut (int) – The timeout.

Return type:

str

Returns:

The read value.

write_online_value(value)

Writes the specified value to the device.

You need to check ScriptDataElement.can_access_online before using this property.

Parameters:

value (str) – The value.

class ScriptDeviceParameters.ScriptRangeDataElement

Bases: ScriptValueDataElement

Data element representing values with a limited range.

property min_value

Get the minimal value for this element as a string representation.

Raises:

InvalidOperationException – Thrown if this element is not a range type element (equivalent to IsRangeType == False).

Return type:

str

property max_value

Get the maximum value for this element as a string representation.

Raises:

InvalidOperationException – Thrown if this element is not a range type element (equivalent to IsRangeType == False).

Return type:

str

class ScriptDeviceParameters.ScriptEnumerationDataElement

Bases: ScriptValueDataElement

Data element representing enumeration values.

property enum_value

Set/get the current value for this element as an enumeration value.

Raises:

InvalidOperationException – Thrown if this element is not a valid enumeration element.

Return type:

ScriptEnumerationValue

property allowed_values

Set/get the current value for this element as an enumeration value.

Invalid values are accepted, but cause the error flag to be set.

Raises:

InvalidOperationException – Thrown if this element is not a valid enumeration element.

Return type:

list[ScriptEnumerationValue]

property value_index

Gets or sets the index of the current value within the allowed_values array.

Return type:

int

Returns:

-1 if the current value is not a valid enumeration value.

read_online_enum_value(nTimeout=1000)

Get_online_enum_values the specified n timeout.

You need to check ScriptDataElement.can_access_online before using this property.

Parameters:

nTimeout (int) – The timeout in milliseconds.

Return type:

ScriptEnumerationValue

Returns:

Teh enumeration value.

write_online_value(value)

Writes the specified value to the device.

You need to check ScriptDataElement.can_access_online before using this property.

Parameters:

value (ScriptEnumerationValue) – The value.

class ScriptDeviceParameters.ScriptEnumerationValue

Bases: object

Defines one element of an enumeration.

property parent

Gets the defining ScriptEnumerationDataElement.

Return type:

ScriptEnumerationDataElement

property identifier

Unique identifier of this enumeration value within its enumeration element.

This is the value to use with the ScriptValueDataElement.value property.

Return type:

str

property visible_name

Internationalized name of the enumeration value. To be used by the presentation layer.

Return type:

str

property description

Internationalized description of the enumeration value. To be used by the presentation layer.

Return type:

str

property value

Gets the value.

Return type:

str

property index

Gets the index of this value within the ScriptEnumerationDataElement.allowed_values list.

Return type:

str

class ScriptDeviceParameters.ScriptDeviceParameter

Bases: ScriptDataElement

A device parameter.

property id

Each parameter has a unique id within it’s parameter list. This is also returned as the identifier in the underlying DataElement.

Return type:

int

property name

Internationalized name of the data element. To be used by the presentation layer.

Return type:

str

property offline_access_rights

Get the allowed access to this parameter in offline mode.

Return type:

AccessRight

property online_access_rights

Get the allowed access to this parameter in online mode.

Return type:

AccessRight

property downloaded_with_ioconfig

Get whether this parameter will be downloaded with the IO-Config.

Return type:

bool

property channel_type

If this parameter represents an IO channel, returns whether it is an input or an output channel. Otherwise this property returns ChannelType.None.

Return type:

ChannelType

property diagnostic_type

Get or set the diagnostic type of this parameter.

Return type:

DiagType

property type_string

Returns a string which fully describes the type.

Return type:

str

property section

Gets the section of the parameter.

The sections are purely informative and help to structure the device parameters in user interfaces.

Return type:

str

property iec_type

Gets the iec type of this parameter, or None if none is defined.

Return type:

str

property param_type

get information about the original paramtype (e.g. “std:uint” or “localtypes:struct”).

Usually, this is the best method to describe the type of an parameter - however, in old projects, this value might not be accurate or even empty.

Return type:

str

get_device_object()

Gets the device object associated with this parameter.

Return type:

ScriptDeviceObject

property disable_mapping

Get whether this parameter will be in the task mapping list for the io drivers.

Version added:

3.5.12.20

Return type:

bool

class ScriptDeviceParameters.ScriptIoVariableMapping

Bases: object

Represents a single variable mapping.

property Id

Gets the identifier.

Return type:

int

property variable

Gets or sets the variable for the mapping.

The string must be a valid IEC variable expression. If it’s an unqualified expression, a new variable with the given name will be created. Qualified expressions define a mapping to an existing variable.

Return type:

str

property default_variable

Gets the default variable, if defined in the device description.

The default variable, if existing, is defined in the device description.

Return type:

str

property mapping_creates_variable

Gets a value indicating whether this ScriptIoVariableMapping creates a new variable.

This is the opposite of maps_to_existing_variable.

Return type:

bool

Returns:

True if it creates a new variable; otherwise, False.

property maps_to_existing_variable

Gets a value indicating whether this ScriptIoVariableMapping maps to an existing variable.

This is the opposite of mapping_creates_variable.

Return type:

bool

Returns:

True if it maps to an existing variable; otherwise, False.

class ScriptDeviceParameters.ScriptIoMapping

Bases: ScriptIoVariableMapping

Describing the I/O Mapping options. This object also represents the first actual mapping for the variable.

Currently the device IO mapping editor UI allows only a single mapping to be configured, so we’ll implicitly handle this mapping similar to what the device IO mapping editor does. When an output variable (or a member thereof) is a struct, either the struct itself or its components may be mapped, but not both, as the semantics of the colliding mappings is not clear.

property automatic_iec_address

Gets or sets a value indicating whether this ScriptIoMapping has automatically assigned IEC addresses.

Return type:

bool

Returns:

True if the IEC addresses are automatically assigned; otherwise, False.

property manual_iec_address

Gets or sets the manually assigned IEC address.

Setting this to None will set automatic_iec_address to True, setting this to an address will set automatic_iec_address to False.

Return type:

str

Returns:

The manually assigned IEC address, or the automatically assigned address if the IEC address is automatically assigned.