nixnet.database.pdu

class nixnet.database._pdu.Pdu(**kwargs)[source]

Bases: nixnet.database._database_object.DatabaseObject

Database PDU

check_config_status()[source]

Check this PDU’s configuration status.

By default, incorrectly configured PDUs in the database are not returned from Cluster.pdus because they cannot be used in the bus communication. You can change this behavior by setting Database.show_invalid_from_open to True. When a PDU configuration status becomes invalid after the database is opened, the PDU still is returned from Cluster.pdus even if Database.show_invalid_from_open is False.

Raises:XnetError – The PDU is incorrectly configured.
cluster

Get the parent cluster in which the PDU has been created.

You cannot change the parent cluster after creating the PDU object.

Type:Cluster
comment

Get or set a comment describing the PDU object.

A comment is a string containing up to 65535 characters.

Type:str
find(object_class, object_name)[source]

Finds an object in the database.

This function finds a database object relative to this parent object. This object may be a grandparent or great-grandparent.

If this object is a direct parent (for example, Frame for Signal), the object_name to search for can be short, and the search proceeds quickly.

If this object is not a direct parent (for example, Database for Signal), the object_name to search for must be qualified such that it is unique within the scope of this object.

For example, if the class of this object is Cluster, and object_class is Signal, you can specify object_name of mySignal, assuming that signal name is unique to the cluster. If not, you must include the Frame name as a prefix, such as myFrameA.mySignal.

NI-XNET supports the following subclasses of DatabaseObject as arguments for object_class:

Parameters:
  • object_class (DatabaseObject) – The class of the object to find.
  • object_name (str) – The name of the object to find.
Returns:

An instance of the found object.

Raises:
  • ValueError – Unsupported value provided for argument object_class.
  • XnetError – The object is not found.
frms

Returns a list of all frames to which the PDU is mapped.

A PDU is transmitted within the frames to which it is mapped.

To map a PDU to a frame, use the Frame.pdu_properties property. You can map one PDU to multiple frames.

Type:list of Frame
mux_data_mux_sig

Data multiplexer signal in the PDU.

This property returns the reference to the data multiplexer signal. If data multiplexer is not defined in the PDU, the property raises an XnetError exception. Use the Pdu.mux_is_muxed property to determine whether the PDU contains a multiplexer signal.

You can create a data multiplexer signal by creating a signal and then setting the Signal.mux_is_data_mux property to True.

A PDU can contain only one data multiplexer signal.

Raises:XnetError – The data multiplexer is not defined in the PDU.
Type:Signal
mux_is_muxed

Returns True if the PDU contains a multiplexer signal.

PDUs containing a multiplexer contain subframes that allow using bits of the payload for different information (signals), depending on the value of the SubFrame.mux_value property.

Type:bool
mux_static_sigs

Returns a list of static signals in the PDU.

Returns an list of signal objects in the PDU that do not depend on value of the SubFrame.mux_value property. Static signals are contained in every PDU transmitted, as opposed to dynamic signals, which are transmitted depending on the value of the SubFrame.mux_value property.

You can create static signals by specifying the PDU as the parent object. You can create dynamic signals by specifying a subframe as the parent.

If the PDU is not multiplexed, this property returns the same list as the Pdu.signals property.

Type:list of Signal
mux_subframes

Collection of SubFrame objects in this PDU.

A subframe defines a group of signals transmitted using the same value of the SubFrame.mux_value. Only one subframe is transmitted in the PDU at a time.

Type:DbCollection
name

Get or set the name of the PDU object.

Lowercase letters, uppercase letters, numbers, and the underscore (_) are valid characters for the short name. The space ( ), period (.), and other special characters are not supported within the name. The short name must begin with a letter (uppercase or lowercase) or underscore, and not a number. The short name is limited to 128 characters.

A PDU name must be unique for all PDUs in a cluster.

Type:str
payload_len

Get or set the size of the PDU data in bytes.

This property is required. If the property does not contain a valid value, and you create an XNET session that uses this PDU, the session returns an error. To ensure that the property contains a valid value, you can do one of the following:

  • Use a database file (or alias) to create the session.

    The file formats require a valid value in the text for this property.

  • Set a value at runtime using this property.

    This is needed when you create your own in-memory database (:memory:) rather than use a file. The property does not contain a default in this case, so you must set a valid value prior to creating a session.

Type:int
signals

Collection of all Signal objects in this PDU.

The collection includes all signals in the PDU, including static and dynamic signals and the multiplexer signal.

Type:DbCollection