nixnet.database.cluster
- class nixnet.database._cluster.Cluster(**kwargs: int)[source]
Bases:
DatabaseObjectDatabase cluster
- property application_protocol: AppProtocol
Get or set the application protocol.
- Type:
- property baud_rate: int
Get or set the buad rate all custer nodes use.
This baud rate represents the rate from the database, so it is read-only from the session. Use a session interface property (for example,
Interface.baud_rate) to override the database baud rate with an application-specific baud rate.CAN
For CAN, this rate can be 33333, 40000, 50000, 62500, 80000, 83333, 100000, 125000, 160000, 200000, 250000, 400000, 500000, 800000, or 1000000. Some transceivers may support only a subset of these values.
LIN
For LIN, this rate can be 2400-20000 inclusive.
If you need values other than these, use the custom settings as described in
Interface.baud_rate.- Type:
int
- property can_fd_baud_rate: int
Get or set the fast data baud rate when
Cluster.can_io_modeisCanIoMode.CAN_FD_BRS.Refer to the
CanIoModefor a description ofCanIoMode.CAN_FD_BRS. Use a session interface property (for example,Interface.can_fd_baud_rate) to override the database fast baud rate with an application-specific fast baud rate.NI-XNET CAN hardware currently accepts the following numeric baud rates: 200000, 250000, 400000, 500000, 800000, 1000000, 1250000, 1600000, 2000000, 2500000, 4000000, 5000000, and 8000000. Some transceivers may support only a subset of these values.
If you need values other than these, use the custom settings as described in
Interface.can_fd_baud_rate.- Type:
int
- property can_fd_iso_mode: CanFdIsoMode
Returns the mode of a CAN FD cluster.
The default is
CanFdIsoMode.ISO. You define the value in a dialog box that appears when you define an alias for the database.- Type:
- check_config_status() None[source]
Check this cluster’s configuration status.
By default, incorrectly configured clusters in the database are not returned from
Database.clustersbecause they cannot be used in the bus communication. You can change this behavior by settingDatabase.show_invalid_from_opento True. When a cluster configuration status becomes invalid after the database is opened, the cluster still is returned fromDatabase.clusterseven ifDatabase.show_invalid_from_openis False.- Raises:
XnetError – The cluster is incorrectly configured.
- property comment: str
Get or set a comment describing the cluster object.
A comment is a string containing up to 65535 characters.
- Type:
str
- property dbc_attributes: DbcAttributeCollection
Access the cluster’s DBC attributes.
- Type:
- property ecus: DbCollection
Returns a collection of
Ecuobjects in this cluster.An ECU is assigned to a cluster when the ECU object is created. You cannot change this assignment afterwards.
- Type:
- export(db_filepath: str) None[source]
Exports this cluster to a CANdb++ or LIN database file format.
A CAN cluster is exported as a CANdb++ database file (.dbc). A LIN cluster is exported as a LIN database file (.ldf). If the target file exists, it is overwritten.
Exporting a cluster is not supported under Real-Time (RT).
- Parameters:
db_filepath (str) – Contains the pathname to the database file.
- find(object_class: Type[DatabaseObject], object_name: str) DatabaseObject[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,
FrameforSignal), theobject_nameto search for can be short, and the search proceeds quickly.If this object is not a direct parent (for example,
DatabaseforSignal), theobject_nameto 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, andobject_classisSignal, you can specifyobject_nameofmySignal, assuming that signal name is unique to the cluster. If not, you must include theFramename as a prefix, such asmyFrameA.mySignal.NI-XNET supports the following subclasses of
DatabaseObjectas arguments forobject_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.
- property frames: DbCollection
Returns a collection of
Frameobjects in this cluster.A frame is assigned to a cluster when the frame object is created. You cannot change this assignment afterwards.
- Type:
- property lin_schedules: DbCollection
Returns a collection of
LinScheddefined in this cluster.You assign a LIN schedule to a cluster when you create the LIN schedule object. You cannot change this assignment afterwards. The schedules in this collection are sorted alphabetically by schedule name.
- Type:
- property lin_tick: float
Returns the relative time between LIN ticks (relative f64 in seconds).
The
LinSchedEntry.delayproperty must be a multiple of this tick.This tick is referred to as the “timebase” in the LIN specification.
The
Ecu.lin_masterproperty defines the Tick property in this cluster. You cannot use the Tick property when there is no LIN Master property defined in this cluster.- Type:
float
- merge(source_obj: Any, copy_mode: Merge, prefix: str, wait_for_complete: bool) int[source]
Merges database objects and related subobjects from the source to this cluster.
The source can be any of the following objects:
All listed objects must have unique names in the cluster. They are referenced here as objects, as opposed to child objects (for example, a signal is a child of a frame).
If the source object name is not used in the target cluster, this function copies the source objects with the child objects to the target. If an object with the same name exists in this cluster, you can avoid name collisions by specifying the prefix to be added to the name.
If an object with the same name exists in this cluster, the merge behavior depends on the
copy_modeinput.Example
Target frame F1(v1) has signals S1 and S2(v1). Source frame F1(v2) has signals S2(v2) and S3.
(v1) and (v2) are two versions of one object with same name, but with different properties.
Result when
copy_modeisCOPY_USE_SOURCE: F1(v2), S2(v2), S3.Result when
copy_modeisCOPY_USE_TARGET: F1(v1), S1, S2(v1).Result when
copy_modeisMERGE_USE_SOURCE: F1(v2), S1, S2(v2), S3.Result when
copy_modeisMERGE_USE_TARGET: F1(v1), S1, S2(v1), S3.
If the source object is a cluster, this function copies all contained PDUs, ECUs, and LIN schedules with their child objects to this cluster.
Depending on the number of contained objects in the source and destination clusters, the execution can take a longer time. If
wait_for_completeisTrue, this function waits until the merging process gets completed. If the execution completes without errors,perecent_completereturns100. Ifwait_for_completeisFalse, the function returns quickly, andperecent_completereturns values less than100. You must callCluster.mergerepeatedly untilperecent_completereturns100. You can use the time between calls to perform asynchronous tasks.- Parameters:
source_obj (object) – The object to be merged into this cluster.
copy_mode (
Merge) – Defines the merging behavior if this cluster already contains an object with the same name.prefix (str) – The prefix to be added to the source object name if an object with the same name and type exists in this cluster.
wait_for_complete (bool) – Determines whether the function returns directly or waits until the entire transmission is completed.
- Returns:
A value which indicates the merging progress as a percentage.
100indicates completion.- Return type:
int
- property name: str
Get or set the name of the cluster 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.
If you use a FIBEX file, the short name comes from the file. If you use a CANdb (.dbc), LDF (.ldf), or NI-CAN (.ncd) file, no cluster name is stored in the file, so NI-XNET uses the name Cluster. If you create the cluster yourself, the name that you provide is used.
A cluster name must be unique for all clusters in a database.
This short name does not include qualifiers to ensure that it is unique, such as the database name. It is for display purposes.
- Type:
str
- property pdus: DbCollection
Returns a collection of
Pduobjects in this cluster.A PDU is assigned to a cluster when the PDU object is created. You cannot change this assignment afterwards.
- Type:
- property pdus_reqd: bool
Returns whether using
PDUsin the database API is required for this cluster.If this property returns
False, it is safe to use signals as child objects of a frame without PDUs. This behavior is compatible with NI-XNET 1.1 or earlier. Clusters from .dbc, .ncd, or FIBEX 2 files always returnFalsefor this property, so using PDUs from those files is not required.If this property returns
True, the cluster contains PDU configuration, which requires reading the PDUs as frame child objects and then signals as PDU child objects, as shown in the following figure.Internally, the database always uses PDUs, but shows the same signal objects also as children of a frame.
For this property to return
False, the following conditions must be fulfilled for all frames in the cluster:Only one PDU is mapped to the frame.
This PDU is not mapped to other frames.
The PDU Start Bit in the frame is 0.
The PDU Update Bit is not used.
If the conditions are not fulfilled for a given frame, signals from the frame are still returned, but reading the property returns a warning.
- Type:
bool