Opens a database file.
When an already open database is opened, this class grants access to the same database and increases an internal reference counter. A multiple referenced (open) database must be closed as many times as it has been opened. Until it is completely closed, the access to this database remains granted, and the database uses computer resources (memory and handles). For more information, refer to
Parameters: database_name (str) – The database alias or file pathname to open.
Closes the database.
For the case that different threads of an application are using the same database,
Database.closemaintain a reference counter indicating how many times the database is open. Every thread can open the database, work with it, and close the database independently using
False. Only the last call to
Database.closeactually closes access to the database.
Another option is that only one thread executes
True, which closes access for all other threads. This may be convenient when, for example, the main program needs to stop all running threads and be sure the database is closed properly, even if some threads could not execute
Parameters: close_all_refs (bool) – Indicates that a database open multiple times (refer to
Database) should be closed completely (
True), or just the reference counter should be decremented (
False), and the database remains open. When the database is closed completely, all references to objects in this database become invalid.
Returns a collection of
Clusterobjects in this database.
A cluster is assigned to a database when the cluster object is created. You cannot change this assignment afterwards.
FIBEX and AUTOSAR files can contain any number of clusters, and each cluster uses a unique name.
For CANdb (.dbc), LDF (.ldf), or NI-CAN (.ncd) files, the file contains only one cluster, and no cluster name is stored in the file. For these database formats, NI-XNET uses the name Cluster for the single cluster.
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.
For example, if the class of this object is
Signal, you can specify
mySignal, assuming that signal name is unique to the cluster. If not, you must include the
Framename as a prefix, such as
NI-XNET supports the following subclasses of
DatabaseObjectas arguments for
- object_class (
DatabaseObject) – The class of the object to find.
- object_name (str) – The name of the object to find.
An instance of the found object.
ValueError– Unsupported value provided for argument
XnetError– The object is not found.
Saves the open database to a FIBEX 3.1.0 file.
The file extension must be .xml. If the target file exists, it is overwritten.
XNET saves to the FIBEX file only features that XNET sessions use to communicate on the network. If the original file was created using non-XNET software, the target file may be missing details from the original file. For example, NI-XNET supports only linear scaling. If the original FIBEX file used a rational equation that cannot be expressed as a linear scaling, XNET converts this to a linear scaling with factor 1.0 and offset 0.0.
db_filepathis empty, the file is saved to the same FIBEX file specified when opened. If opened as a file path, it uses that file path. If opened as an alias, it uses the file path registered for that alias.
Saving a database is not supported under Real-Time (RT), but you can deploy and use a database saved on Windows on a Real-Time (RT) target (refer to Database.deploy).
Parameters: db_filepath (str) – Contains the pathname to the database file or is empty (saves to the original filepath).
After opening a database, this property always is set to
False, meaning that invalid
Signalobjects are not returned in properties that return a
DbCollectionfor the database (for example,
Signalobjects are incorrectly defined and therefore cannot be used in the bus communication. The
Falsesetting is recommended when you use the database to create XNET sessions.
In case the database was opened to correct invalid configuration (for example, in a database editor), you must set the property to
Trueprior to reading properties that return a
DbCollectionfor the database (for example,
For invalid objects, the
Signal.check_config_statusmethods raise an exception if there is a problem. For valid objects, no error is raised.
Signalobjects that became invalid after the database is opened are still returned from the
Frame.mux_static_signals, even if
Falseand Configuration Status returns an error code. For example, if you open a
Framewith valid properties, then you set
Frame.check_config_statusraises an exception, but the frame is returned from