Documentation search search close
CONTENTS
https://www.speedgoat.com/help/slrt/page/icon_documentation.jpg
v10.0.1.x for R2026a
View other versions

speedgoat.can.DbManagerConfig

speedgoat.can.DbManagerConfig — Create a Database Manager Config instance

Description

This Database Manager Config class constructs a class object for managing .dbc database files configured for a Simulink® model. The Config instance is connected to the specified model. Upon construction, it checks for running instances of the Database Manager Config class for the same model - these must be closed to proceed.

Several methods are available to retrieve or modify the configured database options; these methods operate on the data managed by the Config instance itself. Only after saving the Config instance is data passed to the connected model.

Syntax

Get a Database Manager Config instance for a specified model:

configObj = speedgoat.can.DbManagerConfig(modelPath)

Get the value for one or more specified parameters:

configObj.getParameter(parameter1,...,parameterN)

Add a new .dbc database file:

configObj.addDatabase(dbcName)

Set or update the path of a configured .dbc database file:

configObj.setDatabasePath(dbcName, newPath)

Remove a configured .dbc database file:

configObj.removeDatabase(dbcName)

Generate a Simulink library from a specified configured .dbc database file:

configObj.generateSlxLibrary(dbcName, destination)

Generate Simulink libraries for all configured .dbc database files:

configObj.generateAllSlxLibraries(destination)

Save persistent data to the connected model:

configObj.save()

Delete the Database Manager Config instance without saving persistent data:

configObj.delete()

Examples

Get a Database Manager Config instance and connect it to a loaded Simulink model:

configObj = speedgoat.can.DbManagerConfig('myModel')

Get the table of configured .dbc files and related information:

databaseOptions = configObj.getParameter('DatabaseOptions')

Add a .dbc file not on the MATLAB™ path or current folder to the model database options:

configObj.addDatabase('C:\myDatabases\powertrain.dbc')

Add a .dbc file on the MATLAB path or current folder to the model database options:

configObj.addDatabase('batteryManagement.dbc')

Update the path of a configured .dbc file:

configObj.setDatabasePath('powertrain.dbc', 'D:\project\dbc\powertrain.dbc')

Remove a configured .dbc file:

configObj.removeDatabase('powertrain.dbc')

Generate a Simulink library for one configured .dbc file in the current folder:

configObj.generateSlxLibrary('powertrain.dbc')

Generate a Simulink library for one configured .dbc file in a specified destination:

configObj.generateSlxLibrary('powertrain.dbc', 'C:\temp\libraries')

Generate Simulink libraries for all configured .dbc files in a specified destination:

configObj.generateAllSlxLibraries('C:\temp\libraries')

Save persistent database options to the connected model:

configObj.save()

Delete the Database Manager Config instance without saving persistent data:

configObj.delete()

Input Arguments

modelPath - Path or name of a Simulink model [character vector | string]. The path or name of a Simulink model for which CAN database options are managed.

Output Arguments

configObj - Instance of the Database Manager Config class

[DbManagerConfig] The Database Manager Config instance initialized for interacting with the specified model. The model remains connected to the Config instance until the Config instance is deleted.

Notes

This constructor requires a loaded Simulink model. Only one Database Manager Config instance per model can run at a time.