Main Content

partrepo.simscape.BlockDataSet

Store and manage block parameter data and metadata

Since R2025a

Description

partrepo.simscape.BlockDataSet represents a set of parameter data and metadata for a Simscape block.

Use dot notation to view or edit the Metadata and Parameter properties of the BlockDataSet object, respectively. The image shows the contents of the Metadata and Parameter properties.

The block data set contains the metadata and parameters to apply to the Simscape block.

Creation

Use either the partrepo.simscape.BlockDataSet object or the partrepo.simscape.dataSetFromBlock or partrepo.importDataSetsFromJSON functions to create a block data set object.

Description

partrepo.simscape.BlockDataSet creates an empty BlockDataSet object.

example

Properties

expand all

Block data for a Simscape block, specified as a partrepo.simscape.BlockDataSet.Metadata object. You can specify these properties for the Metadata object as a string or a simscape.Value object:

  • Manufacturer — Part manufacturer

  • PartNumber — Part number

  • BlockType — Simulink block type

  • ParameterizationDate — Date at which the parameter data was added

  • SimulinkRelease — Simulink release in which the BlockDataSet object was created

  • ReferenceBlock — Library path for the block

  • LibraryVersion — Library version number for the block

  • ModelingEntityId — Internal identifier used to distinguish classes of parts

  • ModelingEntityType — Internal type used to classify ModelingEntityId properties

  • CustomIdentifier — Additional custom identifier used to distinguish BlockDataSet objects that have the same Manufacturer and PartNumber values

  • PartSchemaId — Internal identifier for the schema associated with the part

The BlockDataSet object may have other metadata properties depending on the part.

Parameter data for a Simscape block data set, specified as a partrepo.simscape.BlockDataSet.Parameter object. You can specify these properties for the partrepo.simscape.BlockDataSet.Parameter object parameters as a string or a simscape.Value object:

  • ValueExpr — Parameter value expression

  • Unit — Parameter units

  • Origin — Source of the parameter data

Object Functions

applyParamsApply parameters from block data set to Simscape block
removeFieldRemove properties from block data set metadata
validateValidate block data set

Examples

collapse all

This example shows how to create a block data set BlockDataSet object, edit it, and apply the parameters to a block.

Create a model with a Simscape block. This example uses a Capacitor block from the Foundation Library.

modelName = "myModel";
close_system(modelName,0) 
libraryBlockName = "fl_lib/Electrical/Electrical Elements/Capacitor";
open_system(new_system(modelName));
blockName = add_block(libraryBlockName,modelName + "/" + "Example block");

Create a block data set object from the Capacitor block.

myDataSet = partrepo.simscape.dataSetFromBlock(blockName)
myDataSet = 

  BlockDataSet with properties:

            ID: "||" (format)
      Metadata: [1×1 Metadata] (11 entries, Incomplete)
    Parameters: [1×1 Parameters] (3 entries)

View the parameter data.

disp(myDataSet.Parameters)
 Parameters with properties:

    c: 1e-6 (F)     | 
    g: 0 (1/Ohm)    | 
    r: 1e-6 (Ohm)   | 

View the metadata.

disp(myDataSet.Metadata)
Metadata (Incomplete) with properties:

            Manufacturer: ""
              PartNumber: ""
               BlockType: "SimscapeBlock"
    ParameterizationDate: "22-Jan-2025"
         SimulinkRelease: "25.1"
          ReferenceBlock: "fl_lib/Electrical/Electrical Elements/Capacitor"
          LibraryVersion: "25001000.1"
        ModelingEntityId: "foundation.electrical.elements.capacitor"
      ModelingEntityType: "SimscapeComponent"
        CustomIdentifier: ""
            PartSchemaId: "defaultSimscapeSchema"

Update the metadata.

myDataSet.Metadata.CustomIdentifier = 'My Capacitor'
myDataSet = 

  BlockDataSet with properties:

            ID: "||My Capacitor" (format)
      Metadata: [1×1 Metadata] (11 entries, Incomplete)
    Parameters: [1×1 Parameters] (3 entries)

Version History

Introduced in R2025a