Main Content

padv.Artifact

Store artifact information

    Description

    This object requires CI/CD Automation for Simulink Check. A padv.Artifact object represents an artifact that you can run a task on in the process defined in your process model. For example, you can use a padv.Artifact object as the input to functions like runprocess and generateProcessTasks when you only want to run or generate tasks associated with a specific artifact.

    Creation

    Description

    artifactObject = padv.Artifact(artifactType,artifactAddress) stores artifact information in a padv.Artifact object, artifactObject. You can use the artifact information when you want to get the ID for a specific task iteration.

    example

    artifactObject = padv.Artifact(___,Name=Value) sets certain properties using one or more name-value arguments. You can use name-value arguments to specify the Alias and Parent properties. The object has other properties, but you cannot set those properties during object creation.

    Input Arguments

    expand all

    Type of artifact, specified as one or more of the values listed in this table. To specify multiple values, use an array. The build system uses the artifact type to identify and categorize the different file types and modeling constructs in your project.

    CategoryArtifact TypeDescription

    MATLAB®

    "m_class"MATLAB class
    "m_file"MATLAB file
    "m_func"MATLAB function
    "m_method"MATLAB class method
    "m_property"MATLAB class property

    Model Advisor

    "ma_config_file"Model Advisor configuration file
    "ma_justification_file"Model Advisor justification file

    Process Advisor

    "padv_dep_artifacts"

    Related artifacts that current artifact depends on

    "padv_output_file"

    Process Advisor output file

    Project

    "project"Current project file

    Requirements

    "mwreq_item"Requirement (since R2024b)

    "sl_req"

    Requirement (for R2024a and earlier)
    "sl_req_file"Requirement file
    "sl_req_table"Requirements Table

    Stateflow®

    "sf_chart"Stateflow chart
    "sf_graphical_fcn"Stateflow graphical function
    "sf_group"Stateflow group
    "sf_state"Stateflow state
    "sf_state_transition_chart"Stateflow state transition chart
    "sf_truth_table"Stateflow truth table

    Simulink®

    "sl_block_diagram"Block diagram
    "sl_data_dictionary_file"Data dictionary file
    "sl_embedded_matlab_fcn"MATLAB function
    "sl_block_diagram"Block diagram
    "sl_library_file"Library file
    "sl_model_file"Simulink model file
    "sl_protected_model_file"Protected Simulink model file
    "sl_subsystem"Subsystem
    "sl_subsystem_file"Subsystem file

    System Composer™

    "zc_block_diagram"System Composer architecture
    "zc_component"System Composer architecture component
    "zc_file"System Composer architecture file
    Tests"harness_info_file"Harness info file
    "sl_harness_block_diagram"Harness block diagram
    "sl_harness_file"Test harness file
    "sl_test_case"Simulink Test™ case
    "sl_test_case_result"Simulink Test case result
    "sl_test_file"Simulink Test file
    "sl_test_iteration"Simulink Test iteration
    "sl_test_iteration_result"Simulink Test iteration result
    "sl_test_report_file"Simulink Test result report
    "sl_test_result_file"Simulink Test result file
    "sl_test_resultset"Simulink Test result set
    "sl_test_seq"Test Sequence
    "sl_test_suite"Simulink Test suite
    "sl_test_suite_result"Simulink Test suite result

    Example: "sl_model_file"

    Example: ["sl_model_file "zc_file"]

    Address of artifact, specified as an padv.util.ArtifactAddress object. Note that the address is relative to the project root.

    The padv.util.ArtifactAddress object represents the file address of an artifact in your project, but also has properties that contain information about the artifact change tracking. For more information, see padv.util.ArtifactAddress and Exclude Files from Change Tracking in Process Advisor.

    Example: padv.util.ArtifactAddress(fullfile("02_Models","AHRS_Voter","specification","AHRS_Voter.slx"))

    Data Types: string

    Properties

    expand all

    Human-readable name for the artifact in the Process Advisor user interface, specified as a string.

    If you want to customize how artifact names appear in the Process Advisor, create a custom query that updates the values of the Alias property for each padv.Artifact object that the query returns.

    Data Types: string

    Type of artifact, specified as one or more of the values listed in this table. To specify multiple values, use an array. The build system uses the artifact type to identify and categorize the different file types and modeling constructs in your project.

    CategoryArtifact TypeDescription

    MATLAB

    "m_class"MATLAB class
    "m_file"MATLAB file
    "m_func"MATLAB function
    "m_method"MATLAB class method
    "m_property"MATLAB class property

    Model Advisor

    "ma_config_file"Model Advisor configuration file
    "ma_justification_file"Model Advisor justification file

    Process Advisor

    "padv_dep_artifacts"

    Related artifacts that current artifact depends on

    "padv_output_file"

    Process Advisor output file

    Project

    "project"Current project file

    Requirements

    "mwreq_item"Requirement (since R2024b)

    "sl_req"

    Requirement (for R2024a and earlier)
    "sl_req_file"Requirement file
    "sl_req_table"Requirements Table

    Stateflow

    "sf_chart"Stateflow chart
    "sf_graphical_fcn"Stateflow graphical function
    "sf_group"Stateflow group
    "sf_state"Stateflow state
    "sf_state_transition_chart"Stateflow state transition chart
    "sf_truth_table"Stateflow truth table

    Simulink

    "sl_block_diagram"Block diagram
    "sl_data_dictionary_file"Data dictionary file
    "sl_embedded_matlab_fcn"MATLAB function
    "sl_block_diagram"Block diagram
    "sl_library_file"Library file
    "sl_model_file"Simulink model file
    "sl_protected_model_file"Protected Simulink model file
    "sl_subsystem"Subsystem
    "sl_subsystem_file"Subsystem file

    System Composer

    "zc_block_diagram"System Composer architecture
    "zc_component"System Composer architecture component
    "zc_file"System Composer architecture file
    Tests"harness_info_file"Harness info file
    "sl_harness_block_diagram"Harness block diagram
    "sl_harness_file"Test harness file
    "sl_test_case"Simulink Test case
    "sl_test_case_result"Simulink Test case result
    "sl_test_file"Simulink Test file
    "sl_test_iteration"Simulink Test iteration
    "sl_test_iteration_result"Simulink Test iteration result
    "sl_test_report_file"Simulink Test result report
    "sl_test_result_file"Simulink Test result file
    "sl_test_resultset"Simulink Test result set
    "sl_test_seq"Test Sequence
    "sl_test_suite"Simulink Test suite
    "sl_test_suite_result"Simulink Test suite result

    Example: "sl_model_file"

    Example: ["sl_model_file "zc_file"]

    Reference to parent artifact, specified as a padv.Artifact object.

    Address of artifact in project, specified as a padv.util.ArtifactAddress object.

    Object Functions

    Object FunctionDescription
    closeClose artifact and remove artifact from cache.
    close(artifactObj)
    To load an artifact into the cache, use the load object function.
    getTypes

    Get artifact type.

    TYPES = getTypes(artifactObj)

    getKey

    Get unique key for artifact. A key is a unique address for a file.

    KEY = getKey(artifactObj)

    hasType

    Check if artifact has type.

    TYPE = hasType(artifactObj)

    loadLoad artifact into cache.
    RESULT = load(artifactObj)
    By default, the load function loads only partial data from test results set files (.mldatx). To load the full results sets into the cache, you can specify PartialLoad as false.
    RESULT = load(artifactObj,PartialLoad=false)
    To remove an artifact from the cache, use the close object function.

    Examples

    collapse all

    Suppose you have a process model with several tasks, but right now you only want to run test cases associated with a single model. You can use a padv.Artifact object to specify the model and use the runprocess function to run the test cases for that model.

    Open the Process Advisor example project, which contains an example process model.

    processAdvisorExampleStart

    The example process contains a Run Tests task (padv.builtin.task.RunTestsPerTestCase) that runs the test cases in the project.

    Create a padv.Artifact object that represents the model that you want to run. For this example, the artifact type is "sl_model_file" because the artifact is a Simulink model and the address is the path to model AHRS_Voter.slx, relative to the project root.

    model = padv.Artifact(...
    "sl_model_file",...
    fullfile("02_Models","AHRS_Voter","specification","AHRS_Voter.slx"));

    Run the Run Tests task on the test cases associated with the model AHRS_Voter.slx by specifying the name-value arguments of the runprocess function.

    runprocess(...
    Tasks = "padv.builtin.task.RunTestsPerTestCase",...
    FilterArtifact = model)
    The build system only runs the test cases associated with the specified model.

    Version History

    expand all